Fairoj : discussion enabled and template and forms enabled
This commit is contained in:
parent
5027ffa334
commit
532cc20c7d
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
@ -25,7 +25,7 @@
|
||||
<br/>
|
||||
</div>
|
||||
<!-- [ngStyle]="{'background':lenderShortName == 'MWISE' ? 'gray' : ''}" -->
|
||||
<mat-card >
|
||||
<mat-card *ngIf="(lenderShortName =='MWISE' && excel_file_id != null) || lenderShortName !='MWISE'">
|
||||
<mat-card-header>
|
||||
<mat-card-title> PD Details </mat-card-title>
|
||||
</mat-card-header>
|
||||
@ -169,7 +169,7 @@
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card *ngIf="(lenderShortName =='MWISE' && excel_file_id != null) || lenderShortName !='MWISE'">
|
||||
<mat-card-header>
|
||||
<mat-card-title>Address Details</mat-card-title>
|
||||
</mat-card-header>
|
||||
@ -243,7 +243,7 @@
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
<mat-card>
|
||||
<mat-card *ngIf="(lenderShortName =='MWISE' && excel_file_id != null) || lenderShortName !='MWISE'">
|
||||
<mat-card-header>
|
||||
<mat-card-title>Applicant Details</mat-card-title>
|
||||
</mat-card-header>
|
||||
|
||||
@ -1120,7 +1120,7 @@ searchFun(control:any,i:number,option){
|
||||
}
|
||||
openExcelUploadModal() {
|
||||
const dialogRef = this.matDialog.open(ExcelUploadDialogComponent,{
|
||||
minWidth:'30vw',
|
||||
minWidth:'50vw',
|
||||
maxWidth:'75vw'
|
||||
})
|
||||
dialogRef.afterClosed().subscribe(result=>{
|
||||
|
||||
@ -2,8 +2,12 @@ input[type="file"] {
|
||||
display: none;
|
||||
}
|
||||
.custom-file-upload {
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid red;
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.custom-file-upload :hover{
|
||||
background-color: rgba(255, 0, 0, 0.317);
|
||||
color: rgba(255, 0, 0, 0.317);
|
||||
}
|
||||
@ -68,8 +68,20 @@ export class AllPdComponent implements OnInit, OnChanges {
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@ -68,8 +68,20 @@ export class CompletedPdComponent implements OnInit, OnChanges {
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@ -65,8 +65,20 @@ export class InprogressPdComponent implements OnInit, OnChanges {
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@ -60,6 +60,7 @@ export class PdStatusChangeDialogueComponent implements OnInit {
|
||||
changePDStatus(status: string): void {
|
||||
let update_status = {
|
||||
"pd_id":this.data.pdid,
|
||||
"random_string":this.data.random_string
|
||||
};
|
||||
this.pd.editPdMasterDetails(update_status, status).subscribe(result => {
|
||||
if (result.status == 200) {
|
||||
|
||||
@ -67,8 +67,20 @@ export class QcCompletedPdComponent implements OnInit, OnChanges {
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@ -66,8 +66,20 @@ export class ScheduledPdComponent implements OnInit, OnChanges {
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
if(this.common) {
|
||||
this.common =this.common.default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
}
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@ -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>
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
@ -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' || parent_ques.field_type == 'str&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' || parent_ques.field_type == 'str&numtoword')"
|
||||
align="end" style="font-size: 12px;">{{"₹"}} {{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'" [ngStyle]="{'margin-bottom':parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&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' || parent_ques.field_type == 'str&numtoword' ? '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" (optionSelected) = "onChangeProperty($event,parent_ques,parent_ques.question_key)">
|
||||
<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' || parent_ques.field_type == 'str&numtoword')"
|
||||
align="end" style="font-size: 12px;">{{"₹"}} {{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.question}}</mat-label>
|
||||
<mat-select [formControlName]="parent_ques.question_key" (selectionChange)="onChangeProperty($event,parent_ques,'','','')">
|
||||
<mat-option>
|
||||
<ngx-mat-select-search [formControl]="commonFilterCtrl" [placeholderLabel]="'Search'"
|
||||
[noEntriesFoundLabel]="'No Matching Result'" >
|
||||
<mat-icon ngxMatSelectSearchClear>close</mat-icon>
|
||||
</ngx-mat-select-search>
|
||||
</mat-option>
|
||||
<mat-option>--</mat-option>
|
||||
|
||||
<mat-option
|
||||
*ngFor="let val of ngxFilteredValue | async"
|
||||
[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>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,465 @@
|
||||
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, ReplaySubject } 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[]>
|
||||
public commonFilterCtrl:FormControl = new FormControl();
|
||||
public ngxFilteredValue:ReplaySubject<any> = new ReplaySubject<any>(1);
|
||||
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))
|
||||
)
|
||||
}
|
||||
if(this.parent_ques.type == '8') {
|
||||
console.log("Initial",this.parent_ques.answers)
|
||||
if(this.parent_ques.answers && this.parent_ques.answers.length > 0){
|
||||
this.ngxFilteredValue.next(this.parent_ques.answers.slice())
|
||||
this.filterList()
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{
|
||||
console.log("last",this.parent_ques.answers)
|
||||
if(this.parent_ques.answers && this.parent_ques.answers.length > 0){
|
||||
this.ngxFilteredValue.next(this.parent_ques.answers.slice())
|
||||
this.filterList()
|
||||
}
|
||||
},1600)
|
||||
}
|
||||
this.filterList()
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
filterList() {
|
||||
this.commonFilterCtrl.valueChanges.pipe().subscribe(()=>{
|
||||
console.log("valuechanges",this.parent_ques)
|
||||
if(this.parent_ques.type == '8' && this.parent_ques.answers && this.parent_ques.answers.length > 0) {
|
||||
this.applyFilter(this.commonFilterCtrl.value,this.ngxFilteredValue,this.parent_ques.answers,'answer')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
applyFilter(filtered_text,filter_list,raw_list,obj_name) {
|
||||
if (!raw_list) {
|
||||
return;
|
||||
}
|
||||
// get the search keyword
|
||||
let search = filtered_text;
|
||||
if (!search) {
|
||||
filter_list.next(raw_list.slice());
|
||||
return;
|
||||
} else {
|
||||
search = search.toLowerCase();
|
||||
}
|
||||
// filter the banks
|
||||
filter_list.next(
|
||||
raw_list.filter(bank => bank[obj_name].toLowerCase().indexOf(search) > -1)
|
||||
);
|
||||
}
|
||||
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?){
|
||||
console.log(sec_control);
|
||||
// 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);
|
||||
// // updatedParams = JSON.parse(updatedParams)
|
||||
// console.log(JSON.parse(updatedParams),updatedParams,JSON.parse(JSON.stringify(updatedParams)))
|
||||
// debugger;
|
||||
let params={records:{state_id:event.value}}
|
||||
console.log("after",onChangeProperty)
|
||||
this.quesService.apiCall(onChangeProperty.api,params,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;
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,395 @@
|
||||
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 {
|
||||
|
||||
pd_all_details:any= {}
|
||||
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) {
|
||||
if(group_indi.api_properties.hasOwnProperty('purpose') && group_indi.api_properties.purpose == 'answer_options_local') {
|
||||
if(group_indi.api_properties.master_name == 'pd_applicants') {
|
||||
group_indi.answers = (this.convertArrayNames( group_indi.api_properties.fields,this.pd_all_details.pdapplicants_detials))
|
||||
val.question[arr_index].answers = group_indi.answers
|
||||
}
|
||||
}
|
||||
else{
|
||||
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) {
|
||||
if(val.api_properties.hasOwnProperty('purpose') && val.api_properties.purpose == 'answer_options_local') {
|
||||
if(val.api_properties.master_name == 'pd_applicants') {
|
||||
val.answers = (this.convertArrayNames( val.api_properties.fields,this.pd_all_details.pdapplicants_detials))
|
||||
}
|
||||
}
|
||||
else{
|
||||
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
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
<span>{{main_applicant}} {{lender_applicant_id ? '('+lender_applicant_id+')' : ''}}, {{customer_segment_abbr}} - {{subproduct_abbr}} </span><br>
|
||||
{{questions_JSON.section_name}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
|
||||
matTooltipPosition="right" mat-dialog-close>
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</h2>
|
||||
<!-- <form [formGroup]="docsCollectedForm"> -->
|
||||
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;">
|
||||
<h5 style="text-align: center;" *ngIf="questions_JSON.questions.length == 0">No Templates Found</h5>
|
||||
<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] = "commonFormGroup" [json_answers]="form_answers"></app-dynamic-form>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions *ngIf="questions_JSON.questions.length > 0">
|
||||
<!-- <div fxFlex="60" class="pb-0 text-sm-left" align="left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="common_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div> -->
|
||||
<div fxFlex="100" align="end">
|
||||
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit"
|
||||
matTooltipPosition="above" (click)="saveForm()" [disabled]="disableAfterSubmit===true">
|
||||
<mat-icon>save</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</mat-dialog-actions>
|
||||
<!-- </form> -->
|
||||
<notifier-container></notifier-container>
|
||||
<!-- </form> -->
|
||||
@ -0,0 +1,31 @@
|
||||
.paragraph_change {
|
||||
color: #fff !important;
|
||||
background-color: #e00201 !important;
|
||||
}
|
||||
::ng-deep { .no-padding > mat-dialog-container {
|
||||
// background: black;
|
||||
padding: 0;
|
||||
// overflow-y: scroll !important;
|
||||
}
|
||||
}
|
||||
// mat-placeholder{
|
||||
// margin-top: 20px;
|
||||
// word-wrap: break-word;
|
||||
// }
|
||||
// input{
|
||||
// height:40px;
|
||||
// }
|
||||
|
||||
.mat-form-field-label {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
textarea.mat-input-element {
|
||||
padding: 0px 0;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.mat-input-placeholder {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FormComponent } from './form.component';
|
||||
|
||||
describe('FormComponent', () => {
|
||||
let component: FormComponent;
|
||||
let fixture: ComponentFixture<FormComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FormComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FormComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,171 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { AwsService } from 'app/AwsService/aws.service';
|
||||
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
|
||||
import { QuesFormService } from '../dynamic-form/ques-form/ques-form.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form',
|
||||
templateUrl: './form.component.html',
|
||||
styleUrls: ['./form.component.scss']
|
||||
})
|
||||
export class FormComponent implements OnInit {
|
||||
form_id: number;
|
||||
parent_pdid: any;
|
||||
pdid: any;
|
||||
notifier: NotifierService;
|
||||
main_applicant: any;
|
||||
lender_applicant_id: any;
|
||||
subproduct_abbr: any;
|
||||
customer_segment_abbr: any;
|
||||
lenderShortName: any;
|
||||
fk_pd_type: any;
|
||||
image_doc_params: { pdid: any; form_id: any; company_id: string; };
|
||||
questions_JSON: any = {questions:[],section_name:''};
|
||||
commonFormGroup:FormGroup;
|
||||
form_answers: any;
|
||||
constructor(notifier: NotifierService,
|
||||
private fb: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private _pd: PdTrigerService,
|
||||
private dialogRef: MatDialogRef<FormComponent>,
|
||||
private dialog: MatDialog, private quesService:QuesFormService,
|
||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any,
|
||||
private pdTriggerService:PdTrigerService,
|
||||
private awsService:AwsService) {
|
||||
// console.log(this.pd_all_details)
|
||||
this.form_id = 24;
|
||||
this.pd_all_details.pdmaster_details=this.pd_all_details.pdmaster_details[0]
|
||||
this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id;
|
||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||
this.notifier = notifier;
|
||||
this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant;
|
||||
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
|
||||
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
|
||||
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
|
||||
this.lenderShortName = this.pd_all_details.pdmaster_details.lender_short_name;
|
||||
this.fk_pd_type = this.pd_all_details.pdmaster_details.fk_pd_type;
|
||||
this.image_doc_params={pdid:this.pdid,form_id:this.form_id,company_id:''}
|
||||
this.quesService.pd_all_details = this.pd_all_details
|
||||
console.log('image_doc_params',this.image_doc_params)
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadTemplate()
|
||||
if(this.pd_all_details.is_answered == '1') {
|
||||
this.getSectionData()
|
||||
}
|
||||
else{
|
||||
this.getExcelData();
|
||||
}
|
||||
}
|
||||
loadTemplate() {
|
||||
// let localId = this.getLocalFormId()
|
||||
console.log("d",this.pd_all_details.form_id,Number(this.pd_all_details.form_id))
|
||||
// this.pdTriggerService.loadTemplate(Number(this.pd_all_details.form_id)).subscribe(result=>{
|
||||
let params = {"fk_entity_id":"35","fk_product_id":"","pd_form_id":this.pd_all_details.form_id,"fk_pd_id":this.pd_all_details.pdmaster_details.pd_id}
|
||||
this.pdTriggerService.loadCreditPDTemplate(params).subscribe(result=>{
|
||||
if(result.dataStatus) {
|
||||
let question_template: any = result.records
|
||||
if (question_template && question_template != null && question_template != undefined
|
||||
) {
|
||||
// question_template = JSON.parse(question_template)
|
||||
if (question_template.hasOwnProperty('template') && question_template.template) {
|
||||
question_template =JSON.parse(question_template.template);
|
||||
this.commonFormGroup = new FormGroup({})
|
||||
this.questions_JSON = question_template;
|
||||
console.log(this.questions_JSON);
|
||||
// setTimeout(() => {
|
||||
// this.covidAnswers = null
|
||||
// console.log("cleared")
|
||||
// }, 2000)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
getSectionData() {
|
||||
let params = {"fk_pd_id":this.pd_all_details.pdmaster_details.pd_id,"fk_form_id":this.pd_all_details.form_id}
|
||||
this.pdTriggerService.getSMCCreditPDSectionData(params).subscribe(result=>{
|
||||
if(result['dataStatus']) {
|
||||
let records = result['records']
|
||||
let formValues:any ={};
|
||||
if(records && records.hasOwnProperty('json') && records.json) {
|
||||
formValues = JSON.parse(records.json)
|
||||
// console.log(this.form)
|
||||
this.form_answers= formValues
|
||||
setTimeout(()=>{
|
||||
this.form_answers = null
|
||||
},2000)
|
||||
// this.commonFormGroup.patchValue(formValues)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
getExcelData() {
|
||||
let params = {"pd_id":this.pd_all_details.pdmaster_details.pd_id,"random_string":this.pd_all_details.pdmaster_details.random_string,"form_id":this.pd_all_details.form_id}
|
||||
this.pdTriggerService.loadDataFromExcel(params).subscribe(result=>{
|
||||
if(result['dataStatus']) {
|
||||
let records = result['records']
|
||||
let formValues:any ={};
|
||||
if(records && records.length > 0) {
|
||||
records.forEach(val=>{
|
||||
if(val) {
|
||||
formValues[val.key_name] = val.value
|
||||
}
|
||||
})
|
||||
// console.log(this.form)
|
||||
this.form_answers= formValues
|
||||
setTimeout(()=>{
|
||||
this.form_answers = null
|
||||
},2000)
|
||||
// this.commonFormGroup.patchValue(formValues)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
getLocalFormId() {
|
||||
console.log(this.pd_all_details)
|
||||
switch(this.pd_all_details.form_id) {
|
||||
case '5':
|
||||
return 2
|
||||
break
|
||||
case '18':
|
||||
return 1
|
||||
break;
|
||||
case '10':
|
||||
return 3
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
saveForm() {
|
||||
console.log("values",this.commonFormGroup.getRawValue(),this.questions_JSON)
|
||||
if(this.commonFormGroup.invalid) {
|
||||
this.commonFormGroup.markAsDirty();
|
||||
this.commonFormGroup.markAsTouched()
|
||||
this.notifier.notify("info","Please fill all the required fields");
|
||||
return
|
||||
}
|
||||
let params = {"fk_pd_id":this.pd_all_details.pdmaster_details.pd_id,"fk_form_id":this.pd_all_details.form_id,"json":this.commonFormGroup.getRawValue(),createdby:''}
|
||||
this.pdTriggerService.saveSMCCreditPDsection(params).subscribe(result=>{
|
||||
if(result['dataStatus']) {
|
||||
this.notifier.notify("success","Saved successfully..")
|
||||
setTimeout(()=>{
|
||||
this.dialogRef.close()
|
||||
},1500)
|
||||
}
|
||||
else {
|
||||
this.notifier.notify("warning","Something went wrong");
|
||||
}
|
||||
},err=>{
|
||||
this.notifier.notify("warning","Network Error");
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,7 +6,8 @@
|
||||
<small>{{pdMasterList.customer_segment_name}}</small>
|
||||
</div>
|
||||
<div fxFlex="66" align="end">
|
||||
<h4 class="mt-0">{{pdMasterList.product_name}}<span *ngIf="pdMasterList.subproduct_name">/{{pdMasterList.subproduct_name}}</span>
|
||||
<h4 class="mt-0">{{pdMasterList.product_name}}
|
||||
<!-- <span *ngIf="pdMasterList.subproduct_name">/{{pdMasterList.subproduct_name}}</span> -->
|
||||
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Close" matTooltipPosition="above"
|
||||
(click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button>
|
||||
</h4>
|
||||
@ -16,7 +17,7 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content style="max-height:100% !important;">
|
||||
<div fxLayout="row wrap" class="child_mat_card">
|
||||
<mat-card fxFlex.xs="80" fxFlex.sm="45" fxFlex.md="32" fxFlex.lg="32" fxFlex.xl="33" *ngFor="let formButton of categoryFormButtons;let quesIndex=index" [ngStyle]="{'background-color':formButton.isAnswered == false ? '#fff' : '#4caf50' ,'color':'#fff'}" (click)="OnSelectDirectForms(formButton)">
|
||||
<mat-card fxFlex.xs="80" fxFlex.sm="45" fxFlex.md="32" fxFlex.lg="32" fxFlex.xl="33" *ngFor="let formButton of categoryFormButtons;let quesIndex=index" [ngStyle]="{'background-color':formButton.is_answered == '0' ? '#fff' : '#4caf50' ,'color':'#fff'}" (click)="OnSelectDirectForms(formButton)">
|
||||
<mat-card-header>
|
||||
<span style="padding: 17px 14px 3px 15px !important;border-radius: 0px 0px 0px 15px!important;width: 50px !important;" class="menu-badge mat-purple ng-star-inserted" align="center">{{quesIndex+1}}</span>
|
||||
<div fxFlex="100" align="left" style="padding:15px !important;">
|
||||
|
||||
@ -6,6 +6,7 @@ import {NotifierService} from 'angular-notifier';
|
||||
import {ListPdComponent} from './../list-pd.component';
|
||||
import {PdTrigerService} from '../../../pd-service/pd-triger.service';
|
||||
import { PdStatusChangeDialogueComponent } from '../pd-status-change-dialogue/pd-status-change-dialogue.component';
|
||||
import { FormComponent } from './forms/form/form.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-start-pd',
|
||||
@ -104,12 +105,13 @@ export class StartPdComponent implements OnInit, OnDestroy {
|
||||
data => {
|
||||
// console.log("after reponse = ", data);
|
||||
if (data.status == 200) {
|
||||
this.pdMasterList=data.records.pdmaster_details;
|
||||
this.pdMasterList=data.records.pdmaster_details[0]
|
||||
// this.categoryList=data.records.question_answers;
|
||||
let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
|
||||
this.mainApplicantName = filterApplicantName.length > 0 ? filterApplicantName[0].applicant_name : '';
|
||||
this.currentPDStatus = data.records.pdmaster_details.pd_status=='INPROGRESS' ? true : data.records.pdmaster_details.pd_status=='SCHEDULED' ? true :data.records.pdmaster_details.pd_status=='ALLOCATED' ? true : false;
|
||||
this.categoryFormButtons = Object.keys(data.records.template_forms).map((item)=>data.records.template_forms[item]).filter(item=>item.isAnswerable===true);
|
||||
// this.categoryFormButtons = Object.keys(data.records.template_forms).map((item)=>data.records.template_forms[item]).filter(item=>item.isAnswerable===true);
|
||||
this.categoryFormButtons = data.records.template_details
|
||||
// this.categoryFormButtons = this.categoryFormButtons.filter(item=>item.isAnswerable===true);
|
||||
this.actualQuestions = this.categoryFormButtons.length;
|
||||
let getAnsweredFormsCount = this.categoryFormButtons.filter(item=>item.isAnswered===true);
|
||||
@ -168,7 +170,45 @@ export class StartPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
OnSelectDirectForms(details: any) {
|
||||
// console.log(details)
|
||||
// this.formsCategoryEnable = true;
|
||||
this.selectedFormsCategory = details;
|
||||
let curr_vendor_ans_fetch_status = null
|
||||
if(this.pdMasterList.fk_pd_type == '2') {
|
||||
if(this.vendor_status_arr && this.vendor_status_arr.length > 0 && this.selectedFormsCategory.form_id != 13) {
|
||||
console.log(this.vendor_status_arr,this.selectedFormsCategory)
|
||||
curr_vendor_ans_fetch_status =this.vendor_status_arr.filter(val=>val.fk_form_id == String(this.selectedFormsCategory.form_id))
|
||||
if(curr_vendor_ans_fetch_status.length > 0) {
|
||||
curr_vendor_ans_fetch_status = curr_vendor_ans_fetch_status[0].form_status
|
||||
}
|
||||
else {
|
||||
curr_vendor_ans_fetch_status = null
|
||||
}
|
||||
}
|
||||
}
|
||||
this.pdFullDetails.pdmaster_details.curr_vendor_ans_fetch_status = curr_vendor_ans_fetch_status
|
||||
this.pdFullDetails.form_id= this.selectedFormsCategory.fk_form_id
|
||||
this.pdFullDetails.is_answered = this.selectedFormsCategory.is_answered
|
||||
console.log(this.pdFullDetails);
|
||||
const dialogRef = this.dialog.open(FormComponent, {
|
||||
data: this.pdFullDetails,
|
||||
// position: { right: '0'},
|
||||
maxWidth: '100vw',
|
||||
maxHeight: '100vh',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
disableClose: true,
|
||||
closeOnNavigation:true,
|
||||
panelClass:'no-padding'
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
// this.notifier.notify('success', 'Successfully allocated.!');
|
||||
this.loadTemplates(this.startPD,2,this.randomString);
|
||||
});
|
||||
}
|
||||
|
||||
// start
|
||||
// direct form based questions
|
||||
// OnSelectDirectForms(details: any) {
|
||||
@ -536,7 +576,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
// load pd view component
|
||||
loadPdViewCompoent() {
|
||||
this.router.navigate(['../../../../viewpd', this.pdMasterList.parent_pd_id,this.randomString], {relativeTo: this.route});
|
||||
this.router.navigate(['../../../../../viewpd', this.pdMasterList.parent_pd_id,this.randomString], {relativeTo: this.route});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,13 @@ import { StartPdComponent } from './start-pd.component';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
import { DemoMaterialModule } from 'app/shared/demo.module';
|
||||
import { NotifierModule, NotifierOptions } from 'angular-notifier';
|
||||
import { FormComponent } from './forms/form/form.component';
|
||||
import { DynamicFormComponent } from './forms/dynamic-form/dynamic-form/dynamic-form.component';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { DynamicQuestionTemplateComponent } from './forms/dynamic-form/dynamic-question-template/dynamic-question-template.component';
|
||||
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
||||
import { MatIconModule } from '@angular/material';
|
||||
|
||||
const pdCustomNotifierOptions: NotifierOptions = {
|
||||
position: {
|
||||
@ -54,9 +61,14 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
StartPdRoutingModule,
|
||||
SharedModule,
|
||||
DemoMaterialModule,
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
FlexLayoutModule,
|
||||
NotifierModule.withConfig(pdCustomNotifierOptions),
|
||||
NgxMatSelectSearchModule,
|
||||
MatIconModule
|
||||
],
|
||||
declarations: [StartPdComponent],
|
||||
entryComponents:[]
|
||||
declarations: [StartPdComponent, FormComponent,DynamicFormComponent,DynamicQuestionTemplateComponent],
|
||||
entryComponents:[FormComponent]
|
||||
})
|
||||
export class StartPdModule { }
|
||||
|
||||
@ -142,6 +142,7 @@
|
||||
<!-- this is for set primary address of the PD actions-->
|
||||
<div [ngSwitch]="addresses.is_primary" style="padding:10px !important;">
|
||||
<div *ngSwitchCase="1">
|
||||
|
||||
<!-- <div fxFlex="50" align="left">
|
||||
<div fxFlex="100" style="color: #e00201">
|
||||
{{master.pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Addon Pending' : master.pd_status | titlecase}}
|
||||
@ -156,7 +157,7 @@
|
||||
<div fxFlex="60" align="right">
|
||||
<!-- <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> -->
|
||||
<!-- <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 ><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.DRAFT && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.TRIGGERED" 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,addresses.addtional_pd_data[0].pd_status)"><mat-icon>question_answer</mat-icon></button></span>
|
||||
<span *ngIf="master.lender_short_name == 'MWISE'"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.DRAFT" 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,addresses.addtional_pd_data[0].pd_status)"><mat-icon>question_answer</mat-icon></button></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -197,7 +198,7 @@
|
||||
<div fxFlex="60" align="right">
|
||||
<!-- <span *ngIf="userRoleID == 10 || userRoleID == 3"><button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.DRAFT && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.COMPLETED && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.ADD_ON_PENDING && addresses.addtional_pd_data[0].pd_status!=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 == 3 || userRoleID == 4 || userRoleID == 5 || userRoleID == 10 "><button *ngIf="roleAccessDetails.schedule && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.DRAFT && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.COMPLETED && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.ADD_ON_PENDING && addresses.addtional_pd_data[0].pd_status!=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 ><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.DRAFT && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.TRIGGERED" 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,addresses.addtional_pd_data[0].pd_status)"><mat-icon>question_answer</mat-icon></button></span>
|
||||
<span *ngIf="master.lender_short_name == 'MWISE'"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.DRAFT" 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,addresses.addtional_pd_data[0].pd_status)"><mat-icon>question_answer</mat-icon></button></span>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row nowrap">
|
||||
|
||||
@ -295,9 +295,9 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
// start pd
|
||||
getPDStart(pdDetails: any, status: string) {
|
||||
this.destroyType = 3;
|
||||
if (status == this.pdStatusCheck.ALLOCATED || status == this.pdStatusCheck.SCHEDULED) {
|
||||
if (status == this.pdStatusCheck.ALLOCATED || status == this.pdStatusCheck.SCHEDULED || status == this.pdStatusCheck.TRIGGERED) {
|
||||
const dialogRef = this.dialog.open(PdStatusChangeDialogueComponent, {
|
||||
data: { pdid: pdDetails.assigned_pd, pd_status: this.pdStatusCheck.INPROGRESS },
|
||||
data: { pdid: pdDetails.assigned_pd, pd_status: this.pdStatusCheck.INPROGRESS,random_string:this.pdMasterData[0].random_string },
|
||||
disableClose: true,
|
||||
minWidth: '30%',
|
||||
maxWidth: '40%',
|
||||
|
||||
@ -168,10 +168,11 @@ export class PdTrigerService {
|
||||
|
||||
// get pd details
|
||||
getPdDetails(lenderId): Observable<any> {
|
||||
let userid=this._aws.getlocale()
|
||||
let entity_id=localStorage.getItem('LocalSetEntity');
|
||||
// let userid=this._aws.getlocale()
|
||||
|
||||
const Lender = userid ?
|
||||
{ params: new HttpParams().set('lenderid', userid) } : {};
|
||||
const Lender = entity_id ?
|
||||
{ params: new HttpParams().set('lenderid', entity_id) } : {};
|
||||
return this._http.get<any>(this.apiUrl + "listLessPDDetails/get",Lender)
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
@ -183,10 +184,11 @@ export class PdTrigerService {
|
||||
// const tabStatus = status ?
|
||||
// { params: new HttpParams().set('status', status)} : {};
|
||||
|
||||
let entity_id=localStorage.getItem('LocalSetEntity');
|
||||
let userid_local:string=this._aws.getlocale()
|
||||
|
||||
const paramHttp= userid_local && status ?
|
||||
{params : new HttpParams().set('lenderid', userid_local).set('status',status)} : {};
|
||||
const paramHttp= entity_id && status ?
|
||||
{params : new HttpParams().set('lenderid', entity_id).set('status',status)} : {};
|
||||
return this._http.get<any[]>(this.apiUrl + "listLessPDDetails/get", paramHttp)
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
@ -267,7 +269,9 @@ export class PdTrigerService {
|
||||
loadPDTemplates(pdId: string,randString): Observable<any> {
|
||||
const options = pdId ?
|
||||
{ params: new HttpParams().set('pd_id', pdId).set('random_string',randString) } : {};
|
||||
return this._http.get<any[]>(this.apiUrl + "loadFullTemplate", options)
|
||||
// return this._http.get<any[]>(this.apiUrl + "loadFullTemplate", options)
|
||||
return this._http.get<any[]>(this.apiUrl + "loadSMCPDTemplate", options)
|
||||
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
@ -797,6 +801,30 @@ uploadSMCDataFile(file) {
|
||||
formData.append("records",JSON.stringify(records))
|
||||
return this._http.post(this.apiUrl+'uploadSMCDataFile',formData)
|
||||
}
|
||||
loadTemplate(form_id) {
|
||||
return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/'+form_id+'.json').map(rr=>{
|
||||
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
|
||||
// this.raw_credit_pd_template= returnValue.records.template
|
||||
return returnValue
|
||||
})
|
||||
}
|
||||
loadCreditPDTemplate(params):Observable<any> {
|
||||
return this._http.post(this.apiUrl+'loadCreditPDTemplate',params)
|
||||
.pipe(catchError(this.handleError("loadCreditPDTemplate",[])))
|
||||
}
|
||||
saveSMCCreditPDsection(params1):Observable<any> {
|
||||
params1.createdby = this._aws.getlocale()
|
||||
// "fk_pd_id":"1","fk_form_id":"1","json":"SOMEDATA","fk_createdby":"12"
|
||||
// let params = {"records":{"smc_credit_pd":this.curr_credit_pd_data.smc_credit_pd,"lender_id":this.curr_credit_pd_data.lender_id,"product_id":this.curr_credit_pd_data.product_id,"fk_createdby":this._awsService.getlocale(),"geo_location":"","section_id":params1.section_id,"questions":params1.questions,"is_complete":"0"}}
|
||||
return this._http.post(this.apiUrl+'saveSMCCreditPDsection',{records:params1})
|
||||
}
|
||||
getSMCCreditPDSectionData(params) {
|
||||
// {"fk_pd_id":"1","fk_form_id":"1"}
|
||||
return this._http.post(this.apiUrl+'getSMCCreditPDSectionData',{records:params})
|
||||
}
|
||||
loadDataFromExcel(params) {
|
||||
return this._http.post(this.apiUrl+'loadDataFromExcel',{records:params})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
206
ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/1.json
Normal file
206
ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/1.json
Normal file
@ -0,0 +1,206 @@
|
||||
{
|
||||
"section_id":"1",
|
||||
"section_name":"Borrower & Guarantor Details",
|
||||
"onsubmit":null,
|
||||
"questions":[
|
||||
{
|
||||
"question":"Borrower Type",
|
||||
"question_key":"borrower_type",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"answers":null,
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Name",
|
||||
"question_key":"borrower_name",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"onchange_properties":null,
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Entity Type",
|
||||
"question_key":"entity_type",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Designation",
|
||||
"question_key":"designation",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Relationship to",
|
||||
"question_key":"relationship_to",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Relationship",
|
||||
"question_key":"relationship",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Relationship",
|
||||
"question_key":"relationship",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Met / Not Met",
|
||||
"question_key":"borrower_met",
|
||||
"type":"2",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"answers":[
|
||||
{
|
||||
"answer_id":"Yes",
|
||||
"answer":"Yes"
|
||||
},
|
||||
{
|
||||
"answer_id":"No",
|
||||
"answer":"No"
|
||||
}
|
||||
],
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Age",
|
||||
"question_key":"borrower_age",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Numbers of years for which the business has been running",
|
||||
"question_key":"numbers_of_years_business_running",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
236
ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/2.json
Normal file
236
ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/2.json
Normal file
@ -0,0 +1,236 @@
|
||||
{
|
||||
"section_id":"2",
|
||||
"section_name":"Address details",
|
||||
"onsubmit":null,
|
||||
"questions":[
|
||||
{
|
||||
"question":"Address at which PD was initiated",
|
||||
"question_key":"initiated_address",
|
||||
"type":"7",
|
||||
"field_width":"100",
|
||||
"answers":null,
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Is this the address where PD is done ?",
|
||||
"question_key":"is_pd_done_on_initiated_address",
|
||||
"type":"2",
|
||||
"field_width":"45",
|
||||
"onchange_properties": [{
|
||||
"purpose":"FORM_CTRL",
|
||||
"form_controls":[
|
||||
{
|
||||
"insert_index":"is_pd_done_on_initiated_address",
|
||||
"expression":"(String('is_pd_done_on_initiated_address') == String('No'))",
|
||||
"value_keys":[
|
||||
"is_pd_done_on_initiated_address"
|
||||
],
|
||||
"questions":[
|
||||
{
|
||||
"question":"Enter actual PD address",
|
||||
"question_key":"alternative_address",
|
||||
"place_holder":"",
|
||||
"field_type":"string",
|
||||
"type":"7",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"is_subfield":"1",
|
||||
"parent_question_key":"is_pd_done_on_initiated_address",
|
||||
"answers":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}],
|
||||
"api_properties":null,
|
||||
"answers":[
|
||||
{
|
||||
"answer_id":"Yes",
|
||||
"answer":"Yes"
|
||||
},
|
||||
{
|
||||
"answer_id":"No",
|
||||
"answer":"No"
|
||||
}
|
||||
],
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Type of PD address",
|
||||
"question_key":"address_type",
|
||||
"type":"3",
|
||||
"field_width":"45",
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"ADDRESSTYPE"
|
||||
},
|
||||
"fields":[
|
||||
"address_type_id",
|
||||
"address_type"
|
||||
]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"PD locality",
|
||||
"question_key":"pd_locality",
|
||||
"type":"3",
|
||||
"field_width":"45",
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"LOCALITY"
|
||||
},
|
||||
"fields":[
|
||||
"locality_id",
|
||||
"locality_name"
|
||||
]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Approach to PD location*",
|
||||
"question_key":"pd_location",
|
||||
"type":"3",
|
||||
"field_width":"45",
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"PDLOCATIONAPPROACH"
|
||||
},
|
||||
"fields":[
|
||||
"pd_location_approach_id",
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Comment on locality",
|
||||
"question_key":"comment_locality",
|
||||
"type":"3",
|
||||
"field_width":"45",
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"COMMENTSONLOCALITY"
|
||||
},
|
||||
"fields":[
|
||||
"comments_on_locality_id",
|
||||
"rating"
|
||||
]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Estimated Area of the business along with UOM",
|
||||
"question_key":"business_estimated_area",
|
||||
"type":"3",
|
||||
"field_width":"45",
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"UOM"
|
||||
},
|
||||
"fields":[
|
||||
"uom_id",
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
541
ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/3.json
Normal file
541
ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/3.json
Normal file
@ -0,0 +1,541 @@
|
||||
{
|
||||
"section_id":"2",
|
||||
"section_name":"Loan details",
|
||||
"onsubmit":null,
|
||||
"questions":[
|
||||
{
|
||||
"question":"Loan amount applied for",
|
||||
"question_key":"loan_amount",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"answers":null,
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Loan Tenure",
|
||||
"question_key":"loan_tenure",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"onchange_properties": null,
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Sub Product",
|
||||
"question_key":"sub_product",
|
||||
"type":"3",
|
||||
"field_width":"45",
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"SUBPRODUCTS"
|
||||
},
|
||||
"fields":[
|
||||
"subproduct_id",
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"End use of loan",
|
||||
"question_key":"end_use",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Total fund requirement",
|
||||
"question_key":"total_fund_requirement",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties": [{
|
||||
"purpose":"FORM_CTRL",
|
||||
"form_controls":[
|
||||
{
|
||||
"insert_index":"total_fund_requirement",
|
||||
"expression":"(String('total_fund_requirement') != String(''))",
|
||||
"value_keys":[
|
||||
"total_fund_requirement"
|
||||
],
|
||||
"questions":[
|
||||
{
|
||||
"question":"Fund Requirement for end use",
|
||||
"question_key":"end_use_fund_requirement",
|
||||
"place_holder":"",
|
||||
"field_type":"string",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"is_subfield":"1",
|
||||
"parent_question_key":"total_fund_requirement",
|
||||
"answers":null,
|
||||
"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":"Is there a BT?",
|
||||
"question_key":"is_transfer",
|
||||
"type":"9",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"answers":[
|
||||
{
|
||||
"answer_id":"Yes",
|
||||
"answer":"Yes"
|
||||
},
|
||||
{
|
||||
"answer_id":"No",
|
||||
"answer":"No"
|
||||
}
|
||||
],
|
||||
"onchange_properties": [{
|
||||
"purpose":"FORM_CTRL",
|
||||
"form_controls":[
|
||||
{
|
||||
"insert_index":"is_transfer",
|
||||
"expression":"(String('is_transfer') == String('Yes'))",
|
||||
"value_keys":[
|
||||
"is_transfer"
|
||||
],
|
||||
"questions":[
|
||||
{
|
||||
"question":"What is the amount of balance transfer",
|
||||
"question_key":"balance_transfer_amount",
|
||||
"place_holder":"",
|
||||
"field_type":"numtoword",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"is_subfield":"1",
|
||||
"parent_question_key":"is_transfer",
|
||||
"answers":null,
|
||||
"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":"Lender from where BT is done",
|
||||
"question_key":"lender",
|
||||
"type":"8",
|
||||
"field_width":"45",
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"BTLENDERLIST"
|
||||
},
|
||||
"fields":[
|
||||
"bt_lender_list_id",
|
||||
"lender_name"
|
||||
]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Top up amount",
|
||||
"question_key":"topup_amount",
|
||||
"type":"1",
|
||||
"field_type":"numtoword",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Type of property being Mortgaged",
|
||||
"question_key":"property_type",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Name of Owner",
|
||||
"question_key":"owner_name",
|
||||
"type":"3",
|
||||
"field_width":"45",
|
||||
"api_properties":
|
||||
{
|
||||
"purpose":"answer_options_local",
|
||||
"master_name":"pd_applicants",
|
||||
"fields":["pd_co_applicant_id","applicant_name"]
|
||||
},
|
||||
"answers":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Property Completion Stage",
|
||||
"question_key":"construction_status",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"answers":null,
|
||||
"onchange_properties":[
|
||||
{
|
||||
"insert_index":"construction_status",
|
||||
"expression":"(String('construction_status') == String('Under Construction'))",
|
||||
"value_keys":[
|
||||
"construction_status"
|
||||
],
|
||||
"questions":[
|
||||
{
|
||||
"question":"Stage of Construction",
|
||||
"question_key":"construction_stage",
|
||||
"place_holder":"",
|
||||
"field_type":"string",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"is_subfield":"1",
|
||||
"parent_question_key":"construction_status",
|
||||
"answers":null,
|
||||
"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":"Estimated market value as per customer",
|
||||
"question_key":"emv_per_customer",
|
||||
"place_holder":"",
|
||||
"field_type":"numtoword",
|
||||
"type":"1",
|
||||
"field_width":"100",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"answers":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Market Value Considered for LTV Calculation (Rs)",
|
||||
"question_key":"ltv_market_value_calculation",
|
||||
"place_holder":"",
|
||||
"field_type":"numtoword",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"answers":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Address of the proposed property",
|
||||
"question_key":"address",
|
||||
"place_holder":"Enter door no,street",
|
||||
"type":"7",
|
||||
"answers":null,
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"field_type":"string",
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Address Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"State",
|
||||
"question_key":"state",
|
||||
"type":"8",
|
||||
"field_width":"45",
|
||||
"answers":null,
|
||||
"api_properties":{
|
||||
"api":"getListOfMaster",
|
||||
"api_method":"POST",
|
||||
"params":{
|
||||
"master_name":"STATE"
|
||||
},
|
||||
"fields":[
|
||||
"state_id",
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"onchange_properties":[
|
||||
{
|
||||
"purpose":"api",
|
||||
"api":"getListOfStatesAndCities",
|
||||
"api_method":"POST",
|
||||
"params":"{records:{state_id:'value_of_answer'}}",
|
||||
"fields":[
|
||||
"state_id",
|
||||
"name"
|
||||
],
|
||||
"local_variable":"local_city"
|
||||
}
|
||||
],
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"State Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"City",
|
||||
"question_key":"city",
|
||||
"type":"8",
|
||||
"field_width":"45",
|
||||
"answers":null,
|
||||
"api_properties":"local_city",
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"CIty Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Pincode",
|
||||
"question_key":"pincode",
|
||||
"type":"8",
|
||||
"field_width":"45",
|
||||
"answers":null,
|
||||
"api_properties":"local_pincode",
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Pincode Required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Property Usage",
|
||||
"question_key":"property_usage",
|
||||
"place_holder":"",
|
||||
"field_type":"string",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"answers":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"question":"Structure Type",
|
||||
"question_key":"structure_type",
|
||||
"place_holder":"",
|
||||
"field_type":"string",
|
||||
"type":"1",
|
||||
"field_width":"45",
|
||||
"api_properties":null,
|
||||
"onchange_properties":null,
|
||||
"is_repeatable":null,
|
||||
"answers":null,
|
||||
"validations":[
|
||||
{
|
||||
"name":"required",
|
||||
"isactive":"1",
|
||||
"validator":"Validators.required",
|
||||
"message":"Field required",
|
||||
"value":null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user