Fairoj : SMC Credit PD Module added
This commit is contained in:
parent
8026e5093c
commit
77f575e1c4
Binary file not shown.
@ -44,7 +44,7 @@ import { NewPasswordDialog, ForgotPass } from './session/login/login.component';
|
||||
import { AuthGuard } from './_guard/auth.guard';
|
||||
import { RoleMenuItemsPipe } from './layouts/role-menu-items.pipe';
|
||||
import { ResizableModule } from 'angular-resizable-element';
|
||||
import { SalesPdComponent } from './sales-pd/sales-pd.component';
|
||||
import { SalesPdComponent, DialogOverviewExampleDialog } from './sales-pd/sales-pd.component';
|
||||
import { PdTrigerService } from './personal-discussion/pd-service/pd-triger.service';
|
||||
import { LoaderService } from './shared/loaderService/loader.service';
|
||||
import { HttpLoaderComponent } from './layouts/http-loader/http-loader.component';
|
||||
@ -68,7 +68,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
||||
AuthLayoutComponent,
|
||||
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, SalesPdComponent,
|
||||
HttpLoaderComponent,
|
||||
AdvanceFilterComponent
|
||||
AdvanceFilterComponent,
|
||||
DialogOverviewExampleDialog
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -122,7 +123,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
||||
multi: true
|
||||
}
|
||||
],
|
||||
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog],
|
||||
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog, DialogOverviewExampleDialog],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
@ -33,6 +33,10 @@ export const AppRoutes: Routes = [{
|
||||
path:'sales-pd-list',
|
||||
component:SalesPdComponent
|
||||
},
|
||||
{
|
||||
path:'credit_pd',
|
||||
loadChildren:'./lender-credit-pd/lender-credit-pd.module#LenderCreditPdModule'
|
||||
},
|
||||
{
|
||||
path:'reports',
|
||||
loadChildren:'./reports/reports.module#ReportsModule'
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
<h1 mat-dialog-title>{{data.title}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>{{data.msg}}</p>
|
||||
|
||||
<!-- <div>
|
||||
<mat-radio-group [(ngModel)]="choosedPD">
|
||||
<mat-label>Choose the PD Type :</mat-label><br/>
|
||||
<mat-radio-button style="margin:10px;" *ngFor="let item of pd_type_list" [value]="item.id">{{item.dis_name}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div> -->
|
||||
</div><br/>
|
||||
<div mat-dialog-actions align="end">
|
||||
<button *ngIf="data.buttons[1].visible" mat-stroked-button color="primary" (click)="onSubmit(data.buttons[1].id)">{{data.buttons[1].name}}</button>
|
||||
<button *ngIf="data.buttons[0].visible" mat-raised-button color="primary" (click)="onSubmit(data.buttons[0].id)" cdkFocusInitial>{{data.buttons[0].name}}</button>
|
||||
</div>
|
||||
@ -0,0 +1,6 @@
|
||||
h1 {
|
||||
font-size: 1.7rem;
|
||||
}
|
||||
p {
|
||||
font-size: 1rem;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AlertDialogComponent } from './alert-dialog.component';
|
||||
|
||||
describe('AlertDialogComponent', () => {
|
||||
let component: AlertDialogComponent;
|
||||
let fixture: ComponentFixture<AlertDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AlertDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AlertDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,30 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'app-alert-dialog',
|
||||
templateUrl: './alert-dialog.component.html',
|
||||
styleUrls: ['./alert-dialog.component.scss']
|
||||
})
|
||||
export class AlertDialogComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<AlertDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data) {
|
||||
// this.notifier=notifier
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
onSubmit(btn_id){
|
||||
console.log(btn_id);
|
||||
// if(this.choosedPD != '' && !this.choosedPD) {
|
||||
// alert("Please choose the PD Type");
|
||||
// return
|
||||
// }
|
||||
this.dialogRef.close(btn_id)
|
||||
}
|
||||
ngOnInit() {}
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
<!-- <p>
|
||||
advance-filter works!
|
||||
</p> -->
|
||||
<mat-expansion-panel [(expanded)]="xpandStatus">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title class="text-xs-left">
|
||||
<mat-toolbar-row>
|
||||
<mat-icon>filter_list</mat-icon>
|
||||
<span class="toolbar-space"></span>
|
||||
<span>Advanced Filter</span>
|
||||
</mat-toolbar-row>
|
||||
</mat-panel-title>
|
||||
|
||||
</mat-expansion-panel-header>
|
||||
<mat-list class="m-gap p-gap" >
|
||||
<div [formGroup]="searchForm" fxLayout="row wrap" fxFlex="100%" fxLayoutGap="35px" fxLayoutAlign="flex-start stretch">
|
||||
<mat-form-field style="width: 20%">
|
||||
<mat-select multiple formControlName="pd_status" placeholder="PD Status">
|
||||
<mat-option *ngFor="let status of pdStatus" [value]="status">{{status}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:20%">
|
||||
<input matInput [matDatepicker]="picker" [max]="todaydate"
|
||||
formControlName="pd_from_date" placeholder="Choose a From date">
|
||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #picker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:20%">
|
||||
<input matInput [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" [max]="todaydate"
|
||||
formControlName="pd_to_date" placeholder="Choose a To date">
|
||||
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
|
||||
<mat-datepicker #picker1></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:20%">
|
||||
<mat-select multiple formControlName="pd_products" placeholder="Products">
|
||||
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.abbr}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width:30%">
|
||||
<mat-select multiple formControlName="pd_city" placeholder="City">
|
||||
<mat-option *ngFor="let city of CITY" [value]="city.city_id">{{city.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field> -->
|
||||
<!-- <mat-form-field style="width:30%">
|
||||
<mat-select multiple formControlName="pd_lender" placeholder="Lender Name">
|
||||
<mat-option *ngFor="let ent of ENTITY" [value]="ent.entity_id">{{ent.full_name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field> -->
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput type="text" formControlName="pd_applicant_name" placeholder="Company/Firm Name">
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width: 30%">
|
||||
<input matInput type="text" formControlName="pd_officer" placeholder="PD Officer Name">
|
||||
</mat-form-field> -->
|
||||
<!-- <div fxLayout="row wrap">
|
||||
<div fxFlex.xs="100%" fxFlex.sm="100%" fxFlex="45%">
|
||||
<mat-checkbox class="example-margin" color="primary" formControlName="is_include_archived">Include Archived</mat-checkbox>
|
||||
</div>
|
||||
</div> --> </div>
|
||||
</mat-list>
|
||||
<div align="right" fxLayout="row" fxLayoutAlign="flex-end">
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="onReset()" matTooltip="Reset"
|
||||
matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
|
||||
<mat-icon>settings_backup_restore</mat-icon>
|
||||
</button>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="searchItem()" matTooltip="Search"
|
||||
matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
|
||||
<mat-icon>search</mat-icon>
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</mat-expansion-panel>
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CreditAdvanceFilterComponent } from './credit-advance-filter.component';
|
||||
|
||||
describe('CreditAdvanceFilterComponent', () => {
|
||||
let component: CreditAdvanceFilterComponent;
|
||||
let fixture: ComponentFixture<CreditAdvanceFilterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreditAdvanceFilterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CreditAdvanceFilterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,121 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
|
||||
import { SalesPdService } from 'app/sales-pd/sales-pd.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-credit-advance-filter',
|
||||
templateUrl: './credit-advance-filter.component.html',
|
||||
styleUrls: ['./credit-advance-filter.component.scss']
|
||||
})
|
||||
export class CreditAdvanceFilterComponent implements OnInit {
|
||||
|
||||
searchForm:FormGroup;
|
||||
todaydate: any;
|
||||
pdStatus: any=[];
|
||||
// pdStatus_all: any=[];
|
||||
ENTITY: any =[];
|
||||
@Input()drop_down_datas
|
||||
@Output() filteredlistData = new EventEmitter();
|
||||
@Output() resetFilter = new EventEmitter();
|
||||
PRODUCTS: any =[];
|
||||
xpandStatus:boolean=false;
|
||||
pipe=new DatePipe('en-US');
|
||||
constructor(private _fb:FormBuilder,private _pd:PdTrigerService,private salesPDService:SalesPdService) {
|
||||
this.todaydate = new Date();
|
||||
this.getDropdown();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
let entity_id=localStorage.getItem('LocalSetEntity');
|
||||
this.searchForm=this._fb.group({
|
||||
pd_status:[''],
|
||||
pd_from_date:[''],
|
||||
pd_to_date:[''],
|
||||
pd_products:[''],
|
||||
pd_lender:[entity_id],
|
||||
pd_applicant_name:[''],
|
||||
pd_officer:[''],
|
||||
})
|
||||
console.log(this.drop_down_datas)
|
||||
}
|
||||
getDropdown(){
|
||||
// this._pd.getAllMasterDatas('PDSTATUS').subscribe(res=>
|
||||
// {
|
||||
// if(res.dataStatus==true)
|
||||
// {
|
||||
// this.pdStatus_all = res.records.filter(status=>status.isactive==1);
|
||||
// }
|
||||
// });
|
||||
this._pd.getAllMasterDatas('ENTITY').subscribe(res=>
|
||||
{
|
||||
if(res.dataStatus==true)
|
||||
{
|
||||
this.ENTITY = res.records.filter(ent=>ent.isactive==1);
|
||||
}
|
||||
});
|
||||
this._pd.getAllMasterDatas('PRODUCTS').subscribe(res=>
|
||||
{
|
||||
if(res.dataStatus==true)
|
||||
{
|
||||
this.PRODUCTS = res.records.filter(pro=>pro.isactive==1);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
ngOnChanges(){
|
||||
console.log(this.drop_down_datas)
|
||||
if(this.drop_down_datas != undefined){
|
||||
this.pdStatus=this.drop_down_datas.pd_status
|
||||
if(this.ENTITY.length != 0) {
|
||||
this.entityCheck()
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{this.entityCheck()},500)
|
||||
}
|
||||
if(this.PRODUCTS.length != 0) {
|
||||
this.productCheck()
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{this.productCheck()},500)
|
||||
}
|
||||
}
|
||||
}
|
||||
productCheck(){
|
||||
this.PRODUCTS=this.PRODUCTS.filter(val=>{
|
||||
if(this.drop_down_datas.product_ids.filter(dp=>dp == val.product_id).length > 0){
|
||||
return val
|
||||
}
|
||||
})
|
||||
}
|
||||
entityCheck(){
|
||||
this.ENTITY=this.ENTITY.filter(val=>{
|
||||
if(this.drop_down_datas.lender_ids.filter(dp=>dp == val.entity_id).length > 0){
|
||||
return val
|
||||
}
|
||||
})
|
||||
}
|
||||
searchItem(){
|
||||
this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date,'yyyy-MM-dd');
|
||||
this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date,'yyyy-MM-dd');
|
||||
// console.log(JSON.stringifythis.searchForm.value);
|
||||
this.xpandStatus=true;
|
||||
this.salesPDService.advancedFilter(this.searchForm.value).subscribe(res=>{
|
||||
if(res.dataStatus){
|
||||
console.log(res);
|
||||
this.filteredlistData.emit(res);
|
||||
this.xpandStatus=false
|
||||
}
|
||||
else{
|
||||
this.filteredlistData.emit(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
onReset(){
|
||||
this.searchForm.reset();
|
||||
this.xpandStatus=false
|
||||
this.resetFilter.emit(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { PdListComponent } from './pd-list/pd-list.component';
|
||||
import { PdQuestionsComponent } from './pd-questions/pd-questions.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path:'',
|
||||
redirectTo:'pdlist',
|
||||
pathMatch:'full'
|
||||
},
|
||||
{
|
||||
path:'pdlist',
|
||||
component:PdListComponent
|
||||
},
|
||||
{
|
||||
path:'pdQuestions',
|
||||
component:PdQuestionsComponent
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class LenderCreditPdRoutingModule { }
|
||||
@ -0,0 +1,13 @@
|
||||
import { LenderCreditPdModule } from './lender-credit-pd.module';
|
||||
|
||||
describe('LenderCreditPdModule', () => {
|
||||
let lenderCreditPdModule: LenderCreditPdModule;
|
||||
|
||||
beforeEach(() => {
|
||||
lenderCreditPdModule = new LenderCreditPdModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(lenderCreditPdModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
123
ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.ts
Normal file
123
ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.ts
Normal file
@ -0,0 +1,123 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { LenderCreditPdRoutingModule } from './lender-credit-pd-routing.module';
|
||||
import { PdListComponent } from './pd-list/pd-list.component';
|
||||
import { PdQuestionsComponent } from './pd-questions/pd-questions.component';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatCardModule, MatInputModule, MatFormFieldModule, MatSelectModule, MatRadioButton, MatCheckboxModule, MatRadioModule, MatToolbarModule, MatIconModule, MatButtonModule, MatSidenavModule, MatListModule, MatExpansionModule, MatProgressSpinnerModule, MatTableModule, MatPaginatorModule, MatTabsModule, MatDatepickerModule } from '@angular/material';
|
||||
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
||||
import { QuesTemplateComponent } from './ques-template/ques-template.component';
|
||||
import { NotifierOptions, NotifierModule } from 'angular-notifier';
|
||||
import { NumberToWordsPipe } from 'app/personal-discussion/pd-pipes/number-to-words.pipe';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { AdvanceFilterComponent } from 'app/sales-pd/advance-filter/advance-filter.component';
|
||||
import { CreditAdvanceFilterComponent } from './credit-advance-filter/credit-advance-filter.component';
|
||||
import { AlertDialogComponent } from './alert-dialog/alert-dialog.component';
|
||||
|
||||
const pdCustomNotifierOptions: NotifierOptions = {
|
||||
position: {
|
||||
horizontal: {
|
||||
position: 'right',
|
||||
distance: 12
|
||||
},
|
||||
vertical: {
|
||||
position: 'top',
|
||||
distance: 32,
|
||||
gap: 10
|
||||
}
|
||||
},
|
||||
theme: 'material',
|
||||
behaviour: {
|
||||
autoHide: 2000,
|
||||
onClick: 'hide',
|
||||
onMouseover: 'pauseAutoHide',
|
||||
showDismissButton: true,
|
||||
stacking: 4
|
||||
},
|
||||
animations: {
|
||||
enabled: true,
|
||||
show: {
|
||||
preset: 'slide',
|
||||
speed: 300,
|
||||
easing: 'ease'
|
||||
},
|
||||
hide: {
|
||||
preset: 'fade',
|
||||
speed: 300,
|
||||
easing: 'ease',
|
||||
offset: 50
|
||||
},
|
||||
shift: {
|
||||
speed: 300,
|
||||
easing: 'ease'
|
||||
},
|
||||
overlap: 150
|
||||
}
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatCardModule,
|
||||
MatInputModule,
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatCheckboxModule,
|
||||
NgxMatSelectSearchModule,
|
||||
MatRadioModule,
|
||||
MatToolbarModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
MatSidenavModule,
|
||||
MatListModule,
|
||||
MatExpansionModule,
|
||||
MatProgressSpinnerModule,
|
||||
FlexLayoutModule,
|
||||
MatTabsModule,
|
||||
MatDatepickerModule,
|
||||
],
|
||||
exports: [
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatCardModule,
|
||||
MatInputModule,
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatCheckboxModule,
|
||||
NgxMatSelectSearchModule,
|
||||
MatRadioModule,
|
||||
MatToolbarModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
MatSidenavModule,
|
||||
MatListModule,
|
||||
MatExpansionModule,
|
||||
MatProgressSpinnerModule,
|
||||
FlexLayoutModule,
|
||||
MatTabsModule,
|
||||
MatDatepickerModule,
|
||||
],
|
||||
declarations: []
|
||||
})
|
||||
export class MaterialModule { }
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
LenderCreditPdRoutingModule,
|
||||
MaterialModule,
|
||||
NotifierModule.withConfig(pdCustomNotifierOptions),
|
||||
SharedModule,
|
||||
MatTableModule,
|
||||
MatPaginatorModule
|
||||
],
|
||||
entryComponents:[AlertDialogComponent],
|
||||
declarations: [PdListComponent,PdQuestionsComponent,QuesTemplateComponent,CreditAdvanceFilterComponent,AlertDialogComponent]
|
||||
})
|
||||
export class LenderCreditPdModule { }
|
||||
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
<mat-card class="p-2" style="box-shadow: 0 0 1px rgba(0,0,0,.18), 0 0 1px rgba(0,0,0,.15) !important">
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="50" class="pb-0 text-sm-left">
|
||||
<mat-form-field dividerColor="primary" style="width: 50%;">
|
||||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<mat-tab-group class="mt-1">
|
||||
<mat-tab>
|
||||
<ng-template mat-tab-label>Credit PD</ng-template>
|
||||
<mat-card-content>
|
||||
<!-- <app-credit-advance-filter [drop_down_datas]="filter_drop_down_data" (filteredlistData)="filteredDataSource($event)"
|
||||
(resetFilter)= "loadSalesPDDetails()"></app-credit-advance-filter> -->
|
||||
<p class="note" *ngIf="!recordStatus && limitMsg">Showing data for last {{common}}. To see older records, please use advanced filter</p>
|
||||
<br/>
|
||||
<mat-table [dataSource]="dataSourceTab4" matSort *ngIf="salesPdData.length > 0" >
|
||||
|
||||
<ng-container matColumnDef="SalesPdId">
|
||||
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="7" fxFlex.sm="7" fxFlex.md="7" fxFlex.lg="7" fxFlex.xl="10">
|
||||
<small mat-line>{{details.smc_credit_pd}}</small>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="SalesPdSno">
|
||||
<mat-cell fxFlex.xs="15" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="16" fxFlex.xl="15" class="cell" *matCellDef="let details;" style="color:rgb(224, 2, 1);font-weight: bold;text-align: left" >
|
||||
<small mat-line>{{details.smc_credit_pd_sno}}</small><br/>
|
||||
<small style="color: black;text-align:center;font-weight: normal;font-size: 15px;">{{details.smc_credit_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}}</small>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Applicant Name">
|
||||
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="20" fxFlex.sm="17" fxFlex.md="18" fxFlex.lg="20" fxFlex.xl="18">
|
||||
<span *ngIf="!details.applicant_name" mat-line>
|
||||
<small>--</small>
|
||||
</span>
|
||||
<span *ngIf="details.applicant_name" mat-line>
|
||||
<b>{{details.applicant_name}}</b>
|
||||
</span><br>
|
||||
<span class="fontsize" mat-line> {{details.applicant_id}}</span>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Short Name">
|
||||
<mat-cell class="cell" *matCellDef="let details" fxLayoutAlign="center start" fxFlex.xs="9" fxFlex.sm="9" fxFlex.md="9" fxFlex.lg="9">
|
||||
<span style="font-weight:500"> <small mat-line>{{details.short_name}}</small></span><br/>
|
||||
<span style="text-align: center;font-weight:400;font-size: 17px;"> <small mat-line>{{details.abbr}}</small></span>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Officer Name">
|
||||
<mat-cell fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="10" fxFlex.lg="13" class="cell" *matCellDef="let details;" fxLayoutAlign="center start">
|
||||
<span *ngIf="!details.officer_name" mat-line>
|
||||
<small>--</small>
|
||||
</span>
|
||||
<span *ngIf="details.officer_name" mat-line>
|
||||
<small mat-line >{{details.officer_name}}</small>
|
||||
</span>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="status">
|
||||
<mat-cell fxFlex.xs="10" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="18" class="cell" *matCellDef="let details;" style="justify-content: flex-start;;text-align: center;font-weight: bold" fxLayoutAlign="start">
|
||||
<span *ngIf="!details.status" mat-line>
|
||||
<small>--</small>
|
||||
</span>
|
||||
<span *ngIf="details.status" mat-line>
|
||||
<small mat-line [ngStyle]="{'color':details.status == 'COMPLETED' ? 'green' :'orange'}">{{details.status}}</small>
|
||||
</span>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Create On">
|
||||
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="10" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="10" fxLayoutAlign="center end">
|
||||
<small mat-line>{{details.createdon | date: 'dd/MM/yyyy'}}</small>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Action">
|
||||
<mat-cell class="cell" *matCellDef="let details;" >
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PDF Download" *ngIf="details.status == 'COMPLETED'"
|
||||
matTooltipPosition="above" color="primary" (click)="salesPDpdf(details.sales_pd_id)"><mat-icon>file_download</mat-icon></button>
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="View PD" *ngIf="details.status != 'COMPLETED'"
|
||||
matTooltipPosition="above" color="primary" (click)="openCurrPD(details)"><mat-icon>visibility</mat-icon></button>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
|
||||
</mat-row>
|
||||
</mat-table>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
<mat-paginator *ngIf="!recordStatus" #paginator class="mat-elevation-z1" [length]="salesPdData.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
|
||||
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
|
||||
</mat-paginator>
|
||||
<mat-card-content *ngIf="recordStatus">
|
||||
<h5 align="center" style="font-weight: bold;
|
||||
color: brown;">Showing data for last {{common}}. To see older records, please use advanced filter</h5>
|
||||
</mat-card-content>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</mat-card>
|
||||
@ -0,0 +1,28 @@
|
||||
.ic-change:hover {
|
||||
transform: scale(1.1);
|
||||
color: green;
|
||||
}
|
||||
.cell{
|
||||
display:inline !important;
|
||||
// text-align: center !important;
|
||||
}
|
||||
.cellhide{
|
||||
display: none !important;
|
||||
}
|
||||
.center{
|
||||
text-align:center;
|
||||
}
|
||||
.fontsize{
|
||||
font-size:14px;
|
||||
}
|
||||
.toolbar-space {
|
||||
flex: 0.01 0 auto;
|
||||
}
|
||||
p.note {
|
||||
// float: right;
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
color: grey;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PdListComponent } from './pd-list.component';
|
||||
|
||||
describe('PdListComponent', () => {
|
||||
let component: PdListComponent;
|
||||
let fixture: ComponentFixture<PdListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PdListComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PdListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
165
ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.ts
Normal file
165
ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.ts
Normal file
@ -0,0 +1,165 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { PageEvent, MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||
import { UserService } from 'app/settings/service/user.service';
|
||||
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { ApiServiceService } from '../services/apiService/api-service.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pd-list',
|
||||
templateUrl: './pd-list.component.html',
|
||||
styleUrls: ['./pd-list.component.scss']
|
||||
})
|
||||
export class PdListComponent implements OnInit {
|
||||
|
||||
public dataLengthTab4: number;
|
||||
public dataSourceTab4 = new MatTableDataSource();
|
||||
|
||||
displayedColumns = ['SalesPdId','SalesPdSno','Applicant Name','Short Name','Officer Name','status','Create On','Action'];
|
||||
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
// data source variable details
|
||||
salesPdData:any[] = [];
|
||||
salesPdpdf:any[] = [];
|
||||
|
||||
errorMessage:any[]=[];
|
||||
recordStatus: boolean;
|
||||
|
||||
xpandStatus: boolean = false;
|
||||
|
||||
// pagination variable details
|
||||
length = 5;
|
||||
pageIndex = 0;
|
||||
pageSize = 10;
|
||||
pageEvent: PageEvent;
|
||||
todaydate:Date = new Date();
|
||||
filter_drop_down_data:any;
|
||||
limitMsg: boolean = false;
|
||||
common: any;
|
||||
|
||||
constructor(private _pdSales: PdTrigerService,private router:Router,private _pdCreditService:ApiServiceService) {
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadSalesPDDetails();
|
||||
// this.salesPDpdf();
|
||||
}
|
||||
|
||||
|
||||
|
||||
loadSalesPDDetails() {
|
||||
this._pdCreditService.listSMCCreditPD()
|
||||
.subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.salesPdData = data.records;
|
||||
this.dataLengthTab4 = data.records.length;
|
||||
this.dataSourceTab4.data = this.salesPdData;
|
||||
this.recordStatus=false
|
||||
this.limitMsg = true
|
||||
if(this.salesPdData.length > 0){
|
||||
let products=[]
|
||||
let lenders=[]
|
||||
let pd_status=[]
|
||||
this.salesPdData.map(val=>{
|
||||
if(products.length > 0 ){
|
||||
if(products.filter(pro=>pro == val.product_id).length == 0 ){
|
||||
products.push(val.product_id)
|
||||
}
|
||||
}
|
||||
else{
|
||||
products.push(val.product_id)
|
||||
}
|
||||
if(lenders.length > 0 ){
|
||||
if(lenders.filter(pro=>pro == val.lender_id).length == 0 ){
|
||||
lenders.push(val.lender_id)
|
||||
}
|
||||
}
|
||||
else{
|
||||
lenders.push(val.lender_id)
|
||||
}
|
||||
if(pd_status.length > 0 ){
|
||||
if(pd_status.filter(pro=>pro == val.status).length == 0 ){
|
||||
pd_status.push(val.status)
|
||||
}
|
||||
}
|
||||
else{
|
||||
pd_status.push(val.status)
|
||||
}
|
||||
})
|
||||
this.filter_drop_down_data={product_ids:products,lender_ids:lenders,pd_status:pd_status}
|
||||
// console.log(this.filter_drop_down_data);
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.salesPdData=[];
|
||||
this.dataLengthTab4= null;
|
||||
this.recordStatus=true;
|
||||
this.limitMsg = false
|
||||
}
|
||||
}
|
||||
// , error => this.errorMessage = <any> error);
|
||||
,error => {
|
||||
this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
alert(error.html_format);
|
||||
});
|
||||
}
|
||||
filteredDataSource(data){
|
||||
console.log("From Parent",data);
|
||||
if(data.dataStatus){
|
||||
this.salesPdData=data.records
|
||||
this.dataLengthTab4 = data.records.length;
|
||||
this.dataSourceTab4.data = this.salesPdData;
|
||||
this.recordStatus=false
|
||||
this.limitMsg = false
|
||||
}
|
||||
else{
|
||||
this.salesPdData=[];
|
||||
this.dataLengthTab4= null;
|
||||
this.recordStatus=true;
|
||||
this.limitMsg = false
|
||||
}
|
||||
}
|
||||
|
||||
salesPDpdf(pdfdetail){
|
||||
this._pdSales.getSalesPdpdf(pdfdetail)
|
||||
.subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
// window.location.href=data.records;
|
||||
window.open(data.records, '_blank');
|
||||
}
|
||||
|
||||
}
|
||||
// , error => this.errorMessage = <any> error);
|
||||
,error => {
|
||||
this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
alert(error.html_format);
|
||||
});
|
||||
|
||||
}
|
||||
pageChange(e) {
|
||||
console.log(e);
|
||||
}
|
||||
ngAfterViewInit() {
|
||||
this.dataSourceTab4.paginator = this.paginator;
|
||||
this.dataSourceTab4.sort = this.sort;
|
||||
}
|
||||
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSourceTab4.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
openCurrPD(curr_pd_data) {
|
||||
this._pdCreditService.curr_credit_pd_data=curr_pd_data
|
||||
this.router.navigate(['../credit_pd/pdQuestions']);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
<div >
|
||||
<mat-toolbar color="primary" class="example-toolbar">
|
||||
<button mat-icon-button (click)="sidenav.toggle()" *ngIf="sidenav_mode">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
<!-- <div fxLayout="row" align="left" fxFlex="100"> -->
|
||||
<div fxFlex="80%" style="font-size:1.3rem;font-weight: bold;padding-top: 0.5rem;">{{curr_pd_info.applicant_name}} <span *ngIf="curr_pd_info.smc_credit_pd_sno">({{curr_pd_info.smc_credit_pd_sno}})</span><br/>
|
||||
<span style="font-size:1rem;font-weight: normal">{{curr_pd_info.abbr}} - {{curr_pd_info.smc_credit_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}}</span>
|
||||
</div>
|
||||
|
||||
<!-- <h1 fxFlex="90" class="example-app-name">{{question_data?.section_name}}</h1> -->
|
||||
<div fxFlex="20%" align="end" *ngIf="!sidenav_mode">
|
||||
<button *ngIf="curr_pd_info.smc_credit_pd_type == '2' && customer_link" align="end" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Copy Customer Link" matTooltipPosition="left" (click)="copyToClipBoard(customer_link, 'Customer Link is copied')"><mat-icon>link</mat-icon></button>
|
||||
<button *ngIf="curr_pd_info.smc_credit_pd_type == '2' && customer_link" align="end" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="left" (click)="go_back()" disabled="true"><mat-icon>sms</mat-icon></button>
|
||||
<button align="end" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="left" (click)="go_back()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</mat-toolbar>
|
||||
<mat-sidenav-container class="example-container" autosize >
|
||||
|
||||
<mat-sidenav [fixedInViewport]="false" #sidenav class="example-sidenav" [mode]="sidenav_mode ? 'over' : 'side'" opened=true>
|
||||
<mat-nav-list >
|
||||
<mat-list-item *ngFor="let item of section_template;let i=index" (click)="gotoSection(item)" [ngClass]="{'selectedSection': selectedSecIndex == i,'border-disabled': sales_pd_id == null && item.is_disabled,
|
||||
'border-saved': sales_pd_id != null && item.hasOwnProperty('status') &&
|
||||
item.status == '1' }"
|
||||
>
|
||||
<!-- <div > -->
|
||||
<!-- <div fxLayout="row"> -->
|
||||
<!-- <div fxFlex="90"> -->
|
||||
|
||||
<p matLine>{{item.section_name}} </p>
|
||||
<ng-container >
|
||||
<mat-icon *ngIf="sales_pd_id != null && item.hasOwnProperty('status') &&
|
||||
item.status == '1' " >check_circle</mat-icon>
|
||||
</ng-container>
|
||||
<!-- </div>
|
||||
<div fxFlex="10"> -->
|
||||
|
||||
<!-- </div> -->
|
||||
<mat-divider></mat-divider>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
</mat-list-item>
|
||||
</mat-nav-list>
|
||||
</mat-sidenav>
|
||||
|
||||
|
||||
<div class="form-container">
|
||||
<mat-card>
|
||||
<mat-card-content *ngIf="question_data.questions.length > 0">
|
||||
|
||||
<app-ques-template (emitter)="navigate($event)" [questions_JSON]="question_data" (imageUploadCheck)="setGroupControl($event)"></app-ques-template>
|
||||
<!-- <button ion-button (click)="onChange()"></button> -->
|
||||
</mat-card-content>
|
||||
<mat-card-content *ngIf="question_data.questions.length == 0">
|
||||
<h5>No Templates Found</h5>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
</mat-sidenav-container>
|
||||
|
||||
</div>
|
||||
<notifier-container></notifier-container>
|
||||
@ -0,0 +1,90 @@
|
||||
::ng-deep .body-container{
|
||||
padding: 0.2rem!important;
|
||||
// height: ;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.example-app-name {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.example-sidenav-content {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.example-sidenav {
|
||||
user-select: none;
|
||||
background-color: aliceblue;
|
||||
height: 75vh !important;
|
||||
// top:100px;
|
||||
}
|
||||
.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
.menu-button {
|
||||
transition: 300ms ease-in-out;
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
.menu-button.rotated {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.submenu {
|
||||
overflow-y: hidden;
|
||||
transition: transform 300ms ease;
|
||||
transform: scaleY(0);
|
||||
transform-origin: top;
|
||||
padding-left: 30px;
|
||||
}
|
||||
.submenu.expanded {
|
||||
transform: scaleY(1);
|
||||
}
|
||||
.form-container {
|
||||
height: 75vh !important;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
// padding: 2rem;
|
||||
// margin-bottom: 2rem;
|
||||
}
|
||||
// #sidenav, .site-sidenav.md-locked-open-add-active, .site-sidenav.md-locked-open {
|
||||
// width: 256px;
|
||||
// min-width: 256px;
|
||||
// max-width: 256px;
|
||||
// }
|
||||
.selectedSection {
|
||||
p{
|
||||
color:white !important
|
||||
}
|
||||
color:white !important;
|
||||
background-color: #c80000;
|
||||
}
|
||||
.selectedSection :hover {
|
||||
// color:black;
|
||||
// p {
|
||||
// color:black !important
|
||||
// }
|
||||
background-color: rgb(209, 209, 209);
|
||||
}
|
||||
.border-disabled{
|
||||
// border-left: 2px solid #00000075 !important;
|
||||
p{
|
||||
margin: 0px !important;
|
||||
color: darkgray;
|
||||
}
|
||||
}
|
||||
.border-saved{
|
||||
// border-left: 2px solid #008828 !important;
|
||||
p{
|
||||
margin: 0px !important;
|
||||
color:#00611d;
|
||||
}
|
||||
mat-icon {
|
||||
color:#12bd45;
|
||||
}
|
||||
// #009b2e
|
||||
}
|
||||
::ng-deep .mat-line{
|
||||
word-wrap: break-word !important;
|
||||
white-space: pre-wrap !important;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PdQuestionsComponent } from './pd-questions.component';
|
||||
|
||||
describe('PdQuestionsComponent', () => {
|
||||
let component: PdQuestionsComponent;
|
||||
let fixture: ComponentFixture<PdQuestionsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PdQuestionsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PdQuestionsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,260 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatSidenav } from '@angular/material';
|
||||
import { ApiServiceService } from '../services/apiService/api-service.service';
|
||||
import { Location } from '@angular/common';
|
||||
import { Router } from '@angular/router';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { UserService } from 'app/settings/service/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pd-questions',
|
||||
templateUrl: './pd-questions.component.html',
|
||||
styleUrls: ['./pd-questions.component.scss']
|
||||
})
|
||||
export class PdQuestionsComponent implements OnInit {
|
||||
@ViewChild('sidenav') sidenav: MatSidenav;
|
||||
isExpanded = true;
|
||||
showSubmenu: boolean = false;
|
||||
isShowing = false;
|
||||
showSubSubMenu: boolean = false;
|
||||
menuItems = [
|
||||
{
|
||||
display_name:"General Info",
|
||||
id:'1'
|
||||
},
|
||||
{
|
||||
display_name:"Fund Requirement",
|
||||
id:'2'
|
||||
},
|
||||
{
|
||||
display_name:"Details of Stackeholder in Business",
|
||||
id:'3'
|
||||
},
|
||||
{
|
||||
display_name:"Other Family Member Details",
|
||||
id:'4'
|
||||
},
|
||||
{
|
||||
display_name:"Business Info",
|
||||
id:'5'
|
||||
},
|
||||
{
|
||||
display_name:"Asset Details",
|
||||
id:'6'
|
||||
},
|
||||
{
|
||||
display_name:"Final Remarks",
|
||||
id:'7'
|
||||
}
|
||||
]
|
||||
raw_data: any;
|
||||
section_template: any = [];
|
||||
sales_pd_id: any =null;
|
||||
selectedSecIndex: number;
|
||||
sidenav_mode: boolean;
|
||||
question_data: any ={questions:[]};
|
||||
curr_pd_info:any={}
|
||||
notifier:NotifierService
|
||||
all_sections: any;
|
||||
customer_link: string = '';
|
||||
constructor(private apiService:ApiServiceService,private _location:Location,private router:Router,notifier:NotifierService,private _userService:UserService) {
|
||||
this.notifier = notifier
|
||||
this._userService.getroles().subscribe(res=>{
|
||||
if(res['dataStatus'] && res['records'] && res['records'].length > 0) {
|
||||
this.apiService.user_login_details = res['records'][0]
|
||||
}
|
||||
})
|
||||
this.curr_pd_info = this.apiService.curr_credit_pd_data
|
||||
if(!this.curr_pd_info || (Object.keys(this.curr_pd_info).length === 0 && this.curr_pd_info.constructor === Object)) {
|
||||
this._location.back();
|
||||
}
|
||||
console.log(this.curr_pd_info);
|
||||
this.sales_pd_id = this.curr_pd_info.smc_credit_pd
|
||||
if(this.sales_pd_id != null) {
|
||||
this.customer_link = window.location.origin+'/customer/#/salespd-images/'+this.curr_pd_info.rand_string
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.curr_pd_info.smc_credit_pd != null) {
|
||||
this.getSectionStatus()
|
||||
}
|
||||
this.getTemplate();
|
||||
this.sidenav_mode =window.matchMedia(`(max-width: 840px)`).matches
|
||||
}
|
||||
getSectionStatus() {
|
||||
let params = {"smc_credit_pd":this.curr_pd_info.smc_credit_pd,"section_id":'all'}
|
||||
this.apiService.getSMCCreditPDSectionData(params).subscribe(res=>{
|
||||
|
||||
if(this.section_template.length > 0)
|
||||
{
|
||||
console.log("if part")
|
||||
this.merge_saved_status(res);
|
||||
}
|
||||
else{
|
||||
setTimeout(()=>{
|
||||
console.log("Else part",this.section_template.length)
|
||||
if(this.section_template.length > 0)
|
||||
{
|
||||
this.merge_saved_status(res);
|
||||
}
|
||||
},500)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
merge_saved_status(res){
|
||||
let saved_sections=res['records'].map(val=>{return {'section_id':val.section_id , 'status':val.status}});
|
||||
console.log("saved",saved_sections);
|
||||
if(saved_sections) {
|
||||
this.curr_pd_info.saved_sections = saved_sections
|
||||
}
|
||||
const mergeById = (a1, a2) =>
|
||||
a1.map(itm => ({
|
||||
...a2.find((item) => (item.section_id === itm.section_id) && item),
|
||||
...itm
|
||||
}));
|
||||
this.section_template = mergeById(this.section_template,saved_sections);
|
||||
console.log("##########",this.section_template);
|
||||
if(this.section_template.length > 0) {
|
||||
// this.is_sync_btn = this.section_template.filter(val=>val.is_synced == false && val.section_id != 'all').length > 0
|
||||
}
|
||||
}
|
||||
|
||||
getTemplate(){
|
||||
this.apiService.loadTemplate().subscribe(result=>{
|
||||
console.log(result);
|
||||
// debugger;
|
||||
// return
|
||||
// })
|
||||
// this.SalesPDService.getData(this.product_id,this.sales_pd_type).subscribe(result=>{
|
||||
console.log("result",result)
|
||||
if(result['dataStatus'] && result.hasOwnProperty('records')){
|
||||
|
||||
this.raw_data=JSON.parse(result['records'].template)
|
||||
this.raw_data.sections.forEach((val,index)=>{
|
||||
val.order_id=index+1
|
||||
})
|
||||
|
||||
this.section_template=this.raw_data.sections.map(val=> {
|
||||
let temp={section_id:val.section_id,section_name:val.section_name,order_id:val.order_id,is_disabled:val.section_id != '1' ? this.sales_pd_id == null ? true : false : false}
|
||||
return temp
|
||||
})
|
||||
console.log(this.section_template)
|
||||
this.gotoSection(this.section_template[0])
|
||||
|
||||
// this.SalesPDService.original_rawData=this.raw_data
|
||||
// localStorage.setItem('question_temp_salespd',JSON.stringify(this.raw_data))
|
||||
// console.log("sales pd",this.SalesPDService.original_rawData)
|
||||
this.all_sections=this.raw_data.sections.map(val=>val.section_id)
|
||||
// this.SalesPDService.available_sections=this.all_sections
|
||||
// this.SalesPDService.current_section='1';
|
||||
}
|
||||
else{
|
||||
let message = result['msg'] ? result['msg'] : 'Something went wrong'
|
||||
alert(message);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
mouseenter() {
|
||||
if (!this.isExpanded) {
|
||||
this.isShowing = true;
|
||||
}
|
||||
}
|
||||
|
||||
mouseleave() {
|
||||
if (!this.isExpanded) {
|
||||
this.isShowing = false;
|
||||
}
|
||||
}
|
||||
menuToggle() {
|
||||
console.log(this.sidenav,this.sidenav.opened)
|
||||
if(this.sidenav.opened) {
|
||||
this.sidenav.close()
|
||||
}
|
||||
else {
|
||||
this.sidenav.open();
|
||||
}
|
||||
}
|
||||
gotoSection(curr_obj) {
|
||||
console.log(curr_obj)
|
||||
if(curr_obj.hasOwnProperty('is_disabled') && curr_obj.is_disabled && this.sales_pd_id == null) {
|
||||
let msg = 'Please Fill the '+this.section_template[0].section_name+' First!!'
|
||||
this.notifier.notify('warning',msg)
|
||||
return;
|
||||
}
|
||||
let selectedSecIndex = curr_obj.order_id-1
|
||||
this.selectedSecIndex = selectedSecIndex
|
||||
console.log(selectedSecIndex);
|
||||
if(this.sidenav_mode) {
|
||||
this.sidenav.close()
|
||||
}
|
||||
this.question_data=this.raw_data.sections.filter(val => val.order_id == curr_obj.order_id)[0]
|
||||
console.log(this.question_data)
|
||||
}
|
||||
go_back() {
|
||||
this.router.navigate(['../credit_pd'])
|
||||
}
|
||||
|
||||
navigate(event){
|
||||
this.sales_pd_id = this.apiService.curr_credit_pd_data.smc_credit_pd
|
||||
this.customer_link = window.location.origin+'/customer/#/salespd-images/'+this.curr_pd_info.rand_string
|
||||
console.log("emitter navigate",event,this.all_sections[this.all_sections.length - 1]);
|
||||
if(this.all_sections[this.all_sections.length - 1] != event.section_id){
|
||||
// this.navCtrl.pop()
|
||||
let nextSection = this.section_template.findIndex(vv=>vv.section_id == event.section_id)
|
||||
console.log("find index",nextSection,this.section_template);
|
||||
// if(nextSection ) {
|
||||
this.gotoSection(this.section_template[nextSection+1])
|
||||
this.getSectionStatus()
|
||||
// }
|
||||
}
|
||||
else{
|
||||
// this.sendData()
|
||||
console.log("else part")
|
||||
// this.sendDatatoApi()
|
||||
// this.SalesPDService.clearLocalData()
|
||||
// this.SalesPDService.clear_local_key('sales_pd_id_PRIMARYKEY');
|
||||
// if(event.hasO)
|
||||
this.apiService.curr_credit_pd_data = {}
|
||||
this.apiService.raw_credit_pd_template = {}
|
||||
let msg=event.hasOwnProperty('is_completed') && event.is_completed == true ? "Completed Successfully" : 'Saved Successfully..!'
|
||||
// this.toastProvider.lenderappmessage(msg);
|
||||
this.notifier.notify('success',msg)
|
||||
// this.SalesPDService.clearLocalData()
|
||||
// this.SalesPDService.clear_local_key('sales_pd_id_PRIMARYKEY');
|
||||
// localStorage.removeItem('product_id_salesPD')
|
||||
setTimeout(()=>{
|
||||
this.router.navigate(['../credit_pd'])
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
copyToClipBoard(message,user_msg?) {
|
||||
const selBox = document.createElement('textarea');
|
||||
selBox.style.position = 'fixed';
|
||||
selBox.style.left = '0';
|
||||
selBox.style.top = '0';
|
||||
selBox.style.opacity = '0';
|
||||
selBox.value = message;
|
||||
document.body.appendChild(selBox);
|
||||
selBox.focus();
|
||||
selBox.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(selBox);
|
||||
if(message == '') {
|
||||
user_msg = "Something went wrong"
|
||||
}
|
||||
this.notifier.notify('info',user_msg)
|
||||
}
|
||||
|
||||
shareViaSMS() {
|
||||
// this.socialSharing.shareViaSMS(this.customer_link_with_text,'').then(result=>{
|
||||
// console.log(result)
|
||||
// },err=>{
|
||||
// console.log(err);
|
||||
// alert("SMS Error "+JSON.stringify(err));
|
||||
// })
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,425 @@
|
||||
<!-- Generated template for the QuesTemplateComponent component -->
|
||||
<div *ngIf="questions_JSON.questions.length > 0" #whole_form>
|
||||
<form [formGroup]="quesAnsForm" >
|
||||
<!-- (ngSubmit)="onSubmit(1)" -->
|
||||
<div *ngIf="quesAnsForm.controls['questions']" >
|
||||
<div formArrayName="questions" fxLayout="row wrap" fxFlex="100" fxLayoutAlign="space-between" fxLayout.xs="column" >
|
||||
<span *ngFor="let parent_ques of quesAnsForm.controls['questions'].controls;let p_i=index" fxFlex.xs="100" fxFlex.sm="100" [fxFlex]="parent_ques.hasOwnProperty('field_width') && parent_ques.field_width ? parent_ques.field_width : '100'"
|
||||
[formGroupName]="p_i">
|
||||
<!-- <div> -->
|
||||
|
||||
<div *ngIf="parent_ques.get('is_repeatable').value != '1'">
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':parent_ques.get('field_type').value == 'numtoword' ? '5%' : '0' }">
|
||||
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<input matInput [type]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'number' : parent_ques.get('field_type').value == 'string' ? 'text' : parent_ques.get('field_type').value" formControlName="answer_value"
|
||||
[placeholder]="parent_ques.get('place_holder').value"
|
||||
autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)"
|
||||
>
|
||||
<!-- [placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" -->
|
||||
<mat-hint *ngIf="parent_ques.get('answer_value').value != '' && parent_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 12px;">{{"₹"}}{{parent_ques.get('answer_value').value | numberToWords}}</mat-hint>
|
||||
<!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> -->
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field> -->
|
||||
<div class="radio-gap" *ngIf="parent_ques.get('type').value == '2'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label><br/>
|
||||
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,parent_ques,'','',p_i)">
|
||||
<mat-radio-button class="radio-btn-gap" *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br />
|
||||
</mat-radio-group>
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '3'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
|
||||
<mat-option *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="radio-gap" formArrayName="answer_value" *ngIf="parent_ques.get('type').value == '5'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<mat-checkbox class="radio-btn-gap" *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer" (change)="onChange_checkbox($event,parent_ques)">{{val.answer}}</mat-checkbox><br />
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '4'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<mat-select multiple formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
|
||||
<mat-option *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<div *ngIf="parent_ques.get('type').value == '6'">
|
||||
<!-- <ion-grid > -->
|
||||
<div fxLayout="row">
|
||||
<div fxLayout ="column" style="padding:none;align-self:center;text-align:center">
|
||||
<div >
|
||||
<img *ngIf="parent_ques.get('answer_value').value != ''" [src]="parent_ques.get('answer_value').value" imageViewer class="doc-image-bucket"><br/>
|
||||
<p *ngIf="parent_ques.get('answer_value').value == ''">Image is not captured.</p>
|
||||
<label ><strong>{{parent_ques.get('question').value}}</strong></label>
|
||||
<!-- <input *ngIf="image.Name =='' && image.option != 'dummy'" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeName($event.target.value,i,image.image)"> -->
|
||||
<!-- <button *ngIf="image.option != 'dummy'" ion-button clear color="optblue" (click)="removeImg(i)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button> -->
|
||||
</div>
|
||||
<div fxLayout="row" style="justify-content: center">
|
||||
<div fxLayout="column">
|
||||
<!-- <button mat-raised clear color="optblue" [disabled]="sales_pd_type == '2'" (click)="captureImg(p_i,parent_ques)"><ion-icon style="font-size: 30px" name="md-camera"></ion-icon></button> -->
|
||||
</div>
|
||||
<!-- IMAGE STATUS ICON FOR INPROGRESS, COMPLETED AND FAILED -->
|
||||
<!-- <ion-col col-4 *ngIf="parent_ques.get('is_image_status').value == true">
|
||||
<ion-spinner name="crescent" style="width: 20px;
|
||||
height: 20px;" (click)="cancelLoader(parent_ques)"
|
||||
*ngIf="parent_ques.get('is_loader').value == true"></ion-spinner>
|
||||
<ion-icon style="color: #008828;float: right;
|
||||
margin-right: 30%;" *ngIf="parent_ques.get('is_saved').value == true" name="checkmark-circle-outline"></ion-icon>
|
||||
<span style="margin:0px;" *ngIf="(parent_ques.get('is_saved').value == false &&
|
||||
parent_ques.get('is_loader').value == false) && (parent_ques.value.hasOwnProperty('is_saved') &&
|
||||
parent_ques.value.hasOwnProperty('is_loader'))" (click)="imageReupload(parent_ques)">
|
||||
<ion-row style="margin-top: -17px;padding:0px;"><button ion-button clear><ion-icon style="color:lightcoral;" name="refresh-circle"></ion-icon></button></ion-row>
|
||||
<ion-row style="margin-top: -20px;padding:0px;"><p style="font-size: 10px">Click to ReUpload</p></ion-row>
|
||||
</span>
|
||||
</ion-col> -->
|
||||
</div>
|
||||
<!-- <ng-container ngProjectAs="mat-hint">
|
||||
<mat-error >Please capture the image</mat-error>
|
||||
</ng-container> -->
|
||||
</div>
|
||||
<hr/>
|
||||
</div>
|
||||
|
||||
<!-- </ion-grid> -->
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
<!-- <ng-container ngProjectAs="mat-hint">
|
||||
<mat-error align="end">Please capture the image</mat-error>
|
||||
</ng-container> -->
|
||||
</div>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '7'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<textarea matInput type="text" rows="3" formControlName="answer_value" placeholder="Enter the Text"
|
||||
autocomplete="off" ></textarea>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="parent_ques.get('type').value == '8'">
|
||||
<mat-label>{{parent_ques.get('question').value}}</mat-label>
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,parent_ques,'','',p_i)">
|
||||
<mat-option>
|
||||
<ngx-mat-select-search formControlName="select_search"
|
||||
[placeholderLabel]="'Search'"
|
||||
[noEntriesFoundLabel]="'No Matching Result'" (keyup)="searchFun(parent_ques,p_i)">
|
||||
<mat-icon ngxMatSelectSearchClear>close</mat-icon>
|
||||
</ngx-mat-select-search>
|
||||
</mat-option>
|
||||
<mat-option>--</mat-option>
|
||||
|
||||
<mat-option *ngFor="let val of fileredSearchValue.length > 0 ? fileredSearchValue[p_i] : parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="radio-gap" *ngIf="parent_ques.get('is_repeatable').value == '1' && parent_ques.controls['questions_group']">
|
||||
<!-- <mat-card> -->
|
||||
<!-- <mat-card-header>
|
||||
<mat-card-title>
|
||||
{{parent_ques.get('group_title').value}}
|
||||
</mat-card-title>
|
||||
</mat-card-header> -->
|
||||
|
||||
<div formArrayName="questions_group" *ngIf="parent_ques.get('group_type').value != '6'">
|
||||
<span
|
||||
*ngFor="let group_ques of parent_ques.controls.questions_group['controls'];let g_i=index;let g_l=last"
|
||||
[formGroupName]="g_i">
|
||||
<mat-accordion *ngIf="parent_ques.get('group_type').value != '6'" #accordion="matAccordion">
|
||||
<mat-expansion-panel [expanded]="step === g_i" #mapanel="matExpansionPanel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{parent_ques.get('group_title').value}} {{g_i+1}}
|
||||
</mat-panel-title>
|
||||
<!-- <mat-panel-description>
|
||||
Type your name and age
|
||||
</mat-panel-description> -->
|
||||
</mat-expansion-panel-header>
|
||||
|
||||
<div formArrayName="questions" *ngIf="group_ques.controls['questions']">
|
||||
<div
|
||||
*ngFor="let single_ques of group_ques.controls.questions['controls'];let s_i=index;let s_l=last"
|
||||
[formGroupName]="s_i">
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '1'" [ngStyle]="{'margin-bottom':single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'numtoword' ? '5%' : '0' : '' }">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label>
|
||||
<input matInput [type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value"
|
||||
[placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''"
|
||||
autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
|
||||
<mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.value.hasOwnProperty('field_type') && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"₹"}}{{single_ques.get('answer_value').value | numberToWords}}</mat-hint>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="radio-gap" *ngIf="single_ques.get('type').value == '2'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label><br/>
|
||||
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
|
||||
<mat-radio-button class="radio-btn-gap" *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br />
|
||||
</mat-radio-group>
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '3'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label>
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
|
||||
<mat-option *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="radio-gap" formArrayName="answer_value" *ngIf="single_ques.get('type').value == '5'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label>
|
||||
<mat-checkbox class="radio-btn-gap" *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer" (change)="onChange_checkbox($event,single_ques)">{{val.answer}}</mat-checkbox><br />
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '4'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label>
|
||||
<mat-select multiple formControlName="answer_value">
|
||||
<mat-option *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '7'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label>
|
||||
<textarea matInput type="text" rows="3" formControlName="answer_value" placeholder="Enter the Text"
|
||||
autocomplete="off" ></textarea>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%" *ngIf="single_ques.get('type').value == '8'">
|
||||
<mat-label>{{single_ques.get('question').value}}</mat-label>
|
||||
<mat-select formControlName="answer_value" (selectionChange)="onChangeProperty($event,single_ques,p_i)">
|
||||
<mat-option>
|
||||
<ngx-mat-select-search formControlName="select_search"
|
||||
[placeholderLabel]="'Search'"
|
||||
[noEntriesFoundLabel]="'No Matching Result'" (keyup)="searchFun(single_ques,p_i)">
|
||||
<mat-icon ngxMatSelectSearchClear>close</mat-icon>
|
||||
</ngx-mat-select-search>
|
||||
</mat-option>
|
||||
<mat-option>--</mat-option>
|
||||
|
||||
<mat-option *ngFor="let val of fileredSearchValue.length > 0 ? fileredSearchValue[p_i] : single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
|
||||
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container>
|
||||
</mat-form-field>
|
||||
|
||||
<div *ngIf="single_ques.controls['subfield_key']">
|
||||
<!-- <div *ngIf="parent_ques.controls[parent_ques.get('subfield_key').value]"> -->
|
||||
<mat-form-field style="width: 100%" >
|
||||
|
||||
<mat-label>{{single_ques.get('subfield_caption').value}}</mat-label>
|
||||
<input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text"
|
||||
autocomplete="off">
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="flex-end" *ngIf="parent_ques.get('is_multi_disabled').value != '1'">
|
||||
<div >
|
||||
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
|
||||
mat-icon-button matTooltip="Delete"
|
||||
matTooltipPosition="above" *ngIf="g_i != 0" (click)="removeData(g_i,parent_ques)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
|
||||
mat-icon-button matTooltip="Delete"
|
||||
matTooltipPosition="above" *ngIf="g_l"
|
||||
(click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event)">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <ion-buttons fxLayout="">
|
||||
<ion-col col-3 offset-3>
|
||||
<button ion-button clear color="optblue" *ngIf="g_i != 0" (click)="removeData(g_i,parent_ques)">
|
||||
<ion-icon style="font-size: 22px" name="md-trash"></ion-icon>
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col col-2 offset-1>
|
||||
<button ion-button clear color="optblue" *ngIf="g_l"
|
||||
(click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event)">
|
||||
<ion-icon style="font-size: 24px" name="add-circle"></ion-icon>
|
||||
</button>
|
||||
</ion-col>
|
||||
</ion-buttons> -->
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
|
||||
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<div formArrayName="questions_group" *ngIf="parent_ques.get('group_type').value == '6'">
|
||||
<hr class="hr">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
<h5> {{parent_ques.get('group_title').value}}</h5>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
|
||||
<!-- <ion-grid > -->
|
||||
<div fxLayout="row">
|
||||
<span
|
||||
*ngFor="let group_ques of parent_ques.controls.questions_group['controls'];let g_i=index;let g_l=last"
|
||||
[formGroupName]="g_i">
|
||||
<!-- </mat-card> -->
|
||||
<span formArrayName="questions" *ngIf="group_ques.controls['questions'] && parent_ques.get('group_type').value == '6'" >
|
||||
<!-- <div > -->
|
||||
|
||||
<!-- <div *ngIf="single_ques.get('type').value == '10'"> -->
|
||||
<!-- {{parent_ques.value.questions_group.length}} -->
|
||||
<p style="margin-left: 45px;font-weight:bold;" *ngIf="parent_ques.value.questions_group.length == 1 &&
|
||||
group_ques.value.questions[0].answer_value == ''">Image is not captured.</p>
|
||||
<div fxLayout="column" style="align-self: center;text-align: center;padding: 0" *ngFor="let single_ques of group_ques.controls.questions['controls'];let s_i=index;let s_l=last"
|
||||
[formGroupName]="s_i">
|
||||
<div style="width: 100%;justify-content: center;text-align: center;align-content: center;margin:2%;" *ngIf="single_ques.get('answer_value').value != ''">
|
||||
<div fxLayout="row" style="width: 100%">
|
||||
<img [src]="single_ques.get('answer_value').value" imageViewer class="doc-image-bucket" ><br/>
|
||||
</div>
|
||||
<div fxLayout="row" style="width: 130px;margin-bottom: 5px;text-align: left">
|
||||
<div >
|
||||
<span style="font-size: 12px;padding: 0px;margin: 0px;">{{single_ques.get('question').value}} {{g_i+1}}</span>
|
||||
</div>
|
||||
|
||||
<!-- IMAGE STATUS ICON FOR INPROGRESS, COMPLETED AND FAILED -->
|
||||
<!-- <ion-col col-4 *ngIf="single_ques.get('is_image_status').value == true">
|
||||
<ion-spinner name="crescent" style="width: 20px;
|
||||
height: 20px;" (click)="cancelLoader(single_ques)"
|
||||
*ngIf="single_ques.get('is_loader').value == true"></ion-spinner>
|
||||
<ion-icon style="color: #008828;float: right;
|
||||
margin-right: 30%;" *ngIf="single_ques.get('is_saved').value == true" name="checkmark-circle-outline"></ion-icon>
|
||||
<span style="margin:0px;" *ngIf="(single_ques.get('is_saved').value == false &&
|
||||
single_ques.get('is_loader').value == false) && (single_ques.value.hasOwnProperty('is_saved') &&
|
||||
single_ques.value.hasOwnProperty('is_loader'))" (click)="imageReupload(single_ques)">
|
||||
<ion-row style="margin-top: -17px;padding:0px;"><button ion-button clear><ion-icon style="color:lightcoral;" name="refresh-circle"></ion-icon></button></ion-row>
|
||||
<ion-row style="margin-top: -20px;padding:0px;"><p style="font-size: 10px">Click to ReUpload</p></ion-row>
|
||||
</span>
|
||||
</ion-col> -->
|
||||
<!-- <input *ngIf="image.Name =='' && image.option != 'dummy'" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeName($event.target.value,i,image.image)"> -->
|
||||
<!-- <button ion-button clear color="optblue" (click)="removeData(g_i,parent_ques)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div style="justify-content: center">
|
||||
<button ion-button clear color="optblue" (click)="captureImg()"><ion-icon style="font-size: 30px" name="md-camera"></ion-icon></button>
|
||||
</div> -->
|
||||
<!-- {{single_ques.value | json}} -->
|
||||
|
||||
<!-- <div class="add-more-image" *ngIf="g_l">
|
||||
<button ion-button clear style="color: black" [disabled]="sales_pd_type == '2'" (click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event,'camera',single_ques)"><ion-icon style="font-size:35px" name="md-camera"></ion-icon>+</button>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- </div> -->
|
||||
</span>
|
||||
<div *ngIf="g_l" style="justify-content: flex-end">
|
||||
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<!-- <ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
|
||||
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
|
||||
</ng-container> -->
|
||||
<!-- </ion-grid> -->
|
||||
<hr class="hr">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="parent_ques.controls['subfield_key']">
|
||||
<!-- <div *ngIf="parent_ques.controls[parent_ques.get('subfield_key').value]"> -->
|
||||
<mat-form-field style="width: 100%" >
|
||||
|
||||
<mat-label>{{parent_ques.get('subfield_caption').value}}</mat-label>
|
||||
<input matInput type="text" formControlName="subfield_value" placeholder="Enter the Text"
|
||||
autocomplete="off">
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
<!-- </div> -->
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="flex-end" class="save-btn">
|
||||
<!-- <ion-col *ngIf="!spinner_access">
|
||||
<button class="btn-no-pad" medium ion-button round outline color="optblue" (click)="onSubmit(0)">Save as Draft</button>
|
||||
</ion-col> -->
|
||||
<div *ngIf="!spinner_access">
|
||||
<!-- <button class="btn-no-pad" medium ion-button type="submit" round color="optblue" (click)="onSubmit(1)"><ion-icon style="color:gray;font-size: 24px;" name="md-arrow-dropright-circle"></ion-icon> {{submit_btn ? 'Complete' : 'Save'}} </button> -->
|
||||
<button type="submit" color="primary" class="ml-1 mr-1 hover-icon" mat-raised-button
|
||||
matTooltip="Submit"
|
||||
matTooltipPosition="above"
|
||||
(click)="onSubmit(1)">
|
||||
<mat-icon>save</mat-icon> {{submit_btn ? 'Complete' : 'Save'}}
|
||||
</button>
|
||||
</div>
|
||||
<!-- <ion-spinner name="dots" color="optblue" style="font-size: 24px;width:50px;height: 50px;" *ngIf="spinner_access"></ion-spinner> -->
|
||||
<div *ngIf="spinner_access">
|
||||
<mat-spinner diameter="25" > </mat-spinner><span style="font-weight: bold"> Saving...</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@ -0,0 +1,39 @@
|
||||
mat-radio-button,mat-checkbox{
|
||||
margin-top: 13px;
|
||||
}
|
||||
.radio-gap{
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.radio-btn-gap{
|
||||
margin:10px;
|
||||
}
|
||||
.doc-image-bucket{
|
||||
padding:0 5px 0 0 !important;
|
||||
width: 120px;
|
||||
height: 80px !important;
|
||||
color:black;
|
||||
//width:130px;
|
||||
//border:3px solid black;
|
||||
//border-radius: 20px;
|
||||
//background-color: gray;
|
||||
}
|
||||
.add-more-image{
|
||||
width: 60%;
|
||||
padding:0 5px 0 0 !important;
|
||||
width: 120px;
|
||||
height: 80px !important;
|
||||
// border: 2px solid gainsboro;
|
||||
// border-style: dashed;
|
||||
// border-radius: 10px;
|
||||
}
|
||||
.hr, hr{
|
||||
font-size: 25px;
|
||||
}
|
||||
// .btn-no-pad{
|
||||
// padding: 8px 8px 8px 5px;
|
||||
|
||||
// }
|
||||
.save-btn{
|
||||
// margin-top: 3%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { QuesTemplateComponent } from './ques-template.component';
|
||||
|
||||
describe('QuesTemplateComponent', () => {
|
||||
let component: QuesTemplateComponent;
|
||||
let fixture: ComponentFixture<QuesTemplateComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ QuesTemplateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(QuesTemplateComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ApiServiceService } from './api-service.service';
|
||||
|
||||
describe('ApiServiceService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: ApiServiceService = TestBed.get(ApiServiceService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,74 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AwsService } from 'app/AwsService/aws.service';
|
||||
|
||||
const apiUrl = environment.apiEndpoint
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class ApiServiceService {
|
||||
// for pd questions component
|
||||
public curr_credit_pd_data:any = {}
|
||||
public raw_credit_pd_template:any;
|
||||
public user_login_details:any ={}
|
||||
|
||||
constructor(private http:HttpClient,private _awsService:AwsService) { }
|
||||
loadTemplate() {
|
||||
return this.http.get('assets/credit_pd_template.json').map(rr=>{
|
||||
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
|
||||
this.raw_credit_pd_template= returnValue.records.template
|
||||
return returnValue
|
||||
})
|
||||
}
|
||||
getCityPincode(value){
|
||||
let params={records:{state_id:value}}
|
||||
return this.http.post(apiUrl+"getListOfStatesAndCities",params)
|
||||
}
|
||||
api_post_method(api_name:string,params,api_method?){
|
||||
|
||||
if(api_method.toUpperCase() == 'POST'){
|
||||
return this.http.post(apiUrl+api_name,params)
|
||||
}
|
||||
else{
|
||||
return this.http.get(apiUrl+api_name)
|
||||
}
|
||||
}
|
||||
getSalesPDSectionData(params) {
|
||||
return this.http.post(apiUrl+'getSalesPDSectionData',{records:params})
|
||||
}
|
||||
|
||||
listSMCCreditPD():Observable<any> {
|
||||
let value= localStorage.getItem('LocalSetEntity')
|
||||
// let params = new HttpParams().set("paramName",value) //Create new HttpParams
|
||||
return this.http.get(apiUrl+'listSMCCreditPD/'+value);
|
||||
}
|
||||
saveSMCCreditPD(params) {
|
||||
let params_defined:any={"smc_credit_pd":this.curr_credit_pd_data.smc_credit_pd == null ? '' : this.curr_credit_pd_data.smc_credit_pd
|
||||
,"fk_sales_pd_id":this.curr_credit_pd_data.fk_sales_pd_id,"lender_id":this.curr_credit_pd_data.lender_id,"product_id":this.curr_credit_pd_data.product_id,"smc_credit_pd_type":this.curr_credit_pd_data.smc_credit_pd_type,"createdby":this._awsService.getlocale(),"status":params.status}
|
||||
return this.http.post(apiUrl+'saveSMCCreditPD',{records:params_defined});
|
||||
}
|
||||
loadSalesPDTemplate():Observable<any> {
|
||||
let lender_id= localStorage.getItem('LocalSetEntity')
|
||||
let params = {"records":{"lender_id":lender_id,"product_id":this.curr_credit_pd_data.product_id,"sales_pd_type":this.curr_credit_pd_data.smc_credit_pd_type,"pd_type":"2"}}
|
||||
return this.http.post(apiUrl+'loadSalesPDTemplate',params).map((res:any)=>{
|
||||
if(res['dataStatus'] && res.hasOwnProperty('records') && res.records.hasOwnProperty('template')){
|
||||
this.raw_credit_pd_template = res.records.template
|
||||
}
|
||||
return res
|
||||
})
|
||||
}
|
||||
saveSMCCreditPDsection(params1):Observable<any> {
|
||||
let params = {"records":{"smc_credit_pd":this.curr_credit_pd_data.smc_credit_pd,"lender_id":this.curr_credit_pd_data.lender_id,"product_id":this.curr_credit_pd_data.product_id,"fk_createdby":this._awsService.getlocale(),"geo_location":"","section_id":params1.section_id,"questions":params1.questions,"is_complete":"0"}}
|
||||
return this.http.post(apiUrl+'saveSMCCreditPDsection',params)
|
||||
}
|
||||
|
||||
getSalesPDImgDataCusLink(params) {
|
||||
return this.http.post(apiUrl+'getSalesPDImgDataCusLink',params)
|
||||
}
|
||||
getSMCCreditPDSectionData(params) {
|
||||
return this.http.post(apiUrl+'getSMCCreditPDSectionData',{records:params})
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { QuesTemplateService } from './ques-template.service';
|
||||
|
||||
describe('QuesTemplateService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: QuesTemplateService = TestBed.get(QuesTemplateService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,412 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms';
|
||||
import { ApiServiceService } from '../apiService/api-service.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class QuesTemplateService {
|
||||
datepipe: DatePipe;
|
||||
public curr_pd_info: any = {};
|
||||
|
||||
constructor(public http: HttpClient,private _fb:FormBuilder,private salesPDProvider:ApiServiceService) {
|
||||
console.log('Hello QuesServiceProvider Provider');
|
||||
this.datepipe=new DatePipe('en-US')
|
||||
}
|
||||
// FOR CREATING A FORM CONTROL DYNAMICALLY
|
||||
assignFormControl_array(formgroup: FormGroup, ques_data: any) {
|
||||
console.log(formgroup, ques_data)
|
||||
this.curr_pd_info = this.salesPDProvider.curr_credit_pd_data
|
||||
const control: any = formgroup.get('questions') as FormArray
|
||||
ques_data.forEach((val, index) => {
|
||||
console.log("quees", val)
|
||||
if (val.hasOwnProperty('is_repeatable') && val.is_repeatable == '1') {
|
||||
control.push(this._fb.group({
|
||||
"is_repeatable": [val.is_repeatable || null],
|
||||
"is_multi_disabled":[val.is_multi_disabled || '0'],
|
||||
"group_title": [val.group_title || null], "group_type": [val.group_type || null]
|
||||
,"question_key":[val.question[0].question_key]
|
||||
}))
|
||||
// let temp=val
|
||||
|
||||
// control.push(this.createValue(temp))
|
||||
|
||||
control.controls[index].addControl('questions_group', this._fb.array([]))
|
||||
|
||||
let childControl: any = control.controls[index].get('questions_group') as FormArray
|
||||
|
||||
childControl.push(this._fb.group({ 'questions': this._fb.array([]) }))
|
||||
console.log("cc", childControl, control, index)
|
||||
let sub_childControl: any = childControl.controls[0].get('questions') as FormArray
|
||||
val.question.forEach((group_indi, arr_index) => {
|
||||
// if(group_indi.api_properties != null && typeof(group_indi.api_properties) == 'object'){
|
||||
console.log("api pro", val.api_properties)
|
||||
// let param
|
||||
// val.api_properties.forEach(val=>param=val)
|
||||
// console.log(param)
|
||||
group_indi.raw_validations = group_indi.validations
|
||||
sub_childControl.push(this.createValue(group_indi))
|
||||
this.addAdditionalControl(group_indi, sub_childControl, arr_index)
|
||||
// if(group_indi.type == '5'){
|
||||
// sub_childControl.controls[arr_index].removeControl('answer_value');
|
||||
// console.log("loop",arr_index,sub_childControl);
|
||||
// sub_childControl.controls[arr_index].addControl('answer_value',this._fb.array([]))
|
||||
// }
|
||||
// if(group_indi.type == '1'){
|
||||
// sub_childControl.controls[arr_index].addControl('field_type',new FormControl(group_indi.field_type))
|
||||
// }
|
||||
// if(val.type == '8'){
|
||||
// sub_childControl.controls[index].addControl('select_search',new FormControl(val.field_type))
|
||||
// }
|
||||
|
||||
if (group_indi.api_properties != null) {
|
||||
this.apiPropertiesCall(group_indi).then(res => {
|
||||
if (res != false) {
|
||||
group_indi.answers = []
|
||||
// group_indi.answers=this.convertArrayNames(val.api_properties.fields,res)
|
||||
sub_childControl.controls[arr_index]['controls'].answers.setValue(this.convertArrayNames(group_indi.api_properties.fields, res))
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
// else{
|
||||
// setTimeout(()=>{
|
||||
// sub_childControl.push(this.createValue(group_indi))
|
||||
// },200)
|
||||
// }
|
||||
// sub_childControl.push(this.createValue(group_indi))
|
||||
})
|
||||
// }
|
||||
// else{
|
||||
// sub_childControl.push(this.createValue(group_indi))
|
||||
// }
|
||||
// setTimeout(()=>{
|
||||
|
||||
// },500)
|
||||
|
||||
console.log("dd112", formgroup, childControl)
|
||||
// let key_list=Object.keys(val)
|
||||
// console.log(Object.keys(val))
|
||||
// key_list.forEach(key=>{
|
||||
// childControl.controls
|
||||
// })
|
||||
}
|
||||
else {
|
||||
// console.log("con",control)
|
||||
// let key_list=Object.keys(val)
|
||||
// console.log(Object.keys(val))
|
||||
// let curr_object
|
||||
// console.log("apikd",typeof(val.api_properties))
|
||||
// if(val.api_properties != null && typeof(val.api_properties) == 'object'){
|
||||
val.raw_validations = val.validations
|
||||
control.push(this.createValue(val))
|
||||
// for checkbox remove the form control and add the formarray for multiple values
|
||||
this.addAdditionalControl(val, control, index)
|
||||
// if(val.type == '5'){
|
||||
// control.controls[index].removeControl('answer_value');
|
||||
// console.log("loop",index,control);
|
||||
// control.controls[index].addControl('answer_value',this._fb.array([]))
|
||||
// }
|
||||
// if(val.type == '1'){
|
||||
// control.controls[index].addControl('field_type',new FormControl(val.field_type))
|
||||
// }
|
||||
// if(val.type == '8'){
|
||||
// control.controls[index].addControl('select_search',new FormControl(val.field_type))
|
||||
// }
|
||||
if (val.api_properties != null) {
|
||||
this.apiPropertiesCall(val).then(res => {
|
||||
console.log("chekc", res)
|
||||
if (res != false) {
|
||||
// val.answers=[]
|
||||
// val.answers=this.convertArrayNames(val.api_properties.fields,res)
|
||||
control.controls[index]['controls'].answers.setValue(this.convertArrayNames(val.api_properties.fields, res))
|
||||
|
||||
}
|
||||
}, err => console.log(err))
|
||||
}
|
||||
// else{
|
||||
// setTimeout(()=>{
|
||||
// control.push(this.createValue(val))
|
||||
// },200)
|
||||
// }
|
||||
|
||||
// }
|
||||
// else{
|
||||
// control.push(this.createValue(val))
|
||||
// }
|
||||
console.log(formgroup)
|
||||
|
||||
}
|
||||
}, err => console.log(err))
|
||||
return formgroup
|
||||
}
|
||||
// END OF FORM CREATION
|
||||
|
||||
// FOR CREATING THE FORM CONTROL FOR SPECIFIC FORM ARRAY
|
||||
createValue(data){
|
||||
let is_amt_in_words=false
|
||||
let answer_value_loc='';
|
||||
let answers_from_client=[]
|
||||
if(data.hasOwnProperty('answer_value') && data.answer_value != '' || null){
|
||||
let values_for_cli:any = this.getAnswerValue(data)
|
||||
if(values_for_cli.flag == 1){
|
||||
answer_value_loc=values_for_cli.values
|
||||
}
|
||||
else{
|
||||
answers_from_client=values_for_cli.values
|
||||
}
|
||||
}
|
||||
// if(data.hasOwnProperty('field_type')){
|
||||
// if(data.field_type == 'num'){
|
||||
// is_amt_in_words=true
|
||||
// }
|
||||
// }
|
||||
return this._fb.group({
|
||||
"answer_value":[{value:answer_value_loc,disabled:answer_value_loc != '' ? true : false}], // OLD VALIDATION >>>> data.type != '6' ? Validators.compose([Validators.required]) : ''
|
||||
"question":[data.question],
|
||||
"question_key":[data.question_key],
|
||||
"type":[data.type],
|
||||
"raw_validations":[data.raw_validations],
|
||||
"validations":[data.raw_validations],
|
||||
"api_properties":[data.api_properties],
|
||||
"onchange_properties":[data.onchange_properties],
|
||||
"answers":[answers_from_client.length != 0 ? answers_from_client: data.answers],
|
||||
"is_repeatable":[data.is_repeatable || null],
|
||||
"group_title":[data.group_title || null]
|
||||
})
|
||||
}
|
||||
// END OF CREATEVALUE FUN
|
||||
|
||||
// FOR REQUESTING THE API AUTOMATICALLY FROM JSON
|
||||
apiPropertiesCall(val){
|
||||
return new Promise((resolve,reject)=>{
|
||||
if(val.api_properties != null && typeof(val.api_properties) == 'object'){
|
||||
let pd_info = this.curr_pd_info
|
||||
console.log(pd_info)
|
||||
let params = val.api_properties.params
|
||||
if(val.api_properties.hasOwnProperty('params_type') && val.api_properties.params_type == 'expression') {
|
||||
params = eval(val.api_properties.params)
|
||||
console.log(params,this.curr_pd_info.smc_credit_pd)
|
||||
// debugger;
|
||||
}
|
||||
this.salesPDProvider.api_post_method(val.api_properties.api,params,val.api_properties.api_method).subscribe(res=>{
|
||||
if(res['dataStatus']){
|
||||
if(res.hasOwnProperty('records')){
|
||||
res=res['records']
|
||||
}
|
||||
resolve(res)
|
||||
console.log(res)
|
||||
// val.answers=res
|
||||
}
|
||||
else{
|
||||
resolve(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
resolve(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
// END OF API PROPERTIES CALL
|
||||
|
||||
// ---FOR CONVERTING THE ANSWER KEYS UNIQUE
|
||||
convertArrayNames(fieldName,data_from_api){
|
||||
let val1=[]
|
||||
let modified_json = data_from_api.map(
|
||||
obj => {
|
||||
if(fieldName.length > 0) {
|
||||
return {
|
||||
"answer_id" : obj[fieldName[0]],
|
||||
"answer":obj[fieldName[1]],
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
return {
|
||||
"answer_id" : obj,
|
||||
"answer":obj,
|
||||
}
|
||||
}
|
||||
});
|
||||
return modified_json
|
||||
}
|
||||
// END OF CONVERTARRAYNAMES FUN--
|
||||
|
||||
// --- FOR SETTING THE VALUE DEFAULT WITH DISABLED AND GENERATE THE ANSWERS FOR FIELDS(EX. refer 'GET_FY_YEARS' switch)
|
||||
getAnswerValue(value_obj) {
|
||||
if (value_obj != null && value_obj.hasOwnProperty('answer_value')) {
|
||||
let return_value = { flag: 1, values: '' };
|
||||
let user_det: any = this.salesPDProvider.user_login_details
|
||||
// user_det = JSON.parse(user_det);
|
||||
switch (value_obj.answer_value) {
|
||||
case 'CURRENT_USER':
|
||||
console.log("current user", user_det)
|
||||
return_value.values = user_det.user_first_name + ' ' + user_det.user_last_name
|
||||
break;
|
||||
case "CURRENT_DESIGNATION":
|
||||
return_value.values = user_det.designation_name != null ? user_det.designation_name : ''
|
||||
break;
|
||||
case "CURRENT_DATE":
|
||||
let date = new Date()
|
||||
return_value.values = this.datepipe.transform(date, 'dd-MM-yyyy, h:mm:ss a')
|
||||
break;
|
||||
case "GET_FY_YEARS":
|
||||
return_value.values = this.getCurrentFyYears()
|
||||
return_value.flag = 2
|
||||
break;
|
||||
default:
|
||||
return_value.values = ''
|
||||
break
|
||||
}
|
||||
return return_value
|
||||
}
|
||||
return ''
|
||||
}
|
||||
// --END OF GETANSWERVALUE FUN
|
||||
|
||||
addAdditionalControl(data,curr_control,curr_index,purpose?){
|
||||
|
||||
//FOR CHECKBOX CHANGE THE VALUE STORAGE AS ARRAY
|
||||
if(data.type == '5'){
|
||||
curr_control.controls[curr_index].removeControl('answer_value');
|
||||
curr_control.controls[curr_index].addControl('answer_value',this._fb.array([]))
|
||||
}
|
||||
|
||||
//FOR numeric of string field
|
||||
if(data.type == '1'){
|
||||
curr_control.controls[curr_index].addControl('field_type',new FormControl(data.field_type))
|
||||
curr_control.controls[curr_index].addControl('place_holder',new FormControl(data.place_holder))
|
||||
}
|
||||
|
||||
//FOR SEARCHABLE FIELD VALUE KEY ()
|
||||
if(data.type == '8'){
|
||||
curr_control.controls[curr_index].addControl('select_search',new FormControl(data.field_type))
|
||||
}
|
||||
if(purpose == 'additional_field'){
|
||||
curr_control.controls[curr_index].addControl('additional_field',new FormControl(1))
|
||||
}
|
||||
|
||||
// FOR IMAGE STATUS
|
||||
if(data.type == '6'){
|
||||
curr_control.controls[curr_index].addControl('is_loader',new FormControl(''))
|
||||
curr_control.controls[curr_index].addControl('is_saved',new FormControl(''))
|
||||
curr_control.controls[curr_index].addControl('is_image_status',new FormControl(false))
|
||||
}
|
||||
|
||||
//FOR SETTING THE VALIDATORS
|
||||
this.settingArrayofValidators(data,curr_control.controls[curr_index],curr_index)
|
||||
}
|
||||
|
||||
// FOR SETTING THE ARRAY OF VALIDATORS COMING FROM JSON Temp,
|
||||
settingArrayofValidators(data,curr_control,curr_index){
|
||||
console.log("entered",data);
|
||||
if(data.hasOwnProperty('validations') && data.validations.length > 0 ){
|
||||
const validList :any= [];
|
||||
let validator_value
|
||||
data.validations=data.validations.filter(val=>val.isactive != '0')
|
||||
data.validations.forEach(valid => {
|
||||
if(valid.value != null && !valid.hasOwnProperty('validation_to')){
|
||||
validator_value= this.getvalidatorValue(valid)
|
||||
}
|
||||
else{
|
||||
validator_value=this.setValueForValidator(valid)
|
||||
console.log("cc",validator_value)
|
||||
|
||||
}
|
||||
validList.push(validator_value);
|
||||
});
|
||||
// console.log("valid",validList,curr_control)
|
||||
// let val="Validators.required"
|
||||
// console.log(typeof(Validators))
|
||||
// console.log(typeof(`${val}`))
|
||||
|
||||
// let val1=`${val}`
|
||||
// console.log(typeof(eval(val)))
|
||||
// console.log(eval(val))
|
||||
console.log(validList)
|
||||
// curr_control.controls[curr_index].controls.answer_value.setValidators(validList)
|
||||
curr_control.controls.answer_value.setValidators(validList)
|
||||
console.log("ddvdeeqq",validList)
|
||||
curr_control.controls.answer_value.updateValueAndValidity()
|
||||
console.log("after setting validators",curr_control)
|
||||
}
|
||||
}
|
||||
// END OF SETTINGARRAYOFVALIDATORS FUN
|
||||
|
||||
// FOR GETTING THE VALIDATION VALUE
|
||||
getvalidatorValue(value_obj){
|
||||
if(value_obj != null && value_obj.hasOwnProperty('value')){
|
||||
let value_of_validator
|
||||
switch(value_obj.value){
|
||||
case 'CURRENT_YEAR':
|
||||
value_of_validator=new Date().getFullYear()
|
||||
break;
|
||||
default:
|
||||
value_of_validator=''
|
||||
break;
|
||||
}
|
||||
value_obj.validator=String(value_of_validator)
|
||||
return this.setValueForValidator(value_obj)
|
||||
}
|
||||
}
|
||||
// END OF GETVALIDATORVALUE FUN
|
||||
|
||||
// FOR GENERATING THE FY YEAR FIELD ANSWERS
|
||||
getCurrentFyYears(){
|
||||
let month=new Date().getMonth()
|
||||
let year=new Date().getFullYear()
|
||||
let fy:any=[];
|
||||
if(month >=3){
|
||||
fy.push({fy_year:year-1+'-'+(year),curr:year})
|
||||
}
|
||||
else{
|
||||
fy.push({fy_year:year-2+'-'+(year-1),curr:year-1})
|
||||
}
|
||||
console.log(fy)
|
||||
for(let i=0;i<=2;i++){
|
||||
fy.push({fy_year:(fy[i].curr-2)+'-'+(fy[i].curr-1),curr:fy[i].curr-1})
|
||||
}
|
||||
return fy.map(val=>({answer:val.fy_year,answer_id:val.fy_year}))
|
||||
}
|
||||
// END OF GETCURRFYYEARS FUN
|
||||
|
||||
// FOR CREATING THE CORRECT VALIDATION
|
||||
setValueForValidator(value_obj){
|
||||
console.log("setvlaue of validator",value_obj.validator,typeof(value_obj.validator))
|
||||
let return_value
|
||||
if(value_obj != null && value_obj.hasOwnProperty('validator')){
|
||||
switch(value_obj.name)
|
||||
{
|
||||
case 'required':
|
||||
return_value=Validators.required
|
||||
break;
|
||||
case 'minLength':
|
||||
return_value=Validators.minLength(value_obj.validator)
|
||||
break;
|
||||
case 'maxLength':
|
||||
return_value=Validators.maxLength(value_obj.validator)
|
||||
break;
|
||||
case 'min':
|
||||
return_value=Validators.min(value_obj.validator)
|
||||
break;
|
||||
case 'max':
|
||||
return_value=Validators.max(value_obj.validator)
|
||||
break;
|
||||
case 'pattern':
|
||||
return_value=Validators.pattern(value_obj.validator)
|
||||
break;
|
||||
default:
|
||||
return_value=''
|
||||
break;
|
||||
}
|
||||
return return_value
|
||||
}
|
||||
else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
// END OF SETVALUEFORVALIDATOR FUN
|
||||
}
|
||||
@ -169,7 +169,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
declarations: [TelePdAllocationComponent, ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, PdReportComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent],
|
||||
declarations: [TelePdAllocationComponent, ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, PdReportComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, DeleteRecordsCountPipe, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
ManagePdRoutingModule,
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="SalesPdSno">
|
||||
<mat-cell fxFlex.xs="15" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="16" fxFlex.xl="15" class="cell" *matCellDef="let details;" style="color:rgb(224, 2, 1);font-weight: bold;text-align: left" >
|
||||
<small mat-line>{{details.sales_pd_sno}}</small>
|
||||
<small mat-line>{{details.sales_pd_sno}}</small><br/>
|
||||
<small style="color: black;text-align:center;font-weight: normal;font-size: 15px;">{{details.sales_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}}</small>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Applicant Name">
|
||||
@ -69,9 +70,11 @@
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Action">
|
||||
<mat-cell class="cell" *matCellDef="let details;" style="justify-content: flex-start">
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PDF Download" [disabled]="details.status != 'COMPLETED'"
|
||||
<mat-cell class="cell" *matCellDef="let details;" style="justify-content: flex-end;padding: 0 !important" fxFlex.xs="10" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="18">
|
||||
<button style="float: right" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PDF Download" [disabled]="details.status != 'COMPLETED'"
|
||||
matTooltipPosition="above" color="primary" (click)="salesPDpdf(details.sales_pd_id)"><mat-icon>file_download</mat-icon></button>
|
||||
<button style="float: right" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Trigger Credit PD" *ngIf="user_type == 'credit'" [disabled]="details.status != 'COMPLETED'"
|
||||
matTooltipPosition="above" color="primary" (click)="newcreditTrigger(details)"><mat-icon>add</mat-icon></button>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatPaginator, MatSort, PageEvent } from '@angular/material';
|
||||
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
|
||||
import { MatTableDataSource, MatPaginator, MatSort, PageEvent, MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
|
||||
import { UserService } from 'app/settings/service/user.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { Router } from '@angular/router';
|
||||
import { ApiServiceService } from 'app/lender-credit-pd/services/apiService/api-service.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sales-pd',
|
||||
@ -35,11 +38,13 @@ export class SalesPdComponent implements OnInit {
|
||||
filter_drop_down_data:any;
|
||||
limitMsg: boolean = false;
|
||||
common: any;
|
||||
user_type: string ='';
|
||||
|
||||
constructor(private _pdSales: PdTrigerService,private userService:UserService) {
|
||||
constructor(private _pdSales: PdTrigerService,private dialog:MatDialog,private router:Router,private _creditPdService:ApiServiceService) {
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
this.user_type = localStorage.getItem('len_user_role')
|
||||
|
||||
}
|
||||
|
||||
@ -154,4 +159,60 @@ export class SalesPdComponent implements OnInit {
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSourceTab4.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
newcreditTrigger(curr_list_obj) {
|
||||
console.log(curr_list_obj);
|
||||
|
||||
const dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
|
||||
width: '500px',
|
||||
data: curr_list_obj
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log('The dialog was closed',result);
|
||||
if(result) {
|
||||
let new_credit_pd_info = curr_list_obj
|
||||
// {fk_sales_pd_id:curr_list_obj.sales_pd_id,sales_pd_sno:curr_list_obj.sales_pd_sno,product_id:curr_list_obj.product_id,smc_credit_pd_type:result,smc_credit_pd:null,lender_id:curr_list_obj.lender_id,applicant_name:curr_list_obj.applicant_name,}
|
||||
new_credit_pd_info.fk_sales_pd_id = curr_list_obj.sales_pd_id
|
||||
new_credit_pd_info.smc_credit_pd_type = result
|
||||
new_credit_pd_info.smc_credit_pd = null
|
||||
this._creditPdService.curr_credit_pd_data = new_credit_pd_info
|
||||
this.router.navigate(['../credit_pd/pdQuestions'])
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'dialog-overview-example-dialog',
|
||||
templateUrl: 'trigger-confirm-dialog.html',
|
||||
})
|
||||
export class DialogOverviewExampleDialog {
|
||||
pd_type_list:any=[{
|
||||
id:"1",
|
||||
dis_name:"Physical PD"
|
||||
},{
|
||||
id:"2",
|
||||
dis_name:"Telephonic PD"
|
||||
}]
|
||||
choosedPD:any=null
|
||||
// notifier:NotifierService
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DialogOverviewExampleDialog>,
|
||||
@Inject(MAT_DIALOG_DATA) public data) {
|
||||
// this.notifier=notifier
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
onSubmit(){
|
||||
console.log(this.choosedPD);
|
||||
if(this.choosedPD != '' && !this.choosedPD) {
|
||||
alert("Please choose the PD Type");
|
||||
return
|
||||
}
|
||||
this.dialogRef.close(this.choosedPD)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
15
ng6-seed/src/app/sales-pd/trigger-confirm-dialog.html
Normal file
15
ng6-seed/src/app/sales-pd/trigger-confirm-dialog.html
Normal file
@ -0,0 +1,15 @@
|
||||
<h1 mat-dialog-title>Confirm</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>Please Confirm you are triggering credit PD for the company <strong>{{data.applicant_name}} ({{data.abbr}})</strong></p>
|
||||
|
||||
<div>
|
||||
<mat-radio-group [(ngModel)]="choosedPD">
|
||||
<mat-label>Choose the PD Type :</mat-label><br/>
|
||||
<mat-radio-button style="margin:10px;" *ngFor="let item of pd_type_list" [value]="item.id">{{item.dis_name}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
</div><br/><br/>
|
||||
<div mat-dialog-actions align="end">
|
||||
<button mat-stroked-button color="primary" (click)="onNoClick()">Cancel</button>
|
||||
<button mat-raised-button color="primary" (click)="onSubmit()" cdkFocusInitial>Yes</button>
|
||||
</div>
|
||||
@ -74,6 +74,12 @@ const salesmenu = [
|
||||
type:'link',
|
||||
icon:'work',
|
||||
},
|
||||
{
|
||||
state:'credit_pd',
|
||||
name:'Credit PD - Internal',
|
||||
type:'link',
|
||||
icon:'list'
|
||||
}
|
||||
// {
|
||||
// state:'quality_check_discussion',
|
||||
// name:'Quality Check',
|
||||
@ -94,7 +100,12 @@ export class HorizontalMenuItems {
|
||||
return HORIZONTALMENUITEMS;
|
||||
}
|
||||
salesgetAll(): Menu[] {
|
||||
return salesmenu;
|
||||
let filtered_sales_menu = salesmenu
|
||||
let user_type= localStorage.getItem('len_user_role')
|
||||
if(user_type != 'credit'){
|
||||
filtered_sales_menu = salesmenu.filter(vv=>vv.state != 'credit_pd')
|
||||
}
|
||||
return filtered_sales_menu;
|
||||
}
|
||||
add(menu: Menu) {
|
||||
// HORIZONTALMENUITEMS.push(Menu);
|
||||
|
||||
@ -156,6 +156,12 @@ const salesMenus: Menu[]= [
|
||||
type:'link',
|
||||
icon:'work',
|
||||
},
|
||||
{
|
||||
state:'credit_pd',
|
||||
name:'Credit PD - Internal',
|
||||
type:'link',
|
||||
icon:'list'
|
||||
}
|
||||
// {
|
||||
// state:'quality_check_discussion',
|
||||
// name:'Quality Check',
|
||||
@ -176,7 +182,12 @@ export class MenuItems {
|
||||
return MENUITEMS;
|
||||
}
|
||||
salesgetAll(): Menu[] {
|
||||
return salesMenus;
|
||||
let filtered_sales_menu = salesMenus
|
||||
let user_type= localStorage.getItem('len_user_role')
|
||||
if(user_type != 'credit'){
|
||||
filtered_sales_menu = salesMenus.filter(vv=>vv.state != 'credit_pd')
|
||||
}
|
||||
return filtered_sales_menu;
|
||||
}
|
||||
|
||||
add(menu: Menu) {
|
||||
|
||||
@ -7,6 +7,7 @@ import { ToggleFullscreenDirective } from './fullscreen/toggle-fullscreen.direct
|
||||
import { RatingComponent} from './rating/rating.component';
|
||||
import { NumbersOnlyDirective } from './numbers-only/numbers-only.directive';
|
||||
import { ForMobileNumbersDirective } from './for-mobile-numbers/for-mobile-numbers.directive';
|
||||
import { NumberToWordsPipe } from 'app/personal-discussion/pd-pipes/number-to-words.pipe';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -16,7 +17,8 @@ import { ForMobileNumbersDirective } from './for-mobile-numbers/for-mobile-numbe
|
||||
ToggleFullscreenDirective,
|
||||
RatingComponent,
|
||||
NumbersOnlyDirective,
|
||||
ForMobileNumbersDirective
|
||||
ForMobileNumbersDirective,
|
||||
NumberToWordsPipe
|
||||
],
|
||||
exports: [
|
||||
AccordionAnchorDirective,
|
||||
@ -25,7 +27,8 @@ import { ForMobileNumbersDirective } from './for-mobile-numbers/for-mobile-numbe
|
||||
ToggleFullscreenDirective,
|
||||
RatingComponent,
|
||||
NumbersOnlyDirective,
|
||||
ForMobileNumbersDirective
|
||||
ForMobileNumbersDirective,
|
||||
NumberToWordsPipe
|
||||
],
|
||||
providers: [ MenuItems, HorizontalMenuItems ]
|
||||
})
|
||||
|
||||
2194
ng6-seed/src/assets/credit_pd_template.json
Normal file
2194
ng6-seed/src/assets/credit_pd_template.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -97,7 +97,7 @@ $mat-toolbar-height-mobile-landscape: 48px !default;
|
||||
display: none;
|
||||
}
|
||||
.mat-drawer-content.mat-sidenav-content {
|
||||
margin: 0 !important;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.horizontal-menu {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user