From 23a97a70849f07a6ffd6539905c340e72fa05e12 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sun, 12 Dec 2021 00:55:56 +0530 Subject: [PATCH] latest requirement issues --- .../pd-allocation/pd-allocation.component.ts | 9 +++-- .../dynamic-form/dynamic-form.component.ts | 39 +++++++++++++++++-- .../ques-form/ques-form.service.ts | 37 ++++++++++-------- .../list-pd/start-pd/start-pd.component.ts | 1 + .../list-pd/view-pd/view-pd.component.html | 3 +- .../list-pd/view-pd/view-pd.component.ts | 1 + 6 files changed, 66 insertions(+), 24 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts index 633db3d..03a0c41 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts @@ -3,6 +3,7 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angul import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; import { NotifierService } from 'angular-notifier'; import { PdTrigerService } from '../../../pd-service/pd-triger.service'; +import { AwsService } from 'app/AwsService/aws.service'; // import { AllocationViewMoreComponent } from './../allocation-view-more/allocation-view-more.component'; // import { VendorPdAllocationComponent } from '../vendor-pd-allocation/VendorPdAllocationComponent'; @@ -36,7 +37,7 @@ export class PdAllocationComponent implements OnInit { private _fb: FormBuilder, private dialogRef: MatDialogRef, private _pd: PdTrigerService, private dialog: MatDialog, - @Inject(MAT_DIALOG_DATA) public data: any) { + @Inject(MAT_DIALOG_DATA) public data: any,private _aws:AwsService) { console.log(data) this.notifier=notifier; if(this.data.lender_role_id == '25') { @@ -46,9 +47,8 @@ export class PdAllocationComponent implements OnInit { ngOnInit() { this.usertype=localStorage.getItem('usertype'); - this.isDisabled=true; - console.log(this.data) + if(this.data.lender_role_id=='28') { this.getSmcVendorPdOfficerList(); @@ -139,10 +139,11 @@ export class PdAllocationComponent implements OnInit { else { + //this.userId = this._aws.getlocale() this.updateData = { "pd_id":this.data.pd_id, // "fk_pd_allocated_to":allocateDetails.fk_user_id, - "fk_pd_allocated_to":allocateDetails.userid, + "fk_pd_allocated_to":this._aws.getlocale(), "pd_agency_id":allocateDetails.entity_id } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts index 7f2e46d..474867f 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts @@ -24,15 +24,46 @@ export class DynamicFormComponent implements OnInit { constructor(private _fb:FormBuilder,private questionService:QuesFormService) { } 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); 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=>{ @@ -53,6 +84,7 @@ export class DynamicFormComponent implements OnInit { // if(parent_control.value.hasOwnProperty('questions_group')){ this.addData(g_i,parent_ques) + // } } // FOR CHILD REPEATABLE @@ -174,6 +206,7 @@ export class DynamicFormComponent implements OnInit { json_obj.questions_level_two.push(json_obj.question); control.push(this._fb.group(control_names)) + json_obj.question.forEach((group_indi,arr_index)=>{ // console.log("sd",childControl) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts index e9f430b..986f54c 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts @@ -45,19 +45,18 @@ export class QuesFormService { this.len=length1; } + createStateSale() { + return this._fb.group({ + Question: ['', Validators.compose([Validators.required])], + Answer: ['', Validators.compose([Validators.required])], + }); +} assignFormControl_array(formgroup: FormGroup, ques_data: any) { - let pdid = JSON.parse(localStorage.getItem('pdid')) - // alert('pdid'); - // alert(pdid); + console.log('formgroup'); console.log(formgroup); - console.log(formgroup.controls); - - //formgroup.addControl('nationality'('', [Validators.required])); - //formgroup.addControl('new', new FormControl('', Validators.required)); - const control: any = formgroup ques_data.forEach((val, index) => { @@ -71,7 +70,7 @@ export class QuesFormService { // })) 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 @@ -82,23 +81,29 @@ export class QuesFormService { console.log(val); if(val.group_key=='cm_queries') { - - alert(pdid); + + + formgroup.addControl('cm_queries1', + this._fb.array(['George Michael', 'Aretha Franklin'])) + this.pdTriggerService.getAdditionalRequirements(pdid).subscribe(res=>{ if(res['dataStatus']){ - console.log('requirements'); - console.log(res['records']); - control.addControl(val.group_key, this._fb.array([])) + // 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":"Question", + "question":"Question1", "question_key":"question", - "place_holder":"Enter text", + "place_holder":"Enter text1", "type":"1", "api_properties":null, "answers":null, diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts index a17ca77..3174e19 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts @@ -61,6 +61,7 @@ export class StartPdComponent implements OnInit, OnDestroy { // start // end + this.listPDComponent.showListView(false); const elemSidebar = document.querySelector('.app-inner .mail-sidebar'); const elemContent = document.querySelector('.app-inner .main-content'); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index a180bf0..6ffc342 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -218,10 +218,11 @@ + - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index 5b76d57..13d5a13 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -355,6 +355,7 @@ export class ViewPdComponent implements OnInit, OnDestroy { // start pd getPDStart(pdDetails: any, status: string) { + console.log('pdddddd'); console.log(pdDetails); // console.log(pdDetails.fk_pd_id);