Fairoj : SMC feedback completed

This commit is contained in:
venbatechnologies@gmail.com 2021-02-15 18:20:52 +05:30
parent a29e437e10
commit 0ac08f7f9a
21 changed files with 515 additions and 100 deletions

View File

@ -57,6 +57,7 @@ export class AllPdComponent implements OnInit, OnChanges {
user_id: any; user_id: any;
startIndex: number; startIndex: number;
endIndex: any; endIndex: any;
filtered_raw_data: any[];
constructor(private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,private userService:UserService, constructor(private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,private userService:UserService,
private _aws:AwsService,private loaderService:LoaderService) { private _aws:AwsService,private loaderService:LoaderService) {
this.LenderRoleID = localStorage.getItem('LenderRoleID'); this.LenderRoleID = localStorage.getItem('LenderRoleID');
@ -129,6 +130,7 @@ console.log(this.displayedColumns)
filterData(text) { filterData(text) {
if(!text) { if(!text) {
setTimeout(()=>{ setTimeout(()=>{
this.filtered_raw_data = []
this.pagedList .next(this.PdListData.slice(0, 10)); this.pagedList .next(this.PdListData.slice(0, 10));
},0) },0)
this.length = this.PdListData.length; this.length = this.PdListData.length;
@ -143,7 +145,10 @@ console.log(this.displayedColumns)
return false return false
}) })
setTimeout(()=>{ 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) },0)
// this.pa // this.pa
// this.length = this.pagedList.length // this.length = this.pagedList.length
@ -209,7 +214,8 @@ console.log(this.displayedColumns)
if(this.endIndex > this.length){ if(this.endIndex > this.length){
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) { pageChange(e) {

View File

@ -223,7 +223,7 @@
</mat-card-content> </mat-card-content>
<div [hidden]="recordStatus"> <div [hidden]="recordStatus">
<mat-paginator #paginator class="mat-elevation-z1" [length]="completedPdListData.length" [pageIndex]="pageIndex" [pageSize]="pageSize" <mat-paginator #paginator class="mat-elevation-z1" [length]="length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent=OnPageChange($event)" showFirstLastButtons> [pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent=OnPageChange($event)" showFirstLastButtons>
</mat-paginator> </mat-paginator>
</div> </div>

View File

@ -57,6 +57,7 @@ export class CompletedPdComponent implements OnInit, OnChanges {
user_id: any; user_id: any;
startIndex: any; startIndex: any;
endIndex: any; endIndex: any;
filtered_raw_data: any[];
constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService, constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService,
private _aws:AwsService, private loaderService:LoaderService) { private _aws:AwsService, private loaderService:LoaderService) {
this.notifier = notifier; this.notifier = notifier;
@ -171,7 +172,8 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID');
if(this.endIndex > this.length){ if(this.endIndex > this.length){
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) { pageChange(e) {
@ -307,6 +309,7 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID');
filterData(text) { filterData(text) {
if(!text) { if(!text) {
setTimeout(()=>{ setTimeout(()=>{
this.filtered_raw_data = []
this.pagedList .next(this.completedPdListData.slice(0, 10)); this.pagedList .next(this.completedPdListData.slice(0, 10));
},0) },0)
this.length = this.completedPdListData.length; this.length = this.completedPdListData.length;
@ -321,7 +324,10 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID');
return false return false
}) })
setTimeout(()=>{ 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) },0)
// this.pa // this.pa
// this.length = this.pagedList.length // this.length = this.pagedList.length

View File

@ -220,7 +220,7 @@
</mat-card-content> </mat-card-content>
<div [hidden]="recordStatus"> <div [hidden]="recordStatus">
<mat-paginator #paginator class="mat-elevation-z1" [length]="progressPdListData.length" [pageIndex]="pageIndex" [pageSize]="pageSize" <mat-paginator #paginator class="mat-elevation-z1" [length]="length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent=OnPageChange($event)" showFirstLastButtons> [pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent=OnPageChange($event)" showFirstLastButtons>
</mat-paginator> </mat-paginator>
</div> </div>

View File

@ -55,6 +55,7 @@ export class InprogressPdComponent implements OnInit, OnChanges {
user_id: any; user_id: any;
startIndex: any; startIndex: any;
endIndex: any; endIndex: any;
filtered_raw_data:any = [];
constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService, constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService,
private _aws:AwsService, private loaderService:LoaderService) { private _aws:AwsService, private loaderService:LoaderService) {
this.notifier = notifier; this.notifier = notifier;
@ -163,7 +164,8 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID');
if(this.endIndex > this.length){ if(this.endIndex > this.length){
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) { pageChange(e) {
@ -296,6 +298,7 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID');
filterData(text) { filterData(text) {
if(!text) { if(!text) {
setTimeout(()=>{ setTimeout(()=>{
this.filtered_raw_data = []
this.pagedList .next(this.progressPdListData.slice(0, 10)); this.pagedList .next(this.progressPdListData.slice(0, 10));
},0) },0)
this.length = this.progressPdListData.length; this.length = this.progressPdListData.length;
@ -310,7 +313,10 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID');
return false return false
}) })
setTimeout(()=>{ 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) },0)
// this.pa // this.pa
// this.length = this.pagedList.length // this.length = this.pagedList.length

View File

@ -3,7 +3,8 @@
<div fxLayout="row"> <div fxLayout="row">
<div fxFlex="50" class="pb-0 text-sm-left"> <div fxFlex="50" class="pb-0 text-sm-left">
<mat-form-field dividerColor="primary" style="width: 50%;"> <mat-form-field dividerColor="primary" style="width: 50%;">
<input matInput [(ngModel)]="filterValue" placeholder="Search"> <input matInput autocomplete="off" [(ngModel)]="filterValue" placeholder="Search">
<span matSuffix class="close_btn_filter" *ngIf="filterValue" (click)="filterValue = ''"><mat-icon>close</mat-icon></span>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="50" class="pb-0 text-sm-right" *ngIf="user_role_name != 'sales' && LenderRoleID != '26' && LenderRoleID != '27'"> <div fxFlex="50" class="pb-0 text-sm-right" *ngIf="user_role_name != 'sales' && LenderRoleID != '26' && LenderRoleID != '27'">

View File

@ -26,3 +26,10 @@
background-color: #fff !important; background-color: #fff !important;
float: right; float: right;
} }
.close_btn_filter{
color: gainsboro
}
.close_btn_filter:hover{
color: black;
cursor: pointer;
}

View File

@ -135,6 +135,7 @@ export class ListPdComponent implements OnInit, OnDestroy {
//get tab changes //get tab changes
onTabClick(event: MatTabChangeEvent) { onTabClick(event: MatTabChangeEvent) {
this.getTabIndex=event.index; 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.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(); this.getTabIndex==0 ? this.allTabC.loadPDDetails() : this.getTabIndex==1 ? this.inprogressTabC.loadPDDetails() : this.getTabIndex==2 ? this.completedTabC.loadPDDetails() : this.qcCompletedTabC.loadPDDetails();

View File

@ -0,0 +1,75 @@
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" style="padding: 1% !important;">
Add New Address
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<!-- <button *ngIf="data.fk_pd_type == 2" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate Vendor" matTooltipPosition="above" (click)="viewVendorOfficer()"><mat-icon>verified_user</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" mat-dialog-close matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content class="mat-typography" style="border-bottom: 2px solid #e2412f8f;">
<form [formGroup]="newAddressForm">
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap.xs="0" fxLayoutGap="10px">
<mat-form-field [appearance]="field_appearance" fxFlex="100%" >
<mat-label>Address</mat-label>
<textarea matInput formControlName="address" placeholder="Enter the address"></textarea>
<mat-error *ngIf="newAddressForm.get('address').hasError('required')">Required</mat-error>
</mat-form-field>
<mat-form-field [appearance]="field_appearance" fxFlex="30%" fxFlex.xs="100%">
<mat-label>State</mat-label>
<mat-select formControlName="state" (selectionChange)="getCityList($event.value.state_id)">
<mat-option>
<ngx-mat-select-search [formControl]="stateSearch"
[placeholderLabel]="'Search State...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let SL of filteredstateList | async" [value]="SL">
{{SL.name}}
</mat-option>
</mat-select>
<mat-error *ngIf="newAddressForm.get('state').hasError('required')">Required</mat-error>
</mat-form-field>
<mat-form-field [appearance]="field_appearance" fxFlex="45%" fxFlex.xs="100%">
<mat-label>City</mat-label>
<mat-select formControlName="city">
<mat-option>
<ngx-mat-select-search [formControl]="citySearch"
[placeholderLabel]="'Search City...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let CL of filteredcityList | async" [value]="CL">
{{CL.city_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="newAddressForm.get('city').hasError('required')">Required</mat-error>
</mat-form-field>
<mat-form-field [appearance]="field_appearance" fxFlex="20%" fxFlex.xs="100%">
<mat-label>Pincode</mat-label>
<mat-select formControlName="pincode">
<mat-option>
<ngx-mat-select-search [formControl]="pinSearch"
[placeholderLabel]="'Search Pincode...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let PL of filteredpincodeList | async" [value]="PL">{{PL.pincode}}</mat-option>
</mat-select>
<mat-error *ngIf="newAddressForm.get('pincode').hasError('required')">Required</mat-error>
</mat-form-field>
</div>
</form>
</mat-dialog-content>
<mat-dialog-actions align="end">
<div fxFlex="50" align="left">
<p *ngIf="errormsg" style="color: red;">{{errormsg}}</p>
</div>
<div fxFlex="50" align="right">
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button> -->
<button mat-raised-button mat-icon-button (click)="addNewAddress()" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Submit" matTooltipPosition="below"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>

View File

@ -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;
}

View File

@ -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<AnswerOptionCreateDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AnswerOptionCreateDialogComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AnswerOptionCreateDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -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<any>= new ReplaySubject<any>(1)
filteredcityList:ReplaySubject<any> = new ReplaySubject<any>(1)
filteredpincodeList:ReplaySubject<any> = new ReplaySubject<any>(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<AnswerOptionCreateDialogComponent>, 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 <any>(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;
}
}

View File

@ -70,7 +70,8 @@
<mat-select [formControlName]="parent_ques.question_key" (selectionChange)="onChangeProperty($event,parent_ques,'','','')"> <mat-select [formControlName]="parent_ques.question_key" (selectionChange)="onChangeProperty($event,parent_ques,'','','')">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let val of parent_ques.answers" <mat-option *ngFor="let val of parent_ques.answers"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option> [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer"
(click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option"><mat-icon *ngIf="val.is_others == '-1'">add_circle_outline</mat-icon> <span>{{val.answer}}</span></mat-option>
</mat-select> </mat-select>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="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())"> <mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
@ -176,7 +177,8 @@
<mat-option <mat-option
*ngFor="let val of ngxFilteredValue | async" *ngFor="let val of ngxFilteredValue | async"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option> [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer"
(click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option"><mat-icon *ngIf="val.is_others == '-1'">add_circle_outline</mat-icon> <span>{{val.answer}}</span></mat-option>
</mat-select> </mat-select>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="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())"> <mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">

View File

@ -78,4 +78,13 @@ mat-form-field {
::ng-deep .mat-form-field-label{ ::ng-deep .mat-form-field-label{
white-space: pre-wrap; 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;
}
} }

View File

@ -3,6 +3,8 @@ import { FormGroup, FormArray, FormControl, FormBuilder } from '@angular/forms';
import { QuesFormService } from '../ques-form/ques-form.service'; import { QuesFormService } from '../ques-form/ques-form.service';
import { startWith, map } from 'rxjs/operators'; import { startWith, map } from 'rxjs/operators';
import { Observable, ReplaySubject } from 'rxjs'; import { Observable, ReplaySubject } from 'rxjs';
import { MatDialog } from '@angular/material';
import { AnswerOptionCreateDialogComponent } from '../../answer-option-create-dialog/answer-option-create-dialog.component';
@Component({ @Component({
selector: 'app-dynamic-question-template', selector: 'app-dynamic-question-template',
@ -25,7 +27,7 @@ export class DynamicQuestionTemplateComponent implements OnInit {
autoCompleteAns:Observable<string[]> autoCompleteAns:Observable<string[]>
public commonFilterCtrl:FormControl = new FormControl(); public commonFilterCtrl:FormControl = new FormControl();
public ngxFilteredValue:ReplaySubject<any> = new ReplaySubject<any>(1); public ngxFilteredValue:ReplaySubject<any> = new ReplaySubject<any>(1);
constructor(private quesService:QuesFormService,private _fb:FormBuilder) { } constructor(private quesService:QuesFormService,private _fb:FormBuilder, private matDialog:MatDialog) { }
ngOnInit() { ngOnInit() {
this.parent_ques = this.currFormArrayObj 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,'') 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){ updateValidationMsg(ques_control,validation_obj){
console.log("updae msg",ques_control,validation_obj); console.log("updae msg",ques_control,validation_obj);
if(!ques_control) { if(!ques_control) {

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { FormGroup, FormArray, FormBuilder, FormControl, Validators } from '@angular/forms'; 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 { environment } from 'environments/environment';
import { DatePipe } from '@angular/common'; import { DatePipe } from '@angular/common';
@ -285,6 +285,7 @@ export class QuesFormService {
if(res['dataStatus']){ if(res['dataStatus']){
if(res.hasOwnProperty('records')){ if(res.hasOwnProperty('records')){
res=res['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) { if(val.api_properties.hasOwnProperty('filter_properties') && val.api_properties.filter_properties && res.length > 0) {
let filter_properties = val.api_properties.filter_properties let filter_properties = val.api_properties.filter_properties
@ -309,7 +310,19 @@ export class QuesFormService {
return this.http.post(apiUrl+api_name,params) return this.http.post(apiUrl+api_name,params)
} }
else{ 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 { return {
"answer_id" : obj[fieldName[0]], "answer_id" : obj[fieldName[0]],
"answer":obj[fieldName[1]], "answer":obj[fieldName[1]],
"is_others":obj.is_others ? obj.is_others : '0'
} }
}); });
return modified_json return modified_json

View File

@ -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 { CaptureBtnComponent } from './forms/image-capture/capture-btn/capture-btn.component';
import { Ng2ImgMaxModule } from 'ng2-img-max'; import { Ng2ImgMaxModule } from 'ng2-img-max';
import { NgxViewerModule } from 'ngx-viewer'; import { NgxViewerModule } from 'ngx-viewer';
import { AnswerOptionCreateDialogComponent } from './forms/answer-option-create-dialog/answer-option-create-dialog.component';
const pdCustomNotifierOptions: NotifierOptions = { const pdCustomNotifierOptions: NotifierOptions = {
position: { position: {
@ -74,7 +75,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
Ng2ImgMaxModule, Ng2ImgMaxModule,
NgxViewerModule NgxViewerModule
], ],
declarations: [StartPdComponent, FormComponent,DynamicFormComponent,DynamicQuestionTemplateComponent, ImageCaptureComponent,CaptureBtnComponent], declarations: [StartPdComponent, FormComponent,DynamicFormComponent,DynamicQuestionTemplateComponent, ImageCaptureComponent,CaptureBtnComponent, AnswerOptionCreateDialogComponent],
entryComponents:[FormComponent,ImageCaptureComponent] entryComponents:[FormComponent,ImageCaptureComponent,AnswerOptionCreateDialogComponent]
}) })
export class StartPdModule { } export class StartPdModule { }

View File

@ -889,5 +889,13 @@ loadTemplate(form_id) {
let param = new HttpParams().set('city_id',city_id).set('usertype',user_type) let param = new HttpParams().set('city_id',city_id).set('usertype',user_type)
return this._http.get(this.apiUrl+"getCMUsers",{params:param}) 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})
}
} }

View File

@ -37,14 +37,24 @@
"is_pd_done_on_initiated_address" "is_pd_done_on_initiated_address"
], ],
"questions":[ "questions":[
{ {
"question":"Enter actual PD address", "question":"Choose the actual PD address",
"question_key":"alternative_address", "question_key":"alternative_address",
"place_holder":"", "place_holder":"",
"field_type":"string", "field_type":"string",
"type":"7", "type":"3",
"field_width":"100", "field_width":"100",
"api_properties":null, "api_properties":{
"api":"getSMCTempAddresses",
"api_method":"GET",
"params":{
"pdid":"VAR_PD_ID"
},
"fields":[
"display",
"display"
]
},
"onchange_properties":null, "onchange_properties":null,
"is_repeatable":null, "is_repeatable":null,
"is_subfield":"1", "is_subfield":"1",
@ -90,7 +100,7 @@
"question":"Type of PD address", "question":"Type of PD address",
"question_key":"address_type", "question_key":"address_type",
"type":"3", "type":"3",
"field_width":"45", "field_width":"90",
"api_properties":{ "api_properties":{
"api":"getListOfMaster", "api":"getListOfMaster",
"api_method":"POST", "api_method":"POST",

View File

@ -336,80 +336,29 @@
] ]
}, },
{ {
"question":"Address of the proposed property", "question":"Address of the proposed property",
"question_key":"address", "question_key":"address",
"place_holder":"Enter door no,street", "place_holder":"",
"type":"7", "field_type":"string",
"answers":null, "type":"3",
"api_properties":null, "field_width":"100",
"onchange_properties":null, "api_properties":{
"is_repeatable":null, "api":"getSMCTempAddresses",
"field_type":"string", "api_method":"GET",
"validations":[ "params":{
"pdid":"VAR_PD_ID"
] },
}, "fields":[
{ "display",
"question":"State", "display"
"question_key":"state", ]
"type":"8", },
"field_width":"45", "onchange_properties":null,
"answers":null, "is_repeatable":null,
"api_properties":{ "answers":null,
"api":"getListOfMaster", "validations":[
"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":"Property Usage", "question":"Property Usage",
"question_key":"property_usage", "question_key":"property_usage",

View File

@ -406,16 +406,25 @@
"question_key":"property_address", "question_key":"property_address",
"place_holder":"", "place_holder":"",
"field_type":"string", "field_type":"string",
"type":"7", "type":"3",
"field_width":"45", "field_width":"100",
"api_properties":null, "api_properties":{
"api":"getSMCTempAddresses",
"api_method":"GET",
"params":{
"pdid":"VAR_PD_ID"
},
"fields":[
"display",
"display"
]
},
"onchange_properties":null, "onchange_properties":null,
"is_repeatable":null, "is_repeatable":null,
"is_subfield":"1", "is_subfield":"1",
"parent_question_key":"property_type", "parent_question_key":"property_type",
"answers":null, "answers":null,
"validations":[ "validations":[
] ]
} }
] ]