This commit is contained in:
sriram-at-840620226347 2020-08-03 19:55:30 +05:30
commit 1ad489f820
5 changed files with 53 additions and 17 deletions

View File

@ -1,7 +1,7 @@
<section [formGroup]="formGroupN">
<!-- {{formGroupN.value | json}} -->
<mat-form-field style="width: 100%" *ngIf="parent_ques.type == '1'"
[ngStyle]="{'margin-bottom':parent_ques.field_type == 'numtoword' ? '5%' : '0' }">
[ngStyle]="{'margin-bottom':parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword' ? '5%' : '0' }">
<mat-label>{{parent_ques.question}}</mat-label>
<input matInput
@ -10,7 +10,7 @@
(change)="onChangeProperty($event,parent_ques,parent_ques.question_key)">
<!-- [placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" -->
<mat-hint
*ngIf="formGroupN.value[parent_ques.question_key] != '' && parent_ques.field_type == 'numtoword'"
*ngIf="formGroupN.value[parent_ques.question_key] != '' && (parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword')"
align="end" style="font-size: 12px;">{{"&#8377;"}} {{formGroupN.value[parent_ques.question_key] | 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> -->
@ -21,20 +21,20 @@
</mat-form-field>
<mat-form-field style="width:100%"
*ngIf="parent_ques.type == '9'">
*ngIf="parent_ques.type == '9'" [ngStyle]="{'margin-bottom':parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword' ? '5%' : '0' }">
<mat-label>{{parent_ques.question}}</mat-label>
<input matInput [type]="parent_ques.field_type == 'num' || parent_ques.field_type == 'numtoword' ? 'number' : parent_ques.field_type== 'string' ? 'text' : parent_ques.field_type"
<input matInput [type]="parent_ques.field_type == 'num' || parent_ques.field_type == 'numtoword' ? 'number' : parent_ques.field_type== 'string' || parent_ques.field_type == 'str&numtoword' ? 'text' : parent_ques.field_type"
[formControlName]="parent_ques.question_key" [placeholder]="parent_ques.place_holder"
(change)="onChangeProperty($event,parent_ques,parent_ques.question_key)"
[matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
<mat-autocomplete #auto="matAutocomplete" (optionSelected) = "onChangeProperty($event,parent_ques,parent_ques.question_key)">
<mat-option *ngFor="let val of autoCompleteAns | async" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer"
>
<span>{{val.answer}}</span>
</mat-option>
</mat-autocomplete>
<mat-hint
*ngIf="formGroupN.value[parent_ques.question_key] != '' && parent_ques.field_type == 'numtoword'"
*ngIf="formGroupN.value[parent_ques.question_key] != '' && (parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword')"
align="end" style="font-size: 12px;">{{"&#8377;"}} {{formGroupN.value[parent_ques.question_key] | 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> -->

View File

@ -382,15 +382,24 @@ export class QueriesDocsComponent implements OnInit {
});
}
if(this.questions_JSON.questions.length > 0) {
let geneatedQues = this.questions_JSON.questions.filter(val=>val.is_repeatable != '1').map(vv=>{
return {question_key:vv.question_key,question:vv.question,is_repeatable:'0',type:vv.type ,is_subfield:vv.hasOwnProperty('is_subfield') ? vv.is_subfield : '0'
,parent_question_key:vv.hasOwnProperty('parent_question_key') ? vv.parent_question_key : ''}
if (this.questions_JSON.questions.length > 0) {
let geneatedQues = this.questions_JSON.questions.filter(val => val.is_repeatable != '1').map(vv => {
// return {question_key:vv.question_key,question:vv.question,is_repeatable:'0',type:vv.type ,is_subfield:vv.hasOwnProperty('is_subfield') ? vv.is_subfield : '0'
// ,parent_question_key:vv.hasOwnProperty('parent_question_key') ? vv.parent_question_key : ''}
let all_value = JSON.parse(JSON.stringify(vv));
delete all_value.onchange_properties
delete all_value.api_properties
delete all_value.answers
delete all_value.validations
all_value.hasOwnProperty('raw_validations') ? delete all_value.raw_validations : ''
all_value.is_subfield = all_value.hasOwnProperty('is_subfield') ? all_value.is_subfield : '0'
all_value.parent_question_key = all_value.hasOwnProperty('parent_question_key') ? all_value.parent_question_key : ''
return all_value
})
let covidFormAnswers = this.covid19QuesForm.getRawValue()
let covidFormAnswers = this.covid19QuesForm.getRawValue()
covidFormAnswers.question_info = geneatedQues
formParams.covid_section = covidFormAnswers
}
}
console.log(formParams);
this.pdTriggerService.saveForm(formParams,this.pd_all_details.pdmaster_details.curr_vendor_ans_fetch_status).subscribe(res=>{

View File

@ -96,7 +96,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
}
getCreditPDTemplate() {
// let params = { "fk_entity_id":this.pddetails.fk_lender_id,"fk_product_id":this.pddetails.fk_product_id,"pd_form_id":this.pddetails.pd_id }
let params = { "fk_entity_id":"","fk_product_id":"","pd_form_id":"24" }
let params = { "fk_entity_id":"","fk_product_id":"","pd_form_id":"24","fk_pd_id": this.startPD }
this._pd.loadCreditPDTemplate(params).subscribe(result=> {
let creditTemplate:any = null;
if(result['dataStatus']) {

View File

@ -68,7 +68,13 @@ export class NumberToWordsPipe implements PipeTransform {
str = words.reverse().join("")
// str =(str.length > 2 && str.charAt(str.length-2)==',') ? str.slice(0, -2) : str;
} else str = "";
return str
if(str) {
return str
}
else {
return null
}
}

View File

@ -221,12 +221,33 @@
"question":"How much is your sales/revenue from April till date?",
"question_key":"sales_or_revenue_amt",
"place_holder":"Enter amount",
"type":"1",
"type":"9",
"answers":[
{
"answer":"Not Disclosed",
"answer_id":"Not Disclosed"
}
],
"onchange_properties":[
{
"purpose": "validations",
"validations": [
{
"name": "pattern",
"isactive": "1",
"validator": "",
"message": "Please enter the amount or choose the suggested text",
"value": "(String('sales_or_revenue_amt').toLowerCase() != String('not disclosed')) ? '[0-9]*' : false",
"validation_to": null,
"value_keys": ["sales_or_revenue_amt"]
}
]
}
],
"field_width":"100",
"answers":null,
"api_properties":null,
"is_repeatable":null,
"field_type":"numtoword",
"field_type":"str&numtoword",
"validations":[
{
"name":"required",