This commit is contained in:
dineshkumarkannan 2018-11-05 17:57:07 +05:30
commit 4e0a4bbf84
10 changed files with 225 additions and 165 deletions

View File

@ -1,4 +1,4 @@
<form [formGroup]="_personalForm">
<form [formGroup]="_personalForm" (submit)="submitPersonalForm(_personalForm.value)">
<!-- start main applicant details -->
@ -12,33 +12,28 @@
<div [formArrayName]="'mainItem'" *ngFor="let mainDetails of pdMainapplicant.controls; let i = index;">
<div [formGroup]="mainDetails">
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==0">
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
<mat-form-field style="width: 100%">
<input matInput [placeholder]="mainDetails.controls.name_ques.value" formControlName="name_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==1">
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
<mat-form-field style="width: 100%">
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
<input matInput [placeholder]="mainDetails.controls.age_ques.value" formControlName="age_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==2">
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
<mat-form-field style="width: 100%">
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
<input matInput [placeholder]="mainDetails.controls.entity_ques.value" formControlName="entity_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==3">
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
<mat-form-field style="width: 100%">
<mat-select [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" required>
<mat-select [placeholder]="mainDetails.controls.qualification_ques.value" formControlName="qualification_ans" required>
<mat-option *ngFor="let education of qualifications" [value]="education" >
{{education}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==4">
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
<mat-select [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" required>
<mat-form-field style="width: 100%">
<mat-select [placeholder]="mainDetails.controls.earningStatus_ques.value" formControlName="earning_ans" required>
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
{{earning}}
</mat-option>
@ -57,48 +52,48 @@
<!-- end main applicant details -->
<!-- start co applicant form details -->
<div fxFlex="50" class="text-xs-left">
<div fxFlex="50" class="text-xs-left" [formArrayName]="'coItem'" *ngFor="let coDetails of pdCoapplicant.controls; let i = index;">
<mat-card>
<mat-card-title>Co Applicant</mat-card-title>
<mat-card-content>
<div [formArrayName]="'coItem'" *ngFor="let coDetails of pdCoapplicant.controls; let i = index;">
<div >
<div [formGroup]="coDetails">
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==0">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
<input matInput [placeholder]="coDetails.controls.name_ques.value" formControlName="name_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==1">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
<input matInput [placeholder]="coDetails.controls.age_ques.value" formControlName="age_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==2">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
<input matInput [placeholder]="coDetails.controls.entity_ques.value" formControlName="entity_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==3">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
<mat-select [placeholder]="coDetails.controls.qualification_ques.value" formControlName="qualification_ans" required>
<mat-option *ngFor="let education of qualifications" [value]="education" >
{{education}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==4">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
<mat-select [placeholder]="coDetails.controls.earningStatus_ques.value" formControlName="earning_ans" required>
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
{{earning}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==5">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
<mat-select [placeholder]="coDetails.controls.relationShip_ques.value" formControlName="relation_ans" required>
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
{{rel.name}}
</mat-option>
@ -109,17 +104,17 @@
</mat-card-content>
<mat-card-actions align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit" matTooltip="Save" matTooltipPosition="above" [disabled]="!_personalForm.valid "><mat-icon>save</mat-icon></button>
</mat-card-actions>
</mat-card>
</div>
</div>
<!-- end co applicant form details -->
<mat-card-actions align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit" matTooltip="Save" matTooltipPosition="above" [disabled]="!_personalForm.valid "><mat-icon>save</mat-icon></button>
</mat-card-actions>
</form>

View File

@ -15,12 +15,17 @@ export class PersonalInfoComponent implements OnInit {
earningStatus:any=["Earning Member","House Wife","Student","Retired","Pensioner","Other Non earning member"];
relationShipList:any=[];
@Input() pdid : string;
@Input() pd_all_details:any;
form_id:number;
private notifier: NotifierService;
public _personalForm: FormGroup;
public mainApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status"];
public coApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status","Relationship"];
public mainApplicantDetails :any=[];
public coApplicantDetails :any=[];
errorMessage:any;
//coItem:any;
//mainItem:any;
@ -35,44 +40,97 @@ export class PersonalInfoComponent implements OnInit {
ngOnInit() {
this.loadPDDetails(this.pdid,this.form_id);
this.loadFormData();
this.getRelationMaster();
this.mainApplicantDetails = this.pd_all_details.pdapplicants_detials.filter(item => item.applicant_type == 1);
// console.log(this.mainApplicantDetails)
this.coApplicantDetails = this.pd_all_details.pdapplicants_detials.filter(item => item.applicant_type == 0);
}
// load form pd details
loadPDDetails(pd:string,form:number){
// this._pd.getAllMasterDatas(pdid,form_id).subscribe(
// data => {
// if (data.status == 200) {
// this.relationShipList=data.records;
this._pd.getPDFormDetailsWithID(this.pdid,this.form_id).subscribe(
data => {
if (data.status == 200) {
// }
// }, error => this.errorMessage = <any> error);
}
else if(data.status == 204){
let defaultMainApp=[];
let defaultCoApp=[];
// generate default main applicant form details
if(this.mainApplicantDetails.length>0){
for(let j=0;j<this.mainApplicantQuestions.length; j++)
{
if(j==0){
let generateRow = {
"pd_question":"",
"pd_answer": this.mainApplicantDetails[0].applicant_name,
}
defaultMainApp.push(generateRow);
}
else{
let generateRow = {
"pd_question":"",
"pd_answer": "",
}
defaultMainApp.push(generateRow);
}
loadFormData(){
}
}
this.loadFormData(defaultMainApp,this.coApplicantDetails);
}
}, error => this.errorMessage = <any> error);
}
loadFormData(mainApp,coApp){
// main applicant
let mainApplicantGroup = new FormArray(this.mainApplicantQuestions.map((item,key) => new FormGroup({
fk_pd_id:new FormControl(null),
pd_question:new FormControl(this.mainApplicantQuestions[key]),
pd_question_type:new FormControl(key),
pd_detail_answer_id: new FormControl(null),
pd_answer_id: new FormControl(null,),
pd_answer: new FormControl(null,Validators.required),
pd_answer_weightage:new FormControl(null),
let mainApplicantGroup = new FormArray(this.mainApplicantDetails.map((item,key) => new FormGroup({
name_ques:new FormControl(this.mainApplicantQuestions[0]),
name_ans:new FormControl(item.applicant_name, Validators.required),
name_id:new FormControl(0),
age_ques:new FormControl(this.mainApplicantQuestions[1]),
age_id:new FormControl(1),
age_ans:new FormControl(null, Validators.required),
entity_ques: new FormControl(this.mainApplicantQuestions[2]),
entity_id: new FormControl(2),
entity_ans:new FormControl(null, Validators.required),
qualification_ques: new FormControl(this.mainApplicantQuestions[3]),
qualification_id: new FormControl(3),
qualification_ans:new FormControl(null, Validators.required),
earningStatus_ques:new FormControl(this.mainApplicantQuestions[4]),
earning_id: new FormControl(4),
earning_ans:new FormControl(null, Validators.required),
})));
// co applicant
let coApplicantGroup = new FormArray(this.coApplicantQuestions.map((item,key) => new FormGroup({
fk_pd_id:new FormControl(null),
pd_question:new FormControl(this.coApplicantQuestions[key]),
pd_question_type:new FormControl(key),
pd_detail_answer_id: new FormControl(null),
pd_answer_id: new FormControl(null),
pd_answer: new FormControl(null, Validators.required),
pd_answer_weightage:new FormControl(null),
})));
let iterateCoApp=[];
let coApplicantGroup = new FormArray(this.coApplicantDetails.map((item,key) => new FormGroup({
name_ques:new FormControl(this.coApplicantQuestions[0]),
name_ans:new FormControl(item.applicant_name, Validators.required),
name_id:new FormControl(0),
age_ques:new FormControl(this.coApplicantQuestions[1]),
age_id:new FormControl(1),
age_ans:new FormControl(null, Validators.required),
entity_ques: new FormControl(this.coApplicantQuestions[2]),
entity_id: new FormControl(2),
entity_ans:new FormControl(null, Validators.required),
qualification_ques: new FormControl(this.coApplicantQuestions[3]),
qualification_id: new FormControl(3),
qualification_ans:new FormControl(null, Validators.required),
earningStatus_ques:new FormControl(this.coApplicantQuestions[4]),
earning_id: new FormControl(4),
earning_ans:new FormControl(null, Validators.required),
relationShip_ques:new FormControl(this.coApplicantQuestions[5]),
relation_id:new FormControl(5),
relation_ans:new FormControl(null, Validators.required),
})));
this._personalForm = this._fb.group({
pdid:null,
@ -80,8 +138,8 @@ export class PersonalInfoComponent implements OnInit {
mainItem: mainApplicantGroup,
coItem: coApplicantGroup,
});
//console.log(this._personalForm);
console.log(this._personalForm.controls.coItem)
}
//get pd main applicant array values
@ -102,5 +160,53 @@ export class PersonalInfoComponent implements OnInit {
}, error => this.errorMessage = <any> error);
}
// submit forms details
submitPersonalForm(formData:any) {
if(this._personalForm.valid){
let applicantDetails:any=[];
formData.mainItem.forEach((element,key) => {
if(key==0){
applicantDetails.push({
"name_ans":element.name_ans,
"age_ans":element.age_ans,
"entity_ans":element.entity_ans,
"qualification_ans":element.qualification_ans,
"earning_ans":element.earning_ans,
})
}
});
formData.coItem.forEach((Coelement,Cokey) => {
applicantDetails.push({
"name_ans":Coelement.name_ans,
"age_ans":Coelement.age_ans,
"qualification_ans":Coelement.qualification_ans,
"entity_ans":Coelement.entity_ans,
"earning_ans":Coelement.earning_ans,
"relation_ans":Coelement.relation_ans,
})
});
let save_details:any={
"pdid": this.pdid,
"formid": this.form_id,
"applicant_details":applicantDetails
};
this._pd.savePDFormDetailsWithID(save_details).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'Success.');
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
}
}

View File

@ -389,7 +389,7 @@
<!-- start personal type questions -->
<ng-container *ngSwitchCase="3">
<app-personal-info [pdid]="startPD"></app-personal-info>
<app-personal-info [pdid]="startPD" [pd_all_details]="pdFullDetails"></app-personal-info>
</ng-container>
<!-- end personal type questions -->
</ng-container>

View File

@ -29,6 +29,7 @@ selectedQuestionIndex:number;
getQuestionsLength:number;
answerList:any=[];
ansPDList:any=[];
pdFullDetails:any=[];
// category static form buttons
categoryFormButtons : any=[
@ -107,6 +108,8 @@ loadTemplates(startID:string){
this.actualQuestions = data.records.counts.overall_question_count;
this.answeredQuestions = data.records.counts.overall_answered_count;
this.pdFullDetails = data.records
}
else{
this.pdMasterList="";

View File

@ -35,53 +35,22 @@
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
</ng-container>
<div *ngIf="!noQuesMasterRecrdFound">
<mat-paginator [length]="enityList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
</div>
</mat-card-content>
<!----<ng-container *ngIf="enityList.length > 0">
<div style="padding: 0 12px;">
<mat-card class="product-card" *ngFor="let product of dataSource.connect() | async">
<div fxLayout="row" fxLayoutAlign="start start">
<div fxFlex="90%" style="padding-top: 10px;">
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
<div fxFlex="0 1 auto" class="ml-xs" fxFlex="10%">
{{ product.entity_name }}
</div>
<div fxFlex="0 1 auto" class="ml-xs" fxFlex="40%">
<div> {{ product.full_name }} ({{product.short_name}})</div>
<div> {{ product.branch_name }} </div>
<div> {{product.city_name}}<span *ngIf="product.state_name">,</span> {{product.state_name}} </div>
</div>
<div fxFlex="0 1 auto" class="ml-xs" fxFlex="30%">
<div> {{ product.phone_number }}</div>
<div> {{ product.official_email }}</div>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
<div fxFlex="0 1 auto" class="ml-xs">
</div>
</div>
</div>
<div fxFlex="10%">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editEntity(product)"><mat-icon>edit</mat-icon></button>
</div>
</div>
</mat-card>
</div>
</ng-container>-->
<mat-card *ngIf="noQuesMasterRecrdFound">
<mat-card-content>
<div class="no-record-found">No Record Found ... </div>
</mat-card-content>
</mat-card>
<div *ngIf="enityList.length > 0">
<mat-paginator [length]="enityList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
</div>
</mat-card>
</div>

View File

@ -43,7 +43,7 @@ export class EntityListComponent implements OnInit {
questionListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
displayedColumns = ['categroy_name', 'question', 'actions'];
displayedColumns = ['entity_name', 'name','contact', 'actions'];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;

View File

@ -47,11 +47,10 @@
</mat-row>
</mat-table>
</ng-container>
<div *ngIf="productList.length > 0">
<mat-paginator [length]="productList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
<mat-paginator #paginator [length]="productList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
</div>
<!---- <ng-container *ngIf="productList.length > 0">

View File

@ -21,9 +21,9 @@
<!--<button mat-stroked-button color="primary" (click)="addNewQuestion()">Add Questions</button>-->
</div>
</div>
<ng-container *ngIf="templateList.length > 0">
<div style="padding: 0 12px;">
<mat-table [dataSource]="dataSource" >
<mat-card-content>
<ng-container >
<mat-table [dataSource]="dataSource" *ngIf="templateList.length > 0" >
<ng-container matColumnDef="template_name">
<mat-cell fxFlex="25%" *matCellDef="let template;">
@ -33,7 +33,7 @@
<ng-container matColumnDef="lender_details">
<mat-cell fxFlex="65%" *matCellDef="let template;">
<div *ngIf="template.lender_details.length > 0" class="text-line-limit">
<span *ngFor="let lender of template.lender_details ; let last = last" > {{lender.full_name}} - {{lender.product_name}} - {{lender.customer_segment_name}} <i *ngIf="!last">,<br></i></span>
<span *ngFor="let lender of template.lender_details ; let last = last" > {{lender.full_name}} - {{lender.product_name}} - {{lender.customer_segment_name}} <span *ngIf="!last">,<br><br></span></span>
</div>
</mat-cell>
</ng-container>
@ -45,38 +45,18 @@
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
<!----<mat-card class="product-card" *ngFor="let template of dataSource.connect() | async">
<div fxLayout="row" fxLayoutAlign="start start" style="padding: 6px 2px;">
<div fxFlex="90%" style="padding: 12px 8px;">
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="start center">
<div class="ml-xs" fxFlex="20%">
<span> {{ template.template_name }}</span>
</div>
<div class="ml-xs" fxFlex="80%">
<div *ngIf="template.lender_details.length > 0">
<span *ngFor="let lender of template.lender_details ; let last = last"> {{lender.full_name}} - {{lender.product_name}} - {{lender.customer_segment_name}} <i *ngIf="!last">,<br></i></span>
</div>
</div>
</div>
</div>
<div fxFlex="10%">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="goToEdit(template.template_id)"><mat-icon>edit</mat-icon></button>
</div>
</div>
</mat-card>-->
</div>
</ng-container>
<mat-card *ngIf="noQuesMasterRecrdFound">
<div class="no-record-found">No Record Found ... </div>
</mat-card>
<div *ngIf="templateList.length > 0">
<mat-paginator #paginator class="mat-elevation-z1" [length]="templateList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
<mat-paginator [length]="templateList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
</div>
<mat-card *ngIf="noTemplMasterRecrdFound">
<mat-card-content>
<div class="no-record-found">No Record Found ... </div>
</mat-card-content>
</mat-card>
</mat-card-content>
</mat-card>
</div>

View File

@ -25,8 +25,8 @@
overflow: hidden;
// white-space: nowrap;
display: -webkit-box;
line-height: 16px; /* fallback */
max-height: 32px; /* fallback */
line-height: 15px; /* fallback */
max-height: 44px; /* fallback */
-webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical;

View File

@ -20,12 +20,13 @@ import { TemplatesAddComponent } from './templates-add/templates-add.component';
})
export class TemplateListComponent implements OnInit, OnDestroy {
public templateList = [];
public templateList: any[] = [];
public listView: boolean;
public names: string;
public noTemplMasterRecrdFound: boolean = false;
public search_cid : any;
// pagination variable details
length = 50;
pageIndex = 0;
@ -55,6 +56,10 @@ export class TemplateListComponent implements OnInit, OnDestroy {
this.getTemplateMastersListDetails();
}
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
// get question master list details
getTemplateMastersListDetails() {
@ -123,7 +128,10 @@ export class TemplateListComponent implements OnInit, OnDestroy {
//Called once, before the instance is destroyed.
//Add 'implements OnDestroy' to the class.
}
// padination page event call
pageChange(e) {
console.log(e);
}
public m_templateList = {
"dataStatus": true,