diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts index 30870cc..40a62da 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts @@ -57,6 +57,7 @@ export class AllPdComponent implements OnInit, OnChanges { user_id: any; startIndex: number; endIndex: any; + filtered_raw_data: any[]; constructor(private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,private userService:UserService, private _aws:AwsService,private loaderService:LoaderService) { this.LenderRoleID = localStorage.getItem('LenderRoleID'); @@ -129,6 +130,7 @@ console.log(this.displayedColumns) filterData(text) { if(!text) { setTimeout(()=>{ + this.filtered_raw_data = [] this.pagedList .next(this.PdListData.slice(0, 10)); },0) this.length = this.PdListData.length; @@ -143,7 +145,10 @@ console.log(this.displayedColumns) return false }) setTimeout(()=>{ - this.pagedList.next(temp) + console.log(temp) + this.filtered_raw_data = temp + this.length = this.filtered_raw_data.length + this.pagedList.next(temp.slice(0, 10)) },0) // this.pa // this.length = this.pagedList.length @@ -209,7 +214,8 @@ console.log(this.displayedColumns) if(this.endIndex > this.length){ this.endIndex = this.length; } - this.pagedList.next(this.PdListData.slice(this.startIndex, this.endIndex)); + let raw_data = this.filtered_raw_data && this.filtered_raw_data.length > 0 ? this.filtered_raw_data : this.PdListData + this.pagedList.next(raw_data.slice(this.startIndex, this.endIndex)); } pageChange(e) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html index 4546e15..4793434 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html @@ -223,7 +223,7 @@
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts index 2032b07..5c6293a 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts @@ -57,6 +57,7 @@ export class CompletedPdComponent implements OnInit, OnChanges { user_id: any; startIndex: any; endIndex: any; + filtered_raw_data: any[]; constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService, private _aws:AwsService, private loaderService:LoaderService) { this.notifier = notifier; @@ -171,7 +172,8 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID'); if(this.endIndex > this.length){ this.endIndex = this.length; } - this.pagedList.next(this.completedPdListData.slice(this.startIndex, this.endIndex)); + let raw_data = this.filtered_raw_data && this.filtered_raw_data.length > 0 ? this.filtered_raw_data : this.completedPdListData + this.pagedList.next(raw_data.slice(this.startIndex, this.endIndex)); } pageChange(e) { @@ -307,6 +309,7 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID'); filterData(text) { if(!text) { setTimeout(()=>{ + this.filtered_raw_data = [] this.pagedList .next(this.completedPdListData.slice(0, 10)); },0) this.length = this.completedPdListData.length; @@ -321,7 +324,10 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID'); return false }) setTimeout(()=>{ - this.pagedList.next(temp) + console.log(temp) + this.filtered_raw_data = temp + this.length = this.filtered_raw_data.length + this.pagedList.next(temp.slice(0, 10)) },0) // this.pa // this.length = this.pagedList.length diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html index 0bda936..7c564e7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html @@ -220,7 +220,7 @@
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts index a6b6580..2c67ae6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts @@ -55,6 +55,7 @@ export class InprogressPdComponent implements OnInit, OnChanges { user_id: any; startIndex: any; endIndex: any; + filtered_raw_data:any = []; constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService, private _aws:AwsService, private loaderService:LoaderService) { this.notifier = notifier; @@ -163,7 +164,8 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID'); if(this.endIndex > this.length){ this.endIndex = this.length; } - this.pagedList.next(this.progressPdListData.slice(this.startIndex, this.endIndex)); + let raw_data = this.filtered_raw_data && this.filtered_raw_data.length > 0 ? this.filtered_raw_data : this.progressPdListData + this.pagedList.next(raw_data.slice(this.startIndex, this.endIndex)); } pageChange(e) { @@ -296,6 +298,7 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID'); filterData(text) { if(!text) { setTimeout(()=>{ + this.filtered_raw_data = [] this.pagedList .next(this.progressPdListData.slice(0, 10)); },0) this.length = this.progressPdListData.length; @@ -310,7 +313,10 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID'); return false }) setTimeout(()=>{ - this.pagedList.next(temp) + console.log(temp) + this.filtered_raw_data = temp + this.length = this.filtered_raw_data.length + this.pagedList.next(temp.slice(0, 10)) },0) // this.pa // this.length = this.pagedList.length diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html index 64d8a58..c52c941 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html @@ -3,7 +3,8 @@
- + + close
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.scss index acb2f11..aa6bed6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.scss @@ -26,3 +26,10 @@ background-color: #fff !important; float: right; } + .close_btn_filter{ + color: gainsboro +} +.close_btn_filter:hover{ + color: black; + cursor: pointer; +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.ts index 876ba5c..18a52f7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.ts @@ -135,6 +135,7 @@ export class ListPdComponent implements OnInit, OnDestroy { //get tab changes onTabClick(event: MatTabChangeEvent) { this.getTabIndex=event.index; + this.filterValue = '' // this.getTabIndex==0 ? this.allTabC.loadPDDetails() : this.getTabIndex==1 ? this.scheduledTabC.loadPDDetails() : this.getTabIndex==2 ? this.inprogressTabC.loadPDDetails() : this.getTabIndex==3 ? this.completedTabC.loadPDDetails() : this.qcCompletedTabC.loadPDDetails(); this.getTabIndex==0 ? this.allTabC.loadPDDetails() : this.getTabIndex==1 ? this.inprogressTabC.loadPDDetails() : this.getTabIndex==2 ? this.completedTabC.loadPDDetails() : this.qcCompletedTabC.loadPDDetails(); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.html new file mode 100644 index 0000000..2f2479e --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.html @@ -0,0 +1,75 @@ +

+
+ Add New Address +
+
+ + + +
+ +

+ + +
+
+ + Address + + Required + + + State + + + + + + {{SL.name}} + + + Required + + + City + + + + + + + {{CL.city_name}} + + + Required + + + Pincode + + + + + {{PL.pincode}} + + Required + +
+
+
+ + +
+

{{errormsg}}

+
+
+ + +
+ +
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.scss new file mode 100644 index 0000000..4b48706 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.scss @@ -0,0 +1,76 @@ +.example-full-width{ + width: 100%; +} +::ng-deep { .min-padding > mat-dialog-container { + // background: black; + padding: 3%; + // overflow-y: scroll !important; + } +} +.view_more { + cursor: pointer; + color: #e00201 !important; + // text-decoration-line: underline; + // text-decoration-style: dotted; + // font-weight: bold; + +} +.text_change { + color: #e00201 !important; +} + .cdk-global-overlay-wrapper{ + justify-content: center !important; +} +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + // padding: 10px !important; +} +.mat-form-field { + width: 100%; +} +.mat-error { + color: #e00201; + float: right; +} + + +@-webkit-keyframes highlight-fade { + 0% { + background: orange; + } + 100% { + background: white; + } + } + @-moz-keyframes highlight-fade { + 0% { + background: orange; + } + 100% { + background: white; + } + } + @-ms-keyframes highlight-fade { + 0% { + background: orange; + } + 100% { + background: white; + } + } + @keyframes highlight-fade { + 0% { + background: orange; + } + 100% { + background: white; + } + } + .field_highlight { + -webkit-animation: highlight-fade 4s ease-out; + -moz-animation: highlight-fade 4s ease-out; + -o-animation: highlight-fade 4s ease-out; + animation: highlight-fade 4s ease-out; + // background: blue; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.spec.ts new file mode 100644 index 0000000..ee8ead3 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AnswerOptionCreateDialogComponent } from './answer-option-create-dialog.component'; + +describe('AnswerOptionCreateDialogComponent', () => { + let component: AnswerOptionCreateDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AnswerOptionCreateDialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AnswerOptionCreateDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.ts new file mode 100644 index 0000000..7caafe6 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/answer-option-create-dialog/answer-option-create-dialog.component.ts @@ -0,0 +1,183 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service'; +import { ReplaySubject } from 'rxjs'; +import { QuesFormService } from '../dynamic-form/ques-form/ques-form.service'; + +@Component({ + selector: 'app-answer-option-create-dialog', + templateUrl: './answer-option-create-dialog.component.html', + styleUrls: ['./answer-option-create-dialog.component.scss'] +}) +export class AnswerOptionCreateDialogComponent implements OnInit { + stateList:any = [] + cityList:any = [] + pincodeList:any = [] + + filteredstateList:ReplaySubject= new ReplaySubject(1) + filteredcityList:ReplaySubject = new ReplaySubject(1) + filteredpincodeList:ReplaySubject = new ReplaySubject(1) + + stateSearch:FormControl = new FormControl('') + citySearch:FormControl = new FormControl('') + pinSearch:FormControl = new FormControl('') + newAddressForm:FormGroup; + + field_appearance="outline" + errormsg: string = null; + + constructor(@Inject(MAT_DIALOG_DATA) public data:any, private _pdService:PdTrigerService, private _fb:FormBuilder, + private dialogRef:MatDialogRef, private quesService:QuesFormService) { + this.newAddressForm = this._fb.group({ + address:['',Validators.required], + state:['',Validators.required], + city:['',Validators.required], + pincode:['',Validators.required] + }) + console.log(this.data) + } + + ngOnInit() { + this._pdService.getAllMasterDatas('STATE').subscribe( + data => { + if (data.status == 200) { + this.stateList = data.records.filter(item => item.isactive == 1); + this.filteredstateList.next(this.stateList); + } + }); + this.filterList() + } + filterList() { + this.stateSearch.valueChanges.pipe().subscribe(()=>{ + this.applyFilter(this.stateSearch.value,this.filteredstateList,this.stateList,'name') + }) + this.citySearch.valueChanges.pipe().subscribe(()=>{ + this.applyFilter(this.citySearch.value,this.filteredcityList,this.cityList,'city_name') + }) + this.pinSearch.valueChanges.pipe().subscribe(()=>{ + this.applyFilter(this.pinSearch.value,this.filteredpincodeList,this.pincodeList,'pincode') + }) + + + } + 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) + ); + } + + //get city list details based on state id + getCityList(stateID: string) { + this._pdService.getStateWiseCities(stateID).subscribe(data => { + if (data.status == 200) { + this.cityList = data.records.cities; + this.pincodeList = data.records.pincode; + this.filteredcityList.next(this.cityList) + this.filteredpincodeList.next(this.pincodeList) + } + }); + } + addNewAddress() { + console.log(this.newAddressForm.getRawValue()) + if(this.newAddressForm.invalid) { + this.showMsg("Please Fill all the fields") + // this.findInvalidControls() + return; + } + let formValue=this.newAddressForm.getRawValue() + let params = {pd_id:this.data.pd_all_details.pdmaster_details.pd_id,file_id:null, addressline:formValue.address, state:formValue.state.state_id, city:formValue.city.city_id, pincode:formValue.pincode.pincode_id} + let display_address= formValue.address+ ', '+formValue.state.name+', '+formValue.city.city_name+', '+formValue.pincode.pincode + console.log(this.newAddressForm.getRawValue(),display_address) + this._pdService.saveNewSMCTempAddresses(params).subscribe(res=>{ + if(res['dataStatus']) { + this._pdService.getSMCTempAddresses(this.data.pd_all_details.pdmaster_details.pd_id).subscribe(rr=>{ + if(rr && rr['dataStatus'] && rr['records']) { + let address_data = this.quesService.convertArrayNames(["display","display"],rr['records']) + this.dialogRef.close({update:true, address_for_display:address_data}) + } + else { + this.dialogRef.close({update:false, error_msg:"Unable to get the address"}) + } + },err=> { + this.dialogRef.close({update:false, error_msg:"Network error. Unable to get the address"}) + }) + // this.dialogRef.close({update:true, address_for_display:display_address}) + } + else { + this.showMsg("Something went wrong") + } + },err=>{ + this.showMsg("Network Error") + }) + + } + showMsg(msg) { + this.errormsg = msg + setTimeout(()=>{ + this.errormsg = null + }, 3000) + } + public findInvalidControls() { + const invalid = []; + + for (const name in (this.newAddressForm.controls)) { + console.log(this.newAddressForm.controls[name],name) + if (this.newAddressForm.controls[name].invalid) { + invalid.push(name); + let invalidFields = [].slice.call(document.getElementsByClassName('ng-invalid')); + let firstInvalidField; + for(let val in invalidFields){ + if( invalidFields[val].nodeName == 'MAT-FORM-FIELD' || invalidFields[val].nodeName == 'MAT-SELECT' || invalidFields[val].nodeName == 'TEXTAREA' || invalidFields[val].nodeName == 'MAT-RADIO-GROUP' ){ //INPUT FOR INPUT FIELD + firstInvalidField=invalidFields[val] + + break; + } + } + + if(firstInvalidField != undefined){ + // firstInvalidField.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"}) + + setTimeout(()=>{ + firstInvalidField.scrollIntoView({block: "start", inline: "nearest"}) + setTimeout(()=>{ + firstInvalidField.focus() + },0) + // firstInvalidField.style.background = 'red' + firstInvalidField.classList.remove('field_highlight') + setTimeout(()=>{ + firstInvalidField.classList.add('field_highlight') + },300) + },300) + + } + break + } + } + + // } + // } + // let business_group_ctrl = formArray.at(2).get('business_group') as FormArray + // const controls = this.getQuestionControl().at(1)['controls'] + // for (const name in controls) { + // if (controls[name].invalid) { + // invalid.push(name); + // } + // } + return invalid; + } + + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html index 427fafc..144b51d 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html @@ -70,7 +70,8 @@ Select {{val.answer}} + [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer" + (click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option">add_circle_outline {{val.answer}} @@ -176,7 +177,8 @@ {{val.answer}} + [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer" + (click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option">add_circle_outline {{val.answer}} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.scss index fcb4546..3abfc47 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.scss @@ -78,4 +78,13 @@ mat-form-field { ::ng-deep .mat-form-field-label{ white-space: pre-wrap; + } + .large-select-option { + height: unset !important; + line-height: 1.2em !important; + padding-top: 0.9em !important; + padding-bottom: 0.9em !important; + span { + white-space: normal; + } } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts index c0c4fb8..d5a2e14 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts @@ -3,6 +3,8 @@ import { FormGroup, FormArray, FormControl, FormBuilder } from '@angular/forms'; import { QuesFormService } from '../ques-form/ques-form.service'; import { startWith, map } from 'rxjs/operators'; import { Observable, ReplaySubject } from 'rxjs'; +import { MatDialog } from '@angular/material'; +import { AnswerOptionCreateDialogComponent } from '../../answer-option-create-dialog/answer-option-create-dialog.component'; @Component({ selector: 'app-dynamic-question-template', @@ -25,7 +27,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { autoCompleteAns:Observable public commonFilterCtrl:FormControl = new FormControl(); public ngxFilteredValue:ReplaySubject = new ReplaySubject(1); - constructor(private quesService:QuesFormService,private _fb:FormBuilder) { } + constructor(private quesService:QuesFormService,private _fb:FormBuilder, private matDialog:MatDialog) { } ngOnInit() { this.parent_ques = this.currFormArrayObj @@ -715,6 +717,32 @@ export class DynamicQuestionTemplateComponent implements OnInit { this.quesService.settingArrayofValidators({validations:new_validations_obj,question_key:validation_obj.validation_to},this.formGroupN,'') } } + newAnswerCreateDialog(choosed_answer_obj,curr_ques_obj) { + console.log(curr_ques_obj,choosed_answer_obj) + if(choosed_answer_obj.is_others == '-1') { + this.formGroupN.get(curr_ques_obj.question_key).setValue('') + let dialog = this.matDialog.open(AnswerOptionCreateDialogComponent,{ + data:{pd_all_details:this.quesService.pd_all_details}, + disableClose: true, + width: '80vw', + maxHeight: '100vh', + panelClass:'min-padding' + }) + dialog.afterClosed().subscribe(rr=>{ + if(rr.update && rr.address_for_display && rr.address_for_display.length > 0) { + console.log(curr_ques_obj.answers,curr_ques_obj.answers.length -2,rr.address_for_display) + // curr_ques_obj.answers.splice(curr_ques_obj.answers.length -1,0,{answer:rr.address_for_display,answer_id:rr.address_for_display}) + curr_ques_obj.answers = rr.address_for_display + console.log(curr_ques_obj.answers,curr_ques_obj.answers[curr_ques_obj.answers.length-2].answer_id) + let lastAddress = curr_ques_obj.answers[curr_ques_obj.answers.length-1].answer_id && curr_ques_obj.answers[curr_ques_obj.answers.length-1].answer_id != null && curr_ques_obj.answers[curr_ques_obj.answers.length-1].is_others != -1 ? curr_ques_obj.answers[curr_ques_obj.answers.length-1].answer_id : curr_ques_obj.answers[curr_ques_obj.answers.length-2].answer_id + this.formGroupN.get(curr_ques_obj.question_key).patchValue(lastAddress) + } + else if(rr.hasOwnProperty('update') && rr.update == false){ + alert(rr.error_msg ? rr.error_msg : "Something went wrong while getting address") + } + }) + } + } updateValidationMsg(ques_control,validation_obj){ console.log("updae msg",ques_control,validation_obj); if(!ques_control) { 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 7ec6787..82ba84e 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 @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { FormGroup, FormArray, FormBuilder, FormControl, Validators } from '@angular/forms'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpParams } from '@angular/common/http'; import { environment } from 'environments/environment'; import { DatePipe } from '@angular/common'; @@ -285,6 +285,7 @@ export class QuesFormService { if(res['dataStatus']){ if(res.hasOwnProperty('records')){ res=res['records'] + // res.push({display:"Add New", id:"00",is_others:"-1"}) } if(val.api_properties.hasOwnProperty('filter_properties') && val.api_properties.filter_properties && res.length > 0) { let filter_properties = val.api_properties.filter_properties @@ -309,7 +310,19 @@ export class QuesFormService { return this.http.post(apiUrl+api_name,params) } else{ - return this.http.get(apiUrl+api_name) + let httpParams = new HttpParams() + if(params) { + let keysList = Object.keys(params) + if(keysList.length > 0) { + keysList.forEach(val=>{ + if(params[val] == 'VAR_PD_ID') { + params[val] = this.pd_all_details.pdmaster_details.pd_id + } + httpParams = httpParams.set(val,params[val]) + }) + } + } + return this.http.get(apiUrl+api_name,{params:httpParams}) } } @@ -323,7 +336,7 @@ export class QuesFormService { return { "answer_id" : obj[fieldName[0]], "answer":obj[fieldName[1]], - + "is_others":obj.is_others ? obj.is_others : '0' } }); return modified_json diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.module.ts index 6b8b17c..3d9cee8 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.module.ts @@ -17,6 +17,7 @@ import { ImageCaptureComponent } from './forms/image-capture/image-capture.compo import { CaptureBtnComponent } from './forms/image-capture/capture-btn/capture-btn.component'; import { Ng2ImgMaxModule } from 'ng2-img-max'; import { NgxViewerModule } from 'ngx-viewer'; +import { AnswerOptionCreateDialogComponent } from './forms/answer-option-create-dialog/answer-option-create-dialog.component'; const pdCustomNotifierOptions: NotifierOptions = { position: { @@ -74,7 +75,7 @@ const pdCustomNotifierOptions: NotifierOptions = { Ng2ImgMaxModule, NgxViewerModule ], - declarations: [StartPdComponent, FormComponent,DynamicFormComponent,DynamicQuestionTemplateComponent, ImageCaptureComponent,CaptureBtnComponent], - entryComponents:[FormComponent,ImageCaptureComponent] + declarations: [StartPdComponent, FormComponent,DynamicFormComponent,DynamicQuestionTemplateComponent, ImageCaptureComponent,CaptureBtnComponent, AnswerOptionCreateDialogComponent], + entryComponents:[FormComponent,ImageCaptureComponent,AnswerOptionCreateDialogComponent] }) export class StartPdModule { } diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 95784c2..b632494 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -889,5 +889,13 @@ loadTemplate(form_id) { let param = new HttpParams().set('city_id',city_id).set('usertype',user_type) return this._http.get(this.apiUrl+"getCMUsers",{params:param}) } + saveNewSMCTempAddresses(params) { + params = {records:params} + return this._http.post(this.apiUrl+'saveNewSMCTempAddresses',params) + } + getSMCTempAddresses(pd_id) { + let params = new HttpParams().set("pdid",pd_id) + return this._http.get(this.apiUrl+'getSMCTempAddresses',{params}) + } } diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json index 75642aa..40302fa 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json @@ -37,14 +37,24 @@ "is_pd_done_on_initiated_address" ], "questions":[ - { - "question":"Enter actual PD address", + { + "question":"Choose the actual PD address", "question_key":"alternative_address", "place_holder":"", "field_type":"string", - "type":"7", + "type":"3", "field_width":"100", - "api_properties":null, + "api_properties":{ + "api":"getSMCTempAddresses", + "api_method":"GET", + "params":{ + "pdid":"VAR_PD_ID" + }, + "fields":[ + "display", + "display" + ] + }, "onchange_properties":null, "is_repeatable":null, "is_subfield":"1", @@ -90,7 +100,7 @@ "question":"Type of PD address", "question_key":"address_type", "type":"3", - "field_width":"45", + "field_width":"90", "api_properties":{ "api":"getListOfMaster", "api_method":"POST", diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json index 1d817f0..7032ca8 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json @@ -336,80 +336,29 @@ ] }, { - "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":[ - - ] - }, - { - "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":[ - - ] - }, - { - "question":"City", - "question_key":"city", - "type":"8", - "field_width":"45", - "answers":null, - "api_properties":"local_city", - "onchange_properties":null, - "is_repeatable":null, - "validations":[ - - ] - }, - { - "question":"Pincode", - "question_key":"pincode", - "type":"8", - "field_width":"45", - "answers":null, - "api_properties":"local_pincode", - "onchange_properties":null, - "is_repeatable":null, - "validations":[ - - ] - }, + "question":"Address of the proposed property", + "question_key":"address", + "place_holder":"", + "field_type":"string", + "type":"3", + "field_width":"100", + "api_properties":{ + "api":"getSMCTempAddresses", + "api_method":"GET", + "params":{ + "pdid":"VAR_PD_ID" + }, + "fields":[ + "display", + "display" + ] + }, + "onchange_properties":null, + "is_repeatable":null, + "answers":null, + "validations":[ + ] + }, { "question":"Property Usage", "question_key":"property_usage", diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json index fcdb97b..d2c09c7 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json @@ -406,16 +406,25 @@ "question_key":"property_address", "place_holder":"", "field_type":"string", - "type":"7", - "field_width":"45", - "api_properties":null, + "type":"3", + "field_width":"100", + "api_properties":{ + "api":"getSMCTempAddresses", + "api_method":"GET", + "params":{ + "pdid":"VAR_PD_ID" + }, + "fields":[ + "display", + "display" + ] + }, "onchange_properties":null, "is_repeatable":null, "is_subfield":"1", "parent_question_key":"property_type", "answers":null, "validations":[ - ] } ]