From cf9a0a2b06929ee79d125295138d774f9fffc6c4 Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Fri, 7 Dec 2018 18:45:26 +0530 Subject: [PATCH] actual pd - report template view and edit : kdk --- .../model-edit-pd-report.component.html | 19 ++++ .../model-edit-pd-report.component.scss | 0 .../model-edit-pd-report.component.spec.ts | 25 +++++ .../model-edit-pd-report.component.ts | 100 ++++++++++++++++++ .../pd-report/pd-report.component.html | 96 +++++++++-------- .../list-pd/pd-report/pd-report.component.ts | 41 ++++++- .../manage-pd/manage-pd.module.ts | 11 +- .../pd-service/pd-triger.service.ts | 14 +++ .../personal-discussion.module.ts | 5 + 9 files changed, 263 insertions(+), 48 deletions(-) create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.html create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.scss create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.spec.ts create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.html new file mode 100644 index 000000000..b3ae9b081 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.html @@ -0,0 +1,19 @@ +

Edit PD Report Details

+ +

Develop across all platforms

+
+
+
+ + + +
+ +
+
+ +
+ + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.spec.ts new file mode 100644 index 000000000..03efc6ed7 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ModelEditPdReportComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ModelEditPdReportComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts new file mode 100644 index 000000000..032df923b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts @@ -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, + @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 = `

My html content

`; + } + + ngOnInit() { + // alert(JSON.stringify(this.data)); + // this.ngForm.controls['content'].setValue('

Home

'); + 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() + "
"; + } + + 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.!'); + + // }) + } +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html index 174555bf2..af40f4bf2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html @@ -1,49 +1,57 @@ +
+ +
+
+
-
- -
-
- -
-
-
- {{pdReportRecords?.billing_name}} -
-
- {{pdReportRecords?.product_name}} -
-
- {{pdReportRecords?.customer_segment_name}} -
-
- {{pdReportRecords?.pd_type_name}} -
-
- {{pdReportRecords?.pd_status}} -
-
- - {{applicants.applicant_name}} , -
- -
- -
-

{{data.name}}

-
-
{{dataQA.question}}
-
{{dataQA.answer}}
+ + +
+
+ {{pdReportRecords?.billing_name}} +
+
+ {{pdReportRecords?.product_name}} +
+
+ {{pdReportRecords?.customer_segment_name}} +
+
+ {{pdReportRecords?.pd_type_name}} +
+
+ {{pdReportRecords?.pd_status}} +
+
+ + {{applicants.applicant_name}} , +
+ +
+ +
+

{{data.name}}

+
+
{{dataQA.question}}
+
{{dataQA.answer}}
+
+
+
+
-
-
-
-
+ + +
+ +
+ + +
+
+ - - - - - + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts index 2793bbc28..b47b81f24 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts @@ -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; + }); + } + } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index 4c3ee77ce..38cf332d9 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -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 { diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 93f3a277e..de7093371 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -289,6 +289,20 @@ getPDFormDetailsWithID(pdID, formID ):Observable { ) } + getPDReportFinalDocument(pdId: number){ + return this._http.post(this.apiUrl+"generatePDReport ",{"records":{"pd_id":pdId}}) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + + getActualPDReportModelTemplate(pdId: number) { + return this._http.post(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 ']; diff --git a/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts b/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts index c0ecf82ed..41ecee292 100755 --- a/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts +++ b/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts @@ -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,