merge: kms
This commit is contained in:
commit
c553e658eb
3752
ng6-seed/package-lock.json
generated
3752
ng6-seed/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -47,8 +47,10 @@
|
||||
"moment": "^2.15.0",
|
||||
"ng-pick-datetime": "^6.0.16",
|
||||
"ng2-charts": "1.6.0",
|
||||
"ng2-ckeditor": "^1.2.2",
|
||||
"ng2-dragula": "1.3.1",
|
||||
"ng2-file-upload": "1.2.1",
|
||||
"ng2-pdf-viewer": "^5.2.3",
|
||||
"ng2-toastr": "^4.1.2",
|
||||
"ng2-validation": "4.2.0",
|
||||
"ngx-color-picker": "^4.0.3",
|
||||
|
||||
@ -6,6 +6,7 @@ import { FormsModule } from '@angular/forms';
|
||||
import { HttpModule, Http } from '@angular/http';
|
||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS} from '@angular/common/http';
|
||||
|
||||
|
||||
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
|
||||
|
||||
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
|
||||
|
||||
@ -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>
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
@ -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.!');
|
||||
|
||||
// })
|
||||
}
|
||||
}
|
||||
@ -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">
|
||||
|
||||
</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>
|
||||
<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 *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>
|
||||
|
||||
|
||||
<notifier-container></notifier-container>
|
||||
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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';
|
||||
import { OtherApplicantDetailsComponent } from './list-pd/start-pd/forms/other-applicant-details/other-applicant-details.component';
|
||||
|
||||
|
||||
@ -251,7 +256,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, OtherApplicantDetailsComponent],
|
||||
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, OtherApplicantDetailsComponent],
|
||||
|
||||
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
|
||||
// providers: [PdTrigerService, GetGeometricLocationService],
|
||||
@ -260,6 +265,8 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
CommonModule,
|
||||
ManagePdRoutingModule,
|
||||
NotifierModule.withConfig(pdCustomNotifierOptions),
|
||||
CKEditorModule,
|
||||
PdfViewerModule,
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
@ -287,7 +294,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, OtherApplicantDetailsComponent],
|
||||
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent],
|
||||
|
||||
})
|
||||
export class ManagePdModule {
|
||||
|
||||
@ -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 '];
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -136,5 +136,15 @@ export class TemplatesService {
|
||||
return this._http.get<any[]>(this.apiUrl + "getListOfCategories");
|
||||
}
|
||||
|
||||
addPDReportModelTemplate(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 + "savePDReportTemplate", {'records': Records });
|
||||
}
|
||||
|
||||
getPDReportModelTemplate(template_id: number): Observable<any> {
|
||||
return this._http.post<any[]>(this.apiUrl + "getPDReportTemplate", { "records": {"fk_template_id": template_id }});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { CKEditorModule } from 'ng2-ckeditor';
|
||||
import {
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
@ -37,6 +37,7 @@ import { MastersService } from './service/masters/masters.service';
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
CKEditorModule,
|
||||
RouterModule.forChild(TemplateRoutes),
|
||||
TemplatesModule,
|
||||
QuestionsModule,
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
<div style="margin: 12px;">
|
||||
<form *ngIf="showEditor" 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>-->
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ReportTemplateComponent } from './report-template.component';
|
||||
|
||||
describe('ReportTemplateComponent', () => {
|
||||
let component: ReportTemplateComponent;
|
||||
let fixture: ComponentFixture<ReportTemplateComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ReportTemplateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ReportTemplateComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,92 @@
|
||||
import { Component, OnInit, ViewChild , Input} from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { TemplatesService } from './../../../../service/templates/templates.service';
|
||||
import { NotifierService } from "angular-notifier";
|
||||
|
||||
@Component({
|
||||
selector: 'app-report-template',
|
||||
templateUrl: './report-template.component.html',
|
||||
styleUrls: ['./report-template.component.scss']
|
||||
})
|
||||
export class ReportTemplateComponent 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 templatesService: TemplatesService,
|
||||
notifier: NotifierService ) {
|
||||
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() {
|
||||
// this.ngForm.controls['content'].setValue('<h1>Home<h1>');
|
||||
this.templatesService.getPDReportModelTemplate(this.questionId).subscribe(data => {
|
||||
if(data.dataStatus){
|
||||
this.recordData = data.records[0];
|
||||
|
||||
this.ngForm = this._formBuilder.group({
|
||||
report_template_id: [this.recordData.report_template_id],
|
||||
fk_template_id: [this.recordData.fk_template_id],
|
||||
content: [this.recordData.content, 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.!');
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -45,6 +45,12 @@
|
||||
</app-template-edit-question-answer>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Report Template">
|
||||
<ng-template matTabContent>
|
||||
<app-report-template [questionId]="question_id">
|
||||
</app-report-template>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</mat-card>
|
||||
</mat-card>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CKEditorModule } from 'ng2-ckeditor';
|
||||
|
||||
import { NotifierModule, NotifierOptions } from 'angular-notifier';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
@ -35,6 +36,7 @@ import { TemplatesService } from './../service/templates/templates.service';
|
||||
import { CategoryQuestionAnswerComponent } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component';
|
||||
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';
|
||||
|
||||
/*
|
||||
* Question Master Module details
|
||||
@ -87,6 +89,7 @@ const customNotifierOptions: NotifierOptions = {
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
CKEditorModule,
|
||||
NotifierModule.withConfig(customNotifierOptions),
|
||||
FlexLayoutModule,
|
||||
MatCardModule,
|
||||
@ -115,7 +118,8 @@ const customNotifierOptions: NotifierOptions = {
|
||||
EditQuestionAnswerComponent,
|
||||
CategoryQuestionAnswerComponent,
|
||||
DialogOverviewExampleDialog,
|
||||
TemplatesAddComponent
|
||||
TemplatesAddComponent,
|
||||
ReportTemplateComponent
|
||||
],
|
||||
entryComponents: [
|
||||
DialogOverviewExampleDialog,
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
<head>
|
||||
<base href="./">
|
||||
<script src="https://cdn.ckeditor.com/4.9.2/full-all/ckeditor.js"></script>
|
||||
<script> CKEDITOR.config.forcePasteAsPlainText = true; </script>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user