This commit is contained in:
dineshkumarkannan 2018-10-25 19:31:34 +05:30
commit 34861ef10f
6 changed files with 768 additions and 453 deletions

View File

@ -1,7 +1,7 @@
<mat-sidenav-container class="app-inner background-none shadow-none mail-db"> <mat-sidenav-container class="app-inner background-none shadow-none mail-db">
<mat-sidenav #mailnav [mode]="isOver() ? 'over' : 'side'" [opened]="!isOver()" class="mail-sidebar pl-xs pr-xs"> <mat-sidenav #mailnav [mode]="isOver() ? 'over' : 'side'" [opened]="!isOver()" class="mail-sidebar pl-xs pr-xs">
<button _ngcontent-c21="" class="compose-btn mat-warn mat-raised-button mb-1" (click)="changePDStatus(PDStatus);"> <span>Complete</span></button>
<mat-expansion-panel *ngFor="let category of categoryList "> <mat-expansion-panel *ngFor="let category of categoryList;let catIndex = index; ">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title class="text-xs-left"> <mat-panel-title class="text-xs-left">
<h6 class="mt-0"> {{category.category_name}}</h6> <h6 class="mt-0"> {{category.category_name}}</h6>
@ -10,7 +10,7 @@
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-list> <mat-list>
<mat-list-item class="custm-list-item" (click)="onSelectQuestions(questions)" *ngFor="let questions of category.questions"> <mat-list-item class="custm-list-item" *ngFor="let questions of category.questions; let quesIndex=index" [ngStyle]="{'color':quesIndex === selectedQuestionIndex && catIndex === selectedCategoryIndex ? 'red' : 'black' }" (click)="OnSelectDirectQuestions(questions, catIndex,quesIndex)">
<small>{{ (questions.question.length>15)? (questions.question | slice:0:15)+'..':(questions.question) }}</small> <small>{{ (questions.question.length>15)? (questions.question | slice:0:15)+'..':(questions.question) }}</small>
</mat-list-item> </mat-list-item>
@ -18,8 +18,6 @@
</mat-list> </mat-list>
</mat-expansion-panel> </mat-expansion-panel>
</mat-sidenav> </mat-sidenav>
<mat-toolbar color="primary" fxHide="false" fxHide.gt-sm> <mat-toolbar color="primary" fxHide="false" fxHide.gt-sm>
<button (click)="mailnav.toggle()" mat-icon-button> <button (click)="mailnav.toggle()" mat-icon-button>
@ -30,14 +28,18 @@
<div class="main-content" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100"> <div class="main-content" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<figure> <figure>
<mat-card-content> <mat-card-content>
<div fxLayout="row" > <div fxLayout="row" >
<button mat-raised-button mat-icon-button class="hover-icon start_close_btn" type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button>
<div fxFlex="33" class="text-xs-left"> <div fxFlex="33" class="text-xs-left">
<h4 class="mt-0">Varun Krish</h4> <h4 class="mt-0">{{mainApplicantName}}</h4>
<small>Salaried Non Professional</small> <small>{{pdMasterList.customer_segment_name}}</small>
</div> </div>
<div fxFlex="66" class="text-xs-right"> <div fxFlex="66" class="text-xs-right">
<h4 class="mt-0">Home Loan / Purchase (Resale) Loan.</h4> <h4 class="mt-0">{{pdMasterList.product_name}}/{{pdMasterList.subproduct_name}}</h4>
<small>IOB - IOB-DEV-001</small> <small>{{pdMasterList.lender_full_name}}/{{pdMasterList.lender_applicant_id}}</small>
</div> </div>
</div> </div>
@ -47,81 +49,56 @@
<!-- <h6 class="mt-0">About</h6> --> <!-- <h6 class="mt-0">About</h6> -->
<p>No Records Found..</p> <p>No Records Found..</p>
</mat-card-content> </mat-card-content>
<mat-card-content *ngIf="selectedCategory.answers">
<h6 class="mt-0">{{selectedCategory.question}}</h6> <!-- check type of questions -->
<ng-container [ngSwitch]="selectedCategory.fk_question_answertype">
<!-- start options type questions section -->
<ng-container *ngSwitchCase="1">
<form [formGroup]="optionsForm" *ngIf="answerList.length>0 ; else noanswers;">
<mat-card-content>
<h6 class="mt-0">{{optionsForm.controls.pd_question.value}}</h6>
<div fxLayout="row" > <div fxLayout="row" >
<div fxFlex="60" class="text-xs-left"> <div fxFlex="60" class="text-xs-left">
<mat-list>
<mat-list-item *ngFor="let ans of selectedCategory.answers">
<small><mat-radio-button></mat-radio-button> <mat-list>
{{ans.answer}}
</small> <mat-radio-group formControlName="modelValue">
<mat-list-item *ngFor="let option of optionsForm.controls.items.value">
<mat-radio-button [value]="option.pd_answer_id">{{option.pd_answer}}</mat-radio-button>
</mat-list-item> </mat-list-item>
</mat-radio-group>
</mat-list> </mat-list>
</div> </div>
<div fxFlex="40" class="text-xs-right"> <div fxFlex="40" class="text-xs-right" *ngIf="optionsForm.controls.documents.length>0">
<mat-card > <mat-card >
<mat-card-content style="display: flex; <mat-card-content style="display: flex;
overflow: auto;min-height: 200px; max-height: 240px;"> overflow: auto;min-height: 200px; max-height: 240px;">
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="50" class="m-gap p-gap"> <div fxFlex="50" class="m-gap p-gap" *ngFor="let docs of optionsForm.controls.documents.value; let docIndex=index">
<div class="p-list-main mb-2"> <div class="p-list-main mb-2">
<div class="p-list"> <div class="p-list">
<div class="top"><img src="assets/images/1.jpg" alt=""></div>
<div class="top"><img [src]="docs.pd_document_url" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>{{docs.pd_document_title}}</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div> </div>
</div> </div>
</div> </div>
<div fxFlex="50" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="assets/images/2.jpg" alt=""></div>
</div> </div>
</div> </div>
</div>
<div fxFlex="50" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="assets/images/3.jpg" alt=""></div>
</div>
</div>
</div>
<div fxFlex="50" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="assets/images/4.jpg" alt=""></div>
</div>
</div>
</div>
<div fxFlex="50" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="assets/images/face1.jpg" alt=""></div>
</div>
</div>
</div>
<div fxFlex="50" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="assets/images/face2.jpg" alt=""></div>
</div>
</div>
</div>
</div> </div>
</mat-card-content> </mat-card-content>
@ -132,27 +109,258 @@
</div> </div>
</mat-card-content> </mat-card-content>
<mat-card-actions *ngIf="selectedCategory.answers"> <mat-card-actions>
<div fxLayout="row" > <div fxLayout="row" >
<div fxFlex="66" class="pb-0 text-sm-left"> <div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks"></textarea> <textarea matInput placeholder="Remarks" formControlName="pd_answer_remark"></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33" class="pb-0 text-sm-right"> <!-- this section for questions type options button actions -->
<mat-button-toggle-group name="alignment" class="mr-1 mb-1"> <div fxFlex="40" class="pb-0 text-sm-right">
<mat-button-toggle value="left"><mat-icon>arrow_backward</mat-icon></mat-button-toggle> <mat-button-toggle-group name="fontStyle" aria-label="Font Style">
<mat-button-toggle value="right"><mat-icon>arrow_forward</mat-icon></mat-button-toggle> <mat-button-toggle value="bold" matTooltip="Save&Previous" (click)="saveNextPrevious(optionsForm.controls,previous)" matTooltipPosition="below"><mat-icon>arrow_backward</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Previous" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_previous</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Next" (click)="skipNextPrevious(next)" matTooltipPosition="below"><mat-icon>skip_next</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Save&Next" (click)="saveNextPrevious(optionsForm.controls,next)" matTooltipPosition="below"><mat-icon>arrow_forward</mat-icon></mat-button-toggle>
</mat-button-toggle-group> </mat-button-toggle-group>
</div>
<!-- end questions type options -->
</div>
</mat-card-actions>
</form>
<ng-template #noanswers>
<mat-card-content>
<h6 class="mt-0">{{selectedCategory.question}}</h6>
</mat-card-content>
<mat-card-actions>
<div fxLayout="row" >
<div fxFlex="100" class="pb-0 text-sm-right">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
<mat-button-toggle value="bold" matTooltip="Skip&Previous" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_previous</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Next" (click)="skipNextPrevious(next)" matTooltipPosition="below"><mat-icon>skip_next</mat-icon></mat-button-toggle>
</mat-button-toggle-group>
</div> </div>
</div> </div>
</mat-card-actions> </mat-card-actions>
</ng-template>
</ng-container>
<!-- end options type questions section -->
<!-- start text box questions section -->
<ng-container *ngSwitchCase="2">
<form [formGroup]="textBoxForm" *ngIf="answerList.length>0 ; else noanswers;">
<mat-card-content>
<h6 class="mt-0">{{textBoxForm.controls.pd_question.value}}</h6>
<div fxLayout="row" >
<div fxFlex="60" class="text-xs-left">
<mat-list [formArrayName]="'items'">
<mat-list-item *ngFor="let control of textBoxForm.controls.items.controls; let i = index;" [formGroup]="control">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Answers</mat-label>
<textarea matInput placeholder="Answers" formControlName="pd_answer"></textarea>
</mat-form-field>
</mat-list-item>
</mat-list>
</div>
<div fxFlex="40" class="text-xs-right" *ngIf="textBoxForm.controls.documents.length>0">
<mat-card >
<mat-card-content style="display: flex;
overflow: auto;min-height: 200px; max-height: 240px;">
<div fxLayout="row wrap">
<div fxFlex="50" class="m-gap p-gap" *ngFor="let docs of textBoxForm.controls.documents.value; let docIndex=index">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img [src]="docs.pd_document_url" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>{{docs.pd_document_title}}</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</mat-card-content>
<mat-card-actions>
<div fxLayout="row" >
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="pd_answer_remark"></textarea>
</mat-form-field>
</div>
<!-- this section for questions type options button actions -->
<div fxFlex="40" class="pb-0 text-sm-right">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
<mat-button-toggle value="bold" matTooltip="Save&Previous" (click)="saveNextPreviousText(textBoxForm.controls,previous)" matTooltipPosition="below"><mat-icon>arrow_backward</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Previous" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_previous</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Next" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_next</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Save&Next" (click)="saveNextPreviousText(textBoxForm.controls,next)" matTooltipPosition="below"><mat-icon>arrow_forward</mat-icon></mat-button-toggle>
</mat-button-toggle-group>
</div>
<!-- end questions type options -->
</div>
</mat-card-actions>
</form>
<ng-template #noanswers>
<mat-card-content>
<h6 class="mt-0">{{selectedCategory.question}}</h6>
</mat-card-content>
<mat-card-actions>
<div fxLayout="row" >
<div fxFlex="100" class="pb-0 text-sm-right">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
<mat-button-toggle value="bold" matTooltip="Skip&Previous" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_previous</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Next" (click)="skipNextPrevious(next)" matTooltipPosition="below"><mat-icon>skip_next</mat-icon></mat-button-toggle>
</mat-button-toggle-group>
</div>
</div>
</mat-card-actions>
</ng-template>
</ng-container>
<!-- end text box questions section -->
<!-- start check box questions section -->
<ng-container *ngSwitchCase="3">
<form [formGroup]="checkBoxForm" *ngIf="answerList.length>0 ; else noanswers;">
<mat-card-content>
<h6 class="mt-0">{{checkBoxForm.controls.pd_question.value}}</h6>
<div fxLayout="row" >
<div fxFlex="60" class="text-xs-left">
<mat-list [formArrayName]="'items'">
<mat-list-item *ngFor="let control of checkBoxForm.controls.items.controls; let i = index;" [formGroup]="control">
<small><mat-checkbox class="example-margin" formControlName="checkbox" id="{{ control.controls.pd_answer_id.value }}"> {{ control.controls.pd_answer.value }}</mat-checkbox> </small>
</mat-list-item>
</mat-list>
</div>
<div fxFlex="40" class="text-xs-right" *ngIf="checkBoxForm.controls.documents.length>0">
<mat-card >
<mat-card-content style="display: flex;
overflow: auto;min-height: 200px; max-height: 240px;">
<div fxLayout="row wrap">
<div fxFlex="50" class="m-gap p-gap" *ngFor="let docs of textBoxForm.controls.documents.value; let docIndex=index">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img [src]="docs.pd_document_url" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>{{docs.pd_document_title}}</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</mat-card-content>
<mat-card-actions *ngIf="checkBoxForm.controls.items.length > 0">
<div fxLayout="row" >
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="pd_answer_remark"></textarea>
</mat-form-field>
</div>
<!-- this section for questions type options button actions -->
<div fxFlex="40" class="pb-0 text-sm-right">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
<mat-button-toggle value="bold" matTooltip="Save&Previous" (click)="saveNextPrevious(checkBoxForm.controls,previous)" matTooltipPosition="below"><mat-icon>arrow_backward</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Previous" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_previous</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Next" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_next</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Save&Next" (click)="saveNextPrevious(checkBoxForm.controls,next)" matTooltipPosition="below"><mat-icon>arrow_forward</mat-icon></mat-button-toggle>
</mat-button-toggle-group>
</div>
<!-- end questions type options -->
</div>
</mat-card-actions>
</form>
<ng-template #noanswers>
<mat-card-content>
<h6 class="mt-0">{{selectedCategory.question}}</h6>
</mat-card-content>
<mat-card-actions>
<div fxLayout="row" >
<div fxFlex="100" class="pb-0 text-sm-right">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
<mat-button-toggle value="bold" matTooltip="Skip&Previous" (click)="skipNextPrevious(previous)" matTooltipPosition="below"><mat-icon>skip_previous</mat-icon></mat-button-toggle>
<mat-button-toggle value="bold" matTooltip="Skip&Next" (click)="skipNextPrevious(next)" matTooltipPosition="below"><mat-icon>skip_next</mat-icon></mat-button-toggle>
</mat-button-toggle-group>
</div>
</div>
</mat-card-actions>
</ng-template>
</ng-container>
</ng-container>
<!-- end check box questions section -->
</figure> </figure>
</div> </div>
</mat-sidenav-container> </mat-sidenav-container>
<notifier-container></notifier-container>

View File

@ -71,7 +71,7 @@ $product-bg-color-hover: rgba(103, 58, 183, 0.7);
} }
.bottom { .bottom {
width: 200%; width: 200%;
height: 20%; height: 15%;
transition: transform 0.5s; transition: transform 0.5s;
h1 { h1 {
margin: 0; margin: 0;
@ -88,9 +88,9 @@ $product-bg-color-hover: rgba(103, 58, 183, 0.7);
position: relative; position: relative;
float: left; float: left;
.details { .details {
padding: 20px; padding: 5px;
float: left; float: left;
width: calc(70% - 40px); // width: calc(70% - 40px);
} }
} }
@ -113,3 +113,9 @@ $product-bg-color-hover: rgba(103, 58, 183, 0.7);
} }
} }
.start_close_btn {
position: fixed;
right: 69px;
top: 112px;
}

View File

@ -1,328 +1,39 @@
import { Component, ViewChild ,OnInit,ViewEncapsulation, OnDestroy } from '@angular/core'; import { Component, ViewChild ,OnInit,ViewEncapsulation, OnDestroy } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { ListPdComponent } from './../list-pd.component'; import { ListPdComponent } from './../list-pd.component';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
@Component({ @Component({
selector: 'app-start-pd', selector: 'app-start-pd',
templateUrl: './start-pd.component.html', templateUrl: './start-pd.component.html',
styleUrls: ['./start-pd.component.scss'] styleUrls: ['./start-pd.component.scss']
}) })
export class StartPdComponent implements OnInit, OnDestroy { export class StartPdComponent implements OnInit, OnDestroy {
private notifier: NotifierService;
public startPD:string; public startPD:string;
// MESSAGE public PDStatus: string;
selectedMessage: any; public mainApplicantName:string;
//public remarks: string;
errorMessage:any;
selectedCategory:any=[]; selectedCategory:any=[];
messages: Object[] = [{ categoryList: any=[];
from: 'John Doe', pdMasterList: any=[];
photo: 'assets/images/face1.jpg', optionsForm: FormGroup;
subject: 'Online', checkBoxForm:FormGroup;
}, { textBoxForm:FormGroup;
from: 'Geremy Ginner', next:number;
photo: 'assets/images/face2.jpg', previous:number;
subject: 'Online', selectedCategoryIndex:number;
}, { selectedQuestionIndex:number;
from: 'Tom Diaz', getQuestionsLength:number;
photo: 'assets/images/face3.jpg', answerList:any=[];
subject: 'Offline', ansPDList:any=[];
}, { constructor(notifier: NotifierService, private fb: FormBuilder,private route: ActivatedRoute,
from: 'Dave Bension',
photo: 'assets/images/face4.jpg',
subject: 'Away',
}, {
from: 'Petter Brook',
photo: 'assets/images/face5.jpg',
subject: 'Busy',
}, {
from: 'Genna Mercy',
photo: 'assets/images/face6.jpg',
subject: 'Busy',
}, {
from: 'Harmy Junior',
photo: 'assets/images/face7.jpg',
subject: 'In a meeting',
}
];
categoryList: Object[]=[
{
"category_name": "Personal ",
"template_category_weightage_id": "1",
"fk_question_category_id": "1",
"fk_template_id": "3",
"weightage": "40",
"createdon": "11/10/2018",
"fk_createdby": "1",
"updatedon": "17/10/2018",
"isactive": "0",
"fk_updatedby": "1",
"questions": [
{
"question_id": "1",
"question": "Percentage of Earning Members to Total Family Members (This is to be calculated by software based on information captured i.e Inf 22 + 1 divided by Inf 21)",
"template_question_id": "1",
"fk_template_id": "3",
"fk_question_id": "1",
"question_weightage": "25",
"question_answerable_by": null,
"fk_template_question_category_id": "1",
"isactive": "1",
"answer_type_name": "Option",
"answers": [
{
"question_answer_id": "1",
"answer": "100%\n",
"template_answer_weightage_id": "1",
"fk_template_question_id": "1",
"fk_question_answer_id": "1",
"template_answer_weightage": "115",
"isactive": "1"
},
{
"question_answer_id": "2",
"answer": "75% to <100%\n",
"template_answer_weightage_id": "2",
"fk_template_question_id": "1",
"fk_question_answer_id": "2",
"template_answer_weightage": "225",
"isactive": "1"
},
{
"question_answer_id": "3",
"answer": "50% to <75%\n",
"template_answer_weightage_id": "3",
"fk_template_question_id": "1",
"fk_question_answer_id": "3",
"template_answer_weightage": "335",
"isactive": "1"
},
{
"question_answer_id": "4",
"answer": "25% to <50%\n",
"template_answer_weightage_id": "4",
"fk_template_question_id": "1",
"fk_question_answer_id": "4",
"template_answer_weightage": "445",
"isactive": "1"
},
{
"question_answer_id": "5",
"answer": "<25%\n",
"template_answer_weightage_id": "5",
"fk_template_question_id": "1",
"fk_question_answer_id": "5",
"template_answer_weightage": "555",
"isactive": "1"
}
]
},
{
"question_id": "2",
"question": "What is the Educational Qualification of the Main Applicant?\n",
"template_question_id": "2",
"fk_template_id": "3",
"fk_question_id": "2",
"question_weightage": "25",
"question_answerable_by": "1",
"fk_template_question_category_id": "1",
"isactive": "1",
"answer_type_name": "Option",
"answers": []
},
{
"question_id": "3",
"question": "What are the Personal Assets Owned?\n",
"template_question_id": "4",
"fk_template_id": "3",
"fk_question_id": "3",
"question_weightage": "50",
"question_answerable_by": null,
"fk_template_question_category_id": "1",
"isactive": "1",
"answer_type_name": "Option",
"answers": [
{
"question_answer_id": "10",
"answer": "If it includes - House / Office \n",
"template_answer_weightage_id": "11",
"fk_template_question_id": "4",
"fk_question_answer_id": "10",
"template_answer_weightage": "1",
"isactive": null
},
{
"question_answer_id": "11",
"answer": "If it includes - Land \n",
"template_answer_weightage_id": "12",
"fk_template_question_id": "4",
"fk_question_answer_id": "11",
"template_answer_weightage": "1",
"isactive": null
},
{
"question_answer_id": "12",
"answer": "If it includes - Four Wheeler Vehicle\n",
"template_answer_weightage_id": "13",
"fk_template_question_id": "4",
"fk_question_answer_id": "12",
"template_answer_weightage": "1",
"isactive": null
},
{
"question_answer_id": "13",
"answer": "If it includes only any other asset\n",
"template_answer_weightage_id": "14",
"fk_template_question_id": "4",
"fk_question_answer_id": "13",
"template_answer_weightage": "1",
"isactive": null
},
{
"question_answer_id": "14",
"answer": "No assets\n",
"template_answer_weightage_id": "15",
"fk_template_question_id": "4",
"fk_question_answer_id": "14",
"template_answer_weightage": "1",
"isactive": null
}
]
}
]
},
{
"category_name": "Proprietary",
"template_category_weightage_id": "2",
"fk_question_category_id": "4",
"fk_template_id": "3",
"weightage": "20",
"createdon": "11/10/2018",
"fk_createdby": "1",
"updatedon": "17/10/2018",
"isactive": "1",
"fk_updatedby": "1",
"questions": []
},
{
"category_name": "Income",
"template_category_weightage_id": "3",
"fk_question_category_id": "3",
"fk_template_id": "3",
"weightage": "40",
"createdon": "11/10/2018",
"fk_createdby": "1",
"updatedon": "17/10/2018",
"isactive": "0",
"fk_updatedby": "1",
"questions": [
{
"question_id": "6",
"question": "How was the approach to the PD location?\n\n",
"template_question_id": "5",
"fk_template_id": "3",
"fk_question_id": "6",
"question_weightage": "10",
"question_answerable_by": null,
"fk_template_question_category_id": "3",
"isactive": "1",
"answer_type_name": "Option",
"answers": [
{
"question_answer_id": "25",
"answer": "Good\n\n",
"template_answer_weightage_id": "16",
"fk_template_question_id": "5",
"fk_question_answer_id": "25",
"template_answer_weightage": "1",
"isactive": null
},
{
"question_answer_id": "26",
"answer": "Fair\n\n",
"template_answer_weightage_id": "17",
"fk_template_question_id": "5",
"fk_question_answer_id": "26",
"template_answer_weightage": "1",
"isactive": null
},
{
"question_answer_id": "27",
"answer": "Difficult\n\n",
"template_answer_weightage_id": "18",
"fk_template_question_id": "5",
"fk_question_answer_id": "27",
"template_answer_weightage": "1",
"isactive": null
}
]
},
{
"question_id": "8",
"question": "Who was the person met during PD?\n\n\n\n",
"template_question_id": "6",
"fk_template_id": "3",
"fk_question_id": "8",
"question_weightage": "90",
"question_answerable_by": null,
"fk_template_question_category_id": "3",
"isactive": "1",
"answer_type_name": "Option",
"answers": [
{
"question_answer_id": "30",
"answer": "Main Applicant\n\n\n\n",
"template_answer_weightage_id": "19",
"fk_template_question_id": "6",
"fk_question_answer_id": "30",
"template_answer_weightage": "2",
"isactive": null
},
{
"question_answer_id": "31",
"answer": "One of the Earning Co applicants\n\n\n\n",
"template_answer_weightage_id": "20",
"fk_template_question_id": "6",
"fk_question_answer_id": "31",
"template_answer_weightage": "2",
"isactive": null
},
{
"question_answer_id": "32",
"answer": "Accountant / Manager / Other employee\n",
"template_answer_weightage_id": "21",
"fk_template_question_id": "6",
"fk_question_answer_id": "32",
"template_answer_weightage": "2",
"isactive": null
},
{
"question_answer_id": "33",
"answer": "One of the Non-Earning Co applicants\n",
"template_answer_weightage_id": "22",
"fk_template_question_id": "6",
"fk_question_answer_id": "33",
"template_answer_weightage": "2",
"isactive": null
},
{
"question_answer_id": "34",
"answer": "Relative / Friend of the applicant\n",
"template_answer_weightage_id": "23",
"fk_template_question_id": "6",
"fk_question_answer_id": "34",
"template_answer_weightage": "2",
"isactive": null
}
]
}
]
}
]
constructor( private route: ActivatedRoute,
private router: Router, private router: Router,
private listPDComponent : ListPdComponent) { private listPDComponent : ListPdComponent, private _pd: PdTrigerService,) {
this.startPD = this.route.snapshot.params['pdid']; this.startPD = this.route.snapshot.params['pdid'];
this.notifier = notifier;
} }
@ -335,6 +46,11 @@ categoryList: Object[]=[
// Ps.initialize(elemSidebar, { wheelSpeed: 2, suppressScrollX: true }); // Ps.initialize(elemSidebar, { wheelSpeed: 2, suppressScrollX: true });
// Ps.initialize(elemContent, { wheelSpeed: 2, suppressScrollX: true }); // Ps.initialize(elemContent, { wheelSpeed: 2, suppressScrollX: true });
} }
this.loadTemplates(this.startPD);
this.next=1;
this.previous=2;
this.PDStatus="COMPLETED"
} }
isMac(): boolean { isMac(): boolean {
let bool = false; let bool = false;
@ -343,6 +59,24 @@ categoryList: Object[]=[
} }
return bool; return bool;
} }
// load pd template details
loadTemplates(startID:string){
this._pd.loadPDTemplates(startID).subscribe(
data => {
if (data.status == 200) {
this.pdMasterList=data.records.pdmaster_details;
this.categoryList=data.records.question_answers;
let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
this.mainApplicantName = filterApplicantName[0].applicant_name;
}
else{
this.pdMasterList="";
this.mainApplicantName="";
this.categoryList=[];
}
}, error => this.errorMessage = <any> error);
}
ngOnDestroy(): void { ngOnDestroy(): void {
this.listPDComponent.showListView(true); this.listPDComponent.showListView(true);
} }
@ -353,13 +87,328 @@ categoryList: Object[]=[
return window.matchMedia(`(max-width: 960px)`).matches; return window.matchMedia(`(max-width: 960px)`).matches;
} }
onSelect(message: Object[]): void { OnSelectDirectQuestions(selectedQuestions: any, categoryIndex:number,questionsIndex:number){
this.selectedMessage = message; this.selectedCategory=selectedQuestions;
this.selectedCategoryIndex=categoryIndex;
this.selectedQuestionIndex=questionsIndex;
let serachQuestions = {
"question_id":selectedQuestions.fk_question_id,
"pd_id":this.startPD,
"template_id":selectedQuestions.fk_template_id,
"category_id":selectedQuestions.fk_template_question_category_id
}
this.getAnswers(serachQuestions);
} }
onSelectQuestions(categoryMessage: any){ // load question based answer list
console.log(categoryMessage) getAnswers(serachList:any){
this.selectedCategory = categoryMessage;
this._pd.getAnswersForPD(serachList).subscribe(
data => {
if (data.status == 200) {
this.answerList=data.records.answers;
this.ansPDList=data.records;
// this for options type questions
if(this.selectedCategory.fk_question_answertype==1){
this.loadOtionsForm(this.selectedCategory, this.answerList);
}
//this for text box type questions
else if(this.selectedCategory.fk_question_answertype==2){
this.loadTextBoxForm(this.selectedCategory,this.answerList);
}
//this for check box type questions
else if(this.selectedCategory.fk_question_answertype==3){
this.loadCheckBoxForm(this.selectedCategory,this.answerList);
}
}
}, error => this.errorMessage = <any> error);
}
// load check box form
loadCheckBoxForm(selectedCategory: any, ansItem: any){
// create checkbox group
let checkboxGroup = new FormArray(ansItem.map(item => new FormGroup({
fk_pd_id:new FormControl(this.startPD),
pd_detail_answer_id: new FormControl(item.pd_detail_answer_id),
pd_answer_id: new FormControl(item.question_answer_id),
pd_answer: new FormControl(item.answer),
pd_answer_weightage:new FormControl(item.template_answer_weightage),
checkbox: new FormControl(item.isactive==null ? false: true)
})));
// create documents group
let documentsGroup = new FormArray(this.ansPDList.images.map(item => new FormGroup({
pd_document_title:new FormControl(item.pd_document_title),
pd_document_url: new FormControl(item.pd_document_name),
})));
// create a hidden reuired formControl to keep status of checkbox group
let hiddenControl = new FormControl(this.mapItems(checkboxGroup.value), Validators.required);
// update checkbox group's value to hidden formcontrol
checkboxGroup.valueChanges.subscribe((v) => {
hiddenControl.setValue(this.mapItems(v));
});
this.checkBoxForm = new FormGroup({
pd_detail_id: new FormControl(this.ansPDList.pd_detail_id),
fk_pd_id: new FormControl(this.startPD),
fk_category_id: new FormControl(this.selectedCategory.fk_template_question_category_id),
fk_question_id: new FormControl(this.selectedCategory.fk_question_id),
pd_question: new FormControl(this.selectedCategory.question),
pd_question_weightage: new FormControl(this.selectedCategory.question_weightage),
pd_answer_remark:new FormControl(this.ansPDList.question_remark),
items: checkboxGroup,
selectedItems: hiddenControl,
documents: documentsGroup
});
}
// map options form group values
mapItems(items) {
let selectedItems = items.filter((item) => item.checkbox).map((item) => item);
return selectedItems.length ? selectedItems : null;
}
// load Options form
loadOtionsForm(selectedCategory: any, ansItem: any){
// create options type group
let optionsGroup = new FormArray(ansItem.map(item => new FormGroup({
fk_pd_id:new FormControl(this.startPD),
pd_detail_answer_id: new FormControl(item.pd_detail_answer_id),
pd_answer_id: new FormControl(item.question_answer_id),
pd_answer: new FormControl(item.answer),
pd_answer_weightage:new FormControl(item.template_answer_weightage),
options: new FormControl(item.isactive==null ? false: true)
})));
// create documents group
let documentsGroup = new FormArray(this.ansPDList.images.map(item => new FormGroup({
pd_document_title:new FormControl(item.pd_document_title),
pd_document_url: new FormControl(item.pd_document_name),
})));
// create a hidden reuired formControl to keep status of checkbox group
let hiddenControl = new FormControl(this.optionsMapItems(optionsGroup.value), Validators.required);
let checkedItem = hiddenControl.value!=null ? new FormControl(hiddenControl.value[0].pd_answer_id) :new FormControl(null);
this.optionsForm = new FormGroup({
pd_detail_id: new FormControl(this.ansPDList.pd_detail_id),
fk_pd_id: new FormControl(this.startPD),
fk_category_id: new FormControl(this.selectedCategory.fk_template_question_category_id),
fk_question_id: new FormControl(this.selectedCategory.fk_question_id),
pd_question: new FormControl(this.selectedCategory.question),
pd_question_weightage: new FormControl(this.selectedCategory.question_weightage),
pd_answer_remark:new FormControl(this.ansPDList.question_remark),
items: optionsGroup,
selectedItems: hiddenControl,
modelValue : checkedItem,
documents: documentsGroup
});
this.optionsForm.controls.modelValue.valueChanges.subscribe((v) => {
hiddenControl.setValue(this.updateOptionsMapItems(v,optionsGroup.value));
});
}
// map option type group values
optionsMapItems(items) {
let optionSelectedItems = items.filter((item) => item.options==true).map((item) => item);
return optionSelectedItems.length ? optionSelectedItems : null;
}
// map options type while change options
updateOptionsMapItems(key,items) {
let updateSelectedItems = items.filter((item) => item.pd_answer_id==key).map((item) => item);
return updateSelectedItems.length ? updateSelectedItems : null;
}
// load text box form
loadTextBoxForm(selectedCategory: any, ansItem: any){
// create text box type group
let textGroup = new FormArray(ansItem.map(item => new FormGroup({
fk_pd_id:new FormControl(this.startPD),
pd_detail_answer_id: new FormControl(item.pd_detail_answer_id),
pd_answer_id: new FormControl(item.question_answer_id),
pd_answer: new FormControl(item.answer),
pd_answer_weightage:new FormControl(item.template_answer_weightage),
text: new FormControl(item.pd_detail_answer_id==null ? false: true)
})));
// create documents group
let documentsGroup = new FormArray(this.ansPDList.images.map(item => new FormGroup({
pd_document_title:new FormControl(item.pd_document_title),
pd_document_url: new FormControl(item.pd_document_name),
})));
this.textBoxForm = new FormGroup({
pd_detail_id: new FormControl(ansItem.pd_detail_id),
fk_pd_id: new FormControl(this.startPD),
fk_category_id: new FormControl(this.selectedCategory.fk_template_question_category_id),
fk_question_id: new FormControl(this.selectedCategory.fk_question_id),
pd_question: new FormControl(this.selectedCategory.question),
pd_question_weightage: new FormControl(this.selectedCategory.question_weightage),
pd_answer_remark:new FormControl(this.ansPDList.question_remark),
items: textGroup,
documents: documentsGroup
});
}
// next save and previous save for options and check box type questions
saveNextPrevious(details:any, type:number){
let fetchAns =[];
details.selectedItems.value.forEach((itemElement, itemIndex) => {
let obj1 = {
fk_pd_detail_id:details.pd_detail_id.value,
fk_pd_id:itemElement.fk_pd_id,
pd_detail_answer_id: itemElement.pd_detail_answer_id,
pd_answer_id: itemElement.pd_answer_id,
pd_answer: itemElement.pd_answer,
pd_answer_weightage:itemElement.pd_answer_weightage,
}
fetchAns.push(obj1)
});
let pd_details:any=[{
"pd_detail_id":details.pd_detail_id.value,
"fk_pd_id":details.fk_pd_id.value,
"fk_category_id":details.fk_category_id.value,
"fk_question_id":details.fk_question_id.value,
"pd_question":details.pd_question.value,
"pd_question_weightage":details.pd_question_weightage.value,
"question_remark":details.pd_answer_remark.value,
"answers":fetchAns,
"images":[]
}];
this._pd.savePDQuestions(pd_details).subscribe(result => {
if (result.status == 200) {
if(type==1){
this.skipNextPrevious(this.next);
}
else{
this.skipNextPrevious(this.previous);
}
}
}, error => {
});
}
// next save and previous save for text type questions
saveNextPreviousText(details:any, type:number){
let fetchAns =[];
details.items.value.forEach((itemElement, itemIndex) => {
let obj1 = {
fk_pd_detail_id:details.pd_detail_id.value,
fk_pd_id:itemElement.fk_pd_id,
pd_detail_answer_id: itemElement.pd_detail_answer_id,
pd_answer_id: itemElement.pd_answer_id,
pd_answer: itemElement.pd_answer,
pd_answer_weightage:itemElement.pd_answer_weightage,
}
fetchAns.push(obj1)
});
let pd_details:any={
"pd_detail_id":details.pd_detail_id.value,
"fk_pd_id":details.fk_pd_id.value,
"fk_category_id":details.fk_category_id.value,
"fk_question_id":details.fk_question_id.value,
"pd_question":details.pd_question.value,
"pd_question_weightage":details.pd_question_weightage.value,
"question_remark":details.pd_answer_remark.value,
"answers":fetchAns,
"images":[]
};
this._pd.savePDQuestions(pd_details).subscribe(result => {
if (result.status == 200) {
if(type==1){
this.skipNextPrevious(this.next);
}
else{
this.skipNextPrevious(this.previous);
}
}
}, error => {
});
}
// skip to previous and next questions
skipNextPrevious(type:number){
// for skip to next
if(type==1){
if(this.categoryList.length > this.selectedCategoryIndex ){
let nextCatList = this.categoryList[this.selectedCategoryIndex];
this.selectedQuestionIndex=this.selectedQuestionIndex < nextCatList.questions.length-1 ? this.selectedQuestionIndex+1 : this.selectedQuestionIndex;
let nextQuesList = nextCatList.questions[this.selectedQuestionIndex];
this.selectedCategory=nextQuesList;
this.selectedCategoryIndex=this.selectedCategoryIndex;
this.selectedQuestionIndex=this.selectedQuestionIndex;
let serachQuestions = {
"question_id":nextQuesList.fk_question_id,
"pd_id":this.startPD,
"template_id":nextQuesList.fk_template_id,
"category_id":nextQuesList.fk_template_question_category_id
}
this.getAnswers(serachQuestions);
}
}
// for skip to previous
else if(type==2){
if(this.categoryList.length > this.selectedCategoryIndex ){
let preCatList = this.categoryList[this.selectedCategoryIndex];
this.selectedQuestionIndex=this.selectedQuestionIndex ==0 ? this.selectedQuestionIndex : this.selectedQuestionIndex-1;
let preQuesList = preCatList.questions[this.selectedQuestionIndex];
this.selectedCategory=preQuesList;
this.selectedCategoryIndex=this.selectedCategoryIndex;
this.selectedQuestionIndex=this.selectedQuestionIndex;
let serachQuestions = {
"question_id":preQuesList.fk_question_id,
"pd_id":this.startPD,
"template_id":preQuesList.fk_template_id,
"category_id":preQuesList.fk_template_question_category_id
}
this.getAnswers(serachQuestions);
} }
}
}
//change pd status
changePDStatus(status:string){
let update_array = {
"pd_id": this.startPD
}
this._pd.editPdMasterDetails(update_array, status).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Completed.');
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
// load pd view component
loadPdViewCompoent(){
this.router.navigate([ '../../../pdlist/viewpd',this.startPD], { relativeTo: this.route });
}
} }

View File

@ -14,9 +14,9 @@
</div> </div>
<mat-card-content> <mat-card-content>
<div fxLayout="row"> <div fxLayout="row wrap">
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50"> <div class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<!--pd master --> <!--pd master -->
<mat-card *ngFor="let master of pdMasterData" class="minheight"> <mat-card *ngFor="let master of pdMasterData" class="minheight">
<div class="cardEdit"> <div class="cardEdit">
@ -43,7 +43,7 @@
</div> </div>
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50"> <div fxFlex.xs="100" class="m-gap p-gap" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<!-- applicant card --> <!-- applicant card -->
<mat-card class="minheight"> <mat-card class="minheight">
<div class="cardEdit"> <div class="cardEdit">
@ -60,7 +60,7 @@
<i class="fa-1x fa fa-user-o"></i> <i class="fa-1x fa fa-user-o"></i>
&nbsp;{{applicant.applicant_name}} </span> &nbsp;&nbsp;&nbsp;<span *ngIf="applicant.mobile_no!=null" class="mb-2 text-center hover-icon"> &nbsp;{{applicant.applicant_name}} </span> &nbsp;&nbsp;&nbsp;<span *ngIf="applicant.mobile_no!=null" class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-phone"></i> <i class="fa-1x fa fa-phone"></i>
&nbsp;{{applicant.mobile_no}} </span> <br><span style="font-size:12px;">Main Applicant</span><span *ngIf="applicant.applicant_type=='1';else codetails"> </span> &nbsp;{{applicant.mobile_no}} </span> <br><span *ngIf="applicant.applicant_type=='1';else codetails" style="font-size:12px;">Main Applicant</span>
<ng-template #codetails>&nbsp;&nbsp;&nbsp;<span>{{applicant.relation_name}}</span></ng-template> <ng-template #codetails>&nbsp;&nbsp;&nbsp;<span>{{applicant.relation_name}}</span></ng-template>
</p> </p>
@ -77,10 +77,9 @@
</mat-card> </mat-card>
</div> </div>
</div>
<div fxLayout="row">
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="m-gap p-gap">
<!-- pd documents card --> <!-- pd documents card -->
<mat-card class="minheight"> <mat-card class="minheight">
<!-- <div class="cardEdit"> <!-- <div class="cardEdit">
@ -108,18 +107,32 @@
</div> </div>
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50"> <div class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<!--pd logs card --> <!--pd logs card -->
<mat-card class="minheight"> <mat-expansion-panel *ngIf="masterPdLogsData.length>0; else nohistory">
<mat-card-header> <mat-expansion-panel-header>
<mat-card-title>PD History</mat-card-title> <mat-panel-title class="text-xs-left">
</mat-card-header> <h6 class="mt-0"> PD History</h6>
<mat-card-content> </mat-panel-title>
<p>No History</p>
</mat-card-content>
<!-- <ng-template #nohistory><mat-card-content><p>No History</p></mat-card-content></ng-template>-->
</mat-expansion-panel-header>
<mat-list class="m-gap p-gap" *ngFor="let masterHistory of masterPdLogsData">
<mat-list-item>
<p>{{masterHistory}}</p>
</mat-list-item>
</mat-list>
</mat-expansion-panel>
<ng-template #nohistory>
<mat-card>
<mat-card-content><p>No History</p></mat-card-content>
</mat-card> </mat-card>
</ng-template>
</div> </div>

View File

@ -24,7 +24,8 @@ export class ViewPdComponent implements OnInit, OnDestroy {
pdMasterData: any=[]; pdMasterData: any=[];
pdApplicantData: any=[]; pdApplicantData: any=[];
pdDocumentsData: any=[]; pdDocumentsData: any=[];
pdLogsData: any=[]; masterPdLogsData: any=[];
applicantPDLogsData: any=[];
viewID:string; viewID:string;
viewParams:any; viewParams:any;
// @Input() childData: string; // @Input() childData: string;
@ -50,7 +51,8 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.pdMasterData=data.records.pd_master_details; this.pdMasterData=data.records.pd_master_details;
this.pdApplicantData= data.records.applicants_details; this.pdApplicantData= data.records.applicants_details;
this.pdDocumentsData=data.records.pd_documnets; this.pdDocumentsData=data.records.pd_documnets;
this.pdLogsData=data.records.pd_logs; this.masterPdLogsData=data.records.pd_logs.master;
//this.applicantPDLogsData= data.records.pd_logs.master;
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }

View File

@ -133,7 +133,6 @@ export class PdTrigerService {
} }
// update pd officer // update pd officer
updatePdOfficer(updateData: any): Observable<any> { updatePdOfficer(updateData: any): Observable<any> {
console.log(updateData)
updateData.fk_updatedby = this._aws.getlocale(); updateData.fk_updatedby = this._aws.getlocale();
updateData.updatedon = currentdate; updateData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"allocatePD",{"records":updateData}) return this._http.post<any>(this.apiUrl+"allocatePD",{"records":updateData})
@ -151,6 +150,44 @@ export class PdTrigerService {
catchError(this.handleError('operation', [])) catchError(this.handleError('operation', []))
) )
} }
//load pd template details
loadPDTemplates(pdId: string):Observable<any>{
const options = pdId ?
{ params: new HttpParams().set('pd_id', pdId) } : {};
return this._http.get<any[]>(this.apiUrl + "loadFullTemplate",options)
.pipe(
catchError(this.handleError('operation', []))
)
}
// load PD question answers
getAnswersForPD(list: any):Observable<any>{
let httpParams = new HttpParams();
httpParams = httpParams.append("category_id", list.category_id);
httpParams = httpParams.append("pd_id", list.pd_id);
httpParams = httpParams.append("question_id", list.question_id);
httpParams = httpParams.append("template_id", list.template_id);
return this._http.post<any[]>(this.apiUrl + "getAnswersForPD",httpParams)
.pipe(
catchError(this.handleError('operation', []))
)
}
// save pd answers
savePDQuestions(saveData: any): Observable<any> {
saveData[0].createdby = this._aws.getlocale();
saveData[0].fk_createdon = currentdate;
// saveData[0].fk_updatedby = this._aws.getlocale();
// saveData[0].updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"savePDQuestions",{"records":saveData})
.pipe(
catchError(this.handleError('operation', []))
)
}
private handleError<T>(operation = 'operation', result?: T) { private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => { return (error: any): Observable<T> => {
return of(result as T); return of(result as T);