code moved for gopi

This commit is contained in:
venbatechnologies@gmail.com 2021-12-15 18:16:41 +05:30
parent 23a97a7084
commit 12766e506d
7 changed files with 118 additions and 117 deletions

View File

@ -13,12 +13,12 @@
<mat-dialog-content>
<mat-card formArrayName="addtional_requirements" *ngFor="let requirements of pdRequirements.controls; let i = index;">
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 90%;">
<mat-card-content [formGroupName]="i" *ngIf="requirements.value.isactive != 0">
<mat-form-field style="width: 90%;" >
<input matInput placeholder="Requirement" formControlName="add_requirement">
</mat-form-field>
<!-- <button mat-raised-button mat-icon-button color="primary" matTooltip="Delete" matTooltipPosition="above" (click)="removeRequirements(i)" type="button"><mat-icon>delete</mat-icon></button> -->
<button mat-raised-button mat-icon-button color="primary" matTooltip="Delete" matTooltipPosition="above" (click)="removeRequirements(i)" type="button"><mat-icon>delete</mat-icon></button>
</mat-card-content>
</mat-card>

View File

@ -66,10 +66,19 @@ export class PdRequirementComponent implements OnInit {
}
}
// removeRequirements(index: number) {
// const requirement_control = <FormArray>this._EditPDRequirementForm.controls['additional_requirements'];
// requirement_control.removeAt(index);
// }
removeRequirements(index: number) {
const requirement_control = <FormArray>this._EditPDRequirementForm.controls['addtional_requirements'];
console.log(requirement_control)
if(requirement_control.value[index].add_req_id != ''){
requirement_control.controls[index]['controls'].isactive.setValue(0)
}
else{
requirement_control.removeAt(index);
}
}
updateAdditionalRequirement(formValue: any) {
if(this._EditPDRequirementForm.invalid) {

View File

@ -13,7 +13,7 @@
<!-- <div *ngIf="parent_ques.sub_title" fxLayout="row" >
<mat-card-subtitle *ngIf="parent_ques.sub_title" fxFlex="100%">
{{parent_ques.sub_title}}
</mat-card-subtitle>
</mat-card-subtitle>
<br style="clear: both;"/>
</div> -->
<div *ngIf="parent_ques.is_repeatable != '1'" >

View File

@ -2,7 +2,7 @@ import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
import { MatExpansionPanel,MatAccordion } from '@angular/material';
import { QuesFormService } from '../ques-form/ques-form.service';
import { PdTrigerService } from '../../../../../../pd-service/pd-triger.service';
@Component({
@ -21,53 +21,32 @@ export class DynamicFormComponent implements OnInit {
step_child:number = 0
@ViewChild('mapanel') matExpansionPanel:MatExpansionPanel
@ViewChild('accordion') Accordion: MatAccordion
constructor(private _fb:FormBuilder,private questionService:QuesFormService) { }
queries_docs: any;
constructor(private _fb:FormBuilder,private questionService:QuesFormService,private pdTriggerService:PdTrigerService) { }
ngOnInit() {
// this.questions_JSON.questions.push([
// {
// "question":"Question",
// "question_key":"question",
// "place_holder":"Enter text",
// "type":"1",
// "api_properties":null,
// "answers":null,
// "onchange_properties":null,
// "is_repeatable":null,
// "field_type":"string",
// "validations":[
// ]
// },
// {
// "question":"Answer",
// "question_key":"answer",
// "place_holder":"Enter the answer here",
// "type":"7",
// "api_properties":null,
// "answers":null,
// "onchange_properties":null,
// "is_repeatable":null,
// "validations":[
// ]
// }
// ])
console.log('first');
// console.log(this.questions_JSON.questions);
console.log(this.form_group_name);
console.log(this.form_group_name);
let pdid = JSON.parse(localStorage.getItem('pdid'))
this.pdTriggerService.getAdditionalRequirements(pdid).subscribe(res=>{
if(res['dataStatus']){
this.queries_docs=res['records'].pd_additional_requirements
}
})
this.form_group_name=this.questionService.assignFormControl_array(this.form_group_name,this.questions_JSON.questions)
this.generateGroupControls();
}
generateGroupControls() {
if(this.json_answers && this.json_answers != null){
this.isDefaultGenerated = true;
this.questions_JSON.questions.forEach(parent_ques=>{
console.log(this.json_answers[parent_ques.group_key]);
// debugger;
// FOR ADDING THE GROUP QUES TO DISPLAY WITHOUT CONSIDERING INDEX 0
if(parent_ques.is_repeatable == '1'){

View File

@ -19,6 +19,9 @@ export class QuesFormService {
formanswers=null;
pd_all_details:any= {}
datepipe: DatePipe;
queries_docs: any;
abc: string;
add_requirement: any;
//length: any;
constructor(private _fb:FormBuilder,private http:HttpClient,private pdTriggerService:PdTrigerService) {
this.datepipe=new DatePipe('en-US')
@ -54,81 +57,58 @@ export class QuesFormService {
assignFormControl_array(formgroup: FormGroup, ques_data: any) {
let pdid = JSON.parse(localStorage.getItem('pdid'))
console.log('formgroup');
console.log(formgroup);
const control: any = formgroup
ques_data.forEach((val, index) => {
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([]))
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('veri');
console.log(val);
//let pddata = JSON.parse(localStorage.getItem('fullpddetails'))
localStorage.setItem('formname',val.group_key)
if(val.group_key=='cm_queries')
{
formgroup.addControl('cm_queries1',
this._fb.array(['George Michael', 'Aretha Franklin']))
this.pdTriggerService.getAdditionalRequirements(pdid).subscribe(res=>{
this.pdTriggerService.getAdditionalRequirements(pdid).subscribe(res=>{
if(res['dataStatus']){
// console.log('requirements');
// console.log(res['records']);
// control.addControl(val.group_key, this._fb.array([]))
let queries_docs=res['records'].pd_additional_requirements
// val.question.push({
// }
// )
console.log('tedt');
console.log(formgroup);
val.group_questions.push([
{
"question":"Question1",
"question_key":"question",
"place_holder":"Enter text1",
"type":"1",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"field_type":"string",
"validations":[
]
},
{
"question":"Answer",
"question_key":"answer",
"place_holder":"Enter the answer here",
"type":"7",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"validations":[
]
}
this.queries_docs=res['records'].pd_additional_requirements
localStorage.setItem('queriesviewdata',this.queries_docs)
console.log('quesries');
console.log(this.queries_docs);
for (let i = 0; i < this.queries_docs.length; ++i) {
childControl.push(this._fb.group(control_names))
console.log('groupquestion');
console.log(val.group_questions);
val.group_questions.push([
{
"question":this.queries_docs[i].add_requirement,
"question_key":"question",
"place_holder":this.queries_docs[i].add_requirement,
"type":"1",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"field_type":"string",
"validations":[
]
},
{
"question":"Answer",
"question_key":"answer",
"place_holder":"Enter the answer here",
"type":"7",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"validations":[
]
}
])
// this.docs_array_value=res['records'].docs_to_be_collected
])
}
}
})
}
@ -733,31 +713,38 @@ export class QuesFormService {
// let sub_childControl: any = childControl.controls[0].get('questions') as FormArray
let control_names:any={}
ques_data[index].group_questions = []
//ques_data[index].group_questions1 = []
ques_data[index].group_questions.push(val.question)
ques_data[index].group_questions.push(val.question)
val.group_questions[0].forEach((group_indi, arr_index) => {
// CREATING A FORMARRAY AND CONTROL FOR CHILD REPEATABLE
if(group_indi.is_repeatable == '2') {
this.addLevelTwoControls(group_indi,childControl,val.group_questions[0],val.question,arr_index)
}
else {
group_indi.raw_validations = group_indi.validations
control_names[group_indi.question_key] = ''
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 = []
@ -783,11 +770,15 @@ export class QuesFormService {
// debugger
// val.questions[0]=val.question;
if(childControl.value.length == 0) {
childControl.push(this._fb.group(control_names))
}
else{
// MERGINE THE 0 INDEX ARRAY WITH CHILD REPEATABLE
// control_names[childControl.at(0)] =''
let previous_added_controls = childControl.at(0).controls
@ -888,7 +879,7 @@ export class QuesFormService {
// FUNCTIONAL TO HANDLE THE CREATION OF CHILD REPEABLE 2
addLevelTwoControls(curr_obj:any,child_control,group_ques,valQues,group_index) {
// CURR VALUE(MULTI ARRAY)
const question_temp:any = JSON.parse(JSON.stringify(curr_obj.questions_level_two));
group_ques[group_index].questions_level_two = []
@ -1129,7 +1120,7 @@ export class QuesFormService {
// --END OF GETANSWERVALUE FUN
addAdditionalControl(data,curr_control,curr_index,purpose?){
//FOR CHECKBOX CHANGE THE VALUE STORAGE AS ARRAY
if(data.type == '5'){
// curr_control.controls[curr_index].removeControl('answer_value');

View File

@ -34,6 +34,7 @@ export class FormComponent implements OnInit {
@Input() json_answers:any;
@ViewChild(DynamicFormComponent) formComponent:DynamicFormComponent
is_loading: boolean = false;
queries_docs: any;
constructor(notifier: NotifierService,
private fb: FormBuilder,
private route: ActivatedRoute,
@ -160,7 +161,7 @@ else
let params = {"fk_entity_id":this.pd_all_details.pdmaster_details.fk_lender_id,"fk_product_id":this.pd_all_details.pdmaster_details.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(!environment.production){
result.dataStatus = false
//result.dataStatus = false
}
if(result.dataStatus) {
let question_template: any = result.records
@ -364,8 +365,29 @@ else
return invalid;
}
saveForm() {
let pdid = localStorage.getItem('pdid')
// if("pd_additional_requirements1" in pddata)
let formname = localStorage.getItem('formname');
let queries_docs='';
this.pdTriggerService.getAdditionalRequirements(pdid).subscribe(res=>{
if(res['dataStatus']){
queries_docs=res['records'].pd_additional_requirements
console.log('cm');
console.log(queries_docs);
if(formname=='cm_queries')
{
console.log('cm');
console.log(queries_docs);
}
}
})
// console.log(this.commonFormGroup.value.cm_queries[1].question);
// return
//console.log("values",this.commonFormGroup.getRawValue(),this.questions_JSON)
if(this.commonFormGroup.invalid) {
this.commonFormGroup.markAsDirty();

View File

@ -43,7 +43,7 @@
<button *ngIf="(master.lender_short_name != 'MWISE' && currentPDStatus=='QC COMPLETED') || (master.lender_short_name == 'MWISE' && LenderRoleID != '25' && LenderRoleID != '27' && currentPDStatus==pdStatusCheck.COMPLETED && currentVendorStatus=='QC COMPLETED') && roleAccessDetails.reports && master.pd_type_name" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above" (click)="smcCreditPDReport(viewID)"><mat-icon>ballot</mat-icon></button>
</span>
<button *ngIf="is_agency_logged_in ==true && (master.lender_short_name != 'MWISE' && currentPDStatus=='QC COMPLETED') || (master.lender_short_name == 'MWISE' && (LenderRoleID == '27'||LenderRoleID == '26') && (currentVendorStatus=='QC COMPLETED')) && roleAccessDetails.reports && master.pd_type_name" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above" (click)="smcCreditPDReport(viewID)"><mat-icon>ballot</mat-icon></button>
<button *ngIf="is_agency_logged_in ==true && (master.lender_short_name != 'MWISE' && currentPDStatus=='QC COMPLETED' ||currentPDStatus==pdStatusCheck.COMPLETED) || (master.lender_short_name == 'MWISE' && (LenderRoleID == '27'||LenderRoleID == '26') && ( currentVendorStatus=='QC COMPLETED'||currentVendorStatus=='COMPLETED')) && roleAccessDetails.reports && master.pd_type_name" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above" (click)="smcCreditPDReport(viewID)"><mat-icon>ballot</mat-icon></button>
<span><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button></span>
</div>
@ -219,13 +219,13 @@
<span *ngIf="master.lender_short_name == 'MWISE' && LenderRoleID != '25' && userId == master.fk_pd_allocated_to"> <button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && master.pd_type_name && addresses.addtional_pd_data[0].pd_status == pdStatusCheck.ALLOCATED" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Reject" matTooltipPosition="above" (click)="rejectPD()"><mat-icon>settings_backup_restore</mat-icon></button></span>
<span *ngIf="is_agency_logged_in == false && master.lender_short_name == 'MWISE' && LenderRoleID == '27' || LenderRoleID == '25' && currentPDStatus == pdStatusCheck.BOUNCED "><button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && (currentPDStatus == pdStatusCheck.ALLOCATED_TO_FIA ||currentPDStatus == pdStatusCheck.TRIGGERED|| (currentPDStatus == pdStatusCheck.ALLOCATED && userId == master.fk_pd_allocated_to)|| (currentPDStatus == pdStatusCheck.BOUNCED && userId == master.fk_pd_allocated_to)) " mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="above" (click)="selfAllocation(addresses.fk_state)"><mat-icon>verified_user</mat-icon></button></span>
<span *ngIf="LenderRoleID =='28' && master.lender_short_name == 'MWISE'"><button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && (currentPDStatus == pdStatusCheck.ALLOCATED_TO_FIA||currentVendorStatus == pdStatusCheck.INPROGRESS ||currentVendorStatus == pdStatusCheck.ALLOCATED|| (currentVendorStatus == pdStatusCheck.ALLOCATED && userId == master.fk_pd_allocated_to)|| (currentVendorStatus == pdStatusCheck.BOUNCED && userId == master.fk_pd_allocated_to)) " mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="above" (click)="selfAllocation(addresses.fk_state)"><mat-icon>verified_user</mat-icon></button></span>
<span *ngIf="LenderRoleID =='28'&&currentVendorStatus != 'QC COMPLETED' && master.lender_short_name == 'MWISE'"><button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && (currentPDStatus == pdStatusCheck.ALLOCATED_TO_FIA||currentVendorStatus == pdStatusCheck.INPROGRESS ||currentVendorStatus == pdStatusCheck.ALLOCATED|| (currentVendorStatus == pdStatusCheck.ALLOCATED && userId == master.fk_pd_allocated_to)|| (currentVendorStatus == pdStatusCheck.BOUNCED && userId == master.fk_pd_allocated_to)) " mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="above" (click)="selfAllocation(addresses.fk_state)"><mat-icon>verified_user</mat-icon></button></span>
<span *ngIf="master.lender_short_name == 'MWISE' && (LenderRoleID == '26')"><button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && (currentPDStatus == pdStatusCheck.TRIGGERED || (currentPDStatus == pdStatusCheck.ALLOCATED && master.pd_allocated_to_role_id == '27')) " mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate to Self" matTooltipPosition="above" (click)="selfAllocation(addresses.fk_city)"><mat-icon>verified_user</mat-icon></button></span>
<span *ngIf="master.lender_short_name == 'MWISE' && (LenderRoleID == '26')"><button *ngIf="roleAccessDetails.allocate && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && (currentPDStatus == pdStatusCheck.TRIGGERED || currentPDStatus == pdStatusCheck.ALLOCATED) || (currentPDStatus == pdStatusCheck.ALLOCATED && master.pd_allocated_to_role_id == '27') " mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate to Vendor" matTooltipPosition="above" (click)="Allocationtovendor(addresses.fk_city)"><mat-icon>verified_user</mat-icon></button></span>
<span *ngIf="master.lender_short_name == 'MWISE' && LenderRoleID != '25' && (LenderRoleID != '26' || userId == master.fk_pd_allocated_to)"><button *ngIf="addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && (currentPDStatus == pdStatusCheck.ALLOCATED || currentPDStatus == pdStatusCheck.INPROGRESS)" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Send back to CPA" matTooltipPosition="above" (click)="allocateToCpa()"><mat-icon>swap_vert</mat-icon></button></span>
<span *ngIf="is_agency_logged_in == false && master.lender_short_name == 'MWISE' && LenderRoleID != '25' && (LenderRoleID != '26' || userId == master.fk_pd_allocated_to)"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].pd_status!=pdStatusCheck.DRAFT && currentPDStatus!=pdStatusCheck.BOUNCED && (LenderRoleID == '27' || LenderRoleID == '28'||currentPDStatus!=pdStatusCheck.TRIGGERED)||LenderRoleID == '29'" 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="is_agency_logged_in == true && master.lender_short_name == 'MWISE' && LenderRoleID != '25' && (LenderRoleID != '29' || userId == master.fk_pd_allocated_to && currentVendorStatus!='QC COMPLETED')"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].vendor_status!=pdStatusCheck.DRAFT && currentVendorStatus!=pdStatusCheck.BOUNCED && currentVendorStatus!='QC COMPLETED'&& (LenderRoleID == '27' || LenderRoleID == '28'||currentVendorStatus!=pdStatusCheck.TRIGGERED)||LenderRoleID == '29'" 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].vendor_status)"><mat-icon>question_answer</mat-icon></button></span>
<span *ngIf="is_agency_logged_in == true && master.lender_short_name == 'MWISE' && LenderRoleID != '25' && (LenderRoleID != '29' || userId == master.fk_pd_allocated_to && currentVendorStatus!='QC COMPLETED')"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].vendor_status!=pdStatusCheck.DRAFT && currentVendorStatus!=pdStatusCheck.BOUNCED && currentVendorStatus!='QC COMPLETED'&& (LenderRoleID == '27' || LenderRoleID == '28'||currentVendorStatus!=pdStatusCheck.TRIGGERED)||LenderRoleID == '29'" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion1" matTooltipPosition="above" (click)="getPDStart(addresses,addresses.addtional_pd_data[0].vendor_status)"><mat-icon>question_answer</mat-icon></button></span>
</div>
</div>
</div>