actual pd - report template view and edit : kdk

This commit is contained in:
dineshkumarkannan 2018-12-07 18:45:26 +05:30
parent 5f79a3b9f0
commit cf9a0a2b06
9 changed files with 263 additions and 48 deletions

View File

@ -0,0 +1,19 @@
<h2 mat-dialog-title>Edit PD Report Details</h2>
<mat-dialog-content class="mat-typography">
<h3>Develop across all platforms</h3>
<div style="margin: 12px;">
<form role="form" [formGroup]="ngForm" accept-charset="UTF-8" novalidate>
<div class="form-group has-feedback">
<ckeditor formControlName="content" name="myckeditor" required [config]="ckeConfig" debounce="500" (change)="onChange($event)">
</ckeditor>
<!--<div *ngIf="myckeditor.invalid && myckeditor.touched" class="help-block">Required field.</div>-->
</div>
<button [disabled]="ngForm.invalid" class="btn btn-primary" (click)="myClick()">Save</button>
</form>
</div>
<!--<div [innerHTML]="mycontent | safeHtml"></div>-->
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button>
<!--<button mat-button [mat-dialog-close]="true" cdkFocusInitial>Install</button>-->
</mat-dialog-actions>

View File

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

View File

@ -0,0 +1,100 @@
import { Component, OnInit, ViewChild , Input, Inject} from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { PdTrigerService } from '../../../../pd-service/pd-triger.service';
import { NotifierService } from "angular-notifier";
import {
MatDialog,
MatDialogRef,
MAT_DIALOG_DATA
} from '@angular/material';
@Component({
selector: 'app-model-edit-pd-report',
templateUrl: './model-edit-pd-report.component.html',
styleUrls: ['./model-edit-pd-report.component.scss']
})
export class ModelEditPdReportComponent implements OnInit {
@Input() questionId: number;
ngForm: FormGroup;
name = 'ng2-ckeditor';
ckeConfig: any;
recordData: any;
log = '';
showEditor= false;
@ViewChild('myckeditor') ckeditor: any;
/**
* Notifier service
*/
private notifier: NotifierService;
constructor( private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
notifier: NotifierService ,
private dialogRef: MatDialogRef<ModelEditPdReportComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier = notifier;
this.ngForm = this._formBuilder.group({
report_template_id: [],
fk_template_id: [],
content: [null, Validators.compose([Validators.required])],
isactive:[1]
})
// this.mycontent = `<p>My html content</p>`;
}
ngOnInit() {
// alert(JSON.stringify(this.data));
// this.ngForm.controls['content'].setValue('<h1>Home<h1>');
this.pdTrigerService.getActualPDReportModelTemplate(this.data.startId).subscribe(data => {
if(data.dataStatus){
this.recordData = data.records[0];
this.ngForm = this._formBuilder.group({
content: [this.recordData.pd_report_latest_version_blob, Validators.compose([Validators.required])],
isactive:[this.recordData.isactive]
})
this.showEditor = true;
} else {
this.recordData = data.records;
this.ngForm = this._formBuilder.group({
report_template_id: [null],
fk_template_id: [this.questionId],
content: [null, Validators.compose([Validators.required])],
isactive:[1]
})
this.showEditor = true;
}
},err => {
});
// this.ckeConfig = {
// allowedContent: false,
// extraPlugins: 'divarea',
// forcePasteAsPlainText: true
// };
}
onChange($event: any): void {
console.log('onChange');
// this.log += new Date() + "<br />";
}
myClick(): void {
// let template = this.ngForm.controls['mycontent'].value;
// let data = {
// template: template,
// template_id: this.questionId
// }
// var formValues = this.ngForm.value;
// Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
// this.templatesService.addPDReportModelTemplate(formValues).subscribe(data=>{
// this.notifier.notify('success', 'Your Changes Updated.!');
// }, err => {
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// })
}
}

View File

@ -1,49 +1,57 @@
<div style="text-align: right;" class="mb-1">
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button>
</div>
<div style="text-align: right;" class="mb-1">
</div>
<mat-card style="min-height:540px;">
<mat-card-content>
<div style="text-align: right;" class="mb-1">
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button>
</div>
<div style="text-align: right;" class="mb-1">
<mat-tab-group>
<mat-tab label="PD Report">
<div>
<div>
<label>Billing Name : </label> {{pdReportRecords?.billing_name}}
</div>
<div>
<label>Product Name : </label> {{pdReportRecords?.product_name}}
</div>
<div>
<label>Customer Segment Name: </label> {{pdReportRecords?.customer_segment_name}}
</div>
<div>
<label>PD Type: </label> {{pdReportRecords?.pd_type_name}}
</div>
<div>
<label>Status: </label> {{pdReportRecords?.pd_status}}
</div>
<div>
<label>Applicant Details : </label>
<span *ngFor="let applicants of pdReportRecords?.pd_applicant_details; let last = last"> {{applicants.applicant_name}} <span *ngIf="!last"> , </span></span>
</div>
<!--{{pdReportRecords.question_answers | json}}-->
<div *ngFor="let data of pdReportRecords?.question_answers.form_details">
</div>
<div>
<div>
<label>Billing Name : </label> {{pdReportRecords?.billing_name}}
</div>
<div>
<label>Product Name : </label> {{pdReportRecords?.product_name}}
</div>
<div>
<label>Customer Segment Name: </label> {{pdReportRecords?.customer_segment_name}}
</div>
<div>
<label>PD Type: </label> {{pdReportRecords?.pd_type_name}}
</div>
<div>
<label>Status: </label> {{pdReportRecords?.pd_status}}
</div>
<div>
<label>Applicant Details : </label>
<span *ngFor="let applicants of pdReportRecords?.pd_applicant_details; let last = last"> {{applicants.applicant_name}} <span *ngIf="!last"> , </span></span>
</div>
<!--{{pdReportRecords.question_answers | json}}-->
<div *ngFor="let data of pdReportRecords?.question_answers.form_details">
<div *ngIf="data?.details.length > 0">
<h4><b>{{data.name}}</b></h4>
<div *ngFor="let dataQA of data?.details">
<div><b>{{dataQA.question}}</b></div>
<div>{{dataQA.answer}}</div>
<div *ngIf="data?.details.length > 0">
<h4><b>{{data.name}}</b></h4>
<div *ngFor="let dataQA of data?.details">
<div><b>{{dataQA.question}}</b></div>
<div>{{dataQA.answer}}</div>
</div>
<hr>
</div>
</div>
</div>
<hr>
</div>
</div>
</div>
</mat-tab>
<mat-tab label="PD Report With Template">
<div>
<button (click)="addNewQuestion()">Edit</button>
<hr>
<pdf-viewer [src]="src"
[original-size]="false">
</pdf-viewer>
</div>
</mat-tab>
</mat-tab-group>
</mat-card-content>
</mat-card>
<notifier-container></notifier-container>

View File

@ -1,3 +1,4 @@
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
import {Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy} from '@angular/core';
import {FormBuilder, FormGroup, Validators, FormControl, FormArray, AbstractControl} from '@angular/forms';
import {ActivatedRoute, Router} from '@angular/router';
@ -5,6 +6,8 @@ import {NotifierService} from 'angular-notifier';
import {ListPdComponent} from './../list-pd.component';
import {PdTrigerService} from '../../../pd-service/pd-triger.service';
import { MatDialog } from "@angular/material";
import { ModelEditPdReportComponent} from './model-edit-pd-report/model-edit-pd-report.component';
@Component({
selector: 'app-pd-report',
@ -12,27 +15,34 @@ import {PdTrigerService} from '../../../pd-service/pd-triger.service';
styleUrls: ['./pd-report.component.scss']
})
export class PdReportComponent implements OnInit {
Url : SafeUrl;
startPD: any;
public src = 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf';
// public src = 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181207%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181207T122031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=fac718f35d195ecb45d1dc7049fbaf0fa3158f237deeedac3bae60f8ec22e822';
// public src;
pdReportRecords:any;
private notifier: NotifierService;
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, public pdTrigerService: PdTrigerService, private listPDComponent: ListPdComponent) {
private router: Router, public pdTrigerService: PdTrigerService, private listPDComponent: ListPdComponent,
private dialog: MatDialog, private sanitizer: DomSanitizer) {
this.startPD = this.route.snapshot.params['pdid'];
this.notifier = notifier;
// this.Url = this.sanitizer.bypassSecurityTrustResourceUrl("https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181207%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181207T122031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=fac718f35d195ecb45d1dc7049fbaf0fa3158f237deeedac3bae60f8ec22e822");
}
ngOnInit() {
this.listPDComponent.showListView(false);
this.getPdReportDetails();
this.getPdReportFinalTemplateDetails();
}
getPdReportDetails() {
this.pdTrigerService.getPdFinalReportDetails(this.startPD).subscribe(data => {
if (data.status == 200) {
// this.pdReportRecords = data.records.question_answers;
this.pdReportRecords = data.records;
// this.pdReportRecords = data.records.qu;
}
@ -41,12 +51,39 @@ export class PdReportComponent implements OnInit {
})
}
getPdReportFinalTemplateDetails(){
this.pdTrigerService.getPDReportFinalDocument(this.startPD).subscribe(data => {
if (data.status == 200) {
// this.pdReportRecords = data.records.question_answers;
// this.src = data.records.pd_report_uri;
// alert(this.src);
// this.pdReportRecords = data.records.qu;
}
}, err=> {
})
}
// load pd view component
loadPdViewCompoent() {
this.router.navigate(['../../viewpd', this.startPD], {relativeTo: this.route});
}
// add questions popup model call
addNewQuestion() {
const dialogRef = this.dialog.open(ModelEditPdReportComponent, {
data: { startId : this.startPD},
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.getQuestionsMasters();
// this.getBranch();
// this.isPopupOpened = false;
});
}
}

View File

@ -1,6 +1,10 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import { CKEditorModule } from 'ng2-ckeditor';
import { PdfViewerModule } from 'ng2-pdf-viewer';
import {
MatCardModule,
MatIconModule,
@ -72,6 +76,7 @@ import {RentalInfoComponent} from "./list-pd/start-pd/forms/rental-info/rental-i
import { AllocationViewMoreComponent } from './list-pd/allocation-view-more/allocation-view-more.component';
import { PdRequirementComponent } from './list-pd/pd-requirement/pd-requirement.component';
import { GeneralInfoComponent } from './list-pd/start-pd/forms/general-info/general-info.component';
import { ModelEditPdReportComponent } from './list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component';
/**
@ -250,7 +255,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
// AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
// OwlNativeDateTimeModule,
// ],
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent],
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent],
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
// providers: [PdTrigerService, GetGeometricLocationService],
@ -259,6 +264,8 @@ const pdCustomNotifierOptions: NotifierOptions = {
CommonModule,
ManagePdRoutingModule,
NotifierModule.withConfig(pdCustomNotifierOptions),
CKEditorModule,
PdfViewerModule,
MatCardModule,
MatIconModule,
MatInputModule,
@ -286,7 +293,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
providers: [PdTrigerService, GetGeometricLocationService],
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent],
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent],
})
export class ManagePdModule {

View File

@ -289,6 +289,20 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
)
}
getPDReportFinalDocument(pdId: number){
return this._http.post<any>(this.apiUrl+"generatePDReport ",{"records":{"pd_id":pdId}})
.pipe(
catchError(this.handleError('operation', []))
)
}
getActualPDReportModelTemplate(pdId: number) {
return this._http.post<any>(this.apiUrl+"getLatestPDReportBlob ",{"records":{"pd_id":pdId}})
.pipe(
catchError(this.handleError('operation', []))
)
}
// inWords(num) {
// let a : any = ['','one ','two ','three ','four ', 'five ','six ','seven ','eight ','nine ','ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen '];

View File

@ -1,6 +1,9 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { CKEditorModule } from 'ng2-ckeditor';
import { PdfViewerModule } from 'ng2-pdf-viewer';
import {
MatCardModule,
MatIconModule,
@ -27,6 +30,8 @@ import { personalDiscussionRoutes } from './personal-discussion.routing';
imports: [
CommonModule,
RouterModule.forChild(personalDiscussionRoutes),
CKEditorModule,
PdfViewerModule,
ManagePdModule,
MatCardModule,
MatIconModule,