template forms list, add details : kdk

This commit is contained in:
dineshkumarkannan 2018-12-31 13:25:28 +05:30
parent dde0d9081f
commit fee4b344ff
11 changed files with 160 additions and 18 deletions

View File

@ -89,7 +89,7 @@
</mat-form-field>
<mat-form-field style="width: 24%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" (change)="loanCalc()" required autocomplete="off">
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required autocomplete="off">
<mat-hint align="end" *ngIf="pdMain.loan_amount.value != ''">{{"&#8377;"}} {{loanAmtInWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>

View File

@ -13,9 +13,10 @@
</div>
<mat-tab-group>
<mat-tab label="PD Data">
<div>
Export
<button (click)="export()">Export Excel</button>
<div align="end" style="padding: 12px;">
<button matTooltip="Export Excel" matTooltipPosition="above" color="primary" mat-icon-button mat-raised-button (click)="export()">
<mat-icon style="color: white;">cloud_download</mat-icon>
</button>
</div>
<div>
<div>

View File

@ -266,7 +266,7 @@ export class PdReportComponent implements OnInit {
console.log(blob);
let datass = blob.headers.get('content-disposition');
let fileName = datass.split(/"/)[1];
this.notifier.notify('success', 'Your Changes Updated.!');
// this.notifier.notify('success', 'Your Changes Updated.!');
const blobs = new Blob([blob.body],
{ type: 'application/vnd.ms-excel' });
const file = new File([blobs], fileName,

View File

@ -19,8 +19,8 @@
mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion" matTooltipPosition="above"
(click)="getPDStart(viewID)"><mat-icon>question_answer</mat-icon></button>
<button *ngIf="master.pd_type_name && (currentPDStatus===pdStatusCheck.QC_COMPLETED || currentPDStatus===pdStatusCheck.COMPLETED)" mat-raised-button
mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above"
<button *ngIf="master.pd_type_name && (currentPDStatus===pdStatusCheck.QC_COMPLETED || currentPDStatus===pdStatusCheck.COMPLETED)"
mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above"
(click)="getPDIDReport(viewID)"><mat-icon>ballot</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
@ -191,26 +191,28 @@
</ng-template>
</div>
<div class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" 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">
<mat-card>
<div style="color:red !important;">
<h6>QC Notes</h6>
</div>
<p>
{{ pdMasterData[0]?.qc_remarks}}</p>
</mat-card>
</div>
<div *ngIf="pdMasterData[0]?.pd_status === 'QC_COMPLETED'" class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50"
<div *ngIf="pdMasterData[0]?.pd_status === 'QC_COMPLETED'" class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50"
fxFlex.lg="50" fxFlex.xl="50">
<mat-card>
<div style="color:red !important;">
<h6>QC Remarks</h6>
</div>
<div>
<div>
{{ pdMasterData[0]?.qc_rating}}
<div>
<div style="display: inline-flex">
<div style="margin: 12px; font-size: 21px;">
{{ pdMasterData[0]?.qc_rating}}
</div>
<div style="display: inline-block">
<app-rating [rating]="pd_QC_Rating"></app-rating>
</div>
</div>
@ -218,8 +220,9 @@
<br>
<div style="display: inline-block;">
{{ pdMasterData[0]?.qc_feedback}}
</div>
</div>
</div>
</mat-card>
</div>
</div>
</mat-card-content>
</div>

View File

@ -146,5 +146,17 @@ export class TemplatesService {
return this._http.post<any[]>(this.apiUrl + "getPDReportTemplate", { "records": {"fk_template_id": template_id }});
}
// selected Template forms details
getTemplateSelectedForms(template_id: any): Observable<any> {
const options = {
params: new HttpParams().set('template_id', template_id)
};
return this._http.get<any[]>(this.apiUrl + "getTemplateForms", options);
}
}
saveTemplateFormsList(Records: any): Observable<any> {
// Records.fk_createdby = this._aws.getlocale();//to get user id for who is created the Record
// Records.createdon = currentdate;//to get Current date and Time for when the Record is created
return this._http.post<any[]>(this.apiUrl + "saveTemplateForms", {'records': Records });
}
}

View File

@ -0,0 +1,9 @@
<mat-selection-list #list [(ngModel)]="selectedOptions" (ngModelChange)="onNgModelChange($event)" class="flexlist">
<mat-list-option *ngFor="let tta of masterFormsList" [value]="tta.form_id">
{{tta.pd_form_name}}
</mat-list-option>
</mat-selection-list>
<div align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="restore()"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" (click)="myClick()"><mat-icon>save</mat-icon></button>
</div>

View File

@ -0,0 +1,7 @@
.flexlist{
display: flex;
flex-wrap: wrap;
}
.flexlist > * {
flex: 0 50%;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TemplateFormsComponent } from './template-forms.component';
describe('TemplateFormsComponent', () => {
let component: TemplateFormsComponent;
let fixture: ComponentFixture<TemplateFormsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TemplateFormsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TemplateFormsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,77 @@
import { Component, OnInit, ViewChild , Input} from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { TemplatesService } from './../../../../service/templates/templates.service';
import { MastersService } from './../../../../service/masters/masters.service';
import { NotifierService } from "angular-notifier";
@Component({
selector: 'app-template-forms',
templateUrl: './template-forms.component.html',
styleUrls: ['./template-forms.component.scss']
})
export class TemplateFormsComponent implements OnInit {
masterFormsList = [] ;
selectedOptions = [];
@Input() questionId: number;
/**
* Notifier service
*/
private notifier: NotifierService;
constructor(private mastersService : MastersService,
private templatesService: TemplatesService,
notifier: NotifierService) {
this.notifier = notifier;
}
ngOnInit() {
this.mastersService.getAllMasterData("PDFORMS").subscribe(data => {
this.masterFormsList = data.records.sort((a ,b)=>{ return a.pd_form_order - b.pd_form_order;});
// this.selectedOptions = ["1"];
this.getSelectedFormDetails();
});
}
restore(): void {
this.getSelectedFormDetails();
}
getSelectedFormDetails() {
this.templatesService.getTemplateSelectedForms(this.questionId).subscribe(data=>{
if(data.dataStatus){
this.selectedOptions = data.records;
} else {
}
})
}
myClick(){
if(this.selectedOptions.length > 0){
let records = {
"template_id":this.questionId,
"forms": this.selectedOptions
}
this.templatesService.saveTemplateFormsList(records).subscribe(data => {
if(data.dataStatus){
this.notifier.notify('success', 'Your Changes Updated.!');
}else{
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
} else {
alert("should select the forms in list !!!");
}
}
onNgModelChange(e){
console.log("event " + e);
}
}

View File

@ -51,6 +51,12 @@
</app-report-template>
</ng-template>
</mat-tab>
<mat-tab label="Forms">
<ng-template matTabContent>
<app-template-forms [questionId]="question_id">
</app-template-forms>
</ng-template>
</mat-tab>
</mat-tab-group>
</mat-card>
</mat-card>

View File

@ -37,6 +37,7 @@ import { CategoryQuestionAnswerComponent } from './templates-list/edit/edit-ques
import { DialogOverviewExampleDialog } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component';
import { TemplatesAddComponent } from './templates-list/templates-add/templates-add.component';
import { ReportTemplateComponent } from './templates-list/edit/report-template/report-template.component';
import { TemplateFormsComponent } from './templates-list/edit/template-forms/template-forms.component';
/*
* Question Master Module details
@ -119,7 +120,8 @@ const customNotifierOptions: NotifierOptions = {
CategoryQuestionAnswerComponent,
DialogOverviewExampleDialog,
TemplatesAddComponent,
ReportTemplateComponent
ReportTemplateComponent,
TemplateFormsComponent
],
entryComponents: [
DialogOverviewExampleDialog,