Fi pd forms and face compare btn show

This commit is contained in:
bitbucket 2022-10-18 11:17:10 +05:30
parent f806a73da9
commit fc5fb90eb6
46 changed files with 9013 additions and 15947 deletions

18437
ng6-seed/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -62,6 +62,7 @@
"ng2-ckeditor": "^1.2.6",
"ng2-dragula": "1.3.1",
"ng2-file-upload": "1.2.1",
"ng2-img-max": "^2.2.4",
"ng2-pdf-viewer": "5.2.3",
"ng2-toastr": "^4.1.2",
"ng2-validation": "4.2.0",
@ -85,6 +86,7 @@
"sweetalert2": "^7.33.1",
"tether": "^1.4.7",
"viewerjs": "^1.5.0",
"watermarkjs": "^2.1.1",
"xlsx": "^0.14.5",
"zone.js": "^0.8.29"
},

View File

@ -154,7 +154,7 @@
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" (click)="selected_pdType(PDL)">
{{PDL.type_name}}
</mat-option>
@ -162,6 +162,20 @@
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 28%" *ngIf="_PDtriggerForm.get('fk_pd_type').value =='4'">
<mat-select placeholder="FI PD Type" formControlName="fk_fi_type_id">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PDL of fi_pdTypeList" [value]="PDL.field_investigation_id
" >
{{PDL.field_investigation}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<!--<mat-form-field style="width: 60%">
<mat-label>{{lenderShortName == 'CFPL' ? 'Facility' :'Loan'}} Amount <span *ngIf="pdMain.loan_amount.hasError('required')">*</span></mat-label>
<input matInput autocomplete="off" placeholder="Enter the amount" formControlName="loan_amount" OnlyNumber autocomplete="off">
@ -170,7 +184,7 @@
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
</mat-form-field>-->
<mat-form-field style="width: 60%">
<mat-form-field [ngStyle] = "{'width':_PDtriggerForm.get('fk_pd_type').value =='4' ? '28%' : '60%'}">
<mat-label>{{lenderShortName == 'CFPL' ? 'Facility' :'Loan'}} Amount </mat-label>
<input matInput autocomplete="off" placeholder="Enter the amount" formControlName="loan_amount" OnlyNumber autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value">{{"&#8377;"}} {{pdMain.loan_amount.value | numberToWords}} Only</mat-hint>

View File

@ -72,6 +72,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
public filteredLenderList:ReplaySubject<any> = new ReplaySubject<any>(1);
public filteredBranchList:ReplaySubject<any> = new ReplaySubject<any>(1);
public filteredLenderpersonList:ReplaySubject<any> = new ReplaySubject<any>(1);
fi_pdTypeList: any;
constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
@ -110,6 +111,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
console.log('res');
this.productAllList=res['records'].products
this.pdTypeList=res['records'].pd_types
this.fi_pdTypeList=res['records'].pd_types[ this.pdTypeList.length-1].field_investigation
console.log( this.fi_pdTypeList)
this.customerSegmentAllList=res['records'].customer_segments
this.finInstitutionList=res['records'].financial_institutions
let lender_other_config = res['records'].lender_other_config
@ -128,7 +132,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
else{
if(this.removedControl.length > 0) {
this.removedControl.forEach(lender_set_config=>{
console.log('lendercofig',lender_set_config)
// console.log('lendercofig',lender_set_config)
this._PDtriggerForm.controls[lender_set_config].setValidators(Validators.compose([Validators.required]));
this._PDtriggerForm.controls[lender_set_config].updateValueAndValidity()
})
@ -143,6 +147,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
this._PDtriggerForm.controls['fk_subproduct_id'].setValue(res['records'].default_sub_product);
this._PDtriggerForm.controls['fk_customer_segment'].setValue(res['records'].default_customer_segment);
this._PDtriggerForm.controls['fk_pd_type'].setValue(res['records'].default_pd_type);
this._PDtriggerForm.controls['fk_fi_type_id'].setValue(res['records'].default_pd_type);
}
@ -170,6 +175,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
fk_product_id: [null],
fk_subproduct_id: [null],
fk_pd_type: [null],
fk_fi_type_id: [null],
fk_customer_segment: [null],
loan_amount: [null, Validators.compose([Validators.required,Validators.pattern('^[0-9]*$')])],
applicant_title_name: [''],
@ -300,7 +306,29 @@ export class AddPdComponent implements OnInit, OnDestroy {
// this._PDtriggerForm.controls['loan_amount'].setValidators([Validators.required])
// }
}
selected_pdType(param){
console.log(param)
if(param.pd_type_id =='4'){
this._PDtriggerForm.controls['sub_entity_id'].disable()
this._PDtriggerForm.controls['lender_sales_person'].disable()
this._PDtriggerForm.controls['fk_customer_segment'].disable()
this._PDtriggerForm.controls['pd_branch_id'].disable()
this._PDtriggerForm.controls['fk_product_id'].disable()
this._PDtriggerForm.controls['fk_subproduct_id'].disable()
this._PDtriggerForm.controls['fk_fi_type_id'].setValidators([Validators.required])
}else{
this._PDtriggerForm.controls['sub_entity_id'].enable()
this._PDtriggerForm.controls['lender_sales_person'].enable()
this._PDtriggerForm.controls['fk_customer_segment'].enable()
this._PDtriggerForm.controls['pd_branch_id'].enable()
this._PDtriggerForm.controls['fk_product_id'].enable()
this._PDtriggerForm.controls['fk_subproduct_id'].enable()
this._PDtriggerForm.controls['fk_fi_type_id'].setValidators(null)
}
}
@ -802,6 +830,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
"remarks": formValue.remarks,
"pd_status": status,
"fk_createdby": this._aws.getlocale(),
"fk_fi_type_id":formValue.fk_fi_type_id
};
@ -911,7 +940,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
if (formValue.docs_to_be_collected.length > 0) {
pd_form.append("docs_to_be_collected", JSON.stringify(formValue.docs_to_be_collected))
}
console.log(pd_form)
this._pd.addPdDetails(pd_form).subscribe(result => {
if (result.status == 200) {
this.disableAfterSubmit = false;

View File

@ -84,7 +84,7 @@ export class AllPdComponent implements OnInit, OnChanges {
// console.log("Browser tab is hidden")
// });
window.addEventListener('visibilitychange', () => {
console.log("Browser tab is visible")
// console.log("Browser tab is visible")
this.loadPDDetails()
});
@ -127,10 +127,10 @@ export class AllPdComponent implements OnInit, OnChanges {
data => {
if (data.status == 200) {
this.PdListData = data.records;
console.log(this.PdListData)
// console.log(this.PdListData)
this.dataLengthTab1 = data.records.length;
this.dataSourceTab1.data = this.PdListData;
console.log(this.dataSourceTab1.data)
console.log(this.dataSourceTab1)
this.recordStatus=false;
}
else{

View File

@ -173,7 +173,21 @@
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 62%">
<mat-form-field style="width: 28%" *ngIf="_EditPDtriggerForm.get('fk_pd_type').value =='4'">
<mat-select placeholder="FI PD Type" formControlName="fk_fi_type_id">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PDL of fi_pdTypeList" [value]="PDL.field_investigation_id
" (click)="selected_pdType(PDL)" >
{{PDL.field_investigation}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field [ngStyle] = "{'width':_EditPDtriggerForm.get('fk_pd_type').value =='4' ? '28%' : '60%'}">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<mat-label>{{lenderShortName == 'CFPL' ? 'Facility' :'Loan'}} Amount <span *ngIf="pdMain.loan_amount.hasError('required')">*</span></mat-label>
<input matInput formControlName="loan_amount"

View File

@ -79,6 +79,7 @@ export class EditPdMasterComponent implements OnInit {
public branchFilterCtrl:FormControl = new FormControl();
public filteredLenderList:ReplaySubject<any> = new ReplaySubject<any>(1);
public filteredBranchList:ReplaySubject<any> = new ReplaySubject<any>(1);
fi_pdTypeList: any=[];
constructor(private _fb: FormBuilder,
@ -89,6 +90,7 @@ export class EditPdMasterComponent implements OnInit {
this.pdid = data.records.pd_id;
this.masterRandomString = data.records.random_string;
this.disableAfterSubmit = false;
console.log(this.data)
}
ngOnInit() {
@ -103,7 +105,7 @@ export class EditPdMasterComponent implements OnInit {
// this.getAddresses();
setTimeout(()=>{
this.loadFormData();
},500)
},600)
this.filterList()
}
@ -111,6 +113,7 @@ export class EditPdMasterComponent implements OnInit {
console.log(entity_id);
this._pd.getEntityPreferences(entity_id).subscribe(res=>{
if(res['dataStatus']){
console.log(res)
this.productAllList=res['records'].products
let x = this.lenderList.filter(item => item.entity_id == this.data.records.fk_lender_id)
this.lenderBranchList = x[0]['branches'];
@ -118,6 +121,8 @@ export class EditPdMasterComponent implements OnInit {
this.filterProductAbbr(x[0]['short_name'],1);
this.pdTypeList=res['records'].pd_types
this.fi_pdTypeList=res['records'].pd_types[ this.pdTypeList.length-1].field_investigation
console.log(this.fi_pdTypeList)
this.customerSegmentAllList=res['records'].customer_segments
this.finInstitutionList=res['records'].financial_institutions
@ -154,6 +159,8 @@ export class EditPdMasterComponent implements OnInit {
this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(res['records'].default_sub_product);
this._EditPDtriggerForm.controls['fk_customer_segment'].setValue(res['records'].default_customer_segment);
this._EditPDtriggerForm.controls['fk_pd_type'].setValue(res['records'].default_pd_type);
//this._EditPDtriggerForm.controls['fk_fi_type_id'].setValue(res['records'].default_pd_type);
}
@ -236,6 +243,7 @@ if(!option){
this._EditPDtriggerForm.controls['fk_product_id'].setValue('');
this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue('');
this._EditPDtriggerForm.controls['fk_pd_type'].setValue('');
// this._EditPDtriggerForm.controls['fk_fi_type_id'].setValue('');
this._EditPDtriggerForm.controls['fk_customer_segment'].setValue('');
this._EditPDtriggerForm.controls['loan_amount'].setValue('');
}
@ -299,6 +307,8 @@ if(!option){
this._EditPDtriggerForm.controls['fk_product_id'].setValue('');
this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue('');
this._EditPDtriggerForm.controls['fk_pd_type'].setValue('');
// this._EditPDtriggerForm.controls['fk_fi_type_id'].setValue('');
this._EditPDtriggerForm.controls['fk_customer_segment'].setValue('');
this._EditPDtriggerForm.controls['loan_amount'].setValue('');
}
@ -392,6 +402,7 @@ if(!option){
fk_product_id: [this.data.records.fk_product_id],
fk_subproduct_id: [this.data.records.fk_subproduct_id],
fk_pd_type: [this.data.records.fk_pd_type],
fk_fi_type_id:[parseInt(this.data.records.fk_fi_type_id)],
fk_customer_segment: [this.data.records.fk_customer_segment],
loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.required,Validators.pattern('^[0-9]*$')])],
addresses: this._fb.array([]),
@ -402,7 +413,7 @@ if(!option){
// other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
remarks: [this.data.records.remarks],
});
console.log( this._EditPDtriggerForm.value)
const addressesArray = this._EditPDtriggerForm.get('addresses') as FormArray;
this._pd.getAddressesDetails(this.pdid).subscribe(
data => {
@ -439,7 +450,8 @@ if(!option){
}
});
this.getContactPerson()
// this._EditPDtriggerForm.controls['fk_fi_type_id'].setValue("2");
}
get pdMain() { return this._EditPDtriggerForm.controls; }
@ -637,6 +649,11 @@ if(!option){
this._EditPDtriggerForm.controls['fk_pd_type'].clearValidators();
this._EditPDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_fi_type_id'].clearValidators();
this._EditPDtriggerForm.controls['fk_fi_type_id'].updateValueAndValidity();
//fk_fi_type_id
this._EditPDtriggerForm.controls['fk_customer_segment'].clearValidators();
this._EditPDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
@ -711,6 +728,11 @@ if(!option){
this._EditPDtriggerForm.controls['fk_pd_type'].clearValidators();
this._EditPDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_fi_type_id'].clearValidators();
this._EditPDtriggerForm.controls['fk_fi_type_id'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_customer_segment'].clearValidators();
this._EditPDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
@ -766,6 +788,7 @@ if(!option){
"fk_product_id": my_array.fk_product_id,
"fk_subproduct_id": my_array.fk_product_id != '4' ? my_array.fk_subproduct_id : null,
"fk_pd_type": my_array.fk_pd_type,
"fk_fi_type_id": my_array.fk_fi_type_id,
"fk_customer_segment": my_array.fk_customer_segment,
"loan_amount": my_array.loan_amount,
  "addressline1": filteredAddressesdata[0].addressline1 != null ? this.titleCase.transform(filteredAddressesdata[0].addressline1) : null,
@ -835,7 +858,29 @@ validateAllFormFields(formGroup: any) {
});
}
selected_pdType(param){
console.log(param)
if(param.pd_type_id =='4'){
this._EditPDtriggerForm.controls['sub_entity_id'].disable()
this._EditPDtriggerForm.controls['lender_sales_person'].disable()
this._EditPDtriggerForm.controls['fk_customer_segment'].disable()
this._EditPDtriggerForm.controls['pd_branch_id'].disable()
this._EditPDtriggerForm.controls['fk_product_id'].disable()
this._EditPDtriggerForm.controls['fk_subproduct_id'].disable()
this._EditPDtriggerForm.controls['fk_fi_type_id'].setValidators([Validators.required])
}else{
this._EditPDtriggerForm.controls['sub_entity_id'].enable()
this._EditPDtriggerForm.controls['lender_sales_person'].enable()
this._EditPDtriggerForm.controls['fk_customer_segment'].enable()
this._EditPDtriggerForm.controls['pd_branch_id'].enable()
this._EditPDtriggerForm.controls['fk_product_id'].enable()
this._EditPDtriggerForm.controls['fk_subproduct_id'].enable()
this._EditPDtriggerForm.controls['fk_fi_type_id'].setValidators(null)
}
}
getContactPerson(flag?){
if(flag == 1){ //FOR IDENTIFY THE LENDER NAME CHANGE TO RESET THE BRANCH
this._EditPDtriggerForm.controls['pd_branch_id'].setValue(null);

View File

@ -162,7 +162,7 @@ export class DynamicQuestionTemplateComponent implements OnInit {
]
if(this.json_answers==null ){
this.formGroupN.get('avail_loan_moratorium_facility').patchValue(('No' || ''))
//this.formGroupN.get('avail_loan_moratorium_facility').patchValue(('No' || ''))
}
if(this.json_answers!=null && this.json_answers != undefined && this.json_answers) {

View File

@ -11,7 +11,7 @@
</div>
</h2>
<!-- <form [formGroup]="docsCollectedForm"> -->
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;" >
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;" [ngStyle]="{'overflow':questions_JSON.section_id == '34' ? 'visible':'auto'}">
<h5 style="text-align: center;" *ngIf="questions_JSON.questions.length == 0 && !is_loading">No Templates Found</h5>
<h5 style="text-align: center;" *ngIf="questions_JSON.questions.length == 0 && is_loading">Loading...</h5>
<mat-card *ngIf="questions_JSON.questions.length > 0">
@ -21,7 +21,8 @@
</mat-card-title>
</mat-card-header> -->
<mat-card-content>
<app-dynamic-form [questions_JSON]="questions_JSON" [form_group_name] = "commonFormGroup" [json_answers]="quesService.formanswers"></app-dynamic-form>
<app-ques-template *ngIf="questions_JSON.section_id == '34'" [questions_JSON]="questions_JSON" [json_answers]="quesService.formanswers" ></app-ques-template>
<app-dynamic-form *ngIf="questions_JSON.section_id != '34'" [questions_JSON]="questions_JSON" [form_group_name] = "commonFormGroup" [json_answers]="quesService.formanswers"></app-dynamic-form>
</mat-card-content>
</mat-card>
@ -41,7 +42,7 @@
</div>
</mat-dialog-actions> -->
<mat-dialog-actions>
<mat-dialog-actions *ngIf="questions_JSON.section_id != '34'" >
<div fxFlex="60" class="pb-0 text-sm-left" align="left" *ngIf="questions_JSON.questions.length > 0" >
<!-- <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>

View File

@ -38,6 +38,7 @@ export class FormComponent implements OnInit {
pd_all_details: any=[];
pdMasterList:any=[];
template_id: any;
fi_fk_pd_type: any;
constructor(notifier: NotifierService,
private fb: FormBuilder,
private route: ActivatedRoute,
@ -60,6 +61,8 @@ export class FormComponent implements OnInit {
// debugger;
this.form_id = 24;
this.pdMasterList= this.pd_all_details_data.pdMasterList
this.fi_fk_pd_type= this.pd_all_details_data.pdMasterList.fk_pd_type
this.parent_pdid = this.pdMasterList.parent_pd_id;
this.pdid = this.pdMasterList.pd_id;
this.notifier = notifier;
@ -76,7 +79,7 @@ export class FormComponent implements OnInit {
//console.log( this.quesService.pd_all_details)
this.quesService.pd_all_details = this.pd_all_details
console.log('image_doc_params',this.image_doc_params)
this.quesService.formanswers = null
}
ngOnInit() {
@ -175,11 +178,12 @@ else
let params = this.pd_all_details_data.FormData.mapid;
console.log(params)
console.log( this.pd_all_details_data)
localStorage.setItem('pd_all_details', JSON.stringify(this.pd_all_details_data))
let map_id = this.pd_all_details_data.FormData.map_id
let form_id = this.pd_all_details_data.FormData.form_id
this.pd_all_details_data.Formname
// let params = {"fk_entity_id":this.pdMasterList.fk_lender_id,"fk_product_id":this.pdMasterList.fk_product_id,"pd_form_id":this.pd_all_details.form_id,"fk_pd_id":this.pdMasterList.pd_id}
this.pdTriggerService.loadCreditPDTemplate2(form_id,map_id, this.pd_all_details_data.Formname,this.template_id).subscribe(result=>{
this.pdTriggerService.loadCreditPDTemplate2(form_id,map_id, this.fi_fk_pd_type,this.template_id).subscribe(result=>{
@ -205,10 +209,10 @@ else
this.questions_JSON = JSON.parse(question_template.json);
console.log(question_template.json)
// this.questions_JSON = question_template;
console.log( this.questions_JSON)
console.log( this.questions_JSON,this.pd_all_details_data)
if(this.pd_all_details_data.FormData.isAnswered == true){
this.getSectionData()
this.getSectionData()
}
// this.getSectionData()
this.questionService.notify(this.questions_JSON)
@ -241,10 +245,10 @@ else
this.commonFormGroup = new FormGroup({})
this.questions_JSON = question_template;
//this.questions_JSON = JSON.parse(question_template.json);
console.log(this.questions_JSON);
console.log(this.questions_JSON,this.pd_all_details_data);
// this.getSectionData()
if(this.pd_all_details_data.FormData.isAnswered == true){
this.getSectionData()
this.getSectionData()
}
this.questionService.notify(this.questions_JSON)
setTimeout(() => {
@ -274,14 +278,26 @@ else
console.log(result)
if(result['dataStatus']) {
let records = result['records']
console.log( this.questions_JSON,records)
// this.questions_JSON.questions = records
//this.quesService.formanswers = records
let formValues:any ={};
if(records && records.hasOwnProperty('json') && records.json) {
if(records || records.hasOwnProperty('json') && records.json) {
//formValues = JSON.parse(records.json)
formValues = records.json
if(this.pd_all_details_data.FormData.form_id =='34'){
this.quesService.formanswers = records
}else{
formValues = records.json
this.quesService.formanswers= formValues
this.loaderService.showMatSpinnerDialog("")
}
console.log( this.quesService.formanswers)
this.questions_JSON
console.log( this.questions_JSON,formValues)
// this.loaderService.showMatSpinnerDialog("")
// setTimeout(()=>{
// this.quesService.formanswers = null
// },2000)

View File

@ -0,0 +1,14 @@
export const photoJSONStructure ={"answer_value": "",
"question": "Approach to PD Location",
"question_key": "approach_to_pd_location",
"type": "6",
"raw_validations": [],
"validations": [],
"api_properties": null,
"onchange_properties": null,
"answers": null,
"is_repeatable": null,
"group_title": null,
"is_loader": "",
"is_saved": "",
"is_image_status": false}

View File

@ -0,0 +1,6 @@
<button [ngStyle]="{'color':role_id == '20' ? '#0d93a9' :'#f44336'}" (click)="capture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<mat-icon name="camera" *ngIf="!addMoreBtn">add_a_photo</mat-icon>
<mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon>
</button>
<input type="file" (change)="capturedImage($event)" id="input-file" name="file" accept="image/*" capture="user" style="display: none">
<!-- document.querySelector('#input-file').click() -->

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CaptureBtnComponent } from './capture-btn.component';
describe('CaptureBtnComponent', () => {
let component: CaptureBtnComponent;
let fixture: ComponentFixture<CaptureBtnComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CaptureBtnComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CaptureBtnComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,69 @@
// import { Component, OnInit } from '@angular/core';
// @Component({
// selector: 'app-capture-btn',
// templateUrl: './capture-btn.component.html',
// styleUrls: ['./capture-btn.component.scss']
// })
// export class CaptureBtnComponent implements OnInit {
// constructor() { }
// ngOnInit() {
// }
// }
import { Component, OnInit, Output, EventEmitter, Input, Injectable } from '@angular/core';
import { Ng2ImgMaxService } from 'ng2-img-max';
import { LoaderService } from 'app/shared/loaderService/loader.service';
@Injectable({
providedIn: 'root'
})
@Component({
selector: 'app-capture-btn',
templateUrl: './capture-btn.component.html',
styleUrls: ['./capture-btn.component.scss']
})
export class CaptureBtnComponent implements OnInit {
@Input() addMoreBtn;
@Output() imageDataEmitter = new EventEmitter
@Output() singleDataEmitter = new EventEmitter
sales_pd_type: string;
role_id: string;
constructor(private ng2ImgMax:Ng2ImgMaxService,private loaderService:LoaderService) {
this.role_id = localStorage.getItem('user_role')
this.sales_pd_type = localStorage.getItem('sales_pd_type')
console.log(this.sales_pd_type)
}
ngOnInit(): void {
console.log(this.addMoreBtn)
}
capturedImage(event){
this.loaderService.showMatSpinnerDialog('Fetching Data...')
console.log(event);
let imageData= event.target.files[0]
this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe(
result => {
this.imageDataEmitter.emit(result)
this.singleDataEmitter.emit(result)
this.loaderService.closeMatSpinnerDialog()
},
error => {
console.log('😢 Oh no!', error);
}
);
}
capture(event){
event.preventDefault();
let element:HTMLElement = document.getElementById('input-file') as HTMLElement
element.click();
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { CameraService } from './camera.service';
describe('CameraService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: CameraService = TestBed.get(CameraService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,111 @@
import { Injectable } from '@angular/core';
import { DatePipe } from '@angular/common';
import * as watermark from 'watermarkjs';
@Injectable({
providedIn: 'root'
})
export class CameraService {
pipe = new DatePipe('en-US')
constructor() {
setTimeout(()=>{
this.getPosition().then(res=>{
console.log("geolocation",res)
},err=>{
console.log("Error in geo",err);
})
},2000)
}
addWatermarks(base64Img,geoCords?) {
return new Promise((resolve, reject) => {
// this.constant.getGeoTag().then(geoCoordinates => {
// this.getPosition().then(geoCords=>{
// console.log(geoCords);
// this.geoCords = geoCoordinates
// });
// this.geoCords=localStorage.getItem('current_coordinates')
// console.log("corrds",this.geoCords)
let raw_img = base64Img
var today = new Date();
// let today_loc = today.toLocaleString('en-US', { timeZone: "Asia/Kolkata" })
let today_loc=this.pipe.transform(today, 'yyyy-MM-dd, h:mm a')
var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
// var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = 'Date : ' + today_loc;
console.log(date)
// fetch(raw_img)
// .then(res => res.blob())
// .then(blob => {
watermark([raw_img, 'assets/images/PD_watermark.png'])
.image(watermark.image.upperRight())
.then(img => {
raw_img = img.src;
let text = watermark.text
watermark([raw_img])
.image(text.upperLeft(dateTime, '19px sans-serif', '#ff0000', 1.0))
// .image(text.upperLeft(dateTime, '20px sans-serif', '#ff0000', 1.0))
.then(img => {
raw_img = img.src;
console.log("2d", raw_img)
// resolve(img.src)
console.log(geoCords)
// let geoCoordinates = geoCords ? geoCords : '-'
if(geoCords) {
let Location = `Location : ` + geoCords
watermark([raw_img])
.image(text.upperLeft(Location, '19px sans-serif', '#ff0000', 1.0, 40 ))
.then(img => {
raw_img = img.src
console.log("3rd", raw_img)
resolve(img.src)
// localStorage.removeItem('current_coordinates')
});
}
else {
resolve(img.src)
}
});
});
// },err=>{
// console.log("Error in geo",err);
// switch(err.code) {
// case 1:
// alert("Geolocation permission is denied. Please allow the permission to capture");
// break;
// case 2:
// alert("Do not get the geolocation of your place");
// break;
// case 2:
// alert("Something went wrong");
// break;
// }
// reject(err);
// })
})
// });
}
getPosition(): Promise<any>
{
return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(resp => {
console.log("Geo",resp.coords);
let latLong:string = resp.coords.latitude+', '+resp.coords.longitude
// resolve({lng: resp.coords.longitude, lat: resp.coords.latitude});
resolve(latLong)
},
err => {
resolve('error');
});
});
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { DataServiceService } from './data-service.service';
describe('DataServiceService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: DataServiceService = TestBed.get(DataServiceService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,25 @@
import { Injectable } from '@angular/core';
export interface errorMsgInterface {
title:string;
subtitle:string;
message:string;
is_homebtn:boolean
}
@Injectable({
providedIn: 'root'
})
export class DataServiceService {
errorMsg:errorMsgInterface
getPDImageData:any;
constructor() {
this.errorMsg ={
title:"404",
subtitle:'Not Found',
message:'The requested URL is not found on the server',
is_homebtn:false
}
}
setErrorMsg(obj:errorMsgInterface) {
this.errorMsg = obj
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { ApiServiceService } from './api-service.service';
describe('ApiServiceService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: ApiServiceService = TestBed.get(ApiServiceService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,85 @@
// import { Injectable } from '@angular/core';
// @Injectable({
// providedIn: 'root'
// })
// export class ApiServiceService {
// constructor() { }
// }
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { environment } from 'environments/environment';
import { Observable } from 'rxjs';
import { AwsService } from 'app/AwsService/aws.service';
const apiUrl = environment.apiEndpoint
@Injectable({
providedIn: 'root'
})
export class ApiServiceService {
// for pd questions component
public curr_credit_pd_data:any = {}
public raw_credit_pd_template:any;
public user_login_details:any ={}
constructor(private http:HttpClient,private _awsService:AwsService) { }
loadTemplate() {
return this.http.get('assets/credit_pd_template.json').map(rr=>{
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
this.raw_credit_pd_template= returnValue.records.template
return returnValue
})
}
getCityPincode(value){
let params={records:{state_id:value}}
return this.http.post(apiUrl+"getListOfStatesAndCities",params)
}
api_post_method(api_name:string,params,api_method?){
if(api_method.toUpperCase() == 'POST'){
return this.http.post(apiUrl+api_name,params)
}
else{
return this.http.get(apiUrl+api_name)
}
}
getSalesPDSectionData(params) {
return this.http.post(apiUrl+'getSalesPDSectionData',{records:params})
}
listSMCCreditPD():Observable<any> {
let value= localStorage.getItem('LocalSetEntity')
// let params = new HttpParams().set("paramName",value) //Create new HttpParams
return this.http.get(apiUrl+'listSMCCreditPD/'+value);
}
saveSMCCreditPD(params) {
let params_defined:any={"smc_credit_pd":this.curr_credit_pd_data.smc_credit_pd == null ? '' : this.curr_credit_pd_data.smc_credit_pd
,"fk_sales_pd_id":this.curr_credit_pd_data.fk_sales_pd_id,"lender_id":this.curr_credit_pd_data.lender_id,"product_id":this.curr_credit_pd_data.product_id,"smc_credit_pd_type":this.curr_credit_pd_data.smc_credit_pd_type,"createdby":this._awsService.getlocale(),"status":params.status}
return this.http.post(apiUrl+'saveSMCCreditPD',{records:params_defined});
}
loadSalesPDTemplate():Observable<any> {
let lender_id= localStorage.getItem('LocalSetEntity')
let params = {"records":{"lender_id":lender_id,"product_id":this.curr_credit_pd_data.product_id,"sales_pd_type":this.curr_credit_pd_data.smc_credit_pd_type,"pd_type":"2"}}
return this.http.post(apiUrl+'loadSalesPDTemplate',params).map((res:any)=>{
if(res['dataStatus'] && res.hasOwnProperty('records') && res.records.hasOwnProperty('template')){
this.raw_credit_pd_template = res.records.template
}
return res
})
}
saveSMCCreditPDsection(params1):Observable<any> {
let params = {"records":{"smc_credit_pd":this.curr_credit_pd_data.smc_credit_pd,"lender_id":this.curr_credit_pd_data.lender_id,"product_id":this.curr_credit_pd_data.product_id,"fk_createdby":this._awsService.getlocale(),"geo_location":"","section_id":params1.section_id,"questions":params1.questions,"is_complete":"0"}}
return this.http.post(apiUrl+'saveSMCCreditPDsection',params)
}
getSalesPDImgDataCusLink(params) {
return this.http.post(apiUrl+'getSalesPDImgDataCusLink',params)
}
getSMCCreditPDSectionData(params) {
return this.http.post(apiUrl+'getSMCCreditPDSectionData',{records:params})
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { QuestionServiceService } from './question-service.service';
describe('QuestionServiceService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: QuestionServiceService = TestBed.get(QuestionServiceService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,470 @@
// import { Injectable } from '@angular/core';
// @Injectable({
// providedIn: 'root'
// })
// export class QuestionServiceService {
// constructor() { }
// }
import { environment } from 'environments/environment';
import { Injectable } from '@angular/core';
import { Observable, of, forkJoin } from 'rxjs';
import { HttpClient, HttpParams } from '@angular/common/http';
import { catchError, map } from 'rxjs/operators';
import { Observer } from 'rxjs';
import { FormGroup, FormControl, FormArray, FormBuilder, Validators } from '@angular/forms';
//import { SalesPdProvider } from '../sales-pd/sales-pd';
import { DatePipe } from '@angular/common';
import { SalesPdService } from './sales-pd.service';
import { ApiServiceService } from './api-service.service';
const api_url = environment.apiEndpoint;
@Injectable({
providedIn: 'root'
})
export class QuestionServiceService {
datepipe: DatePipe;
curr_pd_info: any;
constructor(public http: HttpClient,private _fb:FormBuilder,private salesPDProvider:SalesPdService,private apiService:ApiServiceService) {
this.datepipe=new DatePipe('en-US')
}
// FOR CREATING A FORM CONTROL DYNAMICALLY
assignFormControl_array(formgroup: FormGroup, ques_data: any) {
// alert('question');
this.curr_pd_info = this.apiService.curr_credit_pd_data
console.log(formgroup, ques_data)
const control: any = formgroup.get('questions') as FormArray
ques_data.forEach((val, index) => {
console.log("quees", val)
if (val.hasOwnProperty('is_repeatable') && val.is_repeatable == '1') {
control.push(this._fb.group({
"is_repeatable": [val.is_repeatable || null],
"is_multi_disabled":[val.is_multi_disabled || '0'],
"group_title": [val.group_title || null], "group_type": [val.group_type || null]
,"question_key":[val.question && val.question.length > 0 ? val.question[0].question_key : val.question_key]
}))
// let temp=val
// control.push(this.createValue(temp))
control.controls[index].addControl('questions_group', this._fb.array([]))
let childControl: any = control.controls[index].get('questions_group') as FormArray
childControl.push(this._fb.group({ 'questions': this._fb.array([]) }))
console.log("cc", childControl, control, index)
let sub_childControl: any = childControl.controls[0].get('questions') as FormArray
val.question.forEach((group_indi, arr_index) => {
// if(group_indi.api_properties != null && typeof(group_indi.api_properties) == 'object'){
console.log("api pro", val.api_properties)
// let param
// val.api_properties.forEach(val=>param=val)
// console.log(param)
group_indi.raw_validations = group_indi.validations
sub_childControl.push(this.createValue(group_indi))
this.addAdditionalControl(group_indi,sub_childControl,arr_index)
// if(group_indi.type == '5'){
// sub_childControl.controls[arr_index].removeControl('answer_value');
// console.log("loop",arr_index,sub_childControl);
// sub_childControl.controls[arr_index].addControl('answer_value',this._fb.array([]))
// }
// if(group_indi.type == '1'){
// sub_childControl.controls[arr_index].addControl('field_type',new FormControl(group_indi.field_type))
// }
// if(val.type == '8'){
// sub_childControl.controls[index].addControl('select_search',new FormControl(val.field_type))
// }
if (group_indi.api_properties != null) {
this.apiPropertiesCall(group_indi).then(res => {
if (res != false) {
group_indi.answers = []
// group_indi.answers=this.convertArrayNames(val.api_properties.fields,res)
sub_childControl.controls[arr_index]['controls'].answers.setValue(this.convertArrayNames(group_indi.api_properties.fields, res))
}
})
}
// else{
// setTimeout(()=>{
// sub_childControl.push(this.createValue(group_indi))
// },200)
// }
// sub_childControl.push(this.createValue(group_indi))
})
// }
// else{
// sub_childControl.push(this.createValue(group_indi))
// }
// setTimeout(()=>{
// },500)
console.log("dd112", formgroup, childControl)
// let key_list=Object.keys(val)
// console.log(Object.keys(val))
// key_list.forEach(key=>{
// childControl.controls
// })
}
else {
// console.log("con",control)
// let key_list=Object.keys(val)
// console.log(Object.keys(val))
// let curr_object
// console.log("apikd",typeof(val.api_properties))
// if(val.api_properties != null && typeof(val.api_properties) == 'object'){
val.raw_validations = val.validations
control.push(this.createValue(val))
// for checkbox remove the form control and add the formarray for multiple values
this.addAdditionalControl(val, control, index)
// if(val.type == '5'){
// control.controls[index].removeControl('answer_value');
// console.log("loop",index,control);
// control.controls[index].addControl('answer_value',this._fb.array([]))
// }
// if(val.type == '1'){
// control.controls[index].addControl('field_type',new FormControl(val.field_type))
// }
// if(val.type == '8'){
// control.controls[index].addControl('select_search',new FormControl(val.field_type))
// }
if (val.api_properties != null) {
this.apiPropertiesCall(val).then(res => {
console.log("chekc", res)
if (res != false) {
// val.answers=[]
// val.answers=this.convertArrayNames(val.api_properties.fields,res)
control.controls[index]['controls'].answers.setValue(this.convertArrayNames(val.api_properties.fields, res))
}
}, err => console.log(err))
}
// else{
// setTimeout(()=>{
// control.push(this.createValue(val))
// },200)
// }
// }
// else{
// control.push(this.createValue(val))
// }
console.log(formgroup)
}
console.log('149')
}, err => console.log(err))
console.log('151')
return formgroup
}
// END OF FORM CREATION
// FOR CREATING THE FORM CONTROL FOR SPECIFIC FORM ARRAY
createValue(data){
let is_amt_in_words=false
let answer_value_loc='';
let answers_from_client=[]
if(data.hasOwnProperty('answer_value') && data.answer_value != '' || null){
let values_for_cli:any = this.getAnswerValue(data)
if(values_for_cli.flag == 1){
answer_value_loc=values_for_cli.values
}
else{
answers_from_client=values_for_cli.values
}
}
// if(data.hasOwnProperty('field_type')){
// if(data.field_type == 'num'){
// is_amt_in_words=true
// }
// }
return this._fb.group({
"answer_value":[{value:answer_value_loc,disabled:answer_value_loc != '' ? true : false}], // OLD VALIDATION >>>> data.type != '6' ? Validators.compose([Validators.required]) : ''
"question":[data.question],
"question_key":[data.question_key],
"type":[data.type],
"raw_validations":[data.raw_validations],
"validations":[data.raw_validations],
"api_properties":[data.api_properties],
"onchange_properties":[data.onchange_properties],
"answers":[answers_from_client.length != 0 ? answers_from_client: data.answers],
"is_repeatable":[data.is_repeatable || null],
"is_multiple":[data.is_multiple || 0],
"group_title":[data.group_title || null]
})
}
// END OF CREATEVALUE FUN
// FOR REQUESTING THE API AUTOMATICALLY FROM JSON
apiPropertiesCall(val){
return new Promise((resolve,reject)=>{
if(val.api_properties != null && typeof(val.api_properties) == 'object'){
let pd_info = this.curr_pd_info
console.log(pd_info)
let params = val.api_properties.params
if(val.api_properties.hasOwnProperty('params_type') && val.api_properties.params_type == 'expression') {
params = eval(val.api_properties.params)
console.log(params,this.curr_pd_info.smc_credit_pd)
// debugger;
}
this.salesPDProvider.api_post_method(val.api_properties.api,params,val.api_properties.api_method).subscribe(res=>{
if(res['dataStatus']){
if(res.hasOwnProperty('records')){
res=res['records']
}
resolve(res)
console.log(res)
// val.answers=res
}
else{
resolve(false)
}
})
}
else{
resolve(false)
}
})
}
// END OF API PROPERTIES CALL
// ---FOR CONVERTING THE ANSWER KEYS UNIQUE
convertArrayNames(fieldName,data_from_api){
let val1=[]
let modified_json = data_from_api.map(
obj => {
if(fieldName.length > 0) {
return {
"answer_id" : obj[fieldName[0]],
"answer":obj[fieldName[1]],
}
}
else {
return {
"answer_id" : obj,
"answer":obj,
}
}
});
return modified_json
}
// END OF CONVERTARRAYNAMES FUN--
// --- FOR SETTING THE VALUE DEFAULT WITH DISABLED AND GENERATE THE ANSWERS FOR FIELDS(EX. refer 'GET_FY_YEARS' switch)
getAnswerValue(value_obj) {
if (value_obj != null && value_obj.hasOwnProperty('answer_value')) {
let return_value = { flag: 1, values: '' };
let user_det: any = localStorage.getItem("user_details")
user_det = JSON.parse(user_det);
switch (value_obj.answer_value) {
case 'CURRENT_USER':
console.log("current user", user_det)
return_value.values = user_det.user_first_name + ' ' + user_det.user_last_name
break;
case "CURRENT_DESIGNATION":
return_value.values = user_det.designation_name != null ? user_det.designation_name : ''
break;
case "CURRENT_DATE":
let date = new Date()
return_value.values = this.datepipe.transform(date, 'dd-MM-yyyy, h:mm:ss a')
break;
case "GET_FY_YEARS":
return_value.values = this.getCurrentFyYears()
return_value.flag = 2
break;
default:
return_value.values = ''
break
}
return return_value
}
return ''
}
// --END OF GETANSWERVALUE FUN
addAdditionalControl(data,curr_control,curr_index,purpose?){
console.log(data,curr_control,curr_index)
//FOR CHECKBOX CHANGE THE VALUE STORAGE AS ARRAY
if(data.type == '5'){
console.log('305')
curr_control.controls[curr_index].removeControl('answer_value');
curr_control.controls[curr_index].addControl('answer_value',this._fb.array([]))
}
//FOR numeric of string field
if(data.type == '1'){
console.log('292')
curr_control.controls[curr_index].addControl('field_type',new FormControl(data.field_type))
curr_control.controls[curr_index].addControl('place_holder',new FormControl(data.place_holder))
}
//FOR SEARCHABLE FIELD VALUE KEY ()
if(data.type == '8'){
curr_control.controls[curr_index].addControl('select_search',new FormControl(data.field_type))
}
if(purpose == 'additional_field'){
curr_control.controls[curr_index].addControl('additional_field',new FormControl(1))
}
// FOR IMAGE STATUS
if(data.type == '6'){
curr_control.controls[curr_index].addControl('is_loader',new FormControl(''))
curr_control.controls[curr_index].addControl('is_saved',new FormControl(''))
curr_control.controls[curr_index].addControl('is_image_status',new FormControl(false))
}
if(data.hasOwnProperty('question_enable') && data.question_enable != null && data.question_enable) {
console.log('313',data.hasOwnProperty('question_enable') && data.question_enable != null && data.question_enable)
let expression= data.question_enable;
console.log("Check started",expression,expression.includes('PD_FORM_VALUES'));
if(expression.includes('PD_FORM_VALUES')) {
console.log('311',expression.includes('PD_FORM_VALUES'))
let sales_pd_id = localStorage.getItem('sales_pd_id_PRIMARYKEY')
console.log('319',sales_pd_id)
// this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(sales_pd_id => {
setTimeout(()=>{
if(sales_pd_id) {
console.log('322',sales_pd_id)
let PD_FORM_VALUES = localStorage.getItem('PD_FORM_VALUES-'+sales_pd_id)
console.log('324',PD_FORM_VALUES)
if(PD_FORM_VALUES) {
console.log('326',PD_FORM_VALUES)
PD_FORM_VALUES = JSON.parse(PD_FORM_VALUES)
console.log('328',PD_FORM_VALUES)
// expression = expression.split('PD_FORM_VALUES').join(local_pd_form_values)
console.log("ex",expression)
let result = eval(expression)
console.log(result);
if(!result) {
console.log('324',!result,curr_control.removeAt(curr_index))
curr_control.removeAt(curr_index);
}
}
}
},500)
// })
}
// expression = expression.split(res).join(control_value_obj.answer_value)
}
console.log(curr_control,curr_control.controls[curr_index])
//FOR SETTING THE VALIDATORS
this.settingArrayofValidators(data,curr_control.controls[curr_index],curr_index)
}
// FOR SETTING THE ARRAY OF VALIDATORS COMING FROM JSON Temp,
settingArrayofValidators(data,curr_control,curr_index){
console.log("entered 334",data,curr_control,curr_index);
if(data.hasOwnProperty('validations') && data.validations.length > 0 ){
const validList :any= [];
let validator_value
data.validations=data.validations.filter(val=>val.isactive != '0')
data.validations.forEach(valid => {
if(valid.value != null && !valid.hasOwnProperty('validation_to')){
validator_value= this.getvalidatorValue(valid)
}
else{
validator_value=this.setValueForValidator(valid)
console.log("cc 345",validator_value)
}
validList.push(validator_value);
});
// console.log("valid",validList,curr_control)
// let val="Validators.required"
// console.log(typeof(Validators))
// console.log(typeof(`${val}`))
// let val1=`${val}`
// console.log(typeof(eval(val)))
// console.log(eval(val))
console.log( '358',validList)
// curr_control.controls[curr_index].controls.answer_value.setValidators(validList)
curr_control.controls.answer_value.setValidators(validList)
console.log("ddvdeeqq 361", curr_control.controls.answer_value.setValidators(validList),validList)
curr_control.controls.answer_value.updateValueAndValidity()
console.log("after setting validators 363",curr_control)
}
}
// END OF SETTINGARRAYOFVALIDATORS FUN
// FOR GETTING THE VALIDATION VALUE
getvalidatorValue(value_obj){
if(value_obj != null && value_obj.hasOwnProperty('value')){
let value_of_validator
switch(value_obj.value){
case 'CURRENT_YEAR':
value_of_validator=new Date().getFullYear()
break;
default:
value_of_validator=''
break;
}
value_obj.validator=String(value_of_validator)
return this.setValueForValidator(value_obj)
}
}
// END OF GETVALIDATORVALUE FUN
// FOR GENERATING THE FY YEAR FIELD ANSWERS
getCurrentFyYears(){
let month=new Date().getMonth()
let year=new Date().getFullYear()
let fy:any=[];
if(month >=3){
fy.push({fy_year:year-1+'-'+(year),curr:year})
}
else{
fy.push({fy_year:year-2+'-'+(year-1),curr:year-1})
}
console.log(fy)
for(let i=0;i<=2;i++){
fy.push({fy_year:(fy[i].curr-2)+'-'+(fy[i].curr-1),curr:fy[i].curr-1})
}
return fy.map(val=>({answer:val.fy_year,answer_id:val.fy_year}))
}
// END OF GETCURRFYYEARS FUN
// FOR CREATING THE CORRECT VALIDATION
setValueForValidator(value_obj){
console.log("setvlaue of validator",value_obj.validator,typeof(value_obj.validator))
let return_value
if(value_obj != null && value_obj.hasOwnProperty('validator')){
switch(value_obj.name)
{
case 'required':
return_value=Validators.required
break;
case 'minLength':
return_value=Validators.minLength(value_obj.validator)
break;
case 'maxLength':
return_value=Validators.maxLength(value_obj.validator)
break;
case 'min':
return_value=Validators.min(value_obj.validator)
break;
case 'max':
return_value=Validators.max(value_obj.validator)
break;
case 'pattern':
return_value=Validators.pattern(value_obj.validator)
break;
default:
return_value=''
break;
}
return return_value
}
else{
return false
}
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { SalesPdService } from './sales-pd.service';
describe('SalesPdService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: SalesPdService = TestBed.get(SalesPdService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,755 @@
// import { Injectable } from '@angular/core';
// @Injectable({
// providedIn: 'root'
// })
// export class SalesPdService {
// constructor() { }
// }
import { environment } from 'environments/environment';
import { Injectable } from '@angular/core';
import { Observable, of, forkJoin } from 'rxjs';
import { HttpClient, HttpParams } from '@angular/common/http';
import { catchError, map } from 'rxjs/operators';
import { Observer } from 'rxjs';
const api_url = environment.apiEndpoint;
@Injectable({
providedIn: 'root'
})
export class SalesPdService {
available_sections:any;
original_rawData:any;
current_section:any;
constructor(private _http:HttpClient) { }
advancedFilter(params): Observable<any>{
return this._http.post(api_url+'filterSalesPDList',{"records":params})
}
//checking
// getData1(product_id,sales_pd_type?){
// let users:any=localStorage.getItem('user_details')
// users=JSON.parse(users)
// console.log('users');
// console.log(users);
// let params = {records:{lender_id:users.fk_entity_id,product_id:product_id,sales_pd_type:sales_pd_type}}
// return new Observable((observer:any)=>{
// // START OF GETTING LOCAL TEMPLATE ONLY ON BROWSER
// let fileName = product_id
// if(sales_pd_type) {
// fileName += '-'+sales_pd_type
// }
// alert('filename');
// alert(fileName);
// let api_properties= this._http.post(api_url+'assets/data/sales_pd_templates/8-1.json',{params : params})
// // api_properties = {method:'get', api_url+`assets/data/sales_pd_templates/${fileName}.json`,{params : params}
// //return ;
// // END OF GETTIG LOCAL TEMPLATE
// })
// }
// getSalesPd(): Observable<any> {
// var lender_id= localStorage.getItem('LocalSetEntity')
// let user_role_id = localStorage.getItem('LenderRoleID')
// let user_id = this._aws.getlocale()
// // console.log('555',value);
// return this._http.get<any[]>(api_url + `listSalesPD/${lender_id}/${user_id}/${user_role_id}`)
// // .pipe(
// // catchError(this.handleError('operation', []))
// // )
// }
getData(product_id,sales_pd_type?) {
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
let params
if(users.user_role != '20'){
apiName = 'loadSalesPDTemplate'
params = {records:{lender_id:users.fk_entity_id,product_id:product_id,sales_pd_type:sales_pd_type}}
}else if(users.user_role == '20'){
apiName = 'loadFlyhiPDTemplate'
params = {records:{lender_id:users.fk_entity_id,sales_pd_type:null,pd_type:'2'}}
}
console.log(params)
return new Observable((observer:any)=>{
console.log('111111')
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
// console.log(this.platform.is('cordova'))
// let api_properties
// if(users.user_role != '20'){
let api_properties = {method:'post', api_name:api_url+apiName,params : params}
// console.log(api_properties)
// }else if(users.user_role == '20'){
// let api_properties = {method:'get', api_name:`assets/data/flyhi.json`,params : params}
// }
// START OF GETTING LOCAL TEMPLATE ONLY ON BROWSER
// if(!this.platform.is('cordova')) {
// let fileName = product_id
// if(sales_pd_type) {
// fileName += '-'+sales_pd_type
// }
// }
// END OF GETTIG LOCAL TEMPLATE
return this._http[api_properties.method](api_properties.api_name,api_properties.params).subscribe(result=>{
// if(!this.platform.is('cordova') && !result.hasOwnProperty('dataStatus')) {
// result = {dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
// }
if(result['dataStatus']) {
console.log(result)
// return this.ioniz2acStorageProvider.checkAndInsertApiDataLocally(result,params,'loadSalesPDTemplate',true).then(res=>{
observer.next(result)
observer.complete();
// })
}
else{
observer.next(result)
observer.complete();
}
})
// }
// else {
// return this.ionicStorageProvider.getApiDataFromLocally(params,'loadSalesPDTemplate').subscribe(result=>{
// observer.next(result)
// observer.complete();
// })
// }
})
}
// getData(product_id,sales_pd_type?) {
// let users:any=localStorage.getItem('user_details')
// console.log(users)
// users=JSON.parse(users)
// let params = new HttpParams().set('lender_id',users.fk_entity_id).set('product_id',product_id).set('sales_pd_type',sales_pd_type)
// console.log(params)
// let paramValue = {records:{params}}
// console.log(paramValue)
// // return this._http.get<any[]>(this.apiUrl + "loadFullTemplate", options)
// // return this._http.get<any[]>(api_url + "loadSMCPDTemplate",paramValue)
// // .pipe(
// // catchError(this.handleError('operation', []))
// // )
// }
// // getCMUsers(state_id,user_type):Observable<any> {
// // let param = new HttpParams().set('state_id',state_id).set('usertype',user_type)
// // return this._http.get(this.apiUrl+"getCMUsers",{params:param})
// // }
// loadPDTemplates(pdId: string,randString): Observable<any> {
// const options = pdId ?
// { params: new HttpParams().set('pd_id', pdId).set('random_string',randString) } : {};
// // return this._http.get<any[]>(this.apiUrl + "loadFullTemplate", options)
// return this._http.get<any[]>(api_url + "loadSMCPDTemplate", options)
// .pipe(
// catchError(this.handleError('operation', []))
// )
// }
// private handleError<T>(operation = 'operation', result?: T) {
// return (error: any): Observable<T> => {
// return of(result as T);
// };
// }
saveQuestions(params): Observable<Response>{
console.log('saveQuestions',params)
let result_from_api:any;
let userid:any=localStorage.getItem("user_details")
userid=JSON.parse(userid).userid;
params.createdby=userid
let product_id=localStorage.getItem('product_id_salesPD')
let sales_pd_type = localStorage.getItem('sales_pd_type');
let users:any=localStorage.getItem('user_details')
console.log("userid"+userid)
console.log("product_id"+product_id)
console.log("sales_pd_type"+sales_pd_type)
console.log("users"+users)
users=JSON.parse(users)
// let pd_primary_key;
return Observable.create((observer:Observer<any>) => {
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
// this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
console.log(key_value)
params.sales_pd_id=key_value
let apiName
if(users.user_role != '20'){
params.lender_id=users.fk_entity_id,
params.product_id=product_id
params.sales_pd_type = sales_pd_type
console.log(params)
apiName = 'saveSalesPD'
}else if(users.user_role == '20'){
apiName = 'saveFlyhiPD'
}
let modified_values =params;
if(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true) : true) {
console.log('160',params)
return this._http.post(api_url+apiName,{records:params}).pipe().subscribe(result => {
console.log(result)
// let result = {dataStatus:false,records:{}};
result_from_api =result
// else{
if(!params.hasOwnProperty('status') && params.status != 'COMPLETED') {
console.log('176')
if(params.sales_pd_id != null) {
console.log('178')
modified_values.sales_pd_id = params.sales_pd_id
}
else{
console.log('182')
modified_values.sales_pd_id = result['records']
}
}
if(params.hasOwnProperty('status') && params.status == 'COMPLETED') {
console.log('187')
if(!result_from_api.hasOwnProperty('pd_status') && result_from_api['pd_status'] != 'DRAFT'){
console.log('189')
// this.offlineManagerProvider.deleteCompletedPD(params.sales_pd_id).then(rd=>{
observer.next(result_from_api);
observer.complete();
// })
}
else{
console.log('196')
observer.next(result_from_api);
observer.complete();
}
}
else {
console.log('202')
// this.checkAndCreatePDLocally(modified_values,params,'online').then(lc=>{
observer.next(result_from_api);
observer.complete();
// })
}
// }
})
}
else{
console.log('214')
if(params.hasOwnProperty('status') && params.status != 'COMPLETED') {
console.log('216')
modified_values.sales_pd_id = null
}
let req_params = {url:api_url+apiName,
params:JSON.stringify({records:params}),method:'POST'}
let dd = {product_id:modified_values.product_id,lender_id:modified_values.lender_id}
this.getProductAbbrbyId(dd).then(product_abbr=>{
modified_values.abbr = product_abbr
// this.checkAndCreatePDLocally(modified_values,params,'offline',req_params).then(lc=>{
// console.log("last offline",lc);
// if(params.hasOwnProperty('status') && params.status != 'COMPLETED') {
// result_from_api ={dataStatus:true,records:lc.local_pd_id}
// }
// else{
// result_from_api = {dataStatus:true,records:true}
// }
// console.log("at last ",result_from_api,params);
// // this.insertData_Replace('sales_pd_id_PRIMARYKEY',lc.local_pd_id).then(resul=>{
// observer.next(result_from_api);
// observer.complete();
// // })
// })
})
}
observer.next(result_from_api);
observer.complete();
// })
})
}
saveSalesPDSection(params){
console.log(params);
let users:any=localStorage.getItem('user_details')
console.log('user');
console.log(users);
users=JSON.parse(users)
params.fk_createdby=users.userid;
return Observable.create((observer:Observer<any>)=>{
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
// this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
params.sales_pd_id=key_value
let values={sales_pd_id:params.sales_pd_id,dataStatus:true}
let section_data=JSON.stringify({section_id:params.section_id,section_name:params.section_name,onsubmit:null,questions:params.questions})
let modified_params = params
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'saveSalesPDsection'
}else if(users.user_role == '20'){
apiName = 'saveFlyhiPDsection'
}
// console.log("###################$%%",(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true ) : true));
// if((key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true ) : true)) {
// alert('positive');
return this._http.post(api_url+apiName,{records:params}).pipe().subscribe(response=>{
// delete modified_params.questions
modified_params.is_synced = true;
modified_params.section_data = section_data
if(modified_params.section_id != '9'){
// this.checkAndCreatePDLocally(values,'','online','',modified_params).then(res=>{
observer.next(response)
observer.complete()
// })
}
else {
observer.next(response)
observer.complete()
}
})
// }
// else if(modified_params.section_id != '9'){
// // console.log("#######params",modified_params)
// let offline_params = modified_params
// offline_params.request_items={url:api_url+'saveSalesPDsection',
// params:JSON.stringify({records:params}),method:'POST'}
// offline_params.is_synced = false
// offline_params.section_data = section_data
// console.log(offline_params.request_items.params)
// // this.checkAndCreatePDLocally(values,'','offline','',offline_params).then(res=>{
// // observer.next({dataStatus:true});
// // observer.complete()
// // })
// }
// else{
// observer.next({dataStatus:true});
// observer.complete()
// }
// })
})
}
api_post_method(api_name:string,params,api_method?){
return Observable.create((observer:Observer<any>)=>{
if(api_method.toUpperCase() == 'POST'){
return this._http.post(api_url+api_name,params).subscribe(result=> {
if(result['dataStatus']) {
//return this.ionicStorageProvider.checkAndInsertApiDataLocally(result,params,api_name,true).then(r=>{
observer.next(result);
observer.complete()
//},err=>console.log("ionnic storage err",err));
}
else {
observer.next(result);
observer.complete()
}
})
}
else{
return this._http.get(api_url+api_name).pipe().subscribe(result=> {
//return this.ionicStorageProvider.checkAndInsertApiDataLocally(result,params,api_name).then(rr=>{
observer.next(result);
observer.complete()
// },err=>console.log("ionnic storage err",err));
})
}
})
// FOR CREDIT PD STACKHOLDER INFO API
//else {
// return this.ionicStorageProvider.getApiDataFromLocally(params,api_name)
//}
}
getData_fromLocal(key){
// if(key == 'sales_pd_id_PRIMARYKEY'){
// let sales_pd_id_PRIMARYKEY = 459
// key = sales_pd_id_PRIMARYKEY
// }else if(key == 'sales_rand_string'){
// let sales_rand_string = 'KudFEmAQPmrauNmt'
// key = sales_rand_string
// }
console.log("get data key",key);
// console.log("get data provider",this.storage.get(key))
// console.log("all key in storage",this.storage.keys())
return key;
// return this.storage.get(key);
// return localStorage.getItem(key)
}
getSalesPdpdf(pdfdetail): Observable<any> {
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'downloadSalesPDReport'
}else if(users.user_role == '20'){
apiName = 'downloadFlyhiPDReport'
}
return this._http.get<any[]>(api_url +apiName+"/"+ pdfdetail)
}
getSalesPDSectionData(params){
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'getSalesPDSectionData'
}else if(users.user_role == '20'){
apiName = 'getFlyhiPDSectionData'
}
console.log(params)
return Observable.create((observer:Observer<any>)=>{
let values={sales_pd_id:params.sales_pd_id,dataStatus:true}
this._http.post(api_url+apiName,{records:params}).subscribe(result =>{
console.log(result)
let modified_values:any =result
modified_values.section_id = params.section_id
if(result['dataStatus']) {
if(params.section_id != 'all') {
modified_values = result['records'][0]
modified_values.is_synced = true
observer.next(result);
observer.complete()
}
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
// this.checkAndCreatePDLocally(values,'','online','',modified_values).then(res=>{
// observer.next(result);
// observer.complete()
// })
// }
else {
observer.next(result);
observer.complete()
}
}
else{
observer.next(result);
observer.complete()
}
},err=>{
observer.next(err);
observer.complete();
})
})
}
getSalesPDImgDataCusLink(params) {
return this._http.post(api_url+'getSalesPDImgDataCusLink',params)
}
generateSatelliteImg(params,form_structure):Observable<Response> {
return Observable.create((observer:Observer<any>)=>{
// this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
params.sales_pd_id = key_value
let values={sales_pd_id:key_value,dataStatus:true}
let section_data=JSON.stringify({section_id:form_structure.section_id,section_name:form_structure.section_name,onsubmit:null,questions:form_structure.questions})
let modified_params = form_structure
if(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true) : true) {
this._http.post(api_url+'generateSatelliteImg',params).pipe()
.subscribe(result =>{
observer.next(result);
observer.complete();
}
,err=>{
console.clear();
console.log("err>>>>",err)
observer.next(err);
observer.complete();
})
}
else {
console.log("#######params",modified_params)
let offline_params = modified_params
offline_params.request_items=[{url:api_url+'generateSatelliteImg',
params:JSON.stringify(params),method:'POST'}]
offline_params.is_synced = false
offline_params.section_data = section_data
console.log(offline_params.request_items.params)
//this.checkAndCreatePDLocally(values,'','offline','',offline_params).then(res=>{
observer.next({dataStatus:true});
observer.complete()
// })
}
// })
})
}
// getMasterForFlyhiPD(){
// return this._http.get(api_url+'getMasterForFlyhiPD').map(result=>{
// return result;
// })
// }
getAllMasterDatas(TableName: string): Observable<any> {
let params = { "master_name": TableName }
return new Observable((observer:any)=>{
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
return this._http.post(api_url + 'getListOfMaster', { "master_name": TableName }).subscribe(result=>{
console.log(result)
// return this.ionicStorageProvider.checkAndInsertApiDataLocally(result,params,'getListOfMaster',true).then(rr=>{
observer.next(result);
observer.complete();
// })
})
// }
// else {
// return this.ionicStorageProvider.getApiDataFromLocally(params,'getListOfMaster').subscribe(result=>{
// observer.next(result);
// observer.complete();
// })
// }
})
}
getCityPincode(value){
let params={records:{state_id:value}}
return new Observable((observer:any)=>{
//if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
return this._http.post(api_url+"getListOfStatesAndCities",params).subscribe(result=>{
console.log(result)
// return this.ionicStorageProvider.checkAndInsertApiDataLocally(result,params,'getListOfStatesAndCities',true).then(res=>{
observer.next(result);
observer.complete();
// })
})
//}
//else {
//return this.ionicStorageProvider.getApiDataFromLocally(params,'getListOfStatesAndCities').subscribe(result=>{
// observer.next(result);
// observer.complete();
//})
//}
})
}
getProductAbbrbyId(obj) {
if(obj){
return new Promise((resolve,reject)=>{
return this.getEntityPreferences(obj.lender_id).subscribe(result=>{
if(result && result['dataStatus']) {
let productforLender = result['records'].salespd_products
if(productforLender && productforLender.length > 0) {
let product_abbr = productforLender.filter(val=>val.product_id == obj.product_id).map(va=>va.product_abbr)[0]
resolve(product_abbr)
}
}
})
})
}
}
getEntityPreferences(entity_id){
// return this.http.get(this.apiurl+'getEntityPreferences/'+entity_id);
let params = {entity_id:entity_id}
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
return this._http.get(api_url+'getEntityPreferences/'+entity_id).map(result=>{
// this.ionicStorageProvider.checkAndInsertApiDataLocally(result,params,'getEntityPreferences');
return result;
})
//}
// else {
//return this.ionicStorageProvider.getApiDataFromLocally(params,'getEntityPreferences');
// }
}
insertData_Replace(key,data){
// console.log(key)
return key;
return data;
}
getSalesPDList(is_sales_login){
// let params = new HttpParams().set("paramName",paramValue)
// console.log("Api Stauts ",this.networkProvider.getCurrentNetworkStatus())
let det:any=localStorage.getItem('user_details')
console.log('494',det,localStorage.getItem('user_details'))
det=JSON.parse(det)
console.log('494',det)
let params = {'fk_entity_id':det.fk_entity_id,userid:det.userid}
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
let complete_url = api_url+'listSalesPD/'+det.fk_entity_id
if(is_sales_login) {
complete_url = complete_url+'/'+det.userid+'/'+det.user_role
}
return this._http.get(complete_url).map(res=>{
// this.ionicStorageProvider.checkAndInsertApiDataLocally(res,params,'listSalesPD');
return res;
})
// }
// else{
// return this.ionicStorageProvider.getApiDataFromLocally(params,'listSalesPD');
// }
}
saveSalesPDImage(params,form_structure?): Observable<Response>{
return Observable.create((observer:Observer<any>) => {
// this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
// this.cameraService.getGeoTag().then(geoCords=>{
//params.location=geoCords
console.log(key_value)
params.fk_sales_pd_id=key_value
console.log(params)
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'saveSalesPDImage'
}else if(users.user_role == '20'){
apiName = 'saveFlyhiPDImage'
}
// let values={sales_pd_id:key_value,dataStatus:true}
// let section_data=JSON.stringify({section_id:form_structure.section_id,section_name:form_structure.section_name,onsubmit:null,questions:form_structure.questions})
// let modified_params = form_structure
if(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true) : true) {
this._http.post(api_url+apiName,{records:params},{
reportProgress: true,
}).pipe().subscribe(result => {
console.log(result)
// modified_params.is_synced = true
// modified_params.section_data = section_data
// this.checkAndCreatePDLocally(values,'','online','',modified_params).then(res=>{
observer.next(result);
observer.complete();
// })
},err=>{
console.clear();
// console.log("err>>>>",err)
observer.next(err);
observer.complete();
})
}
else {
// console.log("#######params",modified_params)
// let offline_params = modified_params
// offline_params.request_items=[{url:this.apiUrl+'saveSalesPDImage',
// params:JSON.stringify({records:params}),method:'POST'}]
// offline_params.is_synced = false
// offline_params.section_data = section_data
// console.log(offline_params)
// debugger
// this.checkAndCreatePDLocally(values,'','offline','',offline_params).then(res=>{
observer.next({dataStatus:true});
observer.complete()
// })
}
//})
// })
})
}
updateSectionDataLocally(params,form_structure){
return Observable.create((observer:Observer<any>) => {
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
// this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
// params.location=geoCords
params.fk_sales_pd_id=key_value
let values={sales_pd_id:key_value,dataStatus:true}
let section_data=JSON.stringify({section_id:form_structure.section_id,section_name:form_structure.section_name,onsubmit:null,questions:form_structure.questions})
let modified_params = form_structure
if(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true) : true){
modified_params.is_synced = true
modified_params.section_data = section_data
// this.checkAndCreatePDLocally(values,'','online','',modified_params).then(res=>{
observer.next('');
observer.complete();
//})
// },err=>{
// console.clear();
// // console.log("err>>>>",err)
// observer.next(err);
// observer.complete();
// })
}
else {
// console.log("#######params",modified_params)
let offline_params = modified_params
offline_params.request_items=[{url:api_url+'saveSalesPDImage',
params:JSON.stringify({records:params}),method:'POST'}]
offline_params.is_synced = false
offline_params.section_data = section_data
console.log(offline_params)
// this.checkAndCreatePDLocally(values,'','offline','',offline_params).then(res=>{
observer.next({dataStatus:true});
observer.complete()
//})
}
// })
})
}
clear_local_key(key){
return null;
//return this.storage.remove(key)
}
generatesalereport(params :any): Observable<any> {
// let httpParams = new HttpParams().set('pdid', countpdid);
// httpParams = httpParams.append('random_string',randomString);
return this._http.get(api_url + 'regenerateSaleReport?sales_pd_id=' +params)
// .pipe(
// catchError(this.handleError('role', []))
// )
}
generatemail(params :any): Observable<any> {
// let httpParams = new HttpParams().set('pdid', countpdid);
// httpParams = httpParams.append('random_string',randomString);
return this._http.get(api_url + 'resendSaleReportMail?sales_pd_id=' +params)
// .pipe(
// catchError(this.handleError('role', []))
// )
}
generatesateliteimage(param:any): Observable<any>{
return this._http.post<any>(api_url + 'regenerateSatelliteImg',param )
}
uploadSalesDatatoCET(id): Observable<any> {
let users:any=localStorage.getItem('user_details');
console.log(users);
users=JSON.parse(users);
// return this._http.get<any[]>("http://localhost/AWSEC2/sparqapi/api/uploadSalesPDDataToCETApp/590");
return this._http.get<any[]>(api_url +"uploadSalesPDDataToCETApp/"+id);
}
loadTemplatelocal(){
return this._http.get('assets/data/flyhi.json').map(rr=>{
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
// this.raw_credit_pd_template= returnValue.records.template
return returnValue
})
}
savePDImages(imagesDetails)
{
console.log('savepdimg',imagesDetails);
let record = {'records':imagesDetails};
return this._http.post(api_url+'saveFIPDImg',record).pipe(
map(response=>{
console.log('img response',response);
// this.checkSavedPics(response['dataStatus'],imagesDetails)
// console.log('check Img',this.checkSavedPics);
return response;
},err=>{
console.log("Error in savePDImages",err)
// this.checkSavedPics('',imagesDetails)
// return err
})
)
}
}

View File

@ -0,0 +1,553 @@
<!-- Generated template for the QuesTemplateComponent component -->
<div *ngIf="questions_JSON.questions.length > 0" #whole_form>
<form [formGroup]="quesAnsForm" >
<div *ngIf="quesAnsForm.controls['questions']">
<div formArrayName="questions">
<div *ngFor="let parent_ques of quesAnsForm.controls['questions'].controls;let p_i=index">
<div [formGroupName]="p_i">
<div *ngIf="parent_ques.get('is_repeatable').value != '1'">
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':parent_ques.get('field_type').value == 'numtoword' ? '5%' : '0' }">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
[type]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'number' : parent_ques.get('field_type').value == 'string' ? 'text' : parent_ques.get('field_type').value" formControlName="answer_value"
[placeholder]="parent_ques.value.hasOwnProperty('place_holder') ? parent_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)"></textarea>
<!--<input matInput [type]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'number' : parent_ques.get('field_type').value == 'string' ? 'text' : parent_ques.get('field_type').value" formControlName="answer_value"
[placeholder]="parent_ques.value.hasOwnProperty('place_holder') ? parent_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)"
> -->
<!--[placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" -->
<mat-hint *ngIf="parent_ques.get('answer_value').value != '' && parent_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 12px;">{{"&#8377;"}}{{parent_ques.get('answer_value').value | numberToWords}}</mat-hint>
<!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<!-- <mat-form-field> -->
<div class="radio-gap" *ngIf="parent_ques.get('type').value == '2'">
<mat-label>{{parent_ques.get('question').value}}</mat-label><br/>
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,parent_ques,'','',p_i)">
<mat-radio-button class="radio-btn-gap" *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}&nbsp;&nbsp;&nbsp;</mat-radio-button><br />
</mat-radio-group>
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '3'">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
<mat-option *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<div class="radio-gap" formArrayName="answer_value" *ngIf="parent_ques.get('type').value == '5'">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<mat-checkbox class="radio-btn-gap" *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer" (change)="onChange_checkbox($event,parent_ques)">{{val.answer}}</mat-checkbox><br />
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '4'">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<mat-select multiple formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
<mat-option *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<div *ngIf="parent_ques.get('type').value == '6'">
<!-- <ion-grid > -->
<div fxLayout="row" style=" padding-bottom: 12px;">
<div fxLayout ="column" style="padding:none;align-self:center;text-align:center">
<div >
<div class="top">
<!-- Thumbnail-->
<div class="thumbnail">
<div class="date" style="margin-bottom: -35px; text-align: end;" *ngIf="role_id == '20'">
<!-- <button mat-raised-button mat-icon-button mat-mini-fab
class="date mr-1 mb-1 hover-icon" type="button"
matTooltip="edit" (click)="imageCrop(doc)"
matTooltipPosition="right" >
<mat-icon>edit</mat-icon>
</button> -->
<!-- <button mat-raised-button mat-icon-button mat-mini-fab [ngStyle.xs]="{'font-size':'16px','font-weight':'bold'}" [ngStyle]="{'background-color':role_id == '20' ? '#0d93a9' :'#f44336'}" style=" width: 21px;
height: 20px;"
type="button"
matTooltip="Edit" (click)="imageCrop(parent_ques.get('answer_value').value,parent_ques)"
matTooltipPosition="right">
<mat-icon style="font-size: 14px; line-height: 0px;">edit</mat-icon>
</button> -->
</div>
<img class="image-class" *ngIf="parent_ques.get('answer_value').value != ''" [src]="parent_ques.get('answer_value').value" imageViewer class="doc-image-bucket">
<div class="dummy-img" *ngIf="parent_ques.get('answer_value').value == ''">
<p
style="justify-content: center;align-content: center;text-align: center;align-items: center; margin-top: 10%;">
<span style="font-size: 15px;">
Image is not Captured.
</span><br />
<span style="font-size: 15px;">
<mat-icon>camera</mat-icon>
</span>
</p>
</div>
</div>
</div><br/>
<!-- <p *ngIf="parent_ques.get('answer_value').value == ''">Image is not captured.</p> -->
<label ><strong>{{parent_ques.get('question').value}}</strong>
<!-- <button mat-raised-button mat-icon-button mat-mini-fab
class="date1 mr-1 mb-1 hover-icon" type="button"
matTooltip="edit" (click)="imageCrop(parent_ques.get('answer_value').value)"
matTooltipPosition="right">
<mat-icon>edit</mat-icon>
</button> -->
</label>
<!-- <input *ngIf="image.Name =='' && image.option != 'dummy'" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeName($event.target.value,i,image.image)"> -->
<!-- <button *ngIf="image.option != 'dummy'" ion-button clear color="optblue" (click)="removeImg(i)"><mat-icon style="font-size:22px" name="md-trash"></mat-icon></button> -->
</div>
<div fxLayout="row" style="justify-content: center">
<div fxLayout="column">
<span (click)="index($event,p_i,parent_ques
)">
<app-single-capture-btn class="file-btn" (singleDataEmitter)="captureImg($event,p_i,parent_ques)"></app-single-capture-btn>
</span>
<!-- <button mat-raised clear color="optblue" [disabled]="sales_pd_type == '2'" (click)="captureImg(p_i,parent_ques)"><mat-icon style="font-size: 30px" name="md-camera"></mat-icon></button> -->
</div>
<!-- IMAGE STATUS ICON FOR INPROGRESS, COMPLETED AND FAILED -->
<!-- <ion-col col-4 *ngIf="parent_ques.get('is_image_status').value == true">
<ion-spinner name="crescent" style="width: 20px;
height: 20px;" (click)="cancelLoader(parent_ques)"
*ngIf="parent_ques.get('is_loader').value == true"></ion-spinner>
<mat-icon style="color: #008828;float: right;
margin-right: 30%;" *ngIf="parent_ques.get('is_saved').value == true" name="checkmark-circle-outline"></mat-icon>
<span style="margin:0px;" *ngIf="(parent_ques.get('is_saved').value == false &&
parent_ques.get('is_loader').value == false) && (parent_ques.value.hasOwnProperty('is_saved') &&
parent_ques.value.hasOwnProperty('is_loader'))" (click)="imageReupload(parent_ques)">
<ion-row style="margin-top: -17px;padding:0px;"><button ion-button clear><mat-icon style="color:lightcoral;" name="refresh-circle"></mat-icon></button></ion-row>
<ion-row style="margin-top: -20px;padding:0px;"><p style="font-size: 10px">Click to ReUpload</p></ion-row>
</span>
</ion-col> -->
</div>
<!-- <ng-container ngProjectAs="mat-hint">
<mat-error >Please capture the image</mat-error>
</ng-container> -->
</div>
<hr/>
</div>
<!-- </ion-grid> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
<hr />
<!-- <ng-container ngProjectAs="mat-hint">
<mat-error align="end">Please capture the image</mat-error>
</ng-container>-->
</div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '7'">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<textarea style="overflow: hidden !important;" matInput type="text" cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5" formControlName="answer_value" placeholder="Enter the Text"
autocomplete="off" ></textarea>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '8'">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)" [multiple] = "parent_ques.value.hasOwnProperty('is_multiple') && parent_ques.get('is_multiple').value == '1'">
<mat-option>
<!-- <ngx-mat-select-search formControlName="select_search"
[placeholderLabel]="'Search'"
[noEntriesFoundLabel]="'No Matching Result'" (keyup)="searchFun(parent_ques,p_i)">
<mat-icon name="md-close" ngxMatSelectSearchClear></mat-icon>
</ngx-mat-select-search> -->
</mat-option>
<mat-option *ngIf="parent_ques.get('is_multiple').value != '1'">--</mat-option>
<mat-option *ngFor="let val of fileredSearchValue.length > 0 ? fileredSearchValue[p_i] : parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
</div>
<div class="radio-gap" *ngIf="parent_ques.get('is_repeatable').value == '1' && parent_ques.controls['questions_group']">
<!-- <mat-card> -->
<!-- <mat-card-header>
<mat-card-title>
{{parent_ques.get('group_title').value}}
</mat-card-title>
</mat-card-header> -->
<div formArrayName="questions_group" *ngIf="parent_ques.get('group_type').value != '6'">
<span
*ngFor="let group_ques of parent_ques.controls.questions_group['controls'];let g_i=index;let g_l=last"
[formGroupName]="g_i">
<mat-accordion *ngIf="parent_ques.get('group_type').value != '6'" #accordion="matAccordion">
<mat-expansion-panel [expanded]="step === g_i" #mapanel="matExpansionPanel" style="margin-bottom: 15px !important;">
<mat-expansion-panel-header>
<mat-panel-title>
{{parent_ques.get('group_title').value}} {{g_i+1}}
</mat-panel-title>
<!-- <mat-panel-description>
Type your name and age
</mat-panel-description> -->
</mat-expansion-panel-header>
<div formArrayName="questions" *ngIf="group_ques.controls['questions']">
<div
*ngFor="let single_ques of group_ques.controls.questions['controls'];let s_i=index;let s_l=last"
[formGroupName]="s_i">
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'numtoword' ? '5%' : '0' : '' }">
<mat-label>{{single_ques.get('question').value}}</mat-label>
<textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
[type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value"
[placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)"></textarea>
<!-- <input matInput [type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value"
[placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)"> -->
<mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.value.hasOwnProperty('field_type') && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"&#8377;"}}{{single_ques.get('answer_value').value | numberToWords}}</mat-hint>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<div class="radio-gap" *ngIf="single_ques.get('type').value == '2'">
<mat-label>{{single_ques.get('question').value}}</mat-label><br/>
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
<mat-radio-button class="radio-btn-gap" *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}&nbsp;&nbsp;&nbsp;&nbsp;</mat-radio-button><br />
</mat-radio-group>
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</div>
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '3'">
<mat-label>{{single_ques.get('question').value}}</mat-label>
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
<mat-option *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<div class="radio-gap" formArrayName="answer_value" *ngIf="single_ques.get('type').value == '5'">
<mat-label>{{single_ques.get('question').value}}</mat-label>
<mat-checkbox class="radio-btn-gap" *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer" (change)="onChange_checkbox($event,single_ques)">{{val.answer}}</mat-checkbox><br />
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</div>
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '4'">
<mat-label>{{single_ques.get('question').value}}</mat-label>
<mat-select multiple formControlName="answer_value">
<mat-option *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '7'">
<mat-label>{{single_ques.get('question').value}}</mat-label>
<textarea style="overflow: hidden !important;" cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5" matInput type="text" rows="3" formControlName="answer_value" placeholder="Enter the Text"
></textarea>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '8'">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,p_i)" [multiple] = "parent_ques.value.hasOwnProperty('is_multiple') && parent_ques.get('is_multiple').value == '1'">
<!-- <mat-option>
<ngx-mat-select-search formControlName="select_search"
[placeholderLabel]="'Search'"
[noEntriesFoundLabel]="'No Matching Result'" (keyup)="searchFun(parent_ques,p_i)">
<mat-icon name="md-close" ngxMatSelectSearchClear></mat-icon>
</ngx-mat-select-search>
</mat-option> -->
<mat-option *ngIf="parent_ques.get('is_multiple').value != '1'">--</mat-option>
<mat-option *ngFor="let val of fileredSearchValue.length > 0 ? fileredSearchValue[p_i] : parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<div *ngIf="single_ques.controls['subfield_key']">
<!-- <div *ngIf="parent_ques.controls[parent_ques.get('subfield_key').value]"> -->
<mat-form-field style="width: 100%" >
<mat-label>{{single_ques.get('subfield_caption').value}}</mat-label>
<textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"></textarea>
<!-- <input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"> -->
</mat-form-field>
<!-- </div> -->
</div>
</div>
</div>
<!-- <ion-buttons end> -->
<!-- <div >
<button color="optblue" *ngIf="g_i != 0" (click)="removeData(g_i,parent_ques)">
<mat-icon style="font-size: 22px" name="md-trash"></mat-icon>
</button>
</div>
<div >
<button color="optblue" *ngIf="g_l"
(click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event)">
<mat-icon style="font-size: 24px" name="add-circle"></mat-icon>
</button>
</div> -->
<!-- </ion-buttons> -->
<!-- <div fxLayout="row" fxLayoutAlign="flex-end" fxFlex="100" style="margin-top: 3%;"> -->
<!-- <div> -->
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
mat-icon-button matTooltip="Delete"
matTooltipPosition="above" *ngIf="g_i != 0" (click)="removeData(g_i,parent_ques)">
<mat-icon>delete</mat-icon>
</button>&nbsp;&nbsp;&nbsp;
<!-- </div>
<div> -->
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
mat-icon-button matTooltip="Add More"
matTooltipPosition="above" *ngIf="g_l"
(click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event)">
<mat-icon>add</mat-icon>
</button>
<!-- </div> -->
<!-- </div> -->
</mat-expansion-panel>
</mat-accordion>
</span>
</div>
<div formArrayName="questions_group" *ngIf="parent_ques.get('group_type').value == '6'">
<!-- <hr class="hr"> -->
<mat-card-header>
<!-- <mat-card-title> -->
<h5> {{parent_ques.get('group_title').value}} </h5>
<!-- </mat-card-title> -->
</mat-card-header>
<!-- <ion-grid > -->
<div fxLayout="row">
<span
*ngFor="let group_ques of parent_ques.controls.questions_group['controls'];let g_i=index;let g_l=last"
[formGroupName]="g_i">
<!-- </mat-card> -->
<span formArrayName="questions" *ngIf="group_ques.controls['questions'] && parent_ques.get('group_type').value == '6'" >
<!-- <div > -->
<!-- <div *ngIf="single_ques.get('type').value == '10'"> -->
<!-- {{parent_ques.value.questions_group.length}} -->
<!-- <p style="margin-left: 45px;font-weight:bold;" *ngIf="parent_ques.value.questions_group.length == 1 &&
group_ques.value.questions[0].answer_value == ''">Image is not captured.</p> -->
<div class="dummy-img" *ngIf="parent_ques.value.questions_group.length == 1 &&
group_ques.value.questions[0].answer_value == ''">
<p
style="justify-content: center;align-content: center;text-align: center;align-items: center; margin-top: 10%;">
<span style="font-size: 15px;">
Image is not Captured.
</span> <br />
<span style="font-size: 15px;">
Add More images.
</span> <br />
<span style="font-size: 15px;">
<mat-icon>camera</mat-icon>
</span>
</p>
</div>
<div fxLayout="column" style="align-self: center;text-align: center;padding: 0" *ngFor="let single_ques of group_ques.controls.questions['controls'];let s_i=index;let s_l=last"
[formGroupName]="s_i">
<div style="width: 100%;justify-content: center;text-align: center;align-content: center;margin:2%;padding-right: 20px;" *ngIf="single_ques.get('answer_value').value != ''">
<div fxLayout="row" style="width: 100%">
<div class="top">
<!-- Thumbnail-->
<div class="thumbnail">
<div class="date" style="margin-bottom: -35px; text-align: end;" *ngIf="role_id == '20'">
<!-- <button mat-raised-button mat-icon-button mat-mini-fab [ngStyle.xs]="{'font-size':'16px','font-weight':'bold'}" [ngStyle]="{'background-color':role_id == '20' ? '#0d93a9' :'#f44336'}" style=" width: 21px;
height: 20px;"
class="date1" type="button"
matTooltip="Edit" (click)="imageCrop(single_ques.get('answer_value').value,single_ques,g_i)"
matTooltipPosition="right">
<mat-icon style="font-size: 14px; line-height: 0px;">edit</mat-icon>
</button> -->
</div>
<img class="image-class" [src]="single_ques.get('answer_value').value" imageViewer class="doc-image-bucket" >
<br/>
</div>
</div>
</div>
<div fxLayout="row" style="width: 130px;margin-bottom: 5px;text-align: left">
<div >
<span style="font-size: 12px;padding: 0px;margin: 0px;"><strong>{{single_ques.get('question').value}} {{g_i+1}}</strong></span>
</div>
<!-- IMAGE STATUS ICON FOR INPROGRESS, COMPLETED AND FAILED -->
<div *ngIf="single_ques.get('is_image_status').value == true">
<!-- <ion-spinner name="crescent" style="width: 20px;
height: 20px;" (click)="cancelLoader(single_ques)"
*ngIf="single_ques.get('is_loader').value == true"></ion-spinner> -->
<mat-icon style="color: #008828;float: right;
margin-right: 30%;" *ngIf="single_ques.get('is_saved').value == true" name="checkmark-circle-outline"></mat-icon>
<span style="margin:0px;" *ngIf="(single_ques.get('is_saved').value == false &&
single_ques.get('is_loader').value == false) && (single_ques.value.hasOwnProperty('is_saved') &&
single_ques.value.hasOwnProperty('is_loader'))" (click)="imageReupload(single_ques)">
<div style="margin-top: -17px;padding:0px;"><button mat-ion-button clear><mat-icon style="color:lightcoral;" name="refresh-circle"></mat-icon></button></div>
<div style="margin-top: -20px;padding:0px;"><p style="font-size: 10px">Click to ReUpload</p></div>
</span>
</div>
<!-- <input *ngIf="image.Name =='' && image.option != 'dummy'" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeName($event.target.value,i,image.image)"> -->
<!-- <button ion-button clear color="optblue" (click)="removeData(g_i,parent_ques)"><mat-icon style="font-size:22px" name="md-trash"></mat-icon></button> -->
</div>
</div>
<!-- <div style="justify-content: center">
<button ion-button clear color="optblue" (click)="captureImg()"><mat-icon style="font-size: 30px" name="md-camera"></mat-icon></button>
</div> -->
<!-- {{single_ques.value | json}} -->
<div class="add-more-image" *ngIf="g_l" style="padding-bottom: 12px;padding-top: 12px;">
<!-- <button mat-raised-button color="warn" style="min-width: 65px !important;" [disabled]="sales_pd_type == '2'" (click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event,'camera',single_ques)">
<mat-icon>camera_alt</mat-icon>+
</button> -->
<span (click)="getIndex(g_i,parent_ques,group_ques.get('questions').value,single_ques)">
<app-capture-btn class="file-btn" (imageDataEmitter)="addImage($event,g_i,parent_ques,group_ques.get('questions').value,single_ques)" ></app-capture-btn>
</span>
<!-- <button class="ml-1 mr-1 hover-icon" mat-raised-button clear style="color: #f3432c" [disabled]="sales_pd_type == '2'" (click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event,'camera',single_ques)"><mat-icon style="font-size:25px">camera_alt</mat-icon>+</button> -->
</div>
</div>
<!-- </div> -->
<!-- </div> -->
</span>
<div *ngIf="g_l" style="justify-content: flex-end">
</div>
</span>
</div>
<!-- <ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container> -->
<!-- </ion-grid> -->
<hr class="hr">
</div>
</div>
<div *ngIf="parent_ques.controls['subfield_key']">
<!-- <div *ngIf="parent_ques.controls[parent_ques.get('subfield_key').value]"> -->
<mat-form-field style="width: 100%" >
<mat-label>{{parent_ques.get('subfield_caption').value}}</mat-label>
<textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"></textarea>
<!-- <input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"> -->
</mat-form-field>
<!-- </div> -->
</div>
</div>
</div>
</div>
</div>
<!-- <div *ngIf="roleID != 30">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
<div *ngIf="roleID == 30">
<div *ngIf="local_ques_JSON.section_id != '9' && pdstatus != 'COMPLETED'">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
</div> -->
<!-- <div *ngIf="roleID == 20">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; Save</button>
</div> -->
</form>
</div>
<div *ngIf="roleID == 30" style=" padding-bottom: 37px;">
<div *ngIf="local_ques_JSON.section_id != 9">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
<div *ngIf="local_ques_JSON.section_id == 9 && pdstatus != 'COMPLETED'" style=" padding-bottom: 37px;">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
</div>
<div *ngIf="roleID != 30" style=" padding-bottom: 37px;">
<button [ngStyle]="{'background-color':roleID == '20' ? '#0d93a9' :'#f44336'}" style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="save_image()"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>

View File

@ -0,0 +1,125 @@
// ques-template {
mat-radio-button,mat-checkbox{
margin-top: 13px;
}
.radio-gap{
margin-top: 10px;
margin-bottom: 10px;
}
.radio-btn-gap{
margin:10px;
}
.doc-image-bucket{
padding:0 5px 0 0 !important;
width: 175px;
height: 126px !important;
color:black;
//width:130px;
//border:3px solid black;
//border-radius: 20px;
//background-color: gray;
// }
.add-more-image{
width: 60%;
padding:0 5px 0 0 !important;
width: 120px;
height: 80px !important;
// border: 2px solid gainsboro;
// border-style: dashed;
// border-radius: 10px;
}
.hr, hr{
font-size: 25px;
}
// .btn-no-pad{
// padding: 8px 8px 8px 5px;
// }
.save-btn{
margin-top: 3%;
}
// .mat-input-invalid .mat-input-placeholder {
// color: red;
// }
// .mat-input-invalid .mat-input-ripple {
// background-color: red;
// }
}
// textarea.mat-input-element {
// overflow: hidden !important;
// }
::ng-deep .mat-select-value-text{
line-height: initial !important;
word-wrap: break-word !important;
white-space: pre-wrap !important;
}
::ng-deep .mat-select-value-text {
margin: 1rem 0;
overflow: visible;
line-height: initial;
word-wrap: break-word;
white-space: pre-wrap;
}
.mat-option-text.mat-option-text {
white-space: normal;
}
::ng-deep .mat-select-panel mat-option.mat-option {
height: unset;
}
::ng-deep .mat-option-text.mat-option-text {
white-space: normal;
}
.top .thumbnail{
//height: 400px;
position: relative;
}
.top .thumbnail .date {
// margin-right: 13px;
position: absolute;
right: -10px;
top: 4px;
background-color: #e00201 ;
}
.top .thumbnail .date1 {
// margin-right: 13px;
position: absolute;
right: -10px;
top: 50px;
background-color: #e00201 ;
}
.thumbnail{
max-width: 200px;
width: auto;
// height: 200px;
margin-top: 25px;
padding: 1.4%;
}
.dummy-img {
width: 125px;
height: 120px;
}
.dummy-img {
width: 200px;
height: 170px;
border: 3px dashed rgba(0, 0, 0, 0.2);
border-radius: 7px;
background: #eeee;
color: gray;
}
.image-class {
width: 200px;
height: 170px;
}
hr{
color: #e00201;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { QuesTemplateComponent } from './ques-template.component';
describe('QuesTemplateComponent', () => {
let component: QuesTemplateComponent;
let fixture: ComponentFixture<QuesTemplateComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ QuesTemplateComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(QuesTemplateComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,6 @@
<button [ngStyle]="{'color':role_id == '20' ? '#0d93a9' :'#f44336'}" (click)="singlecapture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<mat-icon name="camera" *ngIf="!addMoreBtn">camera_alt</mat-icon>
<mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon>
</button>
<input type="file" (change)="singlecapturedImage($event)" id="input-files" name="file" accept="image/*" capture="user" style="display: none">
<!-- document.querySelector('#input-file').click() -->

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SingleCaptureBtnComponent } from './single-capture-btn.component';
describe('SingleCaptureBtnComponent', () => {
let component: SingleCaptureBtnComponent;
let fixture: ComponentFixture<SingleCaptureBtnComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SingleCaptureBtnComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SingleCaptureBtnComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,99 @@
// import { Component, OnInit } from '@angular/core';
// @Component({
// selector: 'app-single-capture-btn',
// templateUrl: './single-capture-btn.component.html',
// styleUrls: ['./single-capture-btn.component.scss']
// })
// export class SingleCaptureBtnComponent implements OnInit {
// constructor() { }
// ngOnInit() {
// }
// }
import { Component, OnInit, Output, EventEmitter, Input, Injectable } from '@angular/core';
import { Ng2ImgMaxService } from 'ng2-img-max';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import { MatDialog } from '@angular/material';
@Injectable({
providedIn: 'root'
})
@Component({
selector: 'app-single-capture-btn',
templateUrl: './single-capture-btn.component.html',
styleUrls: ['./single-capture-btn.component.scss']
})
export class SingleCaptureBtnComponent {
@Input() addMoreBtn;
@Output() singleDataEmitter = new EventEmitter
sales_pd_type: string;
role_id: string;
constructor(private ng2ImgMax:Ng2ImgMaxService,private loaderService:LoaderService,private dialog: MatDialog) {
this.role_id = localStorage.getItem('user_role')
this.sales_pd_type = localStorage.getItem('sales_pd_type')
console.log(this.sales_pd_type)
}
ngOnInit(): void {
console.log(this.addMoreBtn)
}
singlecapturedImage(event){
this.loaderService.showMatSpinnerDialog('Fetching Data...')
console.log(event);
let imageData= event.target.files[0]
// const dialogRef = this.dialog.open(ImageEditComponent, {
// data: { 'data': event},
// // position: { right: '0'},
// disableClose: true,
// // height: '80%',
// minWidth: '80%',
// maxWidth: '80%',
// });
// dialogRef.afterClosed()
// .subscribe(dataresult => {
// console.log(dataresult)
// // if(dataresult == 1){
// // this.getApiData()
// // }
// });
this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe(
result => {
console.log(result);
this.singleDataEmitter.emit(result)
this.loaderService.closeMatSpinnerDialog()
},
error => {
console.log('😢 Oh no!', error);
}
);
}
singlecapture(event){
event.preventDefault();
let element:HTMLElement = document.getElementById('input-files') as HTMLElement
element.click();
}
}

View File

@ -105,26 +105,36 @@
<mat-cell *matCellDef="let details;let i =index;" style="padding-right: 0px !important;">
<div *ngIf="faceApiEnabled != 0">
<button *ngIf="(_generalForm.controls.individuals.value[i].is_person_met_pic != '' && _generalForm.controls.individuals.value[i].is_person_met_id_proof != '') && (_generalForm.controls.individuals.value[i].is_person_met_pic != null && _generalForm.controls.individuals.value[i].is_person_met_id_proof != null)" type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button (click)="facialRecognition(details)"
matTooltip="Edit" matTooltipPosition="below" >
matTooltip="Facial Recognition" matTooltipPosition="below" >
<mat-icon>face</mat-icon>
</button>
</div>
<button type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button (click)="editIndividuals(details,i)"
matTooltip="Edit " matTooltipPosition="below" [style.visibility]="_generalForm.controls.individuals.value[i].is_main_applicant == true ? 'hidden':'visible'">
<button type="button" class="mr-1 hover-icon" *ngIf="_generalForm.controls.individuals.value[i].is_main_applicant != true" mat-raised-button mat-icon-button (click)="editIndividuals(details,i)"
matTooltip="Edit " matTooltipPosition="below" [style.display]="_generalForm.controls.individuals.value[i].is_main_applicant == true ? 'none':'block'">
<mat-icon>edit</mat-icon>
</button>
<button type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button
(click)="removeIndividuals(i,details)" matTooltip="Remove Individuals"
<button type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button
(click)="removeIndividuals(i,details)" matTooltip="Remove Individuals" *ngIf="_generalForm.controls.individuals.value[i].is_main_applicant != true"
matTooltipPosition="below" [style.visibility]="_generalForm.controls.individuals.value[i].is_main_applicant == true ? 'hidden':'visible'">
<mat-icon>delete</mat-icon>
</button>
<div *ngIf="digilocker_access_Enabled == 1" >
<button type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button (click)="digitallocker(details,i)"
<button type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button (click)="digitallocker(details,i)" *ngIf="_generalForm.controls.individuals.value[i].is_main_applicant != true"
matTooltip="DigiLocker " matTooltipPosition="below" [style.visibility]="_generalForm.controls.individuals.value[i].is_main_applicant == true ? 'hidden':'visible'">
<mat-icon>vpn_lock</mat-icon>
</button>
</div>
</mat-cell>
</ng-container>
<ng-container matColumnDef="picture">
<mat-header-cell *matHeaderCellDef> </mat-header-cell>
<mat-cell *matCellDef="let details;let i =index;" style="padding-right: 0px !important;">
<div *ngIf="_generalForm.controls.individuals.value[i].is_person_met_pic" >
<img mat-card-avatar
src="{{_generalForm.controls.individuals.value[i].is_person_met_pic}}"

View File

@ -190,4 +190,11 @@ $product-bg-color-hover: rgba(103, 58, 183, 0.7);
// .mat-column-is_applicant {
// width: 12%;
// }
.cell{
display:inline !important;
// text-align: center !important;
}
mat-table{
zoom: 90%;
}

View File

@ -69,7 +69,7 @@ export class GeneralInfoComponent implements OnInit {
/* Declaration for DataTables */
displayedColumns = ['applicant_name', 'is_person_met', 'is_applicant', 'age', 'qualification', 'course_name', 'actions'];
displayedColumns = ['applicant_name', 'is_person_met', 'is_applicant', 'age', 'qualification', 'course_name', 'actions','picture'];
secondDisplayedColumns = ['applicant_name', 'relation', 'relation_to'];
thridDisplayedColumns = ['applicant_name', 'company_relationship', 'relation_to_company'];

View File

@ -63,8 +63,13 @@ export class QueriesDocsComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public pd_all_details: any,
private pdTriggerService:PdTrigerService,
private awsService:AwsService) {
// console.log(this.pd_all_details)
console.log(this.pd_all_details)
if(this.pd_all_details.pdmaster_details.fk_pd_type == '4'){
this.form_id = 31 ;
}else{
this.form_id = 24;
}
console.log( this.form_id)
this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id;
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.notifier = notifier;
@ -412,7 +417,7 @@ export class QueriesDocsComponent implements OnInit {
}
}
let formParams:any ={ parent_pdid:this.parent_pdid,
formid:"24",
formid:this.form_id,
pdid:this.pdid,
fk_createdby:this.awsService.getlocale(),};
this.disableAfterSubmit=true

View File

@ -566,6 +566,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
}
else
if(this.selectedFormsCategory.form_id==24){
console.log(this.pdFullDetails)
const dialogRef = this.dialog.open(QueriesDocsComponent, {
data: this.pdFullDetails,
// position: { right: '0'},

View File

@ -3,10 +3,12 @@
<mat-card-title>
<div fxFlex="33" align="left">
<h4 class="mt-0">{{mainApplicantName}}</h4>
<small>{{pdMasterList.customer_segment_name}}</small>
<small *ngIf="pdMasterList.fk_pd_type !='4'">{{pdMasterList.customer_segment_name}}</small>
<!-- <small *ngIf="pdMasterList.fk_pd_type =='4'">{{pdMasterList.fk_pd_type }}</small> -->
</div>
<div fxFlex="66" align="end">
<h4 class="mt-0">{{pdMasterList.product_name}}<span *ngIf="pdMasterList.subproduct_name">/{{pdMasterList.subproduct_name}}</span>&nbsp;
<h4 class="mt-0"> {{pdMasterList.fk_pd_type !='4' ?pdMasterList.product_name : pdMasterList.fi_type}} <span *ngIf="pdMasterList.subproduct_name">/{{pdMasterList.subproduct_name}}</span>&nbsp;
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button>
</h4>

View File

@ -18,6 +18,7 @@ import { FormGroupComponent } from './../forms-dynamic/form-group/form-group.com
// import { ImageCaptureComponent } from './Form-Dynamic/image-capture/image-capture.component';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import { QueriesDocsComponent } from '../forms/queries-docs/queries-docs.component';
@ -57,6 +58,7 @@ export class StartPd2Component implements OnInit, OnDestroy {
private notifier: NotifierService;
vendor_status_arr: any = [];
photographButtons: any[];
fi_id: string;
constructor(notifier: NotifierService, private dialog: MatDialog, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
@ -66,6 +68,9 @@ export class StartPd2Component implements OnInit, OnDestroy {
// console.log(this.route.snapshot.params['pdid'],this.route.snapshot.params['rdmstr']);
this.notifier = notifier;
this.currentPDStatus = false;
this.fi_id =this.route.snapshot.params['fiid'];
console.log( this.fi_id)
}
ngOnInit() {
@ -78,7 +83,7 @@ export class StartPd2Component implements OnInit, OnDestroy {
// Ps.initialize(elemSidebar, { wheelSpeed: 2, suppressScrollX: true });
// Ps.initialize(elemContent, { wheelSpeed: 2, suppressScrollX: true });
}
this.loadTemplates(this.startPD,1,this.randomString);
this.loadTemplates(this.startPD,1,this.randomString,this.fi_id);
// this.getCreditPDTemplate();
@ -112,9 +117,9 @@ export class StartPd2Component implements OnInit, OnDestroy {
// load templates details
loadTemplates(startID:string,type:number,randomString:string){
loadTemplates(startID:string,type:number,randomString:string,fi_id:string){
// console.log('start pd component inside - loadTemplates params are,',startID,type,randomString);
this._pd.loadPDTemplates2(startID,randomString).subscribe(
this._pd.loadPDTemplates2(startID,randomString,fi_id).subscribe(
data => {
console.log("after reponse = ", data);
console.log("after reponse = ", data.records.pdmaster_details);
@ -190,7 +195,7 @@ export class StartPd2Component implements OnInit, OnDestroy {
.subscribe(dataresult => {
if(dataresult.update_status==true){
setTimeout(()=>{
checkType==2 ? this.router.navigate(['../../viewpd', this.pdMasterList.parent_pd_id], {relativeTo: this.route}) : this.loadTemplates(this.startPD,2,this.randomString);
checkType==2 ? this.router.navigate(['../../viewpd', this.pdMasterList.parent_pd_id], {relativeTo: this.route}) : this.loadTemplates(this.startPD,2,this.randomString,this.fi_id);
let data = {
"pd_id": this.startPD,
"regenerate":0,
@ -211,7 +216,7 @@ export class StartPd2Component implements OnInit, OnDestroy {
}
else {
checkType==1 ? this.router.navigate(['../../viewpd', this.pdMasterList.parent_pd_id], {relativeTo: this.route}) : this.loadTemplates(this.startPD,2,this.randomString);
checkType==1 ? this.router.navigate(['../../viewpd', this.pdMasterList.parent_pd_id], {relativeTo: this.route}) : this.loadTemplates(this.startPD,2,this.randomString,this.fi_id);
}
if(checkType == 2){
// this.loadTemplates(this.startPD,2,this.randomString);
@ -262,6 +267,9 @@ export class StartPd2Component implements OnInit, OnDestroy {
}else if(details.form_id == '18'){
componen_name = GeneralInfoComponent
data = this.pdFullDetails;
}else if(details.form_id == '31'){
componen_name = QueriesDocsComponent
data = this.pdFullDetails;
}
const dialogRef = this.dialog.open(componen_name, {
@ -280,7 +288,7 @@ export class StartPd2Component implements OnInit, OnDestroy {
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
// if(dataresult == 'refresh') {
this.loadTemplates(this.startPD,2,this.randomString);
this.loadTemplates(this.startPD,2,this.randomString,this.fi_id);
// }
});
@ -292,7 +300,9 @@ export class StartPd2Component implements OnInit, OnDestroy {
}
// load pd view component
loadPdViewCompoent() {
this.router.navigate(['../../../viewpd', this.pdMasterList.parent_pd_id,this.randomString], {relativeTo: this.route});
this.router.navigate(["personal_discussion/pdlist/viewpd/"+this.pdMasterList.parent_pd_id+"/"+this.randomString])
// this.router.navigate(['../../../viewpd', this.pdMasterList.parent_pd_id,this.randomString], {relativeTo: this.route});
// this.router.navigate(['personal_discussion/pdlist/viewpd', this.pdMasterList.parent_pd_id,this.randomString], {relativeTo: this.route});
}
}

View File

@ -397,8 +397,9 @@ export class ViewPdComponent implements OnInit, OnDestroy {
}
// pd allocation to
pdAllocationTo(pdData: any,childData: any) {
pdData.pd_id = childData.assigned_pd;
if (pdData.fk_pd_type == 1 || pdData.fk_pd_type == 3 || pdData.fk_pd_type == 2) {
if (pdData.fk_pd_type == 1 || pdData.fk_pd_type == 3 || pdData.fk_pd_type == 2 || pdData.fk_pd_type == 4) {
const dialogRef = this.dialog.open(PdAllocationComponent, {
data: pdData,
position: { right: '0' },
@ -524,12 +525,28 @@ export class ViewPdComponent implements OnInit, OnDestroy {
dialogRef.afterClosed()
.subscribe(dataresult => {
if (dataresult.update_status == true) {
this.router.navigate(['../../../startpd',pdDetails.assigned_pd,this.masterRandomString], { relativeTo: this.route });
console.log(pdDetails)
if( pdDetails.addtional_pd_data[0].fk_pd_type =='4'){
this.router.navigate(['../../../startpd2',pdDetails.assigned_pd,this.masterRandomString], { relativeTo: this.route });
}else{
this.router.navigate(['../../../startpd',pdDetails.assigned_pd,this.masterRandomString], { relativeTo: this.route });
}
}
});
}
else {
this.router.navigate(['../../../startpd', pdDetails.assigned_pd,this.masterRandomString], { relativeTo: this.route });
console.log(pdDetails)
if( pdDetails.addtional_pd_data[0].fk_pd_type=='4'){
this.router.navigate(['../../../startpd2',pdDetails.assigned_pd,this.masterRandomString
], { relativeTo: this.route });
}else{
this.router.navigate(['../../../startpd',pdDetails.assigned_pd,this.masterRandomString], { relativeTo: this.route });
}
// this.router.navigate(['../../../startpd', pdDetails.assigned_pd,this.masterRandomString], { relativeTo: this.route });
}
}
getPDStart2(pdDetails: any, status: string) {

View File

@ -165,6 +165,14 @@ import {
import { CropToolsComponent } from './list-pd/start-pd/forms/dialogue/crop-tools/crop-tools.component';
import { FacialRecognitionModalComponent } from './list-pd/start-pd/forms/facial-recognition/facial-recognition-modal/facial-recognition-modal.component';
import { ImageVideoComponent } from './list-pd/view-pd/image-video/image-video.component';
import { QuesTemplateComponent } from './list-pd/start-pd/forms-dynamic/ques-template/ques-template.component';
import { CaptureBtnComponent } from './list-pd/start-pd/forms-dynamic/ques-template/capture-btn/capture-btn.component';
import { SingleCaptureBtnComponent } from './list-pd/start-pd/forms-dynamic/ques-template/single-capture-btn/single-capture-btn.component';
import { Ng2ImgMaxService } from 'ng2-img-max/dist/src/ng2-img-max.service';
import { ImgMaxSizeService } from 'ng2-img-max/dist/src/img-max-size.service';
import { ImgExifService } from 'ng2-img-max/dist/src/img-exif.service';
import { ImgMaxPXSizeService } from 'ng2-img-max/dist/src/img-maxpx-size.service';
import { Ng2ImgMaxModule } from 'ng2-img-max';
/**
* Custom angular notifier options
*/
@ -210,8 +218,8 @@ const pdCustomNotifierOptions: NotifierOptions = {
};
@NgModule({
declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent,VendorPdAllocationComponent, DuplicatePdComponent,FacialRecognitionModalComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent,StartPd2Component, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent,PdCollectedDocsComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent, ManageRentalVerificationComponent, FuturePlansAndBusinessEnvironmentComponent, ImageCropComponent,CropToolsComponent,PurchaseCalculationComponent,QueriesDocsComponent, ImageDocsComponent,CustomTitleCaseDirective, SpeedDialFabComponent,VideoPlayerComponent,
DynamicFormComponent,DynamicQuestionTemplateComponent, ImagesAllComponent,AnswerOptionCreateDialogComponent,FormComponent,FormGroupComponent, ImageVideoComponent],
declarations: [QuesTemplateComponent,TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent,VendorPdAllocationComponent, DuplicatePdComponent,FacialRecognitionModalComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent,StartPd2Component, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent,PdCollectedDocsComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent, ManageRentalVerificationComponent, FuturePlansAndBusinessEnvironmentComponent, ImageCropComponent,CropToolsComponent,PurchaseCalculationComponent,QueriesDocsComponent, ImageDocsComponent,CustomTitleCaseDirective, SpeedDialFabComponent,VideoPlayerComponent,
DynamicFormComponent,DynamicQuestionTemplateComponent, ImagesAllComponent,AnswerOptionCreateDialogComponent,FormComponent,FormGroupComponent, ImageVideoComponent,CaptureBtnComponent, SingleCaptureBtnComponent,],
imports: [
CommonModule,
ManagePdRoutingModule,
@ -239,7 +247,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
MatSelectModule, MatListModule,MatGridListModule, MatTabsModule, MatBadgeModule, MatCheckboxModule,MatStepperModule,MatSidenavModule ,MatMenuModule, MatButtonToggleModule,
ReactiveFormsModule,
MatBottomSheetModule,
Ng2ImgMaxModule ,
MatDividerModule,
MatNativeDateModule,
@ -262,7 +270,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
MatVideoModule
],
exports: [FacialRecognitionModalComponent,DuplicatePdComponent,VendorPdAllocationComponent,PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent,StartPd2Component, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent,PdCollectedDocsComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, DailyPurchaseDetailsComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,ImageCropComponent,CropToolsComponent,PurchaseCalculationComponent],
exports: [FacialRecognitionModalComponent,DuplicatePdComponent,VendorPdAllocationComponent,PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent,StartPd2Component, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent,PdCollectedDocsComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, DailyPurchaseDetailsComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,ImageCropComponent,CropToolsComponent,PurchaseCalculationComponent,CaptureBtnComponent, SingleCaptureBtnComponent,],
providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'},
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective,QuesFormService],

View File

@ -36,6 +36,10 @@ const routes: Routes = [
path: 'viewpd/:pdid/:rdmstr',
component: ViewPdComponent,
},
{
path: 'viewpd/:pdid/:rdmstr/:fiid',
component: ViewPdComponent,
},
{
path: 'startpd/:pdid/:rdmstr',
component: StartPdComponent,
@ -44,6 +48,10 @@ const routes: Routes = [
path: 'startpd2/:pdid/:rdmstr',
component: StartPd2Component,
},
{
path: 'startpd2/:pdid/:rdmstr/:fiid',
component: StartPd2Component,
},
{
path: 'pd_report/:pdid/:rdmstr',
component: PdReportComponent,

View File

@ -415,10 +415,11 @@ export class PdTrigerService {
catchError(this.handleError('operation', []))
)
}
loadPDTemplates2(pdId: string,randomString): Observable<any> {
loadPDTemplates2(pdId: string,randomString,fi_id): Observable<any> {
let httpParams = new HttpParams().set('pd_id', pdId);
httpParams = httpParams.append('random_string',randomString);
// httpParams = httpParams.append('fi_id',fi_id);
// console.log('loadFullTemplate api load httpParams are',httpParams);
const options = pdId ? { params: httpParams } : {};
console.log(options)
@ -1130,12 +1131,19 @@ export class PdTrigerService {
return this._http.post(this.apiUrl+'saveNewSMCTempAddresses',params)
}
getPDSectionData(pd_id,pd_form_id,form_group) {
console.log(pd_id.fk_pd_type)
if(pd_form_id != '34'){
if(form_group == 1){
return this._http.post(this.apiUrl+'getPDFormDetails',{ "pd_id":pd_id,"pd_form_id":pd_form_id,"company_id":1})
}else{
return this._http.post(this.apiUrl+'getPDFormDetails',{ "pd_id":pd_id.pd_id,"pd_form_id":pd_form_id,parent_pdid:pd_id.parent_pd_id})
}
}else{
return this._http.get(this.apiUrl+'getFIPDImgDetails?pd_id='+pd_id.pd_id)
}
}
@ -1150,7 +1158,7 @@ export class PdTrigerService {
return this._http.get(this.apiUrl+'getPDFormDetails',params)
}
loadCreditPDTemplate2(form_id,mapid,Formname,template_id):Observable<any> {
loadCreditPDTemplate2(form_id,mapid,fi_fk_pd_type,template_id):Observable<any> {
//return this._http.get<any[]>(this.apiUrl + "formWiseJSONTemplateV2?form_id=5&map_id=7").map(result)
@ -1176,12 +1184,22 @@ export class PdTrigerService {
return apivalue
})
}else{
return this._http.get<any[]>(this.apiUrl + "formWiseJSONTemplateV2?form_id="+form_id+"&map_id="+mapid+"").map(result=>{
console.log(result)
let apivalue ={dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
console.log(apivalue)
return apivalue
})
if(fi_fk_pd_type == '4'){
return this._http.get<any[]>(this.apiUrl + "FIformWiseTemplate?form_id="+form_id+"").map(result=>{
console.log(result)
let apivalue ={dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
console.log(apivalue)
return apivalue
})
}else{
return this._http.get<any[]>(this.apiUrl + "formWiseJSONTemplateV2?form_id="+form_id+"&map_id="+mapid+"").map(result=>{
console.log(result)
let apivalue ={dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
console.log(apivalue)
return apivalue
})
}
}
// }

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB