feedbacks issue fix

This commit is contained in:
venbainfotech 2022-02-05 16:14:42 +05:30
parent a130ae554c
commit 9660b8944a
13 changed files with 184 additions and 79 deletions

View File

@ -3,8 +3,8 @@
"version": "0.0.0", "version": "0.0.0",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"production": "node --max_old_space_size=6144 node_modules/@angular/cli/bin/ng build --prod --build-optimizer=true --base-href /salespdpwa/", "production": "node --max_old_space_size=6144 node_modules/@angular/cli/bin/ng build --prod --build-optimizer=true --base-href",
"staging": "node --max_old_space_size=6144 node_modules/@angular/cli/bin/ng build --prod --configuration=staging --base-href /salespdpwa/", "staging": "node --max_old_space_size=6144 node_modules/@angular/cli/bin/ng build --prod --configuration=staging --base-href",
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build",

View File

@ -1,4 +1,4 @@
<button (click)="capture($event)" mat-button mat-raised-button>Capture <button (click)="capture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<mat-icon name="camera" *ngIf="!addMoreBtn">camera_alt</mat-icon> <mat-icon name="camera" *ngIf="!addMoreBtn">camera_alt</mat-icon>
<mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon> <mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon>
</button> </button>

View File

@ -1,5 +1,6 @@
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { Ng2ImgMaxService } from 'ng2-img-max'; import { Ng2ImgMaxService } from 'ng2-img-max';
import { LoaderService } from 'app/shared/loaderService/loader.service';
@Component({ @Component({
selector: 'app-capture-btn', selector: 'app-capture-btn',
@ -11,19 +12,27 @@ export class CaptureBtnComponent implements OnInit {
@Input() addMoreBtn; @Input() addMoreBtn;
@Output() imageDataEmitter = new EventEmitter @Output() imageDataEmitter = new EventEmitter
@Output() singleDataEmitter = new EventEmitter @Output() singleDataEmitter = new EventEmitter
sales_pd_type: string;
constructor(private ng2ImgMax:Ng2ImgMaxService) { } constructor(private ng2ImgMax:Ng2ImgMaxService,private loaderService:LoaderService) {
this.sales_pd_type = localStorage.getItem('sales_pd_type')
console.log(this.sales_pd_type)
}
ngOnInit(): void { ngOnInit(): void {
console.log(this.addMoreBtn) console.log(this.addMoreBtn)
} }
capturedImage(event){ capturedImage(event){
this.loaderService.showMatSpinnerDialog('Fetching Data...')
console.log(event); console.log(event);
let imageData= event.target.files[0] let imageData= event.target.files[0]
this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe( this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe(
result => { result => {
this.imageDataEmitter.emit(result) this.imageDataEmitter.emit(result)
this.singleDataEmitter.emit(result) this.singleDataEmitter.emit(result)
this.loaderService.closeMatSpinnerDialog()
}, },
error => { error => {
console.log('😢 Oh no!', error); console.log('😢 Oh no!', error);

View File

@ -10,13 +10,19 @@
<div *ngIf="parent_ques.get('is_repeatable').value != '1'"> <div *ngIf="parent_ques.get('is_repeatable').value != '1'">
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':parent_ques.get('field_type').value == 'numtoword' ? '5%' : '0' }"> <mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':parent_ques.get('field_type').value == 'numtoword' ? '5%' : '0' }">
<mat-label>{{parent_ques.get('question').value}}</mat-label> <mat-label>{{parent_ques.get('question').value}}</mat-label>
<input matInput [type]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'number' : parent_ques.get('field_type').value == 'string' ? 'text' : parent_ques.get('field_type').value" formControlName="answer_value" <textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
[type]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'number' : parent_ques.get('field_type').value == 'string' ? 'text' : parent_ques.get('field_type').value" formControlName="answer_value"
[placeholder]="parent_ques.value.hasOwnProperty('place_holder') ? parent_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)"></textarea>
<!--<input matInput [type]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'number' : parent_ques.get('field_type').value == 'string' ? 'text' : parent_ques.get('field_type').value" formControlName="answer_value"
[placeholder]="parent_ques.value.hasOwnProperty('place_holder') ? parent_ques.get('place_holder').value : ''" [placeholder]="parent_ques.value.hasOwnProperty('place_holder') ? parent_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)" autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)"
> > -->
<!-- [placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" --> <!--[placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" -->
<mat-hint *ngIf="parent_ques.get('answer_value').value != '' && parent_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 12px;">{{"&#8377;"}}{{parent_ques.get('answer_value').value | numberToWords}}</mat-hint> <mat-hint *ngIf="parent_ques.get('answer_value').value != '' && parent_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 12px;">{{"&#8377;"}}{{parent_ques.get('answer_value').value | numberToWords}}</mat-hint>
<!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> --> <!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error"> <ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
@ -52,7 +58,6 @@
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error> <mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container> </ng-container>
</div> </div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '4'"> <mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '4'">
<mat-label>{{parent_ques.get('question').value}}</mat-label> <mat-label>{{parent_ques.get('question').value}}</mat-label>
<mat-select multiple formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)"> <mat-select multiple formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
@ -77,8 +82,8 @@
</div> </div>
<div fxLayout="row" style="justify-content: center"> <div fxLayout="row" style="justify-content: center">
<div fxLayout="column"> <div fxLayout="column">
<span > <span>
<app-single-capture-btn class="file-btn" (singleDataEmitter)="captureImg($event,p_i,parent_ques)" ></app-single-capture-btn> <app-single-capture-btn class="file-btn" (singleDataEmitter)="captureImg($event,p_i,parent_ques)"></app-single-capture-btn>
</span> </span>
<!-- <button mat-raised clear color="optblue" [disabled]="sales_pd_type == '2'" (click)="captureImg(p_i,parent_ques)"><mat-icon style="font-size: 30px" name="md-camera"></mat-icon></button> --> <!-- <button mat-raised clear color="optblue" [disabled]="sales_pd_type == '2'" (click)="captureImg(p_i,parent_ques)"><mat-icon style="font-size: 30px" name="md-camera"></mat-icon></button> -->
</div> </div>
@ -103,19 +108,20 @@
</div> </div>
<hr/> <hr/>
</div> </div>
<!-- </ion-grid> --> <!-- </ion-grid> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error"> <ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error> <mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
</ng-container> </ng-container>
<!-- <ng-container ngProjectAs="mat-hint"> <!-- <ng-container ngProjectAs="mat-hint">
<mat-error align="end">Please capture the image</mat-error> <mat-error align="end">Please capture the image</mat-error>
</ng-container> --> </ng-container>-->
</div> </div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '7'"> <mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '7'">
<mat-label>{{parent_ques.get('question').value}}</mat-label> <mat-label>{{parent_ques.get('question').value}}</mat-label>
<textarea matInput type="text" rows="3" formControlName="answer_value" placeholder="Enter the Text" <textarea style="overflow: hidden !important;" matInput type="text" cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5" formControlName="answer_value" placeholder="Enter the Text"
autocomplete="off" ></textarea> autocomplete="off" ></textarea>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> --> <!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error"> <ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
@ -178,9 +184,16 @@
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'numtoword' ? '5%' : '0' : '' }"> <mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'numtoword' ? '5%' : '0' : '' }">
<mat-label>{{single_ques.get('question').value}}</mat-label> <mat-label>{{single_ques.get('question').value}}</mat-label>
<input matInput [type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value" <textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
[type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value"
[placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''" [placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)"> autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)"></textarea>
<!-- <input matInput [type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value"
[placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)"> -->
<mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.value.hasOwnProperty('field_type') && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"&#8377;"}}{{single_ques.get('answer_value').value | numberToWords}}</mat-hint> <mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.value.hasOwnProperty('field_type') && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"&#8377;"}}{{single_ques.get('answer_value').value | numberToWords}}</mat-hint>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> --> <!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error"> <ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
@ -230,8 +243,11 @@
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '7'"> <mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '7'">
<mat-label>{{single_ques.get('question').value}}</mat-label> <mat-label>{{single_ques.get('question').value}}</mat-label>
<textarea matInput type="text" rows="3" formControlName="answer_value" placeholder="Enter the Text" <textarea style="overflow: hidden !important;" cdkTextareaAutosize
autocomplete="off" ></textarea> #autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5" matInput type="text" rows="3" formControlName="answer_value" placeholder="Enter the Text"
></textarea>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> --> <!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error"> <ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error> <mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
@ -263,8 +279,14 @@
<mat-form-field style="width: 100%" > <mat-form-field style="width: 100%" >
<mat-label>{{single_ques.get('subfield_caption').value}}</mat-label> <mat-label>{{single_ques.get('subfield_caption').value}}</mat-label>
<input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text" <textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
autocomplete="off"> #autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"></textarea>
<!-- <input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"> -->
</mat-form-field> </mat-form-field>
<!-- </div> --> <!-- </div> -->
</div> </div>
@ -400,8 +422,14 @@
<mat-form-field style="width: 100%" > <mat-form-field style="width: 100%" >
<mat-label>{{parent_ques.get('subfield_caption').value}}</mat-label> <mat-label>{{parent_ques.get('subfield_caption').value}}</mat-label>
<input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text" <textarea style="overflow: hidden !important;" matInput cdkTextareaAutosize
autocomplete="off"> #autosize="cdkTextareaAutosize"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"></textarea>
<!-- <input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text"
autocomplete="off"> -->
</mat-form-field> </mat-form-field>
<!-- </div> --> <!-- </div> -->
</div> </div>

View File

@ -46,3 +46,29 @@
// background-color: red; // background-color: red;
// } // }
} }
// textarea.mat-input-element {
// overflow: hidden !important;
// }
::ng-deep .mat-select-value-text{
line-height: initial !important;
word-wrap: break-word !important;
white-space: pre-wrap !important;
}
::ng-deep .mat-select-value-text {
margin: 1rem 0;
overflow: visible;
line-height: initial;
word-wrap: break-word;
white-space: pre-wrap;
}
.mat-option-text.mat-option-text {
white-space: normal;
}
::ng-deep .mat-select-panel mat-option.mat-option {
height: unset;
}
::ng-deep .mat-option-text.mat-option-text {
white-space: normal;
}

View File

@ -9,6 +9,7 @@ import { FormGroup, FormArray, FormBuilder, FormControl,FormControlName } from '
import { NotifierService } from 'angular-notifier'; import { NotifierService } from 'angular-notifier';
import { takeUntil, single } from 'rxjs/operators'; import { takeUntil, single } from 'rxjs/operators';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
//import { LoadingProvider } from '../../../../providers/common-provider/loading'; //import { LoadingProvider } from '../../../../providers/common-provider/loading';
//import { NavController } from 'ionic-angular/navigation/nav-controller'; //import { NavController } from 'ionic-angular/navigation/nav-controller';
import { Section9, Section1, Section2, Section3, Section4, Section5, Section6, Section7, Section8 } from '../../home/home'; import { Section9, Section1, Section2, Section3, Section4, Section5, Section6, Section7, Section8 } from '../../home/home';
@ -62,6 +63,7 @@ export class QuesTemplateComponent {
original_result_data: any={is_complete:''}; original_result_data: any={is_complete:''};
// spinner_access:boolean=false // spinner_access:boolean=false
raw_data_Section: any={status:''}; raw_data_Section: any={status:''};
@ViewChild('autosize') autosize: CdkTextareaAutosize;
@ViewChild('accordion') Accordion: MatAccordion @ViewChild('accordion') Accordion: MatAccordion
@ViewChild('mapanel') matExpansionPanel:MatExpansionPanel @ViewChild('mapanel') matExpansionPanel:MatExpansionPanel
@Output() imageDataEmitter = new EventEmitter @Output() imageDataEmitter = new EventEmitter
@ -109,7 +111,7 @@ export class QuesTemplateComponent {
if(raw_data_ques.hasOwnProperty('sections') ){ if(raw_data_ques.hasOwnProperty('sections') ){
console.log("FROM COMPONENT",this.questions_JSON); console.log("FROM COMPONENT",this.questions_JSON);
//this.local_ques_JSON={"section_id":"1","section_name":"General Section","onsubmit":null,"questions":[{"question":"Name of The Main Loan Applicant","question_key":"main_loan_applicant","place_holder":"Enter text","type":"1","answers":null,"api_properties":null,"is_repeatable":null,"field_type":"string","validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"Main Loan Applicant Name Required","value":null},{"name":"pattern","isactive":"1","validator":"[A-Za-z ]*","message":"alphabets only ","value":null}],"onchange_properties":null},{"question":"Name of the Company/Firm","question_key":"company_name","place_holder":"Enter text","type":"1","answers":null,"api_properties":null,"onchange_properties":null,"is_repeatable":null,"field_type":"string","validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"Company Name Required","value":null}]},{"question":"Name of Person Met during visit","question_key":"person_met_during_visit","place_holder":"Enter text","type":"1","answers":null,"api_properties":null,"onchange_properties":null,"is_repeatable":null,"field_type":"string","validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"Person Met Name Required","value":null},{"name":"pattern","isactive":"1","validator":"[A-Za-z ]*","message":"alphabets only ","value":null}]},{"question":"Address Visited","question_key":"address_visited","place_holder":"Enter door no,street","type":"1","answers":null,"api_properties":null,"onchange_properties":null,"is_repeatable":null,"field_type":"string","validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"Address Required","value":null}]},{"question":"State","question_key":"state","type":"8","answers":null,"api_properties":{"api":"getListOfMaster","api_method":"POST","params":{"master_name":"STATE"},"fields":["state_id","name"]},"onchange_properties":[{"purpose":"api","api":"getListOfStatesAndCities","api_method":"POST","params":"{records:{state_id:'value_of_answer'}}","fields":["state_id","name"],"local_variable":"local_city"}],"is_repeatable":null,"validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"State Required","value":null}]},{"question":"City","question_key":"city","type":"8","answers":null,"api_properties":"local_city","onchange_properties":null,"is_repeatable":null,"validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"CIty Required","value":null}]},{"question":"Pincode","question_key":"pincode","type":"8","answers":null,"api_properties":"local_pincode","onchange_properties":[{"purpose":"FORM_CTRL","form_controls":[{"insert_index":"pincode","expression":"(pincode == 1)","value_keys":["pincode"],"questions":[{"question_key":"pincode_others","question":"Specify the Pincode","place_holder":"Enter the Pincode","type":"1","api_properties":null,"answers":null,"onchange_properties":null,"is_repeatable":null,"field_type":"num","validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"Pincode is Required","value":null},{"name":"pattern","isactive":"1","validator":"[0-9]{6}","message":"Pincode should be 6 digit","value":null}]}]}]}],"is_repeatable":null,"validations":[{"name":"required","isactive":"1","validator":"Validators.required","message":"Pincode Required","value":null}]}],"order_id":1}
this.local_ques_JSON=this.questions_JSON; this.local_ques_JSON=this.questions_JSON;
if(this.local_ques_JSON.section_id == raw_data_ques.sections[raw_data_ques.sections.length -1].section_id){ if(this.local_ques_JSON.section_id == raw_data_ques.sections[raw_data_ques.sections.length -1].section_id){
this.submit_btn=true this.submit_btn=true
@ -117,8 +119,9 @@ export class QuesTemplateComponent {
} }
console.log('99',this.local_ques_JSON.section_id) console.log('99',this.local_ques_JSON.section_id)
this.quesAnsForm=this.questionService.assignFormControl_array(this.quesAnsForm,this.local_ques_JSON.questions) this.quesAnsForm = this.questionService.assignFormControl_array(this.quesAnsForm,this.local_ques_JSON.questions)
console.log(this.quesAnsForm); console.log(this.quesAnsForm);
// localStorage.setItem('sales_pd_id_PRIMARYKEY', 'null') // localStorage.setItem('sales_pd_id_PRIMARYKEY', 'null')
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY') let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
@ -161,7 +164,7 @@ this.sales_pd_type = localStorage.getItem('sales_pd_type')
getSalesPDSectionFromApi(sales_pd_id){ getSalesPDSectionFromApi(sales_pd_id){
// alert('pass'); // alert('pass');
console.log(sales_pd_id) console.log(sales_pd_id)
this.loaderService.showMatSpinnerDialog('Fetching Data...') // this.loaderService.showMatSpinnerDialog('Fetching Data...')
// this.checkGroupandPatchValues() // this.checkGroupandPatchValues()
// this.loadingProvider.pdloader("Fetching Data...") // this.loadingProvider.pdloader("Fetching Data...")
let params={sales_pd_id:sales_pd_id,section_id:this.local_ques_JSON.section_id} let params={sales_pd_id:sales_pd_id,section_id:this.local_ques_JSON.section_id}
@ -187,7 +190,8 @@ this.sales_pd_type = localStorage.getItem('sales_pd_type')
// FOR DISPLAYING THE CUSTOMER CAPTURED IMAGE (STRUCTURED DYNAMICALLY CREATED IN FRONTEND) (***TELE PD ONLY***) // FOR DISPLAYING THE CUSTOMER CAPTURED IMAGE (STRUCTURED DYNAMICALLY CREATED IN FRONTEND) (***TELE PD ONLY***)
if(sales_pd_id && this.sales_pd_type && this.sales_pd_type == '2' && this.local_ques_JSON.section_id == '9' && !this. sales_pd_id.includes('local')) { if(sales_pd_id && this.sales_pd_type && this.sales_pd_type == '2' && this.local_ques_JSON.section_id == '9' && !this. sales_pd_id.includes('local')) {
this.SalesPdService.getData_fromLocal('sales_rand_string').then((sales_rand_string)=>{ let sales_rand_string = localStorage.getItem('sales_rand_string')
// this.SalesPdService.getData_fromLocal('sales_rand_string').then((sales_rand_string)=>{
let params = {"rand_string":sales_rand_string} let params = {"rand_string":sales_rand_string}
this.SalesPdService.getSalesPDImgDataCusLink(params).subscribe(result=>{ this.SalesPdService.getSalesPDImgDataCusLink(params).subscribe(result=>{
if(result['dataStatus']){ if(result['dataStatus']){
@ -198,7 +202,7 @@ this.sales_pd_type = localStorage.getItem('sales_pd_type')
},err=>{ },err=>{
this.loaderService.closeMatSpinnerDialog() this.loaderService.closeMatSpinnerDialog()
}) })
}) // })
} }
else{ else{
// alert('5th'); // alert('5th');
@ -1319,6 +1323,7 @@ this.proceedonChangeProperty(modified)
return updateMsg; return updateMsg;
} }
onSubmitProperty(sales_pd_id = this.sales_pd_id){ onSubmitProperty(sales_pd_id = this.sales_pd_id){
// this.loaderService.showMatSpinnerDialog('Please wait...')
console.log(this.sales_pd_id) console.log(this.sales_pd_id)
let return_val=[] let return_val=[]
let send_val:boolean=true let send_val:boolean=true
@ -1640,6 +1645,9 @@ this.proceedonChangeProperty(modified)
// } // }
} }
sendSectiontoApi(params){ sendSectiontoApi(params){
setTimeout(()=>{
this.loaderService.showMatSpinnerDialog('Please wait...')
},1200)
// alert('lastsave'); // alert('lastsave');
console.log('lastsave'); console.log('lastsave');
console.log(params); console.log(params);
@ -1649,7 +1657,7 @@ this.proceedonChangeProperty(modified)
if(response.dataStatus){ if(response.dataStatus){
console.log('response',response); console.log('response',response);
// alert('saved successfully'); // alert('saved successfully');
this.loaderService.closeMatSpinnerDialog() // this.loaderService.closeMatSpinnerDialog()
this.notifier.notify("success","Saved Successfully"); this.notifier.notify("success","Saved Successfully");
// let product_id=localStorage.getItem('product_id_salesPD') // let product_id=localStorage.getItem('product_id_salesPD')
// this.router.navigate(['../../sectionlist',product_id,this.sales_pd_type],{ relativeTo: this.route }) // this.router.navigate(['../../sectionlist',product_id,this.sales_pd_type],{ relativeTo: this.route })
@ -1780,7 +1788,7 @@ this.proceedonChangeProperty(modified)
// this.navCtrl.pop(); // this.navCtrl.pop();
// }) // })
} }
this.loaderService.closeMatSpinnerDialog(); // this.loaderService.closeMatSpinnerDialog();
this.loaderService.closeMatSpinnerDialog() this.loaderService.closeMatSpinnerDialog()
},err=>{ },err=>{
this.loaderService.closeMatSpinnerDialog(); this.loaderService.closeMatSpinnerDialog();

View File

@ -1,4 +1,4 @@
<button (click)="singlecapture($event)" mat-button mat-raised-button>Capture <button (click)="singlecapture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<mat-icon name="camera" *ngIf="!addMoreBtn">camera_alt</mat-icon> <mat-icon name="camera" *ngIf="!addMoreBtn">camera_alt</mat-icon>
<mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon> <mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon>
</button> </button>

View File

@ -1,5 +1,6 @@
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { Ng2ImgMaxService } from 'ng2-img-max'; import { Ng2ImgMaxService } from 'ng2-img-max';
import { LoaderService } from 'app/shared/loaderService/loader.service';
@Component({ @Component({
selector: 'app-single-capture-btn', selector: 'app-single-capture-btn',
@ -12,19 +13,26 @@ export class SingleCaptureBtnComponent implements OnInit {
@Input() addMoreBtn; @Input() addMoreBtn;
@Output() singleDataEmitter = new EventEmitter @Output() singleDataEmitter = new EventEmitter
sales_pd_type: string;
constructor(private ng2ImgMax:Ng2ImgMaxService) { } constructor(private ng2ImgMax:Ng2ImgMaxService,private loaderService:LoaderService) {
this.sales_pd_type = localStorage.getItem('sales_pd_type')
console.log(this.sales_pd_type)
}
ngOnInit(): void { ngOnInit(): void {
console.log(this.addMoreBtn) console.log(this.addMoreBtn)
} }
singlecapturedImage(event){ singlecapturedImage(event){
this.loaderService.showMatSpinnerDialog('Fetching Data...')
console.log(event); console.log(event);
let imageData= event.target.files[0] let imageData= event.target.files[0]
this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe( this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe(
result => { result => {
this.singleDataEmitter.emit(result) this.singleDataEmitter.emit(result)
this.loaderService.closeMatSpinnerDialog()
}, },
error => { error => {
console.log('😢 Oh no!', error); console.log('😢 Oh no!', error);

View File

@ -63,7 +63,7 @@ export class SalesPdComponent implements OnInit {
this.is_sales_login = false this.is_sales_login = false
this.getListofPD() this.getListofPD()
} }
},1000) },2000)
setTimeout(()=>{ setTimeout(()=>{
this.common = JSON.parse(localStorage.getItem('commonSettings')) this.common = JSON.parse(localStorage.getItem('commonSettings'))

View File

@ -6,13 +6,20 @@
<h4 class="mt-0">Section List</h4> <h4 class="mt-0">Section List</h4>
</div> </div>
<div fxFlex="33" align="end"> <div fxFlex="33" align="end">
<button *ngIf="customer_link != '' && sales_pd_type == '2'" mat-raised-button mat-icon-button class="hover-icon" type="button" matTooltip="Copy Link" matTooltipPosition="above" (click)="copyToClipBoard(customer_link_with_text, 'Customer Link is copied')"><mat-icon>file_copy</mat-icon></button>&nbsp;&nbsp;
<!-- <button *ngIf="customer_link != '' && sales_pd_type == '2'" mat-raised-button mat-icon-button class="hover-icon" type="button" matTooltip="Send Link vai SMS" matTooltipPosition="above" (click)="shareViaSMS()" ><mat-icon>textsms</mat-icon>
<ion-label >Send Link via SMS</ion-label>
</button>&nbsp;&nbsp; -->
<!-- <a href={{link}} target={{link}}> <!-- <a href={{link}} target={{link}}>
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="link" matTooltipPosition="above"><mat-icon>link</mat-icon></button></a> &nbsp;&nbsp; --> <button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="link" matTooltipPosition="above"><mat-icon>link</mat-icon></button></a> &nbsp;&nbsp; -->
<!-- <button *ngIf="is_sync_btn" mat-raised-button mat-icon-button (click)="syncPDWithSections()"><mat-icon>sync</mat-icon>&nbsp;&nbsp;Sync</button> --> <!-- <button *ngIf="is_sync_btn" mat-raised-button mat-icon-button (click)="syncPDWithSections()"><mat-icon>sync</mat-icon>&nbsp;&nbsp;Sync</button> -->
<!-- <h4 class="mt-0"> --> <!-- <h4 class="mt-0"> -->
<!-- <span *ngIf="pdMasterList.subproduct_name">/{{pdMasterList.subproduct_name}}</span>&nbsp; --> <!-- <span *ngIf="pdMasterList.subproduct_name">/{{pdMasterList.subproduct_name}}</span>&nbsp; -->
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Close" matTooltipPosition="above" <button mat-raised-button mat-icon-button class="hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button> (click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button>
<!-- </h4> --> <!-- </h4> -->

View File

@ -392,9 +392,11 @@ export class SectionListComponent implements OnInit {
this.getSectionStats() this.getSectionStats()
this.loadTemplates(this.product_id,2,this.sales_pd_type); this.loadTemplates(this.product_id,2,this.sales_pd_type);
// } // }
if(dataresult.is_completed == true){ if(dataresult != undefined){
console.log('396') if(dataresult.hasOwnProperty('is_completed') && dataresult.is_completed == true){
this.loadPdViewCompoent() console.log('396')
this.loadPdViewCompoent()
}
} }
}); });
// setTimeout(()=>{ // setTimeout(()=>{
@ -440,23 +442,24 @@ export class SectionListComponent implements OnInit {
// } // }
// }) // })
// } // }
// copyToClipBoard(message,user_msg?) { copyToClipBoard(message,user_msg?) {
// const selBox = document.createElement('textarea'); const selBox = document.createElement('textarea');
// selBox.style.position = 'fixed'; selBox.style.position = 'fixed';
// selBox.style.left = '0'; selBox.style.left = '0';
// selBox.style.top = '0'; selBox.style.top = '0';
// selBox.style.opacity = '0'; selBox.style.opacity = '0';
// selBox.value = message; selBox.value = message;
// document.body.appendChild(selBox); document.body.appendChild(selBox);
// selBox.focus(); selBox.focus();
// selBox.select(); selBox.select();
// document.execCommand('copy'); document.execCommand('copy');
// document.body.removeChild(selBox); document.body.removeChild(selBox);
// if(message == '') { if(message == '') {
// user_msg = "Something went wrong" user_msg = "Something went wrong"
// } }
// this.toastProvider.lenderappmessage(user_msg) this.notifier.notify("warning",user_msg);
// } // this.toastProvider.lenderappmessage(user_msg)
}
// shareViaSMS() { // shareViaSMS() {
// this.socialSharing.shareViaSMS(this.customer_link_with_text,'').then(result=>{ // this.socialSharing.shareViaSMS(this.customer_link_with_text,'').then(result=>{

View File

@ -9,7 +9,8 @@ import { FormGroup, FormControl, FormArray, FormBuilder, Validators } from '@ang
//import { SalesPdProvider } from '../sales-pd/sales-pd'; //import { SalesPdProvider } from '../sales-pd/sales-pd';
import { DatePipe } from '@angular/common'; import { DatePipe } from '@angular/common';
import { SalesPdService } from './sales-pd.service'; import { SalesPdService } from './sales-pd.service';2
import { ApiServiceService } from 'app/lender-credit-pd/services/apiService/api-service.service';
const api_url = environment.apiEndpoint; const api_url = environment.apiEndpoint;
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -17,13 +18,13 @@ const api_url = environment.apiEndpoint;
export class QuestionServiceService { export class QuestionServiceService {
datepipe: DatePipe; datepipe: DatePipe;
curr_pd_info: any; curr_pd_info: any;
constructor(public http: HttpClient,private _fb:FormBuilder,private salesPDProvider:SalesPdService) { constructor(public http: HttpClient,private _fb:FormBuilder,private salesPDProvider:SalesPdService,private apiService:ApiServiceService) {
this.datepipe=new DatePipe('en-US') this.datepipe=new DatePipe('en-US')
} }
// FOR CREATING A FORM CONTROL DYNAMICALLY // FOR CREATING A FORM CONTROL DYNAMICALLY
assignFormControl_array(formgroup: FormGroup, ques_data: any) { assignFormControl_array(formgroup: FormGroup, ques_data: any) {
// alert('question'); // alert('question');
// this.curr_pd_info = this.apiService.curr_credit_pd_data this.curr_pd_info = this.apiService.curr_credit_pd_data
console.log(formgroup, ques_data) console.log(formgroup, ques_data)
const control: any = formgroup.get('questions') as FormArray const control: any = formgroup.get('questions') as FormArray
ques_data.forEach((val, index) => { ques_data.forEach((val, index) => {
@ -54,7 +55,7 @@ export class QuestionServiceService {
// console.log(param) // console.log(param)
group_indi.raw_validations = group_indi.validations group_indi.raw_validations = group_indi.validations
sub_childControl.push(this.createValue(group_indi)) sub_childControl.push(this.createValue(group_indi))
this.addAdditionalControl(group_indi, sub_childControl, arr_index) this.addAdditionalControl(group_indi,sub_childControl,arr_index)
// if(group_indi.type == '5'){ // if(group_indi.type == '5'){
// sub_childControl.controls[arr_index].removeControl('answer_value'); // sub_childControl.controls[arr_index].removeControl('answer_value');
// console.log("loop",arr_index,sub_childControl); // console.log("loop",arr_index,sub_childControl);
@ -145,7 +146,9 @@ export class QuestionServiceService {
console.log(formgroup) console.log(formgroup)
} }
console.log('149')
}, err => console.log(err)) }, err => console.log(err))
console.log('151')
return formgroup return formgroup
} }
// END OF FORM CREATION // END OF FORM CREATION
@ -279,12 +282,14 @@ export class QuestionServiceService {
//FOR CHECKBOX CHANGE THE VALUE STORAGE AS ARRAY //FOR CHECKBOX CHANGE THE VALUE STORAGE AS ARRAY
if(data.type == '5'){ if(data.type == '5'){
console.log('305')
curr_control.controls[curr_index].removeControl('answer_value'); curr_control.controls[curr_index].removeControl('answer_value');
curr_control.controls[curr_index].addControl('answer_value',this._fb.array([])) curr_control.controls[curr_index].addControl('answer_value',this._fb.array([]))
} }
//FOR numeric of string field //FOR numeric of string field
if(data.type == '1'){ if(data.type == '1'){
console.log('292')
curr_control.controls[curr_index].addControl('field_type',new FormControl(data.field_type)) curr_control.controls[curr_index].addControl('field_type',new FormControl(data.field_type))
curr_control.controls[curr_index].addControl('place_holder',new FormControl(data.place_holder)) curr_control.controls[curr_index].addControl('place_holder',new FormControl(data.place_holder))
} }
@ -305,24 +310,35 @@ export class QuestionServiceService {
} }
if(data.hasOwnProperty('question_enable') && data.question_enable != null && data.question_enable) { if(data.hasOwnProperty('question_enable') && data.question_enable != null && data.question_enable) {
console.log('313',data.hasOwnProperty('question_enable') && data.question_enable != null && data.question_enable)
let expression= data.question_enable; let expression= data.question_enable;
console.log("Check started",expression,expression.includes('PD_FORM_VALUES')); console.log("Check started",expression,expression.includes('PD_FORM_VALUES'));
if(expression.includes('PD_FORM_VALUES')) { if(expression.includes('PD_FORM_VALUES')) {
console.log('311',expression.includes('PD_FORM_VALUES'))
let sales_pd_id = localStorage.getItem('sales_pd_id_PRIMARYKEY') let sales_pd_id = localStorage.getItem('sales_pd_id_PRIMARYKEY')
console.log('319',sales_pd_id)
// this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(sales_pd_id => { // this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(sales_pd_id => {
if(sales_pd_id) { setTimeout(()=>{
let PD_FORM_VALUES = localStorage.getItem('PD_FORM_VALUES-'+sales_pd_id) if(sales_pd_id) {
if(PD_FORM_VALUES) { console.log('322',sales_pd_id)
PD_FORM_VALUES = JSON.parse(PD_FORM_VALUES) let PD_FORM_VALUES = localStorage.getItem('PD_FORM_VALUES-'+sales_pd_id)
// expression = expression.split('PD_FORM_VALUES').join(local_pd_form_values) console.log('324',PD_FORM_VALUES)
console.log("ex",expression) if(PD_FORM_VALUES) {
let result = eval(expression) console.log('326',PD_FORM_VALUES)
console.log(result); PD_FORM_VALUES = JSON.parse(PD_FORM_VALUES)
if(!result) { console.log('328',PD_FORM_VALUES)
curr_control.removeAt(curr_index); // expression = expression.split('PD_FORM_VALUES').join(local_pd_form_values)
} console.log("ex",expression)
let result = eval(expression)
console.log(result);
if(!result) {
console.log('324',!result,curr_control.removeAt(curr_index))
curr_control.removeAt(curr_index);
}
}
} }
} },500)
// }) // })
} }
// expression = expression.split(res).join(control_value_obj.answer_value) // expression = expression.split(res).join(control_value_obj.answer_value)
@ -334,7 +350,7 @@ export class QuestionServiceService {
// FOR SETTING THE ARRAY OF VALIDATORS COMING FROM JSON Temp, // FOR SETTING THE ARRAY OF VALIDATORS COMING FROM JSON Temp,
settingArrayofValidators(data,curr_control,curr_index){ settingArrayofValidators(data,curr_control,curr_index){
console.log("entered 334",data); console.log("entered 334",data,curr_control,curr_index);
if(data.hasOwnProperty('validations') && data.validations.length > 0 ){ if(data.hasOwnProperty('validations') && data.validations.length > 0 ){
const validList :any= []; const validList :any= [];
let validator_value let validator_value
@ -361,7 +377,7 @@ export class QuestionServiceService {
console.log( '358',validList) console.log( '358',validList)
// curr_control.controls[curr_index].controls.answer_value.setValidators(validList) // curr_control.controls[curr_index].controls.answer_value.setValidators(validList)
curr_control.controls.answer_value.setValidators(validList) curr_control.controls.answer_value.setValidators(validList)
console.log("ddvdeeqq 361",validList) console.log("ddvdeeqq 361", curr_control.controls.answer_value.setValidators(validList),validList)
curr_control.controls.answer_value.updateValueAndValidity() curr_control.controls.answer_value.updateValueAndValidity()
console.log("after setting validators 363",curr_control) console.log("after setting validators 363",curr_control)
} }

View File

@ -346,7 +346,7 @@ getData_fromLocal(key){
// console.log("all key in storage",this.storage.keys()) // console.log("all key in storage",this.storage.keys())
return key; return key;
// return this.storage.get(key); // return this.storage.get(key);
// return localStorage.getItem(key); // return localStorage.getItem(key)
} }
getSalesPdpdf(pdfdetail): Observable<any> { getSalesPdpdf(pdfdetail): Observable<any> {
return this._http.get<any[]>(api_url + "downloadSalesPDReport/" + pdfdetail) return this._http.get<any[]>(api_url + "downloadSalesPDReport/" + pdfdetail)