This commit is contained in:
sriram-at-840620226347 2020-07-22 18:53:43 +05:30
commit a093ec16d3
29 changed files with 1880 additions and 45 deletions

View File

@ -2002,7 +2002,7 @@
},
"sax": {
"version": "1.2.1",
"resolved": "http://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
"integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=",
"dev": true
},
@ -2483,7 +2483,7 @@
},
"buffer": {
"version": "4.9.1",
"resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
"integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=",
"requires": {
"base64-js": "^1.0.2",
@ -2618,7 +2618,7 @@
},
"calendar-utils": {
"version": "0.1.2",
"resolved": "http://registry.npmjs.org/calendar-utils/-/calendar-utils-0.1.2.tgz",
"resolved": "https://registry.npmjs.org/calendar-utils/-/calendar-utils-0.1.2.tgz",
"integrity": "sha512-9j4Zd1itopNYTSWzFU4MqD2IDHMqznfxsGr8UWGh7hWv+lKzjRJz0LS29iAg5rHtP6+6x3ikQnhoMGqFUzoD2Q=="
},
"caller-callsite": {
@ -7686,7 +7686,7 @@
},
"lodash": {
"version": "3.10.1",
"resolved": "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=",
"dev": true
},
@ -7874,7 +7874,7 @@
},
"load-json-file": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"requires": {
"graceful-fs": "^4.1.2",
@ -7967,7 +7967,7 @@
},
"log4js": {
"version": "0.6.38",
"resolved": "http://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz",
"resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz",
"integrity": "sha1-LElBFmldb7JUgJQ9P8hy5mKlIv0=",
"dev": true,
"requires": {
@ -8261,7 +8261,7 @@
},
"meow": {
"version": "3.7.0",
"resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
"requires": {
"camelcase-keys": "^2.0.0",
@ -8390,7 +8390,7 @@
},
"minimist": {
"version": "1.2.0",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"minipass": {
@ -8479,7 +8479,7 @@
},
"mkdirp": {
"version": "0.5.1",
"resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
@ -8487,7 +8487,7 @@
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
}
}
@ -8949,7 +8949,7 @@
"dependencies": {
"semver": {
"version": "5.3.0",
"resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8="
}
}
@ -9391,7 +9391,7 @@
"dependencies": {
"minimist": {
"version": "0.0.10",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
"dev": true
},
@ -9450,7 +9450,7 @@
},
"os-locale": {
"version": "1.4.0",
"resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"requires": {
"lcid": "^1.0.0"
@ -11964,7 +11964,7 @@
},
"sax": {
"version": "0.5.8",
"resolved": "http://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
"resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
"integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=",
"dev": true
},
@ -12878,7 +12878,7 @@
},
"sax": {
"version": "0.6.1",
"resolved": "http://registry.npmjs.org/sax/-/sax-0.6.1.tgz",
"resolved": "https://registry.npmjs.org/sax/-/sax-0.6.1.tgz",
"integrity": "sha1-VjsZx8HeiS4Jv8Ty/DDjwn8JUrk=",
"dev": true
},
@ -13415,7 +13415,7 @@
},
"wrap-ansi": {
"version": "2.1.0",
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"requires": {
"string-width": "^1.0.1",

View File

@ -8,7 +8,8 @@
</h2>
<h2><img [src]="'http://ssa.sineedge.com/sparqapi/logo/sine_edge_icon.png'" style="height: 50px;;"> <span> {{userDep}} </span>
</h2> -->
<h2><img src="assets/images/PD_Genie_TM.jpg" style="height: 45px;;"> <span> {{userDep}} </span>
<h2><img src="assets/images/PD_Genie_TM1.jpg" style="height: 45px;;">
<!-- <span> {{userDep}} </span> -->
</h2>
</div>
<div class="main-nav">
@ -109,7 +110,8 @@
</h2>-->
<a>
<!-- <img [routerLink]="['/dashboard']" [src]="'http://ssa.sineedge.com/sparqapi/logo/sineedge_red.png'" style="height: 35px;;"> <span> {{userDep}} </span> -->
<img (click)="menunav('HOME')" src="assets/images/PD_Genie_TM.jpg" style="height: 45px;;"> <span> {{userDep}} </span>
<img (click)="menunav('HOME')" src="assets/images/PD_Genie_TM1.jpg" style="height: 45px;;">
<!-- <span> {{userDep}} </span> -->
</a>
</div>
</div>

View File

@ -18,7 +18,9 @@ export class HttpLoaderComponent implements OnInit {
ngOnInit() {
this.subscription = this.loaderService.loaderState
.subscribe((state: LoaderState) => {
setTimeout(()=>{
this.show = state.show;
})
});
}
ngOnDestroy() {

View File

@ -160,10 +160,10 @@
matTooltip="View" matTooltipPosition="above">
<mat-icon>visibility</mat-icon>
</button>
<!-- <button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
<button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
matTooltip="Copy PD" matTooltipPosition="above">
<mat-icon>file_copy</mat-icon>
</button> -->
</button>
</mat-cell>
</ng-container>

View File

@ -134,10 +134,10 @@
<button style ="float: right" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id,details.random_string)" matTooltip="View"
matTooltipPosition="above" color="primary"><mat-icon>visibility</mat-icon></button>
<!-- <button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
<button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
matTooltip="Copy PD" matTooltipPosition="above">
<mat-icon>file_copy</mat-icon>
</button> -->
</button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">

View File

@ -127,10 +127,10 @@
<mat-icon>sms</mat-icon>
</button> -->
<button style="float: right" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id,details.random_string)" matTooltip="View" matTooltipPosition="above" color="primary"><mat-icon>visibility</mat-icon></button>
<!-- <button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
<button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
matTooltip="Copy PD" matTooltipPosition="above">
<mat-icon>file_copy</mat-icon>
</button> -->
</button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">

View File

@ -132,10 +132,10 @@
</button> -->
<button style="float: right" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id,details.random_string)" color="primary" matTooltip="View" matTooltipPosition="above"><mat-icon>visibility</mat-icon></button>
<!-- <button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
<button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
matTooltip="Copy PD" matTooltipPosition="above">
<mat-icon>file_copy</mat-icon>
</button> -->
</button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">

View File

@ -132,10 +132,10 @@
</button> -->
<button style="float: right" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id,details.random_string)" color="primary" matTooltip="View" matTooltipPosition="above"><mat-icon>visibility</mat-icon></button>
<!-- <button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
<button style="float: right" mat-button mat-icon-button class="mb-1 hover-icon" type="button" color="primary" (click)="copyPD(details)"
matTooltip="Copy PD" matTooltipPosition="above">
<mat-icon>file_copy</mat-icon>
</button> -->
</button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">

View File

@ -92,6 +92,10 @@
<mat-error
*ngIf="init_addr.controls['pincode_others'].hasError('required')">
Pincode Required</mat-error>
<mat-error
*ngIf="init_addr.controls['pincode_others'].hasError('minlength') ||
init_addr.controls['pincode_others'].hasError('maxlength')">
Pincode should be 6 digit</mat-error>
</mat-form-field>
</div>
@ -258,7 +262,7 @@
</mat-form-field>
<mat-form-field style="width: 46%;"
*ngIf="addressForm.controls['locality'].value == 1">
*ngIf="addressForm.controls['locality'].value == 1 && addressForm.controls['locality_others']">
<input matInput placeholder="Specify Locality " required
formControlName="locality_others" autocomplete="off">
<!-- autofocus -->

View File

@ -420,6 +420,7 @@ export class AddressComponent implements OnInit {
e == 1 ? this.addressForm.addControl('address_type_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('address_type_others');
break;
case 4:
console.log("value",e );
e == 1 ? this.addressForm.addControl('locality_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('locality_others');
break;
case 5:
@ -534,12 +535,24 @@ export class AddressComponent implements OnInit {
});
}
public findInvalidControls() {
const invalid = [];
const controls = this.addressForm.controls;
for (const name in controls) {
if (controls[name].invalid) {
invalid.push(name);
}
}
return invalid;
}
onSubmit() {
if (!this.addressForm.valid) {
this.validateAllFormFields(this.addressForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
let inavalidCtrls = this.findInvalidControls();
console.log(inavalidCtrls)
return;
}
// else if (this.addressForm.value.address_form_remark == '') {
@ -881,9 +894,85 @@ export class AddressComponent implements OnInit {
this._pd.getVendorDatas('address',this.pdid).subscribe(result=>{
if(result) {
let initiated_address_check =result.records.hasOwnProperty('is_pd_done_on_initiated_address') ? result.records.is_pd_done_on_initiated_address : true ;
if (initiated_address_check == false) {
this.addressForm.addControl('alternative_addresses', this.fb.array([]));
const alternative_address_control = <FormArray>this.addressForm.controls['alternative_addresses'];
if (result.records.alternative_addresses.length > 0) {
result.records.alternative_addresses.forEach((datas, index) => {
if (datas.citySearch == "" || datas.citySearch == null){
delete datas.citySearch;
}
if (datas.pinSearch == "" || datas.pinSearch == null){
delete datas.pinSearch;
}
if (datas.stateSearch == "" || datas.stateSearch == null){
delete datas.stateSearch;
}
let obj = {
'alternative_address': this.transformName(datas.alternative_address),
'alternative_state': datas.alternative_state,
'alternative_city': datas.alternative_city,
'alternative_pincode': datas.alternative_pincode,
// 'alternative_pincode_others': datas.alternative_pincode == 1 ? datas.alternative_pincode_others : '',
'reason_for_alternative_address': datas.reason_for_alternative_address,
}
this.getCityAndPincodeDetails(datas.alternative_state, index, 2);
if(alternative_address_control.length == 1) {
alternative_address_control.removeAt(0);
}
alternative_address_control.push(this.createAlternativeAddresses(obj));
this.setOthers(+datas.alternative_pincode, index, 2);
if(datas.alternative_pincode == 1) {
let AltCtrl: any = alternative_address_control.controls[index];
AltCtrl.controls['alternative_pincode_others'].setValue(datas.alternative_pincode_others);
AltCtrl.controls['alternative_pincode_others'].updateValueAndValidity();
}
this.addressForm.controls.pd_location.setValue(result.records.pd_location);
this.addressForm.controls.address_type.setValue(result.records.address_type);
let selectedAddressType = this.addressData.filter(element => element.address_type_id == result.records.address_type)[0];
if(selectedAddressType != undefined && selectedAddressType.hasOwnProperty('address_type')){
this.selectedAddressType(selectedAddressType.address_type);
}
this.setOthers(result.records.address_type, '', 3);
if (result.records.address_type == 1) {
this.addressForm.controls.address_type_others.setValue(result.records.address_type_others);
this.selectedAddressType(result.records.address_type_others);
}
this.addressForm.controls.comment_locality.setValue(result.records.comment_locality);
this.addressForm.controls.locality.setValue(result.records.locality);
this.setOthers(result.records.locality, '', 4);
if (result.records.locality == 1) {
this.addressForm.controls.locality_others.setValue(result.records.locality_others);
}
if(this.lender_short_name != 'CLIX' && this.prod_catagory != 'BL'){
this.addressForm.controls.estimated_area.setValue(result.records.estimated_area);
this.addressForm.controls.uom.setValue(result.records.uom);
this.setOthers(result.records.uom, '', 5);
if (result.records.uom == 1) {
this.addressForm.controls.uom_others.setValue(result.records.uom_others);
}
}
});
}
}
setTimeout(() =>{
this.addressForm.patchValue(result.records);
},1000)
// console.log(this.addressForm.value,this.commentData,this.locationdata);
// console.log(this.a.value)
console.log(this.addressForm.value)
}
})

View File

@ -0,0 +1,69 @@
<div *ngIf="questions_JSON.questions.length > 0" #whole_form>
<form [formGroup]="form_group_name" fxLayout="row wrap" fxFlex="100" fxLayoutAlign="space-between" fxLayout.xs="column" fxLayoutGap="33px">
<!-- {{form_group_name.value | json}} -->
<!-- <div *ngIf="form_group_name.controls['questions']"> -->
<!-- <section formArrayName="questions">fxFlex.md="33" fxFlex.lg="33" fxFlex.xl="33" -->
<!-- {{form_group_name.value | json}} -->
<span *ngFor="let parent_ques of questions_JSON.questions;let p_i =index; let p_last=last" fxFlex.xs="100" fxFlex.sm="100" [fxFlex]="parent_ques.hasOwnProperty('field_width') && parent_ques.field_width ? parent_ques.field_width : '100'" >
<!-- <div *ngFor="let parent_ques of form_group_name.controls['questions']['controls'];let p_i=index; let p_l=last" [formGroupName]="p_i"> -->
<!-- {{parent_ques | json}} -->
<div *ngIf="parent_ques.is_repeatable != '1'" >
<app-dynamic-question-template [currFormArrayObj]="parent_ques" [json_answers] = "json_answers" [formGroupN]="form_group_name"
[whole_json]="questions_JSON.questions" [json_index]="p_i"></app-dynamic-question-template>
</div>
<div *ngIf="parent_ques.is_repeatable == '1'">
<!-- {{form_group_name.value[parent_ques.group_key] | json}} -->
<div [formArrayName]="parent_ques.group_key" *ngIf="parent_ques.group_type != '6'">
<span *ngFor="let group_ques of form_group_name.get(parent_ques.group_key)['controls'];let g_i=index;let g_l=last"
[formGroupName]="g_i">
<!-- {{g_i}} {{g_l}} -->
<mat-accordion *ngIf="parent_ques.group_type != '6' && parent_ques.group_questions[g_i]" #accordion="matAccordion">
<mat-expansion-panel [expanded]="step === g_i" #mapanel="matExpansionPanel">
<mat-expansion-panel-header>
<mat-panel-title>
{{parent_ques.group_title}} {{g_i+1}}
</mat-panel-title>
<!-- <mat-panel-description>
Type your name and age
</mat-panel-description> -->
</mat-expansion-panel-header>
<div *ngFor="let singleQues of parent_ques.group_questions[g_i];let s_i=index">
<app-dynamic-question-template [currFormArrayObj]="singleQues" [formGroupN]="group_ques" [whole_form]="form_group_name"
[whole_json]="parent_ques.group_questions[g_i]" [json_index]="s_i"></app-dynamic-question-template>
</div>
<div fxLayout="row" fxLayoutAlign="flex-end">
<div >
<!-- <ion-button class="ion-float-right" fill="clear" color="optblue" *ngIf="g_i != 0" (click)="removeData(g_i,parent_ques)">
<ion-icon style="font-size: 22px" name="md-trash"></ion-icon>
</ion-button> -->
<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>
</div>
<div>
<!-- <ion-button class="ion-float-right" fill="clear" color="optblue" *ngIf="g_l"
(click)="addData(g_i,parent_ques,$event)">
<ion-icon style="font-size: 24px" name="add-circle"></ion-icon>
</ion-button> -->
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
mat-icon-button matTooltip="Delete"
matTooltipPosition="above" *ngIf="g_l"
(click)="addData(g_i,parent_ques)">
<mat-icon>add</mat-icon>
</button>
</div>
</div>
</mat-expansion-panel>
</mat-accordion>
</span>
</div>
<!-- IS REPEATABLE -->
</div>
<!-- </div> -->
<!-- </section> -->
</span>
</form>
</div>

View File

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { DynamicFormComponent } from './dynamic-form.component';
describe('DynamicFormComponent', () => {
let component: DynamicFormComponent;
let fixture: ComponentFixture<DynamicFormComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DynamicFormComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(DynamicFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,68 @@
import { Component, OnInit, Input } from '@angular/core';
import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
import { QuesFormService } from '../ques-form/ques-form.service';
@Component({
selector: 'app-dynamic-form',
templateUrl: './dynamic-form.component.html',
styleUrls: ['./dynamic-form.component.scss'],
})
export class DynamicFormComponent implements OnInit {
// form_group_name: FormGroup;
@Input() form_group_name:FormGroup;
@Input() questions_JSON:any;
@Input() json_answers:any;
step: number=0;
constructor(private _fb:FormBuilder,private questionService:QuesFormService) { }
ngOnInit() {
// this.form_group_name=new FormGroup({questions:this._fb.array([])})
console.log(this.questions_JSON,this.json_answers,this.questionService);
this.form_group_name=this.questionService.assignFormControl_array(this.form_group_name,this.questions_JSON.questions)
// debugger
}
ngOnChanges() {
console.log(this.questions_JSON,this.json_answers,this.questionService);
// this.form_group_name=new FormGroup({questions:this._fb.array([])})
console.log(this.form_group_name);
// this.form_group_name.valueChanges.subscribe(()=>{
// this.form_group_name.updateValueAndValidity();
// })
// debugger;
// this.form_group_name.patchValue(this.json_answers)
}
addData(index,json_obj) {
let control_names:any= {}
let control = this.form_group_name.get(json_obj.group_key) as FormArray
json_obj.question.map(val=>{
control_names[val.question_key] = ''
})
console.log(control,json_obj.group_key,control_names);
json_obj.group_questions.push(json_obj.question);
control.push(this._fb.group(control_names))
json_obj.question.forEach((group_indi,arr_index)=>{
// console.log("sd",childControl)
this.questionService.addAdditionalControl(group_indi, control.controls[control.length-1], arr_index)
})
json_obj.question = JSON.parse(JSON.stringify(json_obj.question))
control.updateValueAndValidity();
control.controls[control.length-1].updateValueAndValidity();
this.form_group_name.updateValueAndValidity();
this.step = control.length-1
console.log(this.form_group_name.value);
}
removeData(index,json_obj) {
console.log(json_obj)
// debugger;
let control = this.form_group_name.get(json_obj.group_key) as FormArray
control.removeAt(index)
json_obj.group_questions.splice(index,1)
this.step = control.length-1
console.log(json_obj)
}
}

View File

@ -0,0 +1,184 @@
<section [formGroup]="formGroupN">
<!-- {{formGroupN.value | json}} -->
<mat-form-field style="width: 100%" *ngIf="parent_ques.type == '1'"
[ngStyle]="{'margin-bottom':parent_ques.field_type == 'numtoword' ? '5%' : '0' }">
<mat-label>{{parent_ques.question}}</mat-label>
<input matInput
[type]="parent_ques.field_type == 'num' || parent_ques.field_type == 'numtoword' ? 'number' : parent_ques.field_type== 'string' ? 'text' : parent_ques.field_type"
[formControlName]="parent_ques.question_key" [placeholder]="parent_ques.place_holder" autocomplete="off"
(change)="onChangeProperty($event,parent_ques,parent_ques.question_key)">
<!-- [placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" -->
<mat-hint
*ngIf="formGroupN.value[parent_ques.question_key] != '' && parent_ques.field_type == 'numtoword'"
align="end" style="font-size: 12px;">{{"&#8377;"}} {{formGroupN.value[parent_ques.question_key] | 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.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<mat-form-field style="width:100%"
*ngIf="parent_ques.type == '9'">
<mat-label>{{parent_ques.question}}</mat-label>
<input matInput [type]="parent_ques.field_type == 'num' || parent_ques.field_type == 'numtoword' ? 'number' : parent_ques.field_type== 'string' ? 'text' : parent_ques.field_type"
[formControlName]="parent_ques.question_key" [placeholder]="parent_ques.place_holder"
(change)="onChangeProperty($event,parent_ques,parent_ques.question_key)"
[matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let val of autoCompleteAns | async" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer"
>
<span>{{val.answer}}</span>
</mat-option>
</mat-autocomplete>
<mat-hint
*ngIf="formGroupN.value[parent_ques.question_key] != '' && parent_ques.field_type == 'numtoword'"
align="end" style="font-size: 12px;">{{"&#8377;"}} {{formGroupN.value[parent_ques.question_key] | 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.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<!-- <mat-form-field> -->
<div class="radio-gap" *ngIf="parent_ques.type == '2'">
<mat-label>{{parent_ques.question}}</mat-label><br />
<mat-radio-group aria-label="Select an option" [formControlName]="parent_ques.question_key"
(change)="onChangeProperty($event,parent_ques,'','','')">
<mat-radio-button class="radio-btn-gap" *ngFor="let val of parent_ques.answers"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br />
</mat-radio-group>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error style="font-size:12px" align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.type == '3'">
<mat-label>{{parent_ques.question}}</mat-label>
<mat-select [formControlName]="parent_ques.question_key" (selectionChange)="onChangeProperty($event,parent_ques,'','','')">
<mat-option *ngFor="let val of parent_ques.answers"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<!-- <div class="radio-gap" [formArrayName]="parent_ques.question_key" *ngIf="parent_ques.type == '5'">
<mat-label>{{parent_ques.question}}</mat-label>
<mat-checkbox class="radio-btn-gap" *ngFor="let val of parent_ques.answers"
[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.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</div> -->
<mat-form-field style="width: 100%" *ngIf="parent_ques.type == '4'">
<mat-label>{{parent_ques.question}}</mat-label>
<mat-select multiple [formControlName]="parent_ques.question_key"
(selectionChange)="onChangeProperty($event,parent_ques,'','','')">
<mat-option *ngFor="let val of parent_ques.answers"
[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.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<!-- <div *ngIf="parent_ques.type == '6'">
<ion-grid>
<ion-row>
<ion-col col-6 no-padding align-self: center text-center>
<div>
<img *ngIf="parent_ques.get('answer_value').value != ''" [src]="parent_ques.get('answer_value').value"
imageViewer class="doc-image-bucket"><br />
<label><strong>{{parent_ques.get('question').value}}</strong></label>
</div>
<ion-row style="justify-content: center">
<ion-col col-8>
<button ion-button clear color="optblue" [disabled]="sales_pd_type == '2'"
(click)="captureImg('',parent_ques)">
<ion-icon style="font-size: 30px" name="md-camera"></ion-icon>
</button>
</ion-col>
<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>
<ion-icon style="color: #008828;float: right;
margin-right: 30%;" *ngIf="parent_ques.get('is_saved').value == true" name="checkmark-circle-outline">
</ion-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>
<ion-icon style="color:lightcoral;" name="refresh-circle"></ion-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>
</ion-row>
</ion-col>
<hr />
</ion-row>
</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>
</div> -->
<mat-form-field style="width: 100%" *ngIf="parent_ques.type == '7'">
<mat-label>{{parent_ques.question}}</mat-label>
<textarea matInput type="text" rows="3" [formControlName]="parent_ques.question_key" 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.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<!-- <mat-form-field style="width: 100%" *ngIf="parent_ques.type == '8'">
<mat-label>{{parent_ques.get('question').value}}</mat-label>
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','','')">
<mat-option>
<ngx-mat-select-search formControlName="select_search" [placeholderLabel]="'Search'"
[noEntriesFoundLabel]="'No Matching Result'" (keyup)="searchFun(parent_ques,'')">
<ion-icon name="md-close" ngxMatSelectSearchClear></ion-icon>
</ngx-mat-select-search>
</mat-option>
<mat-option>--</mat-option>
<mat-option
*ngFor="let val of fileredSearchValue.length > 0 ? fileredSearchValue[''] : parent_ques.get('answers').value"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<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> -->
</section>

View File

@ -0,0 +1,34 @@
mat-radio-button,mat-checkbox{
margin-top: 13px;
}
mat-form-field {
width: 100%;
}
.radio-gap{
margin-top: 10px;
margin-bottom: 10px;
}
.radio-btn-gap{
margin:10px;
}
::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle{
border-color:rgb(212, 15, 15);
}
::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle{
color:rgb(212, 15, 15);
background-color:rgb(212, 15, 15);
}
::ng-deep .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
background-color:rgba(224, 22, 22, 0.308);
}
input{
// width: 100px;
// border-radius: 4px;
// border-color: gray;
// font-size: 12px;
height: 28px;
}

View File

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

View File

@ -0,0 +1,417 @@
import { Component, OnInit, Input } from '@angular/core';
import { FormGroup, FormArray, FormControl } from '@angular/forms';
import { QuesFormService } from '../ques-form/ques-form.service';
import { startWith, map } from 'rxjs/operators';
import { Observable } from 'rxjs';
@Component({
selector: 'app-dynamic-question-template',
templateUrl: './dynamic-question-template.component.html',
styleUrls: ['./dynamic-question-template.component.scss'],
})
export class DynamicQuestionTemplateComponent implements OnInit {
@Input() formGroupN : FormGroup;
@Input() currFormArrayObj;
parent_ques: any;
fileredSearchValue: any=[];
@Input() whole_json:any;
@Input() json_index:any;
@Input() whole_form:FormGroup;
@Input() json_answers:any;
local_city: any;
local_pincode: any;
autoCompleteAns:Observable<string[]>
constructor(private quesService:QuesFormService) { }
ngOnInit() {
if(this.parent_ques.type == '9' && this.parent_ques.answers && this.parent_ques.answers.length > 0) {
this.autoCompleteAns =this.formGroupN.get(this.parent_ques.question_key).valueChanges.pipe(
startWith(''),
map(value => this.autoCompleteFilter(value))
)
}
}
ngOnChanges() {
this.parent_ques = this.currFormArrayObj
console.log(this.parent_ques,this.formGroupN);
if(this.json_answers!=null && this.json_answers != undefined && this.json_answers) {
console.log("ddddddddddddddd",this.json_answers[this.parent_ques.question_key],this.parent_ques)
setTimeout(()=>{
this.formGroupN.get(this.parent_ques.question_key).patchValue((this.json_answers[this.parent_ques.question_key] || ''))
this.onChangeProperty({value:this.json_answers[this.parent_ques.question_key]},this.parent_ques,'')
})
// this.formGroupN.get(this.parent_ques.question_key).patchValue(this.json_answers[this.parent_ques.question_key])
// this.onChangeProperty({value:this.json_answers[this.parent_ques.question_key]},this.parent_ques,'')
setTimeout(()=>{
this.json_answers = null
},700)
}
}
autoCompleteFilter(value:string): string[] {
if(value) {
const filterValue = value.toLowerCase();
return this.parent_ques.answers.filter(option => option.answer.toLowerCase().indexOf(filterValue) === 0);
}
else {
return this.parent_ques.answers
}
}
onChange_checkbox(event,sec_control){
console.log(event,sec_control)
const control=this.formGroupN.get(sec_control.question_key) as FormArray
if(event.checked) {
control.push(new FormControl(event.source.value))
} else {
const i = control.controls.findIndex(x => x.value === event.source.value);
control.removeAt(i);
}
}
onChangeProperty(event,sec_control,question_key,options?,sec_index?){
this.fileredSearchValue=[]
if( sec_control.answers!= null && sec_control.answers.length > 0){
// this.creatSubField(sec_control,event.value)
}
//FOR API CALLS
// console.log(sec_control.value);
if(sec_control.onchange_properties != null && sec_control.onchange_properties.length >0){
let onChangeProperties_value=sec_control.onchange_properties
// let new_name=`{
// "purpose":"FORM_CTRL",
// "form_controls":[
// {
// "insert_index":"total_work_exp",
// "expression":"(total_work_exp > vintage_in_current_biz)",
// "value_keys":[
// "total_work_exp",
// "vintage_in_current_biz"],
// "questions":[
// {
// "question_key":"previous_experience_details2",
// "question":"Previous Experience2",
// "type":"1",
// "api_properties":null,
// "answers":null,
// "onchange_properties":null,
// "is_repeatable":null,
// "field_type":"string",
// "validations":[{
// "isactive": "1",
// "message": "Name Required",
// "name": "required",
// "validator": "Validators.required",
// "value": null
// }]
// }]
// },
// {
// "insert_index":"vintage_in_current_biz",
// "expression":"(total_work_exp > vintage_in_current_biz)",
// "value_keys":[
// "total_work_exp",
// "vintage_in_current_biz"],
// "questions":[{
// "question_key":"vintage1",
// "question":"Vintage check",
// "type":"1",
// "api_properties":null,
// "answers":null,
// "onchange_properties":null,
// "is_repeatable":null,
// "field_type":"string",
// "validations":[]
// }]
// }
// ]
// }`
// onChangeProperties_value.push(JSON.parse(new_name))
onChangeProperties_value.forEach(onChangeProperty=>{
console.log("api",onChangeProperty)
if(onChangeProperty.purpose == 'api'){
if(onChangeProperty.api == 'getListOfStatesAndCities'){
// console.log(event.value,onChangeProperty.params)
// onChangeProperty.params = JSON.stringify(onChangeProperty.params);
let updatedParams =JSON.stringify(onChangeProperty.params);
updatedParams = updatedParams.replace('value_of_answer',event.value);
// console.log(JSON.parse(updatedParams),updatedParams,JSON.parse(JSON.stringify(updatedParams)))
// debugger;
console.log("after",onChangeProperty)
this.quesService.apiCall(onChangeProperty.api,JSON.parse(updatedParams),onChangeProperty.api_method).subscribe(res=>{
if(res['dataStatus']){
this.local_city=res['records'].cities
this.local_pincode=res['records'].pincode
this.whole_json.forEach((val,index)=>{
if(val.api_properties == 'local_city'){
this.local_city=this.quesService.convertArrayNames(['city_id','city_name'],this.local_city)
val.answers = (this.local_city)
}
else if(val.api_properties == 'local_pincode'){
this.local_pincode=this.quesService.convertArrayNames(['pincode_id','pincode'],this.local_pincode)
val.answers = (this.local_pincode)
}
})
}
})
}
else{
this.quesService.apiCall(onChangeProperty.api,onChangeProperty.params,onChangeProperty.api_method).subscribe(result=>{
if(result['dataStatus']){
if(result.hasOwnProperty('records')){
result=result['records']
}
// let ques_control= this.quesAnsForm.controls.questions['controls']
// if(options == 2){
// ques_control=group_ques.controls.questions['controls']
// }
this.whole_json.forEach((val,index)=>{
if(val.api_properties == onChangeProperty.local_variable){
let values1=this.quesService.convertArrayNames(onChangeProperty.fields,result)
val.answers = (values1)
}
})
}
})
}
}
if(onChangeProperty.purpose == 'validations'){
// if(options == 2){
this.setValidations_onChange(onChangeProperty,this.formGroupN,sec_control,sec_index)
// }
// else{
// this.setValidations_onChange(onChangeProperty,this.quesAnsForm,sec_control,sec_index)
// }
}
if(onChangeProperty.purpose == 'FORM_CTRL'){
// if(options == 2){
console.log(sec_control)
// debugger;
this.creteNewField(onChangeProperty,this.formGroupN,sec_control,sec_index)
// }
// else{
// this.creteNewField(onChangeProperty,this.quesAnsForm,sec_control,sec_index)
// }
}
})
}
}
creteNewField(form_control_obj_raw,group_ques,sec_control,sec_index,purpose?){
console.log(group_ques,form_control_obj_raw,sec_index);
if(form_control_obj_raw.form_controls.length > 0){
form_control_obj_raw.form_controls.forEach(form_control_obj=>{
if(form_control_obj.value_keys != null && form_control_obj.value_keys.length > 0 ){
let expression_value=form_control_obj.expression
form_control_obj.value_keys.forEach(res=>{
let control_value_obj
if(purpose != 'edit'){
control_value_obj =group_ques.value[res]
}
else{
control_value_obj = sec_index.questions.filter(val=>val.question_key == res)[0]
}
if(control_value_obj){
// if(control_value_obj.answer_value == ''){
// control_value_obj.answer_value =0
// }
expression_value=expression_value.replace(res,control_value_obj)
}
})
console.log("Expression",expression_value)
let calc_exp=eval(expression_value)
console.log("Expression result",calc_exp)
if(calc_exp != false){
if(form_control_obj.questions.length > 0){
let question_index_after
this.whole_json.forEach((val,index,arr)=>{
if(val.question_key == form_control_obj.insert_index){
question_index_after= arr.indexOf(val)
}
})
console.log("after result",question_index_after,sec_index);
this.createControl(form_control_obj,group_ques,question_index_after,1) //FOR ADD CONTOL
}
}
else{
this.createControl(form_control_obj,group_ques,'',2) //FOR REMOVE CONTROL
}
}
})
}
}
createControl(form_control_obj,group_ques,question_index_after,options){
console.log(form_control_obj,group_ques,question_index_after)
let ques_control=this.whole_json
let inserted_control_obj=form_control_obj
inserted_control_obj.questions.sort()
inserted_control_obj.questions.reverse()
inserted_control_obj.questions.forEach(val=>{
if(options == 1){
let check_dup=ques_control.filter(control_key=>control_key.question_key == val.question_key)
console.log(check_dup,this.formGroupN);
// let check_dup = []
if(check_dup.length == 0){
val.raw_validations=val.validations
// ques_control.insert(question_index_after+1,this.questionService.createValue(val))
this.whole_json.splice(question_index_after+1,0,val);
this.formGroupN.addControl(val.question_key,new FormControl(''))
console.log("After adding control",this.whole_json,this.formGroupN,this.whole_form);
this.quesService.addAdditionalControl(val, this.formGroupN, question_index_after+1,"")
}
}
else{
ques_control.forEach((control_key,index)=>{
if(control_key.question_key == val.question_key){
this.whole_json.splice(index,1)
this.formGroupN.controls[val.question_key].reset()
this.formGroupN.removeControl(val.question_key);
}
})
}
})
}
setValidations_onChange(validation_obj_raw,group_ques,sec_control,sec_index){
if(validation_obj_raw.validations.length > 0){
validation_obj_raw.validations.forEach(validation_obj=>{
console.log("sing",validation_obj)
//FOR CHECKING THE EXPRESSION OR NORMAL VALIDATION
if(validation_obj.hasOwnProperty('value_keys')){
if( validation_obj.value_keys != null){
let expression_value=validation_obj.value
validation_obj.value_keys.forEach(res=>{
let validator_value_obj=this.formGroupN.value[res]
if(validator_value_obj){
expression_value=expression_value.replace(res,validator_value_obj)
}
})
// validation_obj.value=expression_value
validation_obj.validator=eval(expression_value)
if(validation_obj.validator == false){
validation_obj.isactive='0'
// // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS
this.proceedValidationSet(validation_obj,group_ques,sec_control,'')
}
else{
validation_obj.isactive='1'
let validator_single=this.quesService.setValueForValidator(validation_obj)
console.log(validator_single)
// // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS
this.proceedValidationSet(validation_obj,group_ques,sec_control,validator_single)
}
//END OF EXPRESSION CHECK
}
else{
// STARTING VALUE VALIDATION
let validator_value_obj
validator_value_obj=this.formGroupN.value[ validation_obj.value]
console.log(validator_value_obj)
validation_obj.validator=validator_value_obj
// let validator_single=this.questionService.setValueForValidator(validation_obj)
// console.log(validator_single)
// MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS
this.proceedValidationSet(validation_obj,group_ques,sec_control,'')
// END OF VALUE VALIDATION
}
//
// }
// else{
// }
}
})
}
}
proceedValidationSet(validation_obj,group_ques,sec_control,validator_single?){
let ques_control;
if(validation_obj.validation_to == null){
console.log("entered",group_ques,sec_control);
ques_control=this.whole_json[this.json_index]
// if(validation_obj.isactive == '1'){
// ques_control.controls.answer_value.setValidators(validator_single)
// ques_control.controls.answer_value.updateValueAndValidity()
// }
// else{
// ques_control.controls.answer_value.clearValidators()
// ques_control.controls.answer_value.updateValueAndValidity()
// }
// validation_obj.validator=validator_single
let new_validation_obj=this.updateValidationMsg(ques_control,validation_obj)
this.quesService.settingArrayofValidators({validations:new_validation_obj,question_key:sec_control.question_key},this.formGroupN,'')
}
else{
ques_control=this.whole_json
let other_control=ques_control.filter(val=>{
if(val.question_key == validation_obj.validation_to){
return val
}
})[0]
// let updateMsg=other_control.value.validations.filter(val=>val.name != validation_obj.name)
// updateMsg.push(validation_obj)
console.log("OTHER CONTROL",other_control)
// other_control.controls.answer_value.setValidators(validator_single)
// if(validation_obj.isactive == '1'){
// other_control.controls.answer_value.setValidators(validator_single)
// other_control.controls.answer_value.updateValueAndValidity()
// }
// else{
// other_control.controls.answer_value.clearValidators()
// other_control.controls.answer_value.updateValueAndValidity()
// }
// other_control.controls.validations.setValue(updateMsg);
// validation_obj.validator=validator_single
let new_validations_obj=this.updateValidationMsg(other_control,validation_obj)
console.log("new validations obj",new_validations_obj,other_control)
this.quesService.settingArrayofValidators({validations:new_validations_obj,question_key:validation_obj.validation_to},this.formGroupN,'')
}
}
updateValidationMsg(ques_control,validation_obj){
console.log("updae msg",ques_control,validation_obj);
let updateMsg=ques_control.validations.filter(val=>val.name != validation_obj.name)
updateMsg.push(validation_obj)
// ques_control.controls.validations.setValue(updateMsg);
ques_control.validations = updateMsg
return updateMsg;
}
}

View File

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

View File

@ -0,0 +1,379 @@
import { Injectable } from '@angular/core';
import { FormGroup, FormArray, FormBuilder, FormControl, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { environment } from 'environments/environment';
const apiUrl = environment.apiEndpoint
@Injectable({
providedIn: 'root'
})
export class QuesFormService {
constructor(private _fb:FormBuilder,private http:HttpClient) {
// this.apiUrl = constantProvider.environment().url
}
// FOR CREATING A FORM CONTROL DYNAMICALLY
assignFormControl_array(formgroup: FormGroup, ques_data: any) {
console.log(formgroup, ques_data)
const control: any = formgroup
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],
// "group_title": [val.group_title || null], "group_type": [val.group_type || null]
// ,"question_key":[val.question[0].question_key]
// }))
control.addControl(val.group_key, this._fb.array([]))
let childControl: any = control.get(val.group_key) 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
let control_names:any={}
ques_data[index].group_questions = []
ques_data[index].group_questions.push(val.question)
val.group_questions[0].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))
// childControl.addControl(group_indi.question_key,new FormControl(''))
control_names[group_indi.question_key] = ''
// childControl.push(this._fb.group({
// [group_indi.question_key] :['']
// }))
// setTimeout(()=>{
// this.addAdditionalControl(group_indi, childControl.at(arr_index), arr_index)
// },2000)
// 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)
group_indi.answers = (this.convertArrayNames(group_indi.api_properties.fields, res))
val.question[arr_index].answers = group_indi.answers
}
})
}
const question_temp:any = JSON.parse(JSON.stringify(val.question));
ques_data[index].question = question_temp
// else{
// setTimeout(()=>{
// sub_childControl.push(this.createValue(group_indi))
// },200)
// }
// sub_childControl.push(this.createValue(group_indi))
})
console.log(control_names);
// val.questions[0]=val.question;
childControl.push(this._fb.group(control_names))
console.log(formgroup.value);
// debugger;
val.group_questions[0].forEach((group_indi,arr_index)=>{
console.log("sd",childControl)
this.addAdditionalControl(group_indi, childControl.controls[0], arr_index)
})
// }
// 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))
formgroup.addControl(val.question_key,new FormControl(''))
// for checkbox remove the form control and add the formarray for multiple values
this.addAdditionalControl(val, formgroup, 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)
val.answers = 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)
}
}, err => console.log(err))
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],
"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'){
this.apiCall(val.api_properties.api,val.api_properties.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)
}
})
}
apiCall(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)
}
}
// 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 => {
return {
"answer_id" : obj[fieldName[0]],
"answer":obj[fieldName[1]],
}
});
return modified_json
}
// END OF CONVERTARRAYNAMES FUN--
addAdditionalControl(data,curr_control,curr_index,purpose?){
console.log(curr_control);
//FOR CHECKBOX CHANGE THE VALUE STORAGE AS ARRAY
if(data.type == '5'){
// curr_control.controls[curr_index].removeControl('answer_value');
// curr_control.controls[curr_index].addControl('answer_value',this._fb.array([]))
curr_control.removeControl(data.question_key)
curr_control.addControl(data.question_key,this._fb.array([]))
}
//FOR numeric of string field
if(data.type == '1'){
// 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))
curr_control.addControl(data.question_key+'_searchControl',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))
}
//FOR SETTING THE VALIDATORS
this.settingArrayofValidators(data,curr_control,curr_index)
}
// FOR SETTING THE ARRAY OF VALIDATORS COMING FROM JSON Temp,
settingArrayofValidators(data,curr_control,curr_index){
console.log("entered",data);
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",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(validList)
// curr_control.controls[curr_index].controls.answer_value.setValidators(validList)
curr_control.controls[data.question_key].setValidators(validList)
console.log("ddvdeeqq",validList)
curr_control.controls[data.question_key].updateValueAndValidity()
console.log("after setting validators",curr_control.controls[data.question_key])
// debugger;
}
}
// 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 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
}
}
// END OF SETVALUEFORVALIDATOR FUN
}

View File

@ -234,6 +234,9 @@ export class FinalRemarksComponent implements OnInit {
recommendationPositiveCtrl.push(this.CreateRecommendationPositive(objs));
});
}
else {
this.addRecommendationPositive()
}
if (data.records.recommendation_refer_to_credit.length > 0) {
let recommendationReferToCredit: any = this._finalRemarkForm.get('recommendation_refer_to_credit') as FormArray;
data.records.recommendation_refer_to_credit.forEach((val, index) => {
@ -241,6 +244,9 @@ export class FinalRemarksComponent implements OnInit {
recommendationReferToCredit.push(this.CreateRecommendationReferToCredit(objs));
});
}
else {
this.addRecommendationReferToCredit()
}
if (data.records.recommendation_negative.length > 0) {
let recommendationNegativeCtrl: any = this._finalRemarkForm.get('recommendation_negative') as FormArray;
data.records.recommendation_negative.forEach((val, index) => {
@ -248,6 +254,9 @@ export class FinalRemarksComponent implements OnInit {
recommendationNegativeCtrl.push(this.CreateRecommendationNegative(objs));
});
}
else {
this.addRecommendationNegative()
}
this._finalRemarkForm.controls.is_service_provided.setValue(data.records.is_service_provided);

View File

@ -70,7 +70,6 @@
<mat-card style="margin-left: 15px;">
<mat-card-content formArrayName="docs_to_be_sighted">
<div *ngFor="let item of docsCollectedForm.controls.docs_to_be_sighted['controls'];let i=index" [formGroupName]="i">
<div fxLayout="row wrap">
<div fxFlex="60">
<div >
@ -87,6 +86,7 @@
<!-- <button style="color:#E00201" *ngIf="camera_btn[i] == true" ion-button slot="end" clear small float-right (click)="capture(i,item)"><ion-icon style="font-size:30px;float:right;" name="md-camera"></ion-icon></button> -->
<!-- </ion-buttons> -->
<!-- </div> -->
<div *ngIf="item.controls['img'] && item.value.img != ''">
<img [src]="item.value.img" style="width:85px; height: 85px;float:right" ngxViewer>
</div>
@ -106,6 +106,16 @@
</mat-card>
</mat-card>
</div>
<mat-card *ngIf="questions_JSON.questions.length > 0">
<mat-card-header>
<mat-card-title>
<h5>{{questions_JSON.section_name}}</h5>
</mat-card-title>
</mat-card-header>
<mat-card-content>
<app-dynamic-form [questions_JSON]="questions_JSON" [form_group_name] = "covid19QuesForm" [json_answers]="covidAnswers"></app-dynamic-form>
</mat-card-content>
</mat-card>
</ng-template>
</mat-tab>
<mat-tab label="Docs">

View File

@ -33,6 +33,25 @@ export class QueriesDocsComponent implements OnInit {
fk_pd_type: any;
image_doc_params: { pdid: string; form_id: number; company_id: string; };
covid19QuesForm:FormGroup;
// temlateQues:any
// `{
// "form_name":"Personal Discussion Sheet - Working Capital Term Loan (For Sales Team)",
// "sections":[
// `
questions_JSON: any = {questions:[]};
covidAnswers :any = null;
// = {
// "business_impacted_by_covid19": "No",
// "avail_loan_moratorium_facility": "Yes",
// "avail_any_loan": "Yes",
// "sales_or_revenue_amt": "233",
// "mentioned_turover_validated": "Yes",
// "business_impacted_by_covid19_No": "Business falls under essential services like chemist",
// "avail_any_loan_Yes": "df",
// "mentioned_turover_validated_Yes": "records shown"
// }
constructor(notifier: NotifierService,
private _ngZone: NgZone,
private fb: FormBuilder,
@ -71,6 +90,7 @@ export class QueriesDocsComponent implements OnInit {
addtional_requirements:this.fb.array([this.createview()])
})
this.getFullPD();
this.getCovidQuesTemplate()
}
createview(){
@ -78,7 +98,25 @@ export class QueriesDocsComponent implements OnInit {
name:['']
})
}
getCovidQuesTemplate() {
// this.qustCat.covid19Ques().subscribe(res=>{
let covidQuesTemplate: any = localStorage.getItem('dynamicQuesTemplate')
if (covidQuesTemplate && covidQuesTemplate != null && covidQuesTemplate != undefined
) {
covidQuesTemplate = JSON.parse(covidQuesTemplate)
if (covidQuesTemplate.hasOwnProperty('template') && covidQuesTemplate.template) {
covidQuesTemplate =JSON.parse(covidQuesTemplate.template);
this.covid19QuesForm = new FormGroup({})
this.questions_JSON = covidQuesTemplate;
console.log(this.questions_JSON);
setTimeout(() => {
this.covidAnswers = null
console.log("cleared")
}, 2000)
}
}
// })
}
getFullPD(){
// let records = {'parent_pdid': this.pdDetails.parent_pd_id,'pdid':this.pdDetails.pd_id,'random_string':this.pdDetails.random_string};
@ -152,14 +190,58 @@ export class QueriesDocsComponent implements OnInit {
// this.docs_change_fun(index,data)
})
}
if(retrieved_data.hasOwnProperty('covid_section') && retrieved_data.covid_section) {
this.covidAnswers = retrieved_data.covid_section
}
// console.log("form123",this.docsCollectedForm.value);
this.docsCollectedForm.patchValue(retrieved_data)
}
if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') {
console.log(this.pd_all_details.pdmaster_details.vendor_status);
setTimeout(()=>{
this.getDataFromVendor()
},1000)
}
},err=>{
})
}
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this.pdTriggerService.getVendorDatas('queries_form',this.pdid).subscribe(result=>{
if(result && result['dataStatus']) {
if(result.records.hasOwnProperty('docs_to_be_sighted') && result.records.docs_to_be_sighted.length > 0) {
result.records.docs_to_be_sighted.forEach((doc_value,index)=>{
console.log(doc_value)
if(doc_value.hasOwnProperty('img') && doc_value.img && doc_value.img != '') {
this.docs_change_fun(index,'yes')
}
else if(doc_value.hasOwnProperty('reason') && doc_value.reason && doc_value.reason != '') {
this.docs_change_fun(index,'no');
}
// let data=doc_value.control_name
// data=parseInt(data)
// console.log("data",data);
// data=doc_value.data
// this.docs_change_fun(index,data)
})
this.docsCollectedForm.patchValue(result.records);
}
// let curr_control: any = <FormArray>ParCtrls.controls[0];
// result.records.business_address_availability ='yes'
// console.log(this._generalForm.value)
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/
initControls(){
if(this.queries_docs.length != 0){
this.queries_docs.forEach(res=>{
@ -207,6 +289,40 @@ export class QueriesDocsComponent implements OnInit {
// console.log("Error",err)
// })
// }
/**
* Marks all controls in a form group as touched
* @param formGroup - The form group to touch
*/
private markFormGroupTouched(formGroup: FormGroup) {
(<any>Object).values(formGroup.controls).forEach(control => {
control.markAsTouched();
if (control.controls) {
this.markFormGroupTouched(control);
}
});
}
public findInvalidControls() {
const controls = this.covid19QuesForm.controls;
console.log(controls)
for (const name in controls) {
if (controls[name].invalid) {
let invalidFields = [].slice.call(document.getElementsByClassName('ng-invalid'));
let firstInvalidField;
for(let val in invalidFields){
if( invalidFields[val].nodeName == 'MAT-FORM-FIELD'){ //INPUT FOR INPUT FIELD
firstInvalidField=invalidFields[val]
break;
}
}
if(firstInvalidField != undefined){
firstInvalidField.scrollIntoView(true)
}
break;
}
}
// return invalid;
}
saveForm(){
// console.log(this.docsCollectedForm.value);
// this.docsCollectedForm.value.docs_to_be_sighted.forEach(value=>{
@ -218,11 +334,34 @@ export class QueriesDocsComponent implements OnInit {
// }
// })
if(this.docsCollectedForm.invalid){
if(this.docsCollectedForm.invalid && (this.queries_docs.length > 0 || this.docs_array_value.length > 0)){
this.notifier.notify("warning","Please Fill all the Fields and capture the image if required");
return
}
}
if(this.questions_JSON.questions.length > 0) {
console.log(this.covid19QuesForm.getRawValue(),this.covid19QuesForm.valid,JSON.stringify(this.covid19QuesForm.getRawValue()),this.questions_JSON.questions);
if(this.covid19QuesForm.invalid) {
this.covid19QuesForm.markAsDirty()
this.markFormGroupTouched(this.covid19QuesForm)
this.findInvalidControls()
this.notifier.notify("warning","Please Fill all the required Fields");
// console.log(geneatedQues)
// let group_ques = this.questions_JSON.question.filter(val=>val.is_repeatable == '1')
// if(group_ques.length >0 && group_ques.hasOwnProperty('question') && group_ques.question) {
// group_ques=group_ques.question.map(vv=>{
// return {question_key:vv.question_key,question:vv.question,is_repeatable:'0'}
// })
// }
return;
}
}
let formParams:any;
this.disableAfterSubmit=true
this.docsCollectedForm.value.addtional_requirements[0].hasOwnProperty('name') ? delete this.docsCollectedForm.value.addtional_requirements[0].name : ''
if((this.queries_docs.length > 0 || this.docs_array_value.length > 0)) {
formParams = this.docsCollectedForm.value
formParams.addtional_requirements[0].hasOwnProperty('name') ? delete formParams.addtional_requirements[0].name : ''
// console.log(JSON.stringify(this.docsCollectedForm.value));
// this.constantProvider.getGeoTag().then(geoCoords=>{
// if(this.docsCollectedForm.value.link == ""){
@ -237,8 +376,19 @@ export class QueriesDocsComponent implements OnInit {
}, error => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
});
}
this.pdTriggerService.saveForm(this.docsCollectedForm.value).subscribe(res=>{
if(this.questions_JSON.questions.length > 0) {
let geneatedQues = this.questions_JSON.questions.filter(val=>val.is_repeatable != '1').map(vv=>{
return {question_key:vv.question_key,question:vv.question,is_repeatable:'0',type:vv.type}
})
let covidFormAnswers = this.covid19QuesForm.getRawValue()
covidFormAnswers.question_info = geneatedQues
formParams.covid_section = covidFormAnswers
}
console.log(formParams);
this.pdTriggerService.saveForm(formParams).subscribe(res=>{
if(res['dataStatus']){
this.notifier.notify("success","Record Saved Successfully..")
setTimeout(()=>{
@ -265,7 +415,7 @@ export class QueriesDocsComponent implements OnInit {
if(value == 'yes'){
// this.camera_btn[index]=true
control.controls[index].removeControl('reason')
// control.controls[index].addControl('img',new FormControl('',Validators.required))
control.controls[index].addControl('img',new FormControl('',Validators.required))
// control.controls[index].addControl('is_new',new FormControl('',Validators.required))
}
else if(value == 'no'){

View File

@ -89,7 +89,21 @@ export class StartPdComponent implements OnInit, OnDestroy {
// Ps.initialize(elemContent, { wheelSpeed: 2, suppressScrollX: true });
}
this.loadTemplates(this.startPD,1,this.randomString);
this.getCreditPDTemplate();
}
getCreditPDTemplate() {
// let params = { "fk_entity_id":this.pddetails.fk_lender_id,"fk_product_id":this.pddetails.fk_product_id,"pd_form_id":this.pddetails.pd_id }
let params = { "fk_entity_id":"","fk_product_id":"","pd_form_id":"24" }
this._pd.loadCreditPDTemplate(params).subscribe(result=> {
let creditTemplate:any = null;
if(result['dataStatus']) {
if(result.hasOwnProperty('records') && result['records']) {
creditTemplate = result['records'];
}
}
localStorage.setItem("dynamicQuesTemplate",JSON.stringify(creditTemplate));
})
}
isMac(): boolean {
let bool = false;

View File

@ -179,7 +179,7 @@
<strong> {{master.pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Addon Pending' : master.pd_status | titlecase}}</strong>
</button>
<span *ngIf="userRoleID == 10 || userRoleID == 3"><button *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdMaster(master)" matTooltipPosition="above" matTooltip="Edit PD Master"><mat-icon>edit</mat-icon></button>
<span *ngIf="userRoleID == 10 || userRoleID == 3"><button *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED || currentPDStatus==pdStatusCheck.ALLOCATED_TO_PARTNER" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdMaster(master)" matTooltipPosition="above" matTooltip="Edit PD Master"><mat-icon>edit</mat-icon></button>
<button *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Trigger" matTooltipPosition="above" (click)="directTriggerPD(mandatoryFieldsValidations,master)"><mat-icon>flash_on</mat-icon></button>
</span>
<span *ngIf="userRoleID != 4 || userRoleID != 8 || userRoleID != 9"><button *ngIf="roleAccessDetails.reports && master.pd_type_name && currentPDStatus==pdStatusCheck.QC_COMPLETED" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above" (click)="getPDIDReport(viewID)"><mat-icon>ballot</mat-icon></button></span>
@ -211,7 +211,7 @@
<span><button *ngIf="roleAccessDetails.trigger && addresses.assigned_pd==null || addresses.assigned_pd==''" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" [matTooltip]="master.fk_primary_address_id ? 'Initiate PD for this address' : 'Initiate Address for PD Process'" matTooltipPosition="above" (click)="initiateAddtionalPD(master,addresses,master.fk_primary_address_id ? true : false)"><mat-icon>where_to_vote</mat-icon></button></span>
<span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 10"><button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.COMPLETED && master.pd_status!=pdStatusCheck.ADD_ON_PENDING && currentPDStatus!=pdStatusCheck.QC_COMPLETED" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="above" (click)="pdAllocationTo(master,addresses)"><mat-icon>verified_user</mat-icon></button></span>
<span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.schedule && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.COMPLETED && master.pd_status!=pdStatusCheck.ADD_ON_PENDING && currentPDStatus!=pdStatusCheck.QC_COMPLETED" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Schedule" matTooltipPosition="above" (click)="scheduleDetails(master,addresses)"><mat-icon>schedule</mat-icon></button></span>
<span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.TRIGGERED && enableStartPD" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion" matTooltipPosition="above" (click)="getPDStart(addresses,master.pd_status)"><mat-icon>question_answer</mat-icon></button></span>
<span *ngIf="userRoleID == 2 || userRoleID == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && master.pd_type_name && currentPDStatus!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.TRIGGERED && currentPDStatus!=pdStatusCheck.ALLOCATED_TO_PARTNER && enableStartPD" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion" matTooltipPosition="above" (click)="getPDStart(addresses,master.pd_status)"><mat-icon>question_answer</mat-icon></button></span>
</div>
</div>
</div>
@ -348,7 +348,7 @@
<div fxFlex="70" align="left" style="padding: 10px !important;">
<mat-card-title>Applicants</mat-card-title>
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED">
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED || currentPDStatus==pdStatusCheck.ALLOCATED_TO_PARTNER">
<span *ngIf="userRoleID == 10 || userRoleID == 3"><button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData,CustomerSegmentAbbr)"><mat-icon>edit</mat-icon></button></span>
</div>
</mat-card-header>
@ -398,7 +398,7 @@
<div fxFlex="70" align="left" style="padding: 10px !important;">
<mat-card-title>Credit Managers Specific Queries</mat-card-title>
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED">
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED || currentPDStatus==pdStatusCheck.ALLOCATED_TO_PARTNER">
<span *ngIf="userRoleID == 10 || userRoleID == 3"><button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editAdditionalRequirement(pdAdditionalReqData)"><mat-icon>edit</mat-icon></button></span>
</div>
</mat-card-header>
@ -421,7 +421,7 @@
<div fxFlex="70" align="left" style="padding: 10px !important;">
<mat-card-title>Documents to be collected</mat-card-title>
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED">
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="roleAccessDetails.trigger && currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED || currentPDStatus==pdStatusCheck.ALLOCATED_TO_PARTNER">
<span *ngIf="userRoleID == 10 || userRoleID == 3"><button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editCollectedDocument(pdCollectedDocument)"><mat-icon>edit</mat-icon></button></span>
</div>
</mat-card-header>

View File

@ -90,6 +90,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
"COMPLETED": 'COMPLETED',
"ADD_ON_PENDING": 'ADD_ON_PENDING',
"QC_COMPLETED": 'QC_COMPLETED',
"ALLOCATED_TO_PARTNER":'ALLOCATED_TO_PARTNER'
};
mandatoryFieldsValidations: any = [];
@ -163,7 +164,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
if (data.status == 200) {
let masterData: any = data.records.pd_master_details;
this.pdMasterData.push(masterData[0]);
if(this.pdMasterData[0].pd_status == 'COMPLETED') {
if((this.pdMasterData[0].fk_pd_type == '3' || this.pdMasterData[0].fk_pd_type == '2') && (this.pdMasterData[0].pd_status == 'COMPLETED' || this.pdMasterData[0].pd_status == 'QC_COMPLETED')) {
this.getVideoUrl(this.viewID,this.masterRandomString)
this.videoplayback.enableBtn = true;
}

View File

@ -133,6 +133,9 @@ import { ImageDocsComponent } from './list-pd/start-pd/forms/image-docs/image-do
import { environment } from 'environments/environment'
import { CustomTitleCaseDirective } from '../pd-directive/custom-title-case.directive';
import { SpeedDialFabComponent } from './list-pd/view-pd/speed-dial-fab/speed-dial-fab.component';
import { DynamicFormComponent } from './list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component';
import { DynamicQuestionTemplateComponent } from './list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component';
import { QuesFormService } from './list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service';
/**
* Custom angular notifier options
@ -179,7 +182,8 @@ const pdCustomNotifierOptions: NotifierOptions = {
};
@NgModule({
declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent,VendorPdAllocationComponent, DuplicatePdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, 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,PurchaseCalculationComponent,QueriesDocsComponent, ImageDocsComponent,CustomTitleCaseDirective, SpeedDialFabComponent],
declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent,VendorPdAllocationComponent, DuplicatePdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, 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,PurchaseCalculationComponent,QueriesDocsComponent, ImageDocsComponent,CustomTitleCaseDirective, SpeedDialFabComponent,
DynamicFormComponent,DynamicQuestionTemplateComponent],
imports: [
CommonModule,
ManagePdRoutingModule,
@ -218,10 +222,11 @@ const pdCustomNotifierOptions: NotifierOptions = {
exports: [DuplicatePdComponent,VendorPdAllocationComponent,PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, 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,PurchaseCalculationComponent],
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],
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective,QuesFormService],
entryComponents: [DuplicatePdComponent,VendorPdAllocationComponent,PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,BusinessAssetsInfoComponent,
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent,PdCollectedDocsComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,FuturePlansAndBusinessEnvironmentComponent,ImageCropComponent,QueriesDocsComponent],
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent,PdCollectedDocsComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,FuturePlansAndBusinessEnvironmentComponent,ImageCropComponent,QueriesDocsComponent,
DynamicFormComponent,DynamicQuestionTemplateComponent],
})
export class ManagePdModule {
}

View File

@ -368,6 +368,7 @@ export class PdTrigerService {
catchError(this.handleError('operation', []))
)
}
// load PD question answers
getAnswersForPD(list: any): Observable<any> {
@ -945,7 +946,8 @@ export class PdTrigerService {
getVendorDatas(form_name,pd_id?) {
let formsDet = [{form_name:"general",form_id:"18"},{form_name:"address",form_id:"5"},{form_name:"business_info",form_id:"13"},
{form_name:"business_assets",form_id:"22"},{form_name:"neighbourhood_details",form_id:"19"},
{form_name:"final_remarks",form_id:"20"}
{form_name:"final_remarks",form_id:"20"},
{form_name:"queries_form",form_id:"24"}
]
// let records = {"records":data[form_name]}
@ -957,4 +959,21 @@ export class PdTrigerService {
getVendorAnswers(params):Observable<any> {
return this._http.post(this.apiUrl+'getVendorAnswers',params)
}
covid19Ques() {
return this._http.get('../../../assets/sample_covid19_ques.json')
}
loadCreditPDTemplate(params) {
return this._http.post(this.apiUrl+'loadCreditPDTemplate', params)
// dummy data
// return this._http.get('../../../assets/sample_covid19_ques.json').map(result=>{
// console.log(result)
// let apivalue ={dataStatus:true,records:{template:JSON.stringify(result)}}
// console.log(apivalue)
// return apivalue
// })
}
}

View File

@ -0,0 +1,319 @@
{
"section_id":"1",
"section_name":"Covid 19 Questions",
"onsubmit":null,
"questions":[
{
"question":" Is your business adversely impacted by coronavirus outbreak ?",
"question_key":"business_impacted_by_covid19",
"type":"2",
"field_width":"100",
"answers":[
{
"answer_id":"Yes",
"answer":"Yes"
},
{
"answer_id":"No",
"answer":"No"
}
],
"api_properties":null,
"onchange_properties":[
{
"purpose":"FORM_CTRL",
"form_controls":[
{
"insert_index":"business_impacted_by_covid19",
"expression":"(String('business_impacted_by_covid19') == String('Yes'))",
"value_keys":[
"business_impacted_by_covid19"
],
"questions":[
{
"question":"Choose any",
"question_key":"business_impacted_by_covid19_Yes",
"place_holder":"",
"field_type":"string",
"type":"9",
"field_width":"100",
"api_properties":null,
"onchange_properties":null,
"is_repeatable":null,
"answers":[
{
"answer_id":"Employees/labour not available",
"answer":"Employees/labour not available"
},
{
"answer_id":"business closed during lockdown",
"answer":"business closed during lockdown"
},
{
"answer_id":"sales reduced due to lockdown",
"answer":"sales reduced due to lockdown"
},
{
"answer_id":"sales not picking up post lock down etc",
"answer":"sales not picking up post lock down etc"
}
],
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field required",
"value":null
}
]
}
]
}
]
},
{
"purpose":"FORM_CTRL",
"form_controls":[
{
"insert_index":"business_impacted_by_covid19",
"expression":"(String('business_impacted_by_covid19') == String('No'))",
"value_keys":[
"business_impacted_by_covid19"
],
"questions":[
{
"question":"Choose any",
"question_key":"business_impacted_by_covid19_No",
"place_holder":"",
"field_type":"string",
"type":"9",
"field_width":"100",
"api_properties":null,
"onchange_properties":null,
"is_repeatable":null,
"answers":[
{
"answer_id":"Business falls under essential services like chemist",
"answer":"Business falls under essential services like chemist"
},
{
"answer_id":" grocery store etc",
"answer":"grocery store etc"
}
],
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field required",
"value":null
}
]
}
]
}
]
}
],
"is_repeatable":null,
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field Required",
"value":null
}
]
},
{
"question":" Did you avail the loan moratorium facility on your existing loans which is extended by your bank or financial institution? ",
"question_key":"avail_loan_moratorium_facility",
"type":"2",
"field_width":"100",
"onchange_properties":[],
"api_properties":null,
"answers":[
{
"answer":"Yes",
"answer_id":"Yes"
},
{
"answer":"No",
"answer_id":"No"
}
],
"is_repeatable":null,
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field Required",
"value":null
}
]
},
{
"question":"Are you planning to avail/ or already availed any loan or any other term facility for your business or personal use?",
"question_key":"avail_any_loan",
"type":"2",
"field_width":"100",
"api_properties":null,
"answers":[
{
"answer":"Yes",
"answer_id":"Yes"
},
{
"answer":"No",
"answer_id":"No"
}
],
"onchange_properties":[
{
"purpose":"FORM_CTRL",
"form_controls":[
{
"insert_index":"avail_any_loan",
"expression":"(String('avail_any_loan') == String('Yes'))",
"value_keys":[
"avail_any_loan"
],
"questions":[
{
"question":"Please specify amount, lender etc.",
"question_key":"avail_any_loan_Yes",
"type":"7",
"field_width":"100",
"api_properties":null,
"onchange_properties":null,
"is_repeatable":null,
"answers":[],
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field Required",
"value":null
}
]
}
]
}
]
}],
"is_repeatable":null,
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field Required",
"value":null
}
]
},
{
"question":"How much is your sales/revenue from April till date?",
"question_key":"sales_or_revenue_amt",
"place_holder":"Enter amount",
"type":"1",
"field_width":"100",
"answers":null,
"api_properties":null,
"is_repeatable":null,
"field_type":"numtoword",
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field Required",
"value":null
}
]
},
{
"question":"Is turnover mentioned above validated?",
"question_key":"mentioned_turover_validated",
"type":"2",
"field_width":"100",
"api_properties":null,
"answers":[
{
"answer":"Yes",
"answer_id":"Yes"
},
{
"answer":"No",
"answer_id":"No"
}
],
"onchange_properties":[
{
"purpose":"FORM_CTRL",
"form_controls":[
{
"insert_index":"mentioned_turover_validated",
"expression":"(String('mentioned_turover_validated') == String('Yes'))",
"value_keys":[
"mentioned_turover_validated"
],
"questions":[
{
"question":"Choose any",
"question_key":"mentioned_turover_validated_Yes",
"place_holder":"",
"field_type":"string",
"type":"9",
"field_width":"100",
"api_properties":null,
"onchange_properties":null,
"is_repeatable":null,
"answers":[
{
"answer_id":"Bills",
"answer":"Bills"
},
{
"answer_id":"Gst returns",
"answer":"Gst returns"
},
{
"answer_id":"records shown",
"answer":"records shown"
}
],
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field required",
"value":null
}
]
}
]
}
]
}
],
"is_repeatable":null,
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Field Required",
"value":null
}
]
}
]
}