diff --git a/ng6-seed/PD Genie Lender web test 05-03-2020.zip b/ng6-seed/PD Genie Lender web test 05-03-2020.zip deleted file mode 100644 index 15c17bf..0000000 Binary files a/ng6-seed/PD Genie Lender web test 05-03-2020.zip and /dev/null differ diff --git a/ng6-seed/src/app/app.module.ts b/ng6-seed/src/app/app.module.ts index 6f58c67..c9d0ae6 100755 --- a/ng6-seed/src/app/app.module.ts +++ b/ng6-seed/src/app/app.module.ts @@ -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 { } diff --git a/ng6-seed/src/app/app.routing.ts b/ng6-seed/src/app/app.routing.ts index 2f736ea..4d8498f 100755 --- a/ng6-seed/src/app/app.routing.ts +++ b/ng6-seed/src/app/app.routing.ts @@ -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' diff --git a/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.html b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.html new file mode 100644 index 0000000..ab2090c --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.html @@ -0,0 +1,15 @@ +

{{data.title}}

+
+

{{data.msg}}

+ + +

+
+      + +
diff --git a/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.scss b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.scss new file mode 100644 index 0000000..f9ca6e6 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.scss @@ -0,0 +1,6 @@ +h1 { + font-size: 1.7rem; +} +p { + font-size: 1rem; +} \ No newline at end of file diff --git a/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.spec.ts b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.spec.ts new file mode 100644 index 0000000..cb8655d --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AlertDialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AlertDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.ts b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.ts new file mode 100644 index 0000000..cbed82f --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/alert-dialog/alert-dialog.component.ts @@ -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, + @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() {} + +} diff --git a/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.html b/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.html new file mode 100644 index 0000000..44aebb3 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.html @@ -0,0 +1,78 @@ + + + + + + filter_list + + Advanced Filter + + + + + +
+ + + {{status}} + + + + + + + + + + + + + + + + {{pro.abbr}} + + + + + + + + +
+
+
+ + + + + + +
+ + +
\ No newline at end of file diff --git a/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.scss b/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.spec.ts b/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.spec.ts new file mode 100644 index 0000000..56d2474 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CreditAdvanceFilterComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CreditAdvanceFilterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.ts b/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.ts new file mode 100644 index 0000000..64509e4 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/credit-advance-filter/credit-advance-filter.component.ts @@ -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); + } + +} diff --git a/ng6-seed/src/app/lender-credit-pd/lender-credit-pd-routing.module.ts b/ng6-seed/src/app/lender-credit-pd/lender-credit-pd-routing.module.ts new file mode 100644 index 0000000..494f66c --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/lender-credit-pd-routing.module.ts @@ -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 { } diff --git a/ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.spec.ts b/ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.spec.ts new file mode 100644 index 0000000..8876370 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.spec.ts @@ -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(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.ts b/ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.ts new file mode 100644 index 0000000..b4bb44e --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/lender-credit-pd.module.ts @@ -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 { } + + diff --git a/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.html b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.html new file mode 100644 index 0000000..24b86b4 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.html @@ -0,0 +1,95 @@ + +
+
+ + + +
+
+ + + Credit PD + + +

Showing data for last {{common}}. To see older records, please use advanced filter

+
+ + + + + {{details.smc_credit_pd}} + + + + + {{details.smc_credit_pd_sno}}
+ {{details.smc_credit_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}} +
+
+ + + + -- + + + {{details.applicant_name}} +
+ {{details.applicant_id}} +
+
+ + + {{details.short_name}}
+ {{details.abbr}} +
+
+ + + + -- + + + {{details.officer_name}} + + + + + + + -- + + + {{details.status}} + + + + + + {{details.createdon | date: 'dd/MM/yyyy'}} + + + + + + + + + + +
+ +
+ + + + +
Showing data for last {{common}}. To see older records, please use advanced filter
+
+
+
+
\ No newline at end of file diff --git a/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.scss b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.scss new file mode 100644 index 0000000..743bbfe --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.scss @@ -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; + } + diff --git a/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.spec.ts b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.spec.ts new file mode 100644 index 0000000..7810842 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PdListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PdListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.ts b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.ts new file mode 100644 index 0000000..b706aa0 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-list/pd-list.component.ts @@ -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 = 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 = 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']); + } + +} diff --git a/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.html b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.html new file mode 100644 index 0000000..0501c1d --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.html @@ -0,0 +1,65 @@ +
+ + + +
{{curr_pd_info.applicant_name}} ({{curr_pd_info.smc_credit_pd_sno}})
+ {{curr_pd_info.abbr}} - {{curr_pd_info.smc_credit_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}} +
+ + +
+ + + +
+ +
+ + + + + + + + + +

{{item.section_name}}

+ + check_circle + + + + + + + +
+
+
+ + +
+ + + + + + + +
No Templates Found
+
+
+ +
+ +
+ +
+ \ No newline at end of file diff --git a/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.scss b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.scss new file mode 100644 index 0000000..94ed011 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.scss @@ -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; +} \ No newline at end of file diff --git a/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.spec.ts b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.spec.ts new file mode 100644 index 0000000..08055dc --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PdQuestionsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PdQuestionsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.ts b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.ts new file mode 100644 index 0000000..3b6d91d --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/pd-questions/pd-questions.component.ts @@ -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)); + // }) + } +} diff --git a/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.html b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.html new file mode 100644 index 0000000..d0c4511 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.html @@ -0,0 +1,425 @@ + +
+
+ +
+
+ + + +
+ + + + {{parent_ques.get('question').value}} + + + {{"₹"}}{{parent_ques.get('answer_value').value | numberToWords}} + + + {{validation.message}} + + + +
+ {{parent_ques.get('question').value}}
+ + {{val.answer}}
+
+ + {{validation.message}} + +
+ + + {{parent_ques.get('question').value}} + + {{val.answer}} + + + + {{validation.message}} + + + +
+ {{parent_ques.get('question').value}} + {{val.answer}}
+ + {{validation.message}} + +
+ + + {{parent_ques.get('question').value}} + + {{val.answer}} + + + + {{validation.message}} + + + +
+ +
+
+
+
+

Image is not captured.

+ + + +
+
+
+ +
+ + +
+ +
+
+
+ + + + {{validation.message}} + + +
+ + + {{parent_ques.get('question').value}} + + + + {{validation.message}} + + + + + {{parent_ques.get('question').value}} + + + + close + + + -- + + {{val.answer}} + + + + {{validation.message}} + + + +
+ + + + +
+ + + +
+ + + + + + {{parent_ques.get('group_title').value}} {{g_i+1}} + + + + +
+
+ + + {{single_ques.get('question').value}} + + {{"₹"}}{{single_ques.get('answer_value').value | numberToWords}} + + + {{validation.message}} + + + +
+ {{single_ques.get('question').value}}
+ + {{val.answer}}
+
+ + {{validation.message}} + +
+ + + {{single_ques.get('question').value}} + + {{val.answer}} + + + + {{validation.message}} + + + +
+ {{single_ques.get('question').value}} + {{val.answer}}
+ + {{validation.message}} + +
+ + + {{single_ques.get('question').value}} + + {{val.answer}} + + + + {{validation.message}} + + + + + {{single_ques.get('question').value}} + + + + {{validation.message}} + + + + + {{single_ques.get('question').value}} + + + + close + + + -- + + {{val.answer}} + + + + {{validation.message}} + + + +
+ + + + {{single_ques.get('subfield_caption').value}} + + + +
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ + + + +
+
+
+
+ + +
{{parent_ques.get('group_title').value}}
+
+
+ + +
+ + + + + + + +

Image is not captured.

+
+
+
+
+
+
+
+ {{single_ques.get('question').value}} {{g_i+1}} +
+ + + + + +
+
+ + + + +
+ + + + + + + +
+
+ +
+
+
+ + +
+
+
+ +
+ + + + {{parent_ques.get('subfield_caption').value}} + + + +
+ + +
+
+
+
+ +
+ + +
+ +
+   Saving... +
+
+
+ +
\ No newline at end of file diff --git a/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.scss b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.scss new file mode 100644 index 0000000..d6937e1 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.scss @@ -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%; +} \ No newline at end of file diff --git a/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.spec.ts b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.spec.ts new file mode 100644 index 0000000..0cd85cd --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ QuesTemplateComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(QuesTemplateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.ts b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.ts new file mode 100644 index 0000000..22f49a8 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/ques-template/ques-template.component.ts @@ -0,0 +1,1650 @@ +import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core'; +import { FormGroup, FormBuilder, FormArray, FormControl } from '@angular/forms'; +import { Subject } from 'rxjs'; +import { MatAccordion, MatExpansionPanel, MatDialog } from '@angular/material'; +import { HttpEventType, HttpResponse } from '@angular/common/http'; +import { QuesTemplateService } from '../services/ques-template/ques-template.service'; +import { ApiServiceService } from '../services/apiService/api-service.service'; +import { NotifierService } from 'angular-notifier'; +import { AlertDialogComponent } from '../alert-dialog/alert-dialog.component'; + +@Component({ + selector: 'app-ques-template', + templateUrl: './ques-template.component.html', + styleUrls: ['./ques-template.component.scss'] +}) +export class QuesTemplateComponent implements OnInit { + + + text: string; + @Input() questions_JSON:any; + quesAnsForm: FormGroup; + step: number=0; + local_city: any; + local_pincode: any; + @Output() emitter=new EventEmitter() + @Output() imageUploadCheck = new EventEmitter() + local_ques_JSON: any; + geoCoordinates: string; + fileredSearchValue: any=[]; + protected _onDestroy=new Subject(); + submit_btn: boolean=false; + original_result_data: any={is_complete:''}; + spinner_access:boolean=false + raw_data_Section: any={status:''}; + @ViewChild('accordion') Accordion: MatAccordion + @ViewChild('mapanel') matExpansionPanel:MatExpansionPanel + emittedFormGroup: any = null; + sales_pd_id: any; + sales_pd_type: string; + private notifier: NotifierService; + curr_pd_info:any={} + sales_pd_section_to_fetch: any; + constructor(notifier: NotifierService,private _fb:FormBuilder,private questionService:QuesTemplateService,private salesPDProvider:ApiServiceService, + private dialog:MatDialog) { + console.log('Hello QuesTemplateComponent Component'); + this.text = 'Hello World'; + this.notifier = notifier; + } + ngOnInit() { + this.sales_pd_section_to_fetch = localStorage.getItem('commonSettings') + this.sales_pd_section_to_fetch = JSON.parse(this.sales_pd_section_to_fetch).sales_pd_section_to_fetch + // console.log(this.sales_pd_section_to_fetch,Object.keys(this.sales_pd_section_to_fetch),Object['value'](this.sales_pd_section_to_fetch)); + // this.sales_pd_section_to_fetch= Object. + // this.sales_pd_section_to_fetch = Object.keys(this.sales_pd_section_to_fetch).map(key =>{let temp=[]; temp.push(this.sales_pd_section_to_fetch[key]); return temp}); +// this.sales_pd_section_to_fetch = values.join(","); +console.log(this.sales_pd_section_to_fetch); + // debugger; + } + ngOnChanges(){ + // this.loadingProvider.pdloader("Fetching Data...") + // this.quesAnsForm=this._fb.group({questions:this._fb.array([])}) + this.quesAnsForm=new FormGroup({questions:this._fb.array([])}) + let raw_data_ques:any=this.salesPDProvider.raw_credit_pd_template + + raw_data_ques=JSON.parse(raw_data_ques) + + // if(raw_data_ques != null){ + // if(raw_data_ques.hasOwnProperty('sections') ){ + console.log("FROM COMPONENT",this.questions_JSON,raw_data_ques); + this.local_ques_JSON=this.questions_JSON + if(this.local_ques_JSON.section_id == raw_data_ques.sections[raw_data_ques.sections.length -1].section_id){ + this.submit_btn=true + // this.sendDatatoApi() + } + else { + this.submit_btn = false + } + + this.quesAnsForm=this.questionService.assignFormControl_array(this.quesAnsForm,this.local_ques_JSON.questions) + console.log(this.quesAnsForm); + + // this.salesPDProvider.getData_fromLocal('sec'+this.local_ques_JSON.section_id).then(resultData=>{ + // this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then((key_value)=>{ + // this.sales_pd_id = key_value + // if(resultData != null && resultData.sales_pd_id == key_value){ + // this.original_result_data=resultData + // this.checkGroupandPatchValues() + // this.loadingProvider.dismissLoader() + // } + // else if(key_value != null){ + // this.getSalesPDSectionFromApi(key_value) + // } + // else{ + // // this.loadingProvider.dismissLoader() + // } + + + // }) + // }) + + // } +// } + this.curr_pd_info = this.salesPDProvider.curr_credit_pd_data + if(this.curr_pd_info || (Object.keys(this.curr_pd_info).length != 0 && this.curr_pd_info.constructor != Object)) { + this.sales_pd_type = this.curr_pd_info.smc_credit_pd_type + this.sales_pd_id = this.curr_pd_info.fk_sales_pd_id + if(this.curr_pd_info.smc_credit_pd && this.curr_pd_info.smc_credit_pd != null) { + // this.getSalesPDSectionFromApi(this.sales_pd_id); + // console.log(this.curr_pd_info.saved_sections ); + // debugger; + if(this.curr_pd_info.saved_sections) { + this.proceedToGetDataFromSmcCredit() + } + else { + setTimeout(()=>{ + this.proceedToGetDataFromSmcCredit() + },500) + } + } + else { + this.getSalesPDSectionFromApi(this.sales_pd_id) + } + } + this.quesAnsForm.markAsUntouched(); + this.quesAnsForm.markAsPristine() + this.quesAnsForm.updateValueAndValidity(); + + } + proceedToGetDataFromSmcCredit () { + if(this.local_ques_JSON.section_id == '19' || (this.curr_pd_info.saved_sections && this.curr_pd_info.saved_sections.length > 0 && + this.curr_pd_info.saved_sections.filter(vl=>vl.section_id == this.local_ques_JSON.section_id).length > 0)) { + + this.getSMCCreditPDSectionData() + + } + else { + let temp_res=this.sales_pd_section_to_fetch.filter(vv=>vv.section_id == this.local_ques_JSON.section_id) + if(temp_res && temp_res.length > 0) { + this.getSalesPDSectionFromApi(this.sales_pd_id) + } + } +} + + getSMCCreditPDSectionData() { + let params = {"smc_credit_pd":this.curr_pd_info.smc_credit_pd,"section_id":this.local_ques_JSON.section_id} + this.salesPDProvider.getSMCCreditPDSectionData(params).subscribe(response=>{ + if(response['dataStatus']){ + + this.raw_data_Section=response['records'][0] + this.original_result_data=response['records'][0].section_data + this.original_result_data=JSON.parse(this.original_result_data); + // debugger; + // this.original_result_data.questions=this.original_result_data.questions.filter(val=>val.question_key == 'selfie_with_person_met') + this.checkGroupandPatchValues() + // this.loadingProvider.dismissLoader() + } + else{ + this.sendAutomaticallyToApi() + // FOR DISPLAYING THE CUSTOMER CAPTURED IMAGE (STRUCTURED DYNAMICALLY CREATED IN FRONTEND) (***TELE PD ONLY***) + + if(this.curr_pd_info.smc_credit_pd && this.sales_pd_type && this.sales_pd_type == '2' && this.local_ques_JSON.section_id == '19' ) { + // this.salesPDProvider.getData_fromLocal('sales_rand_string').then((sales_rand_string)=>{ + let params = {"rand_string":this.curr_pd_info.rand_string} + this.salesPDProvider.getSalesPDImgDataCusLink(params).subscribe(result=>{ + if(result['dataStatus']){ + this.updateCustomerImages(result['records']) + this.checkGroupandPatchValues() + } + // this.loadingProvider.dismissLoader() + },err=>{ + // this.loadingProvider.dismissLoader() + }) + // }) +} +else { + this.getSalesPDSectionFromApi(this.sales_pd_id) +} + // else{ + // // this.loadingProvider.dismissLoader() + // } + } + }) + } + getSalesPDSectionFromApi(sales_pd_id){ + // this.loadingProvider.pdloader("Fetching Data...") + let params={sales_pd_id:sales_pd_id,section_id:this.local_ques_JSON.section_id} + this.salesPDProvider.getSalesPDSectionData(params).subscribe(response=>{ + if(response['dataStatus']){ + + this.raw_data_Section=response['records'][0] + this.original_result_data=response['records'][0].section_data + this.original_result_data=JSON.parse(this.original_result_data); + console.log(this.original_result_data); + // debugger; + // this.original_result_data.questions=this.original_result_data.questions.filter(val=>val.question_key == 'selfie_with_person_met') + this.checkGroupandPatchValues() + // this.loadingProvider.dismissLoader() + } + else{ + this.sendAutomaticallyToApi() + // FOR DISPLAYING THE CUSTOMER CAPTURED IMAGE (STRUCTURED DYNAMICALLY CREATED IN FRONTEND) (***TELE PD ONLY***) + + if(sales_pd_id && this.sales_pd_type && this.sales_pd_type == '2' && this.local_ques_JSON.section_id == '9' ) { + // this.salesPDProvider.getData_fromLocal('sales_rand_string').then((sales_rand_string)=>{ + let params = {"rand_string":this.curr_pd_info.rand_string} + this.salesPDProvider.getSalesPDImgDataCusLink(params).subscribe(result=>{ + if(result['dataStatus']){ + this.updateCustomerImages(result['records']) + this.checkGroupandPatchValues() + } + // this.loadingProvider.dismissLoader() + },err=>{ + // this.loadingProvider.dismissLoader() + }) + // }) +} + else{ + // this.loadingProvider.dismissLoader() + } + } + + },err=>{ + // this.loadingProvider.dismissLoader() + }) + } + // For Officer Details Form + sendAutomaticallyToApi(){ + if(this.local_ques_JSON.section_id == '8'){ + this.onSubmit(1); + } + } + // // for Image section creating a image stucture with images for patching values. + updateCustomerImages(img_values) { + if(this.local_ques_JSON.section_id == '19'){ + // let img_values:any=`{"img_data": [ + // { + // "img_key": "selfie_with_person_met", + // "img_name": "Person met", + // "img_url": "https://mllj2j8xvfl0.i.optimole.com/Lsv2lkg-oXPY0cKC/w:auto/h:auto/q:98/https://s15165.pcdn.co/wp-content/uploads/2018/06/what-is-a-website-url.jpg", + // "is_multiple": 0 + // }, + // { + // "heading":"Name Board Seen", + // "img_key": "name_board_seen", + // "img_name": "Name Board Seen", + // "img_data":[ { + // "img_url":"https://www.howtogeek.com/wp-content/uploads/2018/06/shutterstock_1006988770.png" + // }, + // { + // "img_url":"https://mllj2j8xvfl0.i.optimole.com/Lsv2lkg-oXPY0cKC/w:auto/h:auto/q:98/https://s15165.pcdn.co/wp-content/uploads/2018/06/what-is-a-website-url.jpg" + // }], + // "is_multiple": 1 + // }, + // { + // "heading":"Stock Photograph", + // "img_key": "stock_image", + // "img_name": "stock photo", + // "img_data":[{ + // "img_url":"https://www.howtogeek.com/wp-content/uploads/2018/06/shutterstock_1006988770.png" + // }], + // "is_multiple": 1 + // }, + // { + // "heading":"Workplace Interior Photograph", + // "img_key": "workplace_interior_image", + // "img_name": "Workplace Interior Photograph", + // "img_data":[ { + // "img_url":"https://www.howtogeek.com/wp-content/uploads/2018/06/shutterstock_1006988770.png" + // }, + // { + // "img_url":"https://mllj2j8xvfl0.i.optimole.com/Lsv2lkg-oXPY0cKC/w:auto/h:auto/q:98/https://s15165.pcdn.co/wp-content/uploads/2018/06/what-is-a-website-url.jpg" + // }], + // "is_multiple": 1 + // } + // ]}` + // img_values = JSON.parse(img_values) + let createPhotoStructure:any=this.quesAnsForm.value.questions + // console.log("update Image fun",this.quesAnsForm.value,img_values,this.quesAnsForm.get('questions')['controls'][0],this.photoStructure) + if(img_values.img_data.length > 0) { + // img_values.img_data.forEach(img_obj=>{ + for(let img_obj of img_values.img_data) { + if(img_obj) { + let findRootIndex = createPhotoStructure.findIndex(val=>val.question_key == img_obj.img_key) + let current_control_obj:any =[] + current_control_obj = createPhotoStructure[findRootIndex] + console.log(createPhotoStructure[findRootIndex]) + if(img_obj.is_multiple != '1'){ + current_control_obj.answer_value = img_obj.img_url + } + else { + if(img_obj.hasOwnProperty('img_data') && img_obj.img_data.length > 0) { + // img_obj.img_data.forEach(multi_obj=>{ + for(let multi_obj of img_obj.img_data) { + if(multi_obj) { + // console.log(multi_obj) + let temp_obj:any = [] + temp_obj.length = 0; + + temp_obj = {} + temp_obj = {"answer_value": "", + "question": "Approach to PD Location", + "question_key": "approach_to_pd_location", + "type": "6", + "raw_validations": [], + "validations": [], + "api_properties": null, + "onchange_properties": null, + "answers": null, + "is_repeatable": null, + "group_title": null, + "is_loader": "", + "is_saved": "", + "is_image_status": false} + temp_obj.question = img_obj.img_name + temp_obj.question_key = img_obj.img_key + temp_obj.answer_value = multi_obj.img_url + // console.log(temp_obj); + // debugger; + // current_control_obj.questions_group.unshift({questions:[temp_obj]}) + createPhotoStructure[findRootIndex].questions_group.unshift({questions:[temp_obj]}) + } + } + // }) + } + } + } + } + console.log(createPhotoStructure); + // debugger; + this.original_result_data.questions= createPhotoStructure; + // this.quesAnsForm.get('questions').patchValue(createPhotoStructure); + } + + } + } + proceedonChangeProperty(local_value_obj?){ + console.log("On Change Property",this.quesAnsForm.value.questions); + + this.quesAnsForm.controls.questions['controls'].forEach((val,p_i)=>{ + + // --- FOR ONCHANGE PROPERTIES--- + if(val.value.onchange_properties != null){ + let onChangeProperties_value=val.value.onchange_properties + onChangeProperties_value.forEach(onChangeProperty=>{ + if(onChangeProperty.purpose == 'FORM_CTRL'){ + + this.creteNewField(onChangeProperty,this.quesAnsForm,'',this.original_result_data,"edit"); + } + }) + } + + // JSON QUESTION CHANGE FOR SINGLE + console.log("key",p_i,this.quesAnsForm.value) + if (this.original_result_data.questions[p_i] != undefined) { + if (this.quesAnsForm.value.questions[p_i].is_repeatable != 1 && this.quesAnsForm.value.questions[p_i].question_key !== this.original_result_data.questions[p_i].question_key) { + // ADDING THE QUESTION TO FETCHED DATA ARRAY + if (this.quesAnsForm.value.questions.filter(data => data.question_key! == this.quesAnsForm.value.questions[p_i].question_key) == 0) { + this.original_result_data.questions.splice(p_i, 0, this.quesAnsForm.value.questions[p_i]) + } + // ---- END OF ADDING DATA ---- + + // REMOVING THE QUESTION TO FETCHED DATA ARRAY + else { + console.log("Else part>>", this.quesAnsForm.value.questions[p_i].question_key, this.original_result_data.questions[p_i].question_key, val) + this.original_result_data.questions.splice(p_i, 1) + console.log("after", this.original_result_data.questions, this.quesAnsForm.value.questions) + } + // --- END OF REMOVING QUESTION --- + } + } + //---- END OF JSON QUESTION CHANGE---- + + if(val.value.is_repeatable == '1'){ + val.controls.questions_group.controls.forEach((group_ques,g_i)=>{ + // console.clear() + + group_ques.value.questions.forEach((single_ques,s_i)=>{ + + // --- FOR ONCHANGE PROPERTIES--- + if(single_ques.onchange_properties != null){ + let onChangeProperties_value=single_ques.onchange_properties + onChangeProperties_value.forEach(onChangeProperty=>{ + if(onChangeProperty.purpose == 'FORM_CTRL'){ + + this.creteNewField(onChangeProperty,group_ques,'',this.original_result_data.questions[p_i].questions_group[g_i],"edit"); + } + }) + } + // ---END OF ON CHANGE PROPERTIES--- + + // ----FOR SUBFIELD GENERATION IN GROUP QUES---- + let control=this.quesAnsForm.get('questions')['controls'][p_i].get('questions_group')['controls'][g_i].get('questions')['controls'][s_i] as FormArray + if (control.value.answers != null && control.value.answers.length > 0) { + let answer_value_obj=local_value_obj.questions[p_i].questions_group[g_i].questions[s_i] + if(answer_value_obj != undefined){ + + this.creatSubField(control, answer_value_obj.answer_value) + } + } + // ----END OF SUBFIELD GENERATION---- + + // JSON QUESTION CHANGE FOR GROUP + // setTimeout(()=>{ + let form_c=single_ques + let form_control=this.quesAnsForm.value.questions[p_i].questions_group[g_i].questions[s_i] + console.log(this.original_result_data.questions[p_i],p_i,this.original_result_data) + let local__g_data=this.original_result_data.questions[p_i].questions_group[g_i].questions + if(local__g_data[s_i] != undefined){ + if(form_control.question_key != local__g_data[s_i].question_key){ + local__g_data.splice(s_i,0,form_c) + } + + } + // }) + //---- END OF JSON QUESTION CHANGE---- + }) + }) + } + + }) + } + checkGroupandPatchValues(){ + let modified=this.original_result_data + modified.questions.forEach((parent_ques,p_i)=>{ + // FOR ADDING THE GROUP QUES TO DISPLAY WITHOUT CONSIDERING INDEX 0 + if(parent_ques.is_repeatable == '1'){ + parent_ques.questions_group.forEach((group_ques,g_i)=>{ + if(g_i != 0){ + let parent_control=this.quesAnsForm.get('questions')['controls'][p_i] as FormArray + + if(parent_control.value.hasOwnProperty('questions_group')){ + this.addData(g_i-1,parent_control,group_ques.questions,'','') + } + } +}) +} + // FOR CREATING A SUBFIELD FOR CHOOSED OPTION OTHERS + else { + let control=this.quesAnsForm.get('questions')['controls'][p_i] + if(control != undefined && control != null){ + if (control.value.answers != null && control.value.answers.length > 0) { + this.creatSubField(control, parent_ques.answer_value) + } + } + } +}) +this.proceedonChangeProperty(modified) + + + + this.quesAnsForm.get('questions').patchValue(this.original_result_data.questions); + console.log(this.quesAnsForm) + } + setStep(index: number) { + this.step = index; + } + + nextStep() { + this.step++; + } + + prevStep() { + this.step--; + } + httpListener(event){ + if (event.type === HttpEventType.UploadProgress) { + // This is an upload progress event. Compute and show the % done: + const percentDone = Math.round(100 * event.loaded / event.total); + console.log(`File is ${percentDone}% uploaded.`); + } else if (event instanceof HttpResponse) { + console.log('File is completely uploaded!'); + } + } + + addData(group_index, parent_index, data, event, options?: any, single_ques?) { + console.clear(); + data=data.filter(group_indi=>!group_indi.hasOwnProperty('additional_field') && group_indi.additional_field != 1 ) + + if (options == 'camera') { + + // this.cameraProvider.getpicture().then(res => { + + // if (res != 'error') { + // this.geoCoordinates = localStorage.getItem('current_coordinates') + // this.cameraProvider.addWatermarks(res).then(watermarkedImage => { + // single_ques.controls.answer_value.setValue(watermarkedImage) + // // this.sales_pd_id = Number(this.sales_pd_id) + // // console.log(this.sales_pd_id) + + // // if(this.networkDetection.getCurrentNetworkStatus() == ConnectionStatus.online && (typeof(this.sales_pd_id) == 'string' ? !this.sales_pd_id.includes('local') : true) ) { + // single_ques.controls.is_image_status.setValue(true) + // single_ques.controls.is_loader.setValue(true); + // single_ques.controls.is_saved.setValue(false); + // // } + + // //SENDING SINGLE IMAGE TO API WITH PRIMARY KEY + // let params={"fk_sales_pd_id":"","img":watermarkedImage,"img_name":single_ques.value.question_key} + // let storage_param=this.questions_JSON + // let form_structure=this.questions_JSON + // form_structure.questions=this.quesAnsForm.getRawValue().questions + // form_structure.is_complete=1 + + + // // else { + // // single_ques.controls.is_image_status.setValue(true) + // // single_ques.controls.is_loader.setValue(false); + // // single_ques.controls.is_saved.setValue(true); + // // } + // this.emittedFormGroup = this.quesAnsForm.getRawValue() + // // PASSING THE VALUE TO PARENT COMPONENT + // this.imageUploadCheck.emit(this.emittedFormGroup); + + // this.salesPDProvider.saveSalesPDImage(params,form_structure).subscribe(apiresult=>{ + // if(apiresult['dataStatus']){ + // single_ques.controls.is_loader.setValue(false); + // single_ques.controls.is_saved.setValue(true); + // this.httpListener(apiresult); + // form_structure.questions=this.quesAnsForm.getRawValue().questions + // this.salesPDProvider.updateSectionDataLocally(params,form_structure).subscribe(res=>{ + // }) + // storage_param.questions=this.quesAnsForm.getRawValue().questions + // this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{ + // storage_param.sales_pd_id=key_value + // // this.salesPDProvider.insertData_Replace('sec'+storage_param.section_id,storage_param) + // }) + // console.log("image saved successfully") + // } + // else{ + // single_ques.controls.is_loader.setValue(false); + // single_ques.controls.is_saved.setValue(false); + // this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) + // this.toastProvider.lenderappmessage("Something went wrong"); + // } + // this.emittedFormGroup = this.quesAnsForm.getRawValue() + // this.imageUploadCheck.emit(this.emittedFormGroup); + // },err=>{ + // single_ques.controls.is_loader.setValue(false); + // single_ques.controls.is_saved.setValue(false); + // this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) + // console.log("error",err); + // this.toastProvider.lenderappmessage('Network Error') + // this.emittedFormGroup = this.quesAnsForm.getRawValue() + // this.imageUploadCheck.emit(this.emittedFormGroup); + // }) + // }) + // let control: any = parent_index['controls'].questions_group as FormArray + // control.push(this._fb.group({ 'questions': this._fb.array([]) })) + // let sub_childControl: any = control.controls[group_index + 1].get('questions') as FormArray + // data.forEach((group_indi,arr_index )=> { + // delete group_indi.answer_value + // sub_childControl.push(this.questionService.createValue(group_indi)) + // this.questionService.addAdditionalControl(group_indi, sub_childControl, arr_index) + // }) + // } + // }, error => { + // console.log("Camera Error ", JSON.stringify(error)); + // }) +// single_ques.controls.answer_value.setValue(base64) +// console.clear(); +// console.log(single_ques); +// single_ques.controls.is_image_status.setValue(true); +// single_ques.controls.is_loader.setValue(true); +// single_ques.controls.is_saved.setValue(false); +// console.log(single_ques); +// let control: any = parent_index['controls'].questions_group as FormArray +// control.push(this._fb.group({ 'questions': this._fb.array([]) })) +// let sub_childControl: any = control.controls[group_index + 1].get('questions') as FormArray +// data.forEach(group_indi => { +// delete group_indi.answer_value +// sub_childControl.push(this.questionService.createValue(group_indi)) +// }) + +// let storage_param=this.questions_JSON +// storage_param.questions=this.quesAnsForm.getRawValue().questions + +// this.salesPDProvider.insertData_Replace('sec'+storage_param.section_id,storage_param) +// let params={"fk_sales_pd_id":"","img":base64,"img_name":single_ques.value.question_key} +// // let storage_param=this.questions_JSON +// this.salesPDProvider.saveSalesPDImage(params).subscribe(apiresult=>{ +// if(apiresult['dataStatus']){ +// single_ques.controls.is_loader.setValue(false); +// single_ques.controls.is_saved.setValue(true); +// this.httpListener(apiresult); +// storage_param.questions=this.quesAnsForm.getRawValue().questions +// this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{ +// storage_param.sales_pd_id=key_value +// this.salesPDProvider.insertData_Replace('sec'+storage_param.section_id,storage_param) +// }) +// console.log("image saved successfully") +// } +// else{ +// single_ques.controls.is_loader.setValue(false); +// single_ques.controls.is_saved.setValue(false); +// this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) +// this.toastProvider.lenderappmessage("Something went wrong"); +// } +// },err=>{ +// single_ques.controls.is_loader.setValue(false); +// single_ques.controls.is_saved.setValue(false); +// this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) +// console.log("error",err); +// this.toastProvider.lenderappmessage('Network Error') +// }) + //camera capture + + } + else { + let control: any = parent_index['controls'].questions_group as FormArray + if(event!= ''){ + event.stopPropagation() + } + + this.step = control.length + control.push(this._fb.group({ 'questions': this._fb.array([]) })) + let sub_childControl: any = control.controls[group_index + 1].get('questions') as FormArray + data.forEach((group_indi, arr_index) => { + sub_childControl.push(this.questionService.createValue(group_indi)) + this.questionService.addAdditionalControl(group_indi, sub_childControl, arr_index) + }) + + + } + } + // sendGeoCordsForSatellite(geoCords,form_structure){ + // let params = {"sales_pd_id":'',"geo_location":geoCords} + // this.salesPDProvider.generateSatelliteImg(params,form_structure).subscribe(val=>{}) + // } + // captureImg(parent_index,parent_control){ + // // parent_control.controls.is_image_status.setValue('l') + // this.cameraProvider.getpicture().then(res => { + // if (res != 'error') { + // this.geoCoordinates=localStorage.getItem('current_coordinates') + // this.cameraProvider.addWatermarks(res).then(watermarkedImage=>{ + + // parent_control.controls.answer_value.setValue(watermarkedImage) + + + // //SENDING SINGLE IMAGE TO API WITH PRIMARY KEY + // let params={"fk_sales_pd_id":"","img":watermarkedImage,"img_name":parent_control.value.question_key} + // let storage_param=this.questions_JSON + // const form_structure=this.questions_JSON + // form_structure.questions=this.quesAnsForm.getRawValue().questions + // form_structure.is_complete=1 + + // // if(this.networkDetection.getCurrentNetworkStatus() == ConnectionStatus.online && typeof(this.sales_pd_id) != 'string' && (typeof(this.sales_pd_id) == 'string' ? !this.sales_pd_id.includes('local') : true) ) { + // parent_control.controls.is_image_status.setValue(true) + // parent_control.controls.is_loader.setValue(true); + // parent_control.controls.is_saved.setValue(false); + // // } + // // else { + // // parent_control.controls.is_image_status.setValue(true) + // // parent_control.controls.is_loader.setValue(false); + // // parent_control.controls.is_saved.setValue(true); + // // } + + // this.emittedFormGroup = this.quesAnsForm.getRawValue() + // this.imageUploadCheck.emit(this.emittedFormGroup); + + + // this.salesPDProvider.saveSalesPDImage(params,form_structure).subscribe(apiresult=>{ + // if(apiresult['dataStatus']){ + + // parent_control.controls.is_loader.setValue(false); + // parent_control.controls.is_saved.setValue(true); + + // form_structure.questions=this.quesAnsForm.getRawValue().questions + // // this.httpListener(apiresult); + // this.salesPDProvider.updateSectionDataLocally(params,form_structure).subscribe(res=>{ + // this.sendGeoCordsForSatellite(this.geoCoordinates,form_structure) + // }) + // console.log("Result",apiresult['dataStatus']) + // this.toastProvider.lenderappmessage(parent_control.value.question+ " Saved Successfully") + // storage_param.questions=this.quesAnsForm.getRawValue().questions + // this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{ + // storage_param.sales_pd_id=key_value + // // this.salesPDProvider.insertData_Replace('sec'+storage_param.section_id,storage_param) + // }) + // } + // else{ + // parent_control.controls.is_loader.setValue(false); + // parent_control.controls.is_saved.setValue(false); + // this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) + // this.toastProvider.lenderappmessage("Something went wrong"); + // } + // this.emittedFormGroup = this.quesAnsForm.getRawValue() + // this.imageUploadCheck.emit(this.emittedFormGroup); + // },err=>{ + // parent_control.controls.is_loader.setValue(false); + // parent_control.controls.is_saved.setValue(false); + // this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) + // console.log("error",err); + // this.toastProvider.lenderappmessage('Network Error') + // this.emittedFormGroup = this.quesAnsForm.getRawValue() + // this.imageUploadCheck.emit(this.emittedFormGroup); + // }) + + // }) + + // } + // // parent_control.controls.answer_value.setValue(base64) + // }, error => { + // console.log("Camera Error ", JSON.stringify(error)); + // }) + + // } + + removeData(group_index,parent_control){ + let control:any=parent_control['controls'].questions_group as FormArray + control.removeAt(group_index) + event.stopPropagation() + this.step=control.length-1 + } + onChange_checkbox(event,sec_control){ + console.log(event,sec_control) + const control=sec_control.get('answer_value') as FormArray + + if(event.checked) { + control.push(new FormControl(event.source.value)) + } else { + const i = control.controls.findIndex(x => x.value === event.source.value); + control.removeAt(i); + } + } + creatSubField(sec_control,choosen_value){ + + let curr_answer:any=[] + console.log(sec_control,choosen_value) + if(typeof(choosen_value) == 'object'){ + curr_answer =sec_control.value.answers.filter(val=>choosen_value.filter(arr_val=>arr_val == val.answer_id).length > 0 && val.hasOwnProperty('subfield_key') && val.subfield_key != '' && val.subfield_caption != '') + } + else{ + curr_answer=sec_control.value.answers.filter(val=>val.answer_id == choosen_value && val.hasOwnProperty('subfield_key') && val.subfield_key != '' && val.subfield_caption != '') + } + if(curr_answer.length >0){ + curr_answer=curr_answer[0] + console.log(curr_answer) + sec_control.addControl('subfield_key',new FormControl(curr_answer.subfield_key)) + sec_control.addControl('subfield_caption',new FormControl(curr_answer.subfield_caption)) + sec_control.addControl('subfield_value',new FormControl('')) + } + else{ + sec_control.removeControl('subfield_key') + sec_control.removeControl('subfield_caption') + sec_control.removeControl('subfield_value') + } + } + + onChangeProperty(event,sec_control,group_ques,options?,sec_index?){ + this.fileredSearchValue=[] + + if( sec_control.value.answers!= null && sec_control.value.answers.length > 0){ + this.creatSubField(sec_control,event.value) + } + //FOR API CALLS + // console.log(sec_control.value); + if(sec_control.value.onchange_properties != null && sec_control.value.onchange_properties.length >0){ + + let onChangeProperties_value=sec_control.value.onchange_properties + +// let new_name=`{ +// "purpose":"FORM_CTRL", +// "form_controls":[ +// { +// "insert_index":"total_work_exp", +// "expression":"(total_work_exp > vintage_in_current_biz)", +// "value_keys":[ +// "total_work_exp", +// "vintage_in_current_biz"], +// "questions":[ +// { +// "question_key":"previous_experience_details2", +// "question":"Previous Experience2", +// "type":"1", +// "api_properties":null, +// "answers":null, +// "onchange_properties":null, +// "is_repeatable":null, +// "field_type":"string", +// "validations":[{ +// "isactive": "1", +// "message": "Name Required", +// "name": "required", +// "validator": "Validators.required", +// "value": null +// }] + +// }] + +// }, +// { +// "insert_index":"vintage_in_current_biz", +// "expression":"(total_work_exp > vintage_in_current_biz)", +// "value_keys":[ +// "total_work_exp", +// "vintage_in_current_biz"], +// "questions":[{ +// "question_key":"vintage1", +// "question":"Vintage check", +// "type":"1", +// "api_properties":null, +// "answers":null, +// "onchange_properties":null, +// "is_repeatable":null, +// "field_type":"string", +// "validations":[] + +// }] + +// } +// ] + +// }` +// onChangeProperties_value.push(JSON.parse(new_name)) + + onChangeProperties_value.forEach(onChangeProperty=>{ + console.log("api",onChangeProperty) + if(onChangeProperty.purpose == 'api'){ + if(onChangeProperty.api == 'getListOfStatesAndCities'){ + this.salesPDProvider.getCityPincode(event.value).subscribe(res=>{ + if(res['dataStatus']){ + this.local_city=res['records'].cities + this.local_pincode=res['records'].pincode + + this.quesAnsForm.controls.questions['controls'].forEach((val,index)=>{ + + if(val.value.api_properties == 'local_city'){ + + this.local_city=this.questionService.convertArrayNames(['city_id','city_name'],this.local_city) + val.controls.answers.setValue(this.local_city) + } + else if(val.value.api_properties == 'local_pincode'){ + this.local_pincode=this.questionService.convertArrayNames(['pincode_id','pincode'],this.local_pincode) + val.controls.answers.setValue(this.local_pincode) + } + + }) + + } + }) + } + else{ + this.salesPDProvider.api_post_method(onChangeProperty.api,onChangeProperty.params,onChangeProperty.api_method).subscribe(result=>{ + if(result['dataStatus']){ + if(result.hasOwnProperty('records')){ + result=result['records'] + } + let ques_control= this.quesAnsForm.controls.questions['controls'] + if(options == 2){ + ques_control=group_ques.controls.questions['controls'] + } + + ques_control.forEach((val,index)=>{ + + if(val.value.api_properties == onChangeProperty.local_variable){ + let values1=this.questionService.convertArrayNames(onChangeProperty.fields,result) + val.controls.answers.setValue(values1) + } + + }) + } + }) + } + } + if(onChangeProperty.purpose == 'validations'){ + + if(options == 2){ + this.setValidations_onChange(onChangeProperty,group_ques,sec_control,sec_index) + } + else{ + this.setValidations_onChange(onChangeProperty,this.quesAnsForm,sec_control,sec_index) + } + } + if(onChangeProperty.purpose == 'FORM_CTRL'){ + + if(options == 2){ + this.creteNewField(onChangeProperty,group_ques,sec_control,sec_index) + } + else{ + this.creteNewField(onChangeProperty,this.quesAnsForm,sec_control,sec_index) + } + } + }) + } + } + creteNewField(form_control_obj_raw,group_ques,sec_control,sec_index,purpose?){ + console.log(group_ques,form_control_obj_raw,sec_index); + if(form_control_obj_raw.form_controls.length > 0){ + form_control_obj_raw.form_controls.forEach(form_control_obj=>{ + if(form_control_obj.value_keys != null && form_control_obj.value_keys.length > 0 ){ + let expression_value=form_control_obj.expression + form_control_obj.value_keys.forEach(res=>{ + let control_value_obj + if(purpose != 'edit'){ + control_value_obj =group_ques.value.questions.filter(val=>val.question_key == res)[0] + } + else{ + control_value_obj =sec_index.questions.filter(val=>val.question_key == res)[0] + } + if(control_value_obj){ + if(control_value_obj.answer_value == ''){ + control_value_obj.answer_value =0 + } + expression_value=expression_value.replace(res,control_value_obj.answer_value) + } + }) + + let calc_exp=eval(expression_value) + + if(calc_exp != false){ + if(form_control_obj.questions.length > 0){ + let question_index_after + group_ques.value.questions.forEach((val,index,arr)=>{ + + if(val.question_key == form_control_obj.insert_index){ + question_index_after= arr.indexOf(val) + } + }) + console.log(question_index_after,sec_index); + this.createControl(form_control_obj,group_ques,question_index_after,1) //FOR ADD CONTOL + } + } + else{ + this.createControl(form_control_obj,group_ques,'',2) //FOR REMOVE CONTROL + } + } + }) + } + } + createControl(form_control_obj,group_ques,question_index_after,options){ + console.log(form_control_obj,group_ques,question_index_after) + let ques_control=group_ques.get('questions') as FormArray + let inserted_control_obj=form_control_obj + inserted_control_obj.questions.sort() + inserted_control_obj.questions.reverse() + inserted_control_obj.questions.forEach(val=>{ + if(options == 1){ + let check_dup=ques_control.value.filter(control_key=>control_key.question_key == val.question_key) + if(check_dup.length == 0){ + val.raw_validations=val.validations + ques_control.insert(question_index_after+1,this.questionService.createValue(val)) + + this.questionService.addAdditionalControl(val, ques_control, question_index_after+1,"additional_field") + } + } + else{ + ques_control.controls.forEach((control_key,index)=>{ + if(control_key.value.question_key == val.question_key){ + ques_control.removeAt(index) + } + }) + } + }) + } + setValidations_onChange(validation_obj_raw,group_ques,sec_control,sec_index){ + + + if(validation_obj_raw.validations.length > 0){ + validation_obj_raw.validations.forEach(validation_obj=>{ + console.log("sing",validation_obj) + //FOR CHECKING THE EXPRESSION OR NORMAL VALIDATION + if(validation_obj.hasOwnProperty('value_keys')){ + + if( validation_obj.value_keys != null){ + + + let expression_value=validation_obj.value + validation_obj.value_keys.forEach(res=>{ + let validator_value_obj=group_ques.value.questions.filter(val=>val.question_key == + res)[0] + if(validator_value_obj){ + expression_value=expression_value.replace(res,validator_value_obj.answer_value) + } + }) + + // validation_obj.value=expression_value + validation_obj.validator=eval(expression_value) + + if(validation_obj.validator == false){ + validation_obj.isactive='0' + // // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS + this.proceedValidationSet(validation_obj,group_ques,sec_index,'') + } + else{ + validation_obj.isactive='1' + let validator_single=this.questionService.setValueForValidator(validation_obj) + console.log(validator_single) + // // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS + this.proceedValidationSet(validation_obj,group_ques,sec_index,validator_single) + } + //END OF EXPRESSION CHECK + } + else{ + // STARTING VALUE VALIDATION + let validator_value_obj + + + + validator_value_obj=group_ques.value.questions.filter(val=>val.question_key == + validation_obj.value)[0] + console.log(validator_value_obj) + + validation_obj.validator=validator_value_obj.answer_value + + // let validator_single=this.questionService.setValueForValidator(validation_obj) + // console.log(validator_single) + // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS + this.proceedValidationSet(validation_obj,group_ques,sec_index,'') + + // END OF VALUE VALIDATION + } + + // + + // } + // else{ + + // } + + } + }) + } + } + + proceedValidationSet(validation_obj,group_ques,sec_index,validator_single?){ + let ques_control; + if(validation_obj.validation_to == null){ + console.log("entered",group_ques,sec_index); + ques_control=group_ques.controls.questions['controls'][sec_index] + + + // if(validation_obj.isactive == '1'){ + // ques_control.controls.answer_value.setValidators(validator_single) + // ques_control.controls.answer_value.updateValueAndValidity() + // } + // else{ + // ques_control.controls.answer_value.clearValidators() + // ques_control.controls.answer_value.updateValueAndValidity() + // } + // validation_obj.validator=validator_single + let new_validation_obj=this.updateValidationMsg(ques_control,validation_obj) + + this.questionService.settingArrayofValidators({validations:new_validation_obj},ques_control,sec_index) + } + else{ + ques_control=group_ques.controls.questions['controls'] + let other_control=ques_control.filter(val=>{ + if(val.controls.question_key.value == validation_obj.validation_to){ + return val + } + })[0] + // let updateMsg=other_control.value.validations.filter(val=>val.name != validation_obj.name) + // updateMsg.push(validation_obj) + console.log(other_control) + // other_control.controls.answer_value.setValidators(validator_single) + // if(validation_obj.isactive == '1'){ + // other_control.controls.answer_value.setValidators(validator_single) + // other_control.controls.answer_value.updateValueAndValidity() + // } + // else{ + // other_control.controls.answer_value.clearValidators() + // other_control.controls.answer_value.updateValueAndValidity() + // } + + // other_control.controls.validations.setValue(updateMsg); + // validation_obj.validator=validator_single + let new_validations_obj=this.updateValidationMsg(other_control,validation_obj) + console.log("new validations obj",new_validations_obj,other_control) + this.questionService.settingArrayofValidators({validations:new_validations_obj},other_control,'') + } + } + updateValidationMsg(ques_control,validation_obj){ + console.log("updae msg",ques_control,validation_obj); + let updateMsg=ques_control.value.validations.filter(val=>val.name != validation_obj.name) + updateMsg.push(validation_obj) + ques_control.controls.validations.setValue(updateMsg); + return updateMsg; + } + onSubmitProperty(){ + let return_val=[] + let send_val:boolean=true + // this.local_ques_JSON.onsubmit=[ + // { + // "expression": "(function () {let sum_val=null;let ques_key=[];control.questions_group.forEach(ques_obj=>{ques_obj.questions.map(ques=>{if(ques.question_key == submitProperty.key_name){ques_key.push(ques)}})});if(ques_key.length >=3){return true}else{return false}return sum_val}())", + // "key_name": "approach_to_pd_location", + // "msg": "Minimum 3 image required in approach" + // }, + // { + // "expression": "(function () {let sum_val=null;let ques_key=[];if(control.question_key == submitProperty.key_name && control.answer_value == ''){return false}else{return true}return sum_val}())", + // "key_name": "selfie_with_person_met", + // "msg": "Selfie Person met pic is required" + // } + // { + // "expression": "(function () {let sum_val=null;let ques_key=[];if(control.question_key == submitProperty.key_name){return control.answer_value.length >= 100}}())", + // "key_name": "brief_business_service", + // "msg": "Please enter more details" + // } + // ] + // console.log(this.local_ques_JSON); + if(this.local_ques_JSON.hasOwnProperty('onsubmit') && this.local_ques_JSON.onsubmit != null){ + for(let i=0; i{ + let parent_ques + for( parent_ques of this.quesAnsForm.value.questions){ + // this.local_ques_JSON.onsubmit.forEach(submitProperty=>{ + + let submitProperty=this.local_ques_JSON.onsubmit[i] + + + if((parent_ques.is_repeatable == '1' && parent_ques.questions_group[0].questions.filter(val=>val.question_key == submitProperty.key_name).length > 0 ) || parent_ques.question_key == submitProperty.key_name){ + + + return_val.length = 0 + let val=this.calculation(parent_ques,submitProperty) + + if(val != true && val != 100){ + this.notifier.notify('warning',submitProperty.msg) + return_val.push(false) ; + break; + } + else { + return_val.push(true) ; + } + } + else{ + send_val =true + } + // }) + // }) + } + // console.log(return_val.filter(val=>val == false).length > 0) + if(return_val.filter(val=>val == false).length > 0){ + break; + } + } + console.log(return_val) + if(return_val.length > 0){ + if(return_val.filter(res=>res == false).length > 0){ + send_val = false + } + else{ + send_val =true + } + } + } + return send_val + } + calculation(control,submitProperty){ + // console.log("control",control) + // let exp=` + // (function () {let sum_val=null + // let ques_key=[] + // control.questions_group.forEach(ques_obj=>{ + // ques_obj.questions.map(ques=>{ + // // console.log(ques) + // if(ques.question_key == 'share_holding'){ + // ques_key.push(ques) + // } + // }) + // }) + // if(ques_key.length > 0){ + // console.log(ques_key) + // sum_val= ques_key.map(val=>val.answer_value).reduce((tot,val)=>{ + // console.log(">>>>",tot,val) + // return parseInt(tot)+parseInt(val) + // }) + // } + // return sum_val == 100}());` + + //for image total check + // let exp=` + // (function () {let sum_val=null + // let ques_key=[] + // control.questions_group.forEach(ques_obj=>{ + // ques_obj.questions.map(ques=>{ + // // console.log(ques) + // if(ques.question_key == 'name_board_seen'){ + // ques_key.push(ques) + // } + // }) + // }) + // if(ques_key.length >= 3){ + // sum_val=true + // } + // else{ + // sum_val=false + // } + // return sum_val }());` + + + let val= eval(submitProperty.expression); + console.log(val) + return val + } + + + searchFun(control,index){ + console.log(control,index); + // control.controls['select_search'].valueChanges + // .pipe(takeUntil(this._onDestroy)) + // .subscribe(()=>{ + // this.fileredSearchValue + this.fileredSearchValue[index]=this.searchValue(control.value.answers,control.controls['select_search'].value,'') + console.log(this.fileredSearchValue) + // }) + + + } + searchValue(exist_data,value,option){ + // console.log("option",option) + let returnDataVal:any + if(!exist_data){ + return + } + let searchVal=value + if(!searchVal){ + returnDataVal=exist_data.slice(); + } + + else{ + searchVal = searchVal.toLowerCase() + } + if(option=='state'){ + returnDataVal=exist_data.filter(res=>res.name.toLowerCase().indexOf(searchVal) > -1) + } + else if(option=='city'){ + returnDataVal=exist_data.filter(res=>res.city_name.toLowerCase().indexOf(searchVal) > -1) + } + else if(option=='pin'){ + returnDataVal=exist_data.filter(res=>res.pincode.toLowerCase().indexOf(searchVal) > -1) + } + else{ + returnDataVal=exist_data.filter(res=>res.answer.toLowerCase().indexOf(searchVal) > -1) + } + + return returnDataVal + } + public findInvalidControls() { + const controls = this.quesAnsForm.get('questions')['controls']; + console.log(controls) + for (const name in controls) { + if (controls[name].invalid) { + let invalidFields = [].slice.call(document.getElementsByClassName('ng-invalid')); + let firstInvalidField; + for(let val in invalidFields){ + if( invalidFields[val].nodeName == 'MAT-FORM-FIELD'){ //INPUT FOR INPUT FIELD + firstInvalidField=invalidFields[val] + break; + } + } + if(firstInvalidField != undefined){ + firstInvalidField.scrollIntoView(true) + } + break; + } + } + // return invalid; +} + onSubmit(flag){ //1-Submit 0-Draft + if(flag != 0){ + if(this.quesAnsForm.invalid){ + let msg:string="Please Fill all the Fields"; + if(this.submit_btn == true){ + msg="Please take the necessary pictures" + } + this.notifier.notify('error',msg) + this.quesAnsForm.markAsDirty(); + this.quesAnsForm.markAsTouched(); + // this.Accordion.displayMode + if(this.matExpansionPanel!= undefined){ + this.matExpansionPanel.open() + } + this.findInvalidControls() + return + } + // CHECKING THE SAVE IMAGE REQUEST IS STILL PENDING + // if(this.submit_btn == true && this.emittedFormGroup != null){ + // console.clear(); + // console.log(this.quesAnsForm.dirty); + // let form_structure=this.quesAnsForm.getRawValue().questions + // // form_structure.forEach(parent_ques=>{ + // for(let i=0; i{ + // // group_ques.questions.forEach(single_ques=>{ + // if(single_ques.is_loader == true){ + // this.toastProvider.lenderappmessage("Some images are still uploading. Please wait...") + // return; + // } + // // }) + // // }) + // } + // } + // } + // } + // // }) + // } + // //END OF IMAGE SAVE REQUEST CHECK + let checkProperty=this.onSubmitProperty() + console.log("check rp",checkProperty) + if(checkProperty == false){ + return; + } + } + + let storage_param=this.questions_JSON + storage_param.questions=this.quesAnsForm.getRawValue().questions + storage_param.is_complete=flag + this.spinner_access=true + + if (this.submit_btn && flag == 0) { + // this.insertSectionDataLocally(storage_param) + storage_param.questions=this.questions_JSON.questions + + setTimeout(()=>{ + this.emitter.emit(storage_param) + this.spinner_access=false + }) + return; + } + console.log(this.quesAnsForm.dirty) + // if(this.quesAnsForm.dirty){ + if(this.local_ques_JSON.section_id == 1 || this.submit_btn){ + let result = this.curr_pd_info.smc_credit_pd + // this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(result=>{ + if(result != null && !this.submit_btn){ + this.sendSectiontoApi(storage_param) + } + else{ + this.sendDatatoApi(storage_param) + } + // }) + } + else{ + this.sendSectiontoApi(storage_param) + } + // } + // else if(!this.submit_btn){ + // if(flag == 1 && ((this.raw_data_Section.hasOwnProperty('status') && this.raw_data_Section.status == '0') || (this.original_result_data.hasOwnProperty('is_complete') && this.original_result_data.is_complete == 0))){ + // this.sendSectiontoApi(storage_param) + // } + // else{ + // this.spinner_access=false + // this.insertSectionDataLocally(storage_param) + // } + // } + // else{ + // this.sendDatatoApi(storage_param) + // } + } + sendSectiontoApi(params){ + + this.salesPDProvider.saveSMCCreditPDsection(params).subscribe(response=>{ + if(this.local_ques_JSON.section_id != 9){ + if(response.dataStatus){ + this.notifier.notify('success',"Saved Successfully.."); + setTimeout(()=>{ + // this.insertSectionDataLocally(params) //FOR INSERTING AND REDIRECTING TO NEXT PAGE + this.spinner_access=false + params.questions=this.questions_JSON.questions + params.is_completed=false + setTimeout(()=>{ + console.log('emiiter') + this.emitter.emit(params) + }) + },1200) + } + else{ + this.spinner_access=false + } + } + },err=>this.spinner_access=false) + } + sendDatatoApi(section_data?){ + + this.spinner_access=true + // this.cameraProvider.getGeoTag().then(geo_cords=>{ + // let params={pd_json:JSON.stringify(res),geo_location:geo_cords} + if(this.submit_btn){ + const dialogRef = this.dialog.open(AlertDialogComponent, { + width: '500px', + data: {buttons:[{name:"Ok",visible:true,id:'ok'},{name:'Cancel',visible:'true',id:'cancel'}],title:'Complete sales PD', + msg:'You are completing this PD, once completed you will not be able to make changes'} + }); + + dialogRef.afterClosed().subscribe(result => { + console.log('The dialog was closed',result); + if(result && result != 'cancel') { + this.saveSalesPDAPI(section_data) + } + else { + this.spinner_access = false + } + }); + // let alert=this.notifier.setAlertWithButtons('Complete sales PD','You are completing this PD, once completed you will not be able to make changes',{button1:'Cancel',button2:'Complete'}) + // alert.present(); + // alert.onDidDismiss((data)=>{ + // if(data != false){ + // this.saveSalesPDAPI(section_data) + // } + // else{ + // this.spinner_access=false + // } + // }) + } + else{ + this.saveSalesPDAPI(section_data) + } + + + // }) + + // }) + } + saveSalesPDAPI(section_data){ + let params:any={"status":"STARTED"} + if(this.submit_btn){ + params.status="COMPLETED" + } + this.salesPDProvider.saveSMCCreditPD(params).subscribe((apiresult:any)=>{ + if(apiresult['dataStatus']){ + if(apiresult['records'] != true && typeof(apiresult['records']) != 'object'){ + this.curr_pd_info.smc_credit_pd = String(apiresult['records']) + this.curr_pd_info.rand_string= String(apiresult['rand_string']) + console.log("sdfffffffffffffff",this.curr_pd_info,this.salesPDProvider.curr_credit_pd_data) + // this.salesPDProvider.insertData_Replace('sales_pd_id_PRIMARYKEY',String(apiresult['records'])).then(local_result=>{ + // this.salesPDProvider.insertData_Replace('sales_rand_string',String(apiresult['rand_string'])).then(()=>{ + if(!this.submit_btn){ + this.sendSectiontoApi(section_data) + } + // }) + // }) + } + else + if(!this.submit_btn){ + this.sendSectiontoApi(section_data) + } + else if(apiresult.hasOwnProperty('pd_status') && apiresult['pd_status'] == 'DRAFT'){ + // this.toastProvider.setAlert("Personal Discussion is not completed","Some of the sections are saved as draft. Kindly check and complete that.") + + let section_redirect=apiresult['records'] + let section_dis_names:any=[]; + if(section_redirect.length > 0){ + section_redirect.forEach(res=>{ + section_dis_names.push(res.sectin_name) + }) + } + alert("Sales PD is incomplete
The Following sections are not Saved "+section_dis_names+'') + // let alert=this.toastProvider.setAlertWithOkButton("Sales PD is incomplete","The Following sections are not Saved "+section_dis_names+'') + // alert.present() + // alert.onDidDismiss(()=>{ + // this.redirect_to_section('') + // }) + + } + else{ + section_data.questions=this.questions_JSON.questions + section_data.is_completed=true + setTimeout(()=>{ + this.emitter.emit(section_data) + }) + } + // this.insertSectionDataLocally(section_data) + + // this.SalesPDService.clearLocalData() + // if(res.length > 1){ + // this.toastProvider.lenderappmessage("Saved Successfully..!"); + // } + // setTimeout(()=>{ + // this.navCtrl.setRoot(SalesPDlistPage) + // },2000) + + } + else{ + this.notifier.notify('warning',"Something went wrong"); + // setTimeout(()=>{ + // this.navCtrl.pop(); + // }) + } + // this.loadingProvider.dismissLoader(); + this.spinner_access=false + },err=>{ + // this.loadingProvider.dismissLoader(); + this.spinner_access=false + + this.notifier.notify('error','Network Error') + this.sendDatatoApi(section_data); + }) + } + // redirect_to_section(section_id){ + // let re_section:any=Section1 + // switch (parseInt(section_id)) { + // case 1: + // re_section = Section1 + // break; + // case 2: + // re_section = Section2 + // break; + // case 3: + // re_section = Section3 + // break; + // case 4: + // re_section = Section4 + // break; + // case 5: + // re_section = Section5 + // break; + // case 6: + // re_section = Section6 + // break; + // case 7: + // re_section = Section7 + // break; + // case 8: + // re_section = Section8 + // break; + // case 9: + // re_section = Section9 + // break; + // default: + // re_section='' + // break; + // } + // let product_id=localStorage.getItem('product_id_salesPD') + // if(re_section != ''){ + // this.navCtrl.setRoot(re_section,{product_id:product_id}) + // } + // else{ + // this.navCtrl.pop(); + // } + // } + +// insertSectionDataLocally(section_data){ +// this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{ +// section_data.sales_pd_id=key_value +// // this.salesPDProvider.insertData_Replace('sec'+section_data.section_id,section_data) +// }) +// section_data.questions=this.questions_JSON.questions +// setTimeout(()=>{ +// this.emitter.emit(section_data) +// }) +// } + // SENDING SALES PD SECTION 9 STRUCTURE(photographs) + ngOnDestroy(){ + // console.clear() + console.log("dirty check",this.quesAnsForm.dirty) + if(this.local_ques_JSON.section_id == 9 && this.emittedFormGroup != null){ + // FOR SENDING THE IMAGE SECTION (SECTION ID 9) JSON Structure + let form_structure=this.quesAnsForm.getRawValue().questions + form_structure.forEach((parent_ques,p_index, p_object)=>{ + if(parent_ques.hasOwnProperty('is_repeatable') && parent_ques.is_repeatable != '1'){ + if(parent_ques.answer_value != '' && parent_ques.answer_value != null){ + parent_ques.answer_value = 'SAVED' + if(parent_ques.is_loader == false && parent_ques.is_saved == false){ + p_object.splice(p_index,1) + } + } + } + else{ + parent_ques.questions_group.forEach((group_ques,g_index,g_object)=>{ + group_ques.questions.forEach((single_ques,s_index, s_object)=>{ + if(single_ques.answer_value != '' && single_ques.answer_value != null){ + single_ques.answer_value = 'SAVED' + if(single_ques.is_loader == false && single_ques.is_saved == false){ + // single_ques.is_saved = '' + // single_ques.is_loader = '' + // single_ques.is_image_status=false + g_object.splice(g_index,1) + // delete parent_ques.questions_group[g_index] + } + } + }) + }) + } + }) + + let sectionApi_param=this.questions_JSON + sectionApi_param.questions=form_structure + sectionApi_param.is_complete=1 + // this.sendSectiontoApi(sectionApi_param) + } + } + // imageReupload(single_ques){ + + // let storage_param=this.questions_JSON + // storage_param.questions=this.quesAnsForm.getRawValue().questions + + // let data=single_ques.value + // let params={"fk_sales_pd_id":"","img":data.answer_value,"img_name":data.question_key} + // const form_structure=this.questions_JSON + // form_structure.questions=this.quesAnsForm.getRawValue().questions + // form_structure.is_complete=1 + + // // if(this.networkDetection.getCurrentNetworkStatus() == ConnectionStatus.online && typeof(this.sales_pd_id) != 'string' && (typeof(this.sales_pd_id) == 'string' ? !this.sales_pd_id.includes('local') : true) ) { + // single_ques.controls.is_image_status.setValue(true); + // single_ques.controls.is_loader.setValue(true); + // single_ques.controls.is_saved.setValue(false); + // // } + // // else { + // // single_ques.controls.is_image_status.setValue(true) + // // single_ques.controls.is_loader.setValue(false); + // // single_ques.controls.is_saved.setValue(true); + // // } + + // this.salesPDProvider.saveSalesPDImage(params,form_structure).subscribe(apiresult=>{ + // if(apiresult['dataStatus']){ + // single_ques.controls.is_loader.setValue(false); + // single_ques.controls.is_saved.setValue(true); + // this.httpListener(apiresult); + // form_structure.questions=this.quesAnsForm.getRawValue().questions + // // this.httpListener(apiresult); + // this.salesPDProvider.updateSectionDataLocally(params,form_structure).subscribe(res=>{ + // }) + // storage_param.questions=this.quesAnsForm.getRawValue().questions + // this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{ + // storage_param.sales_pd_id=key_value + // // this.salesPDProvider.insertData_Replace('sec'+storage_param.section_id,storage_param) + // }) + // console.log("image saved successfully") + // } + // else{ + // single_ques.controls.is_loader.setValue(false); + // single_ques.controls.is_saved.setValue(false); + // this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) + // this.toastProvider.lenderappmessage("Something went wrong"); + // } + // },err=>{ + // single_ques.controls.is_loader.setValue(false); + // single_ques.controls.is_saved.setValue(false); + // this.salesPDProvider.clear_local_key('sec'+storage_param.section_id) + // console.log("error",err); + // this.toastProvider.lenderappmessage('Network Error') + // }) + // } + cancelLoader(control){ + control.controls.is_loader.setValue(false); + control.controls.is_image_status.setValue(false); + } + +} diff --git a/ng6-seed/src/app/lender-credit-pd/services/apiService/api-service.service.spec.ts b/ng6-seed/src/app/lender-credit-pd/services/apiService/api-service.service.spec.ts new file mode 100644 index 0000000..ab0f1bd --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/services/apiService/api-service.service.spec.ts @@ -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(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/services/apiService/api-service.service.ts b/ng6-seed/src/app/lender-credit-pd/services/apiService/api-service.service.ts new file mode 100644 index 0000000..19c6733 --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/services/apiService/api-service.service.ts @@ -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 { + 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 { + 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 { + 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}) + } +} diff --git a/ng6-seed/src/app/lender-credit-pd/services/ques-template/ques-template.service.spec.ts b/ng6-seed/src/app/lender-credit-pd/services/ques-template/ques-template.service.spec.ts new file mode 100644 index 0000000..461aebc --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/services/ques-template/ques-template.service.spec.ts @@ -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(); + }); +}); diff --git a/ng6-seed/src/app/lender-credit-pd/services/ques-template/ques-template.service.ts b/ng6-seed/src/app/lender-credit-pd/services/ques-template/ques-template.service.ts new file mode 100644 index 0000000..426756b --- /dev/null +++ b/ng6-seed/src/app/lender-credit-pd/services/ques-template/ques-template.service.ts @@ -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 +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index cbc270a..03a7e6b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -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, diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.html b/ng6-seed/src/app/sales-pd/sales-pd.component.html index abc8f31..514fbe9 100644 --- a/ng6-seed/src/app/sales-pd/sales-pd.component.html +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.html @@ -23,7 +23,8 @@ - {{details.sales_pd_sno}} + {{details.sales_pd_sno}}
+ {{details.sales_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}}
@@ -69,9 +70,11 @@ - - + diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.ts b/ng6-seed/src/app/sales-pd/sales-pd.component.ts index 31228ec..dc927be 100644 --- a/ng6-seed/src/app/sales-pd/sales-pd.component.ts +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.ts @@ -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, + @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) + } + } diff --git a/ng6-seed/src/app/sales-pd/trigger-confirm-dialog.html b/ng6-seed/src/app/sales-pd/trigger-confirm-dialog.html new file mode 100644 index 0000000..53391db --- /dev/null +++ b/ng6-seed/src/app/sales-pd/trigger-confirm-dialog.html @@ -0,0 +1,15 @@ +

Confirm

+
+

Please Confirm you are triggering credit PD for the company {{data.applicant_name}} ({{data.abbr}})

+ +
+ + Choose the PD Type :
+ {{item.dis_name}} +
+
+


+
+      + +
diff --git a/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts b/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts index 2b65018..6073a2a 100755 --- a/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts +++ b/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts @@ -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); diff --git a/ng6-seed/src/app/shared/menu-items/menu-items.ts b/ng6-seed/src/app/shared/menu-items/menu-items.ts index 8ef2a95..d824ac8 100755 --- a/ng6-seed/src/app/shared/menu-items/menu-items.ts +++ b/ng6-seed/src/app/shared/menu-items/menu-items.ts @@ -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) { diff --git a/ng6-seed/src/app/shared/shared.module.ts b/ng6-seed/src/app/shared/shared.module.ts index cfb4c28..d8f845f 100755 --- a/ng6-seed/src/app/shared/shared.module.ts +++ b/ng6-seed/src/app/shared/shared.module.ts @@ -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 ] }) diff --git a/ng6-seed/src/assets/credit_pd_template.json b/ng6-seed/src/assets/credit_pd_template.json new file mode 100644 index 0000000..afb3761 --- /dev/null +++ b/ng6-seed/src/assets/credit_pd_template.json @@ -0,0 +1,2194 @@ +{ + "form_name":"Personal Discussion Sheet - Business Loans (For Sales Team)", + "sections":[ + { + "section_id":"1", + "section_name":"General Section", + "onsubmit":null, + "questions":[ + { + "question":"Name of The Main Loan Applicant", + "question_key":"main_loan_applicant", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Main Loan Applicant Name Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[A-Za-z ]*", + "message":"alphabets only ", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Name of the Company/Firm", + "question_key":"company_name", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Company Name Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[A-Za-z&@#.$ ]*", + "message":"alphabets only ", + "value":null + } + ] + }, + { + "question":"Name of Person Met during visit", + "question_key":"person_met_during_visit", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Person Met Name Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[A-Za-z ]*", + "message":"alphabets only ", + "value":null + } + ] + }, + { + "question":"Address Visited", + "question_key":"address_visited", + "place_holder":"Enter door no,street", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Address Required", + "value":null + } + ] + }, + { + "question":"State", + "question_key":"state", + "type":"8", + "answers":null, + "api_properties":{ + "api":"getListOfMaster", + "api_method":"POST", + "params":{ + "master_name":"STATE" + }, + "fields":[ + "state_id", + "name" + ] + }, + "onchange_properties":[ + { + "purpose":"api", + "api":"getListOfStatesAndCities", + "api_method":"POST", + "params":"{records:{state_id:'value_of_answer'}}", + "fields":[ + "state_id", + "name" + ], + "local_variable":"local_city" + } + ], + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"State Required", + "value":null + } + ] + }, + { + "question":"City", + "question_key":"city", + "type":"8", + "answers":null, + "api_properties":"local_city", + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"CIty Required", + "value":null + } + ] + }, + { + "question":"Pincode", + "question_key":"pincode", + "type":"8", + "answers":null, + "api_properties":"local_pincode", + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"pincode", + "expression":"(pincode == 1)", + "value_keys":[ + "pincode" + ], + "questions":[ + { + "question_key":"pincode_others", + "question":"Specify the Pincode", + "place_holder":"Enter the Pincode", + "type":"1", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Pincode is Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[0-9]{6}", + "message":"Pincode should be 6 digit", + "value":null + } + ] + } + ] + } + ] + } + ], + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Pincode Required", + "value":null + } + ] + } + ] + }, + { + "section_id":"2", + "section_name":"Fund Requirement", + "onsubmit":null, + "questions":[ + { + "question":"Loan Amount Applied for (Rs)", + "question_key":"loan_amount_applied", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"numtoword", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Loan amount Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"validations", + "validations":[ + { + "name":"min", + "isactive":"1", + "validator":"", + "message":"should be greater or equal to Loan Amount", + "value":"loan_amount_applied", + "validation_to":"total_fund_requirement", + "value_keys":null + } + ] + } + ] + }, + { + "question":"Total Fund Requirement (Rs)", + "question_key":"total_fund_requirement", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"numtoword", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Total Fund Required", + "value":null + } + ] + }, + { + "question":"Loan Tenure (Months)", + "question_key":"loan_tenure", + "place_holder":"Enter number", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Loan tenure Required" + }, + { + "name":"maxLength", + "validator":"3", + "isactive":"1", + "message":"loan tenure 3 digit only", + "value":null + } + ] + }, + { + "question":"Loan Purpose (End-Use)", + "question_key":"loan_purpose", + "type":"4", + "answers":[ + { + "answer_id":"Working Capital", + "answer":"Working Capital", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Purchase of Business Assets", + "answer":"Purchase of Business Assets", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":" Bridge Finance for Working Capital", + "answer":" Bridge Finance for Working Capital", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Business Expansion", + "answer":"Business Expansion", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Office Renovation", + "answer":"Office Renovation", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Debt Consolidation", + "answer":"Debt Consolidation", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Others (Specify)", + "answer":"Others (Specify)", + "subfield_key":"other_end_use", + "subfield_caption":"Specifiy Other End Use", + "subfield_type":"1" + } + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Loan purpose Required", + "value":null + } + ] + } + ] + }, + { + "section_id":"3", + "section_name":"Details of key stakeholders", + "onsubmit":[ + { + "key_name":"share_holding", + "expression":"(function () {let sum_val=null;let ques_key=[];control.questions_group.forEach(ques_obj=>{ques_obj.questions.map(ques=>{if(ques.question_key == 'share_holding'){ques_key.push(ques)}})});if(ques_key.length > 0){sum_val= ques_key.map(val=>val.answer_value).reduce((tot,val)=>{return parseInt(tot)+parseInt(val)})}return sum_val<=100}())", + "msg":"Sum of shareholding should be equal to 100" + } + ], + "questions":[ + { + "question":[ + { + "question":"Name", + "question_key":"name", + "place_holder":"Enter text", + "type":"1", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[A-Za-z ]*", + "message":"alphabets only ", + "value":null + } + ] + }, + { + "question":"Share Holding (%)", + "question_key":"share_holding", + "place_holder":"Enter number", + "type":"1", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Share value Required", + "value":null + }, + { + "name":"max", + "validator":"100", + "isactive":"1", + "message":"Number must be less than 100", + "value":null + } + ] + }, + { + "question":"Year(s) in Current Business", + "question_key":"vintage_in_current_biz", + "place_holder":"Enter in years", + "type":"1", + "api_properties":null, + "answers":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Year(s) in Current Business Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[0-9]{0,3}", + "message":"Year should be 3 digit", + "value":null + } + ], + "onchange_properties":null + } + ], + "is_repeatable":"1", + "group_title":"Details of Key Stakeholders in the Business" + } + ] + }, + { + "section_id":"10", + "section_name":"Other Family Members involved in the business", + "onsubmit":[], + "questions":[ + { + "question":[ + { + "question":"Name", + "question_key":"name", + "place_holder":"Enter text", + "type":"1", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[A-Za-z ]*", + "message":"alphabets only ", + "value":null + } + ] + }, + { + "question":"Relationship", + "question_key":"relationship", + "type":"8", + "answers":null, + "api_properties":{ + "api":"getListOfMaster", + "api_method":"POST", + "params":{ + "master_name":"RELATIONSHIPS" + }, + "fields":[ + "relationship_id", + "name" + ] + }, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Relationship Required", + "value":null + } + ] + }, + { + "question":"Relation to Individual Stakeholders", + "question_key":"relation_to_ind_stakeholders", + "type":"3", + "answers":[], + "api_properties":{ + "api":"getStakeHoldersInfo", + "api_method":"POST", + "params": + "(function () {let pd_id = pd_info.smc_credit_pd; return {smc_credit_pd:pd_id}}())" + , + "params_type":"expression", + "fields":[] + }, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Relation to Company / Firm", + "question_key":"relation_to_company", + "type":"8", + "answers":[], + "api_properties":{ + "api":"getListOfMaster", + "api_method":"POST", + "params":{ + "master_name": "COMPANYRELATIONSHIPS" + }, + "fields":[ + "company_relationship_id", + "name" + ] + }, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Relationship Required", + "value":null + } + ] + }, + { + "question":"Started Business (Yes / No)", + "question_key":"started_business", + "type":"2", + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"No", + "answer":"No ", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + } + ], + "is_repeatable":"1", + "group_title":"Other Family Members involved in the business" + } + ] + }, + { + "section_id":"11", + "section_name":"Key Products and business contribution", + "onsubmit":null, + "questions":[ + { + "question":"Key Products", + "question_key":"key_products", + "type":"1", + "place_holder":"Enter Product", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Product required", + "value":null + } + ] + }, + { + "question":"Business contribution", + "question_key":"business_contribution", + "type":"1", + "place_holder":"eg Clothing, Scrap metal, Cargo Service, Herbal Products etc.", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Product/Service Type Required", + "value":null + } + ] + } + ] + }, + { + "section_id":"12", + "section_name":"Employee Strength & Seasonality of the Business", + "onsubmit":null, + "questions":[ + { + "question":[ + { + "question":"Permanent >>", + "question_key":"permanent_as_per_personmet", + "type":"1", + "place_holder":"Permanent Employee(s)", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Temporary >>", + "question_key":"temporary_as_per_personmet", + "place_holder":"Temporary Employee(s)", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Sales/Revenue Required", + "value":null + } + ] + } + ], + "is_multi_disabled":"1", + "is_repeatable":"1", + "group_title":"No of Employees as per person met" + }, + { + "question":[ + { + "question":"Permanent >>", + "question_key":"permanent_during_visit", + "type":"1", + "place_holder":"Permanent Employee(s)", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Temporary >>", + "question_key":"temporary_during_visit", + "place_holder":"Temporary Employee(s)", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Sales/Revenue Required", + "value":null + } + ] + } + ], + "is_multi_disabled":"1", + "is_repeatable":"1", + "group_title":"No fo Employees Sighted during the Visit" + }, + { + "question":[ + { + "question":"Permanent Employee(s) Salary", + "question_key":"permanent_approx_sal", + "type":"1", + "place_holder":"Permanent Salary", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Temporary Employee(s) Salary", + "question_key":"temporary_approx_sal", + "place_holder":"Temporary Salary", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Sales/Revenue Required", + "value":null + } + ] + } + ], + "is_multi_disabled":"1", + "is_repeatable":"1", + "group_title":"Approx Salary Paid per month (Rs)" + }, + { + "question":[ + { + "question":"Business Seasonal", + "question_key":"business_seasonal", + "type":"2", + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"No", + "answer":"No ", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":[ + { + "purpose": "FORM_CTRL", + "form_controls": [ + { + "insert_index": "business_seasonal", + "expression": "(String('business_seasonal') == String('Yes'))", + "value_keys": [ + "business_seasonal" + ], + "questions": [ + { + "question_key": "lean_months_seasonal", + "question": "Please Mention Lean Months", + "place_holder": "Eg. 10", + "type": "1", + "api_properties": null, + "answers": null, + "onchange_properties": null, + "is_repeatable": null, + "field_type": "tel", + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Previous Experience Required", + "value": null + }, + { + "name": "max", + "isactive": "1", + "validator": "12", + "message": "Months must be less than 12", + "value": null + }, + { + "name": "pattern", + "isactive": "1", + "validator": "[0-9]*", + "message": "Month must be a numeric digit", + "value": null + } + ] + } + ] + } + ] + } + ], + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + } + ], + "is_multi_disabled":"1", + "is_repeatable":"1", + "group_title":"Seasonality of the Business" + } + ] + }, + { + "section_id":"13", + "section_name":"Assets Used in Business", + "onsubmit":[], + "questions":[ + { + "question":[ + { + "question":"Asset Type", + "question_key":"asset_type", + "type":"8", + "answers":null, + "api_properties":{ + "api":"getListOfMaster", + "api_method":"POST", + "params":{ + "master_name": "ASSETTYPE" + }, + "fields":[ + "id", + "name" + ] + }, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Asset Description", + "question_key":"asset_description", + "place_holder":"Enter text", + "type":"1", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[A-Za-z ]*", + "message":"alphabets only ", + "value":null + } + ] + }, + { + "question":"Asset Ownership ", + "question_key":"asset_ownership", + "type":"2", + "answers":[ + { + "answer_id":"Owned", + "answer":"Owned", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Rented", + "answer":"Rented", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"asset_ownership", + "expression":"(String('asset_ownership') == String('Owned'))", + "value_keys":[ + "asset_ownership" + ], + "questions": [ + { + "question":"If Owned then Owner Name", + "question_key":"owned_then_owner_name", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + }, + { + "name":"pattern", + "isactive":"1", + "validator":"[A-Za-z ]*", + "message":"alphabets only ", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"If Owned then Market Value", + "question_key":"owned_then_market_value", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Name Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Age of the Asset (Years)", + "question_key":"age_of_the_asset", + "place_holder":"Enter yrs", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Is there a Loan Against the Asset?", + "question_key":"is_there_loan_against_asset", + "type":"2", + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"No", + "answer":"No ", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + } + ] + } + ] + } + ], + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + } + + ], + "is_repeatable":"1", + "group_title":"Assets Used in Business" + } + ] + }, + { + "section_id":"5", + "section_name":"Financial Information", + "onsubmit":[ + { + "expression":"(function (){let sum_val=null;let ques_key=[];control.questions_group.forEach(ques_obj=>{ques_obj.questions.map(ques=>{if(ques.question_key == submitProperty.key_name){ques_key.push(ques.answer_value)}})});console.log('none',ques_key);return new Set(ques_key).size === ques_key.length}())", + "key_name":"fy", + "msg":"Year already entered earlier" + } + ], + "questions":[ + { + "question":[ + { + "question":"Enter FY", + "question_key":"fy", + "type":"3", + "answers":[ + + ], + "answer_value":"GET_FY_YEARS", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Fin Yr Required", + "value":null + } + ] + }, + { + "question":"Sales / Revenue (Rs) ", + "question_key":"sales_revenue", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"numtoword", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Sales/Revenue Required", + "value":null + } + ] + }, + { + "question":"Net Profit / (Net Loss) (Rs) ", + "question_key":"net_profit", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"numtoword", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Net profit/loss Required", + "value":null + } + ], + "onchange_properties":[ + { + "purpose":"validations", + "validations":[ + { + "name":"max", + "isactive":"1", + "validator":"", + "message":"should be less then sales", + "value":"sales_revenue", + "validation_to":null, + "value_keys":null + } + ] + } + ] + } + ], + "is_repeatable":"1", + "group_title":"Particulars of Financials as per books of Accounts" + }, + { + "question":"Income Considered (Rs Per Annum) ", + "question_key":"income_considered", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"numtoword", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Income Considered Required", + "value":null + } + ], + "onchange_properties":[ + + ] + }, + { + "question":"Income assessment Program Recommended ", + "question_key":"income_assessment_program_recommended", + "type":"3", + "answers":[ + { + "answer_id":"Vanilla", + "answer":"Vanilla", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"IM", + "answer":"IM", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"GPR", + "answer":"GPR", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Banking", + "answer":"Banking", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Income assessment Program Required", + "value":null + } + ] + }, + { + "question":"Fixed Obligations (Rs per month) ", + "question_key":"fixed_obligations", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"numtoword", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Fixed Obligations Required", + "value":null + } + ], + "onchange_properties":null + } + ] + }, + { + "section_id":"14", + "section_name":"Working Capital Cycle", + "onsubmit":null, + "questions":[ + { + "question":"Debtor Days", + "question_key":"debtor_days", + "place_holder":"Enter Days", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Debtor Days Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Creditor Days", + "question_key":"creditor_days", + "place_holder":"Enter Days", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Creditor Days Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Stock Days", + "question_key":"stock_days", + "place_holder":"Enter Days", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Stock Days Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Does the business have any working capital facility from any lender other than Moneywise?", + "question_key":"business_have_any_working_capital_from_other_lender", + "type":"2", + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"No", + "answer":"No ", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":[ + { + "purpose": "FORM_CTRL", + "form_controls": [ + { + "insert_index": "business_have_any_working_capital_from_other_lender", + "expression": "(String('business_have_any_working_capital_from_other_lender') == String('Yes'))", + "value_keys": [ + "business_have_any_working_capital_from_other_lender" + ], + "questions": [ + { + "question_key": "other_lender_details_of_working_capital", + "question": "If Yes, then details of the same to be captured", + "place_holder": "Enter Here....", + "type": "1", + "api_properties": null, + "answers": null, + "onchange_properties": null, + "is_repeatable": null, + "field_type": "tel", + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Previous Experience Required", + "value": null + } + ] + } + ] + } + ] + } + ], + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Remarks on Financials >>", + "question_key":"remarks_on_financials", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Remarks Required", + "value":null + } + ] + }, + { + "question":"Loan Tenure (Months)", + "question_key":"loan_tenure", + "place_holder":"Enter number", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Loan tenure Required" + }, + { + "name":"maxLength", + "validator":"3", + "isactive":"1", + "message":"loan tenure 3 digit only", + "value":null + } + ] + }, + { + "question":"Loan Purpose (End-Use)", + "question_key":"loan_purpose", + "type":"4", + "answers":[ + { + "answer_id":"Working Capital", + "answer":"Working Capital", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Purchase of Business Assets", + "answer":"Purchase of Business Assets", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":" Bridge Finance for Working Capital", + "answer":" Bridge Finance for Working Capital", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Business Expansion", + "answer":"Business Expansion", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Office Renovation", + "answer":"Office Renovation", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Debt Consolidation", + "answer":"Debt Consolidation", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Others (Specify)", + "answer":"Others (Specify)", + "subfield_key":"other_end_use", + "subfield_caption":"Specifiy Other End Use", + "subfield_type":"1" + } + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Loan purpose Required", + "value":null + } + ] + } + ] + }, + { + "section_id":"15", + "section_name":"Details of Stock Sighted during the PD visit", + "onsubmit":null, + "questions":[ + { + "question":[ + { + "question":"Type of Stock (RM / FG)", + "question_key":"type_of_stock", + "type":"2", + "answers":[ + { + "answer_id":"RM", + "answer":"RM", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"FG", + "answer":"FG", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Type of Stock Required", + "value":null + } + ] + }, + { + "question":"Stock Item", + "question_key":"stock_item", + "place_holder":"Enter stock name", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Stock Item Required", + "value":null + } + ] + }, + { + "question":"Approx Stock Value (Rs) ", + "question_key":"approx_stock_value", + "place_holder":"Enter amount", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"numtoword", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Stock Value Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Approx Stock Quantity", + "question_key":"approx_stock_quantity", + "place_holder":"Enter stock Quantity", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Stock Quantity Required", + "value":null + } + ] + } + ], + "is_repeatable":"1", + "group_title":"Details of Stock Sighted during the PD visit" + }, + { + "question":"Does stock sighted justify the business operations ? (Yes / No)", + "question_key":"stock_sighted_justify", + "type":"2", + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"No", + "answer":"No ", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":[ + { + "purpose": "FORM_CTRL", + "form_controls": [ + { + "insert_index": "stock_sighted_justify", + "expression": "(String('stock_sighted_justify') == String('No'))", + "value_keys": [ + "stock_sighted_justify" + ], + "questions": [ + { + "question_key": "stock_sighted_justify_no_resons", + "question": "If No then mention reasons", + "place_holder": "Enter Resaon", + "type": "1", + "api_properties": null, + "answers": null, + "onchange_properties": null, + "is_repeatable": null, + "field_type": "string", + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Required", + "value": null + } + ] + } + ] + } + ] + } + ], + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + } + ] + }, + { + "section_id":"16", + "section_name":"Future Plans & Business Environment", + "onsubmit":null, + "questions":[ + { + "question":"USP of the business (How applicant’s business is different from others in the business)", + "question_key":"usp_of_the_business", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Future plan for business expansion", + "question_key":"future_plan_for_business_expansion", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Key competitors in the business", + "question_key":"key_competitors_in_the_business", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Succession Plan for business", + "question_key":"succession_plan_for_business", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ], + "onchange_properties":null + }, + { + "question":"Brief of other group concerns/Business run by the applicant", + "question_key":"brief_of_other_group_concerns", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ], + "onchange_properties":null + } + ] + }, + { + "section_id":"17", + "section_name":"Final Remarks of PD officer", + "onsubmit":null, + "questions":[ + { + "question":"Customer Behaviour ", + "question_key":"customer_behaviour", + "type":"2", + "answers":[ + { + "answer_id":"Polite", + "answer":"Polite", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Rude", + "answer":"Rude", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Others", + "answer":"Others (Please specify) ", + "subfield_key":"other_customer_behaviour", + "subfield_caption":"Please Specifiy Other Customer Behaviour", + "subfield_type":"1" + } + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Suitability of Business Location ", + "question_key":"suitability_of_business_location ", + "type":"2", + "answers":[ + { + "answer_id":"Well Suited", + "answer":"Well Suited", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Fairly Suited", + "answer":"Fairly Suited", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Not Suited", + "answer":"Not Suited ", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"PD Officer's Overall Assessment", + "question_key":"overall_assessment", + "type":"2", + "answers":[ + { + "answer_id":"Positive", + "answer":"Positive", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Negative", + "answer":"Negative ", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"PD Officer's key points considered while arriving at the aforementioned status.", + "question_key":"pd_officer_key_point", + "place_holder":"Enter number", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"num", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + }, + { + "name":"maxLength", + "isactive":"1", + "validator":"2", + "message":"Two digit only", + "value":null + } + ] + }, + { + "question":"Any Other remarks ", + "question_key":"any_other_remarks", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + + ] + } + ] + }, + { + "section_id":"18", + "section_name":"Officer Details", + "onsubmit":null, + "questions":[ + { + "question":"Name of Credit Team Member", + "question_key":"name_of_credit_team_member", + "place_holder":"Enter text", + "type":"1", + "field_type":"string", + "answers":null, + "answer_value":"CURRENT_USER", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Designation", + "question_key":"designation", + "place_holder":"Enter text", + "type":"1", + "answers":null, + "answer_value":"CURRENT_DESIGNATION", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Date", + "question_key":"date", + "place_holder":"Enter date", + "type":"1", + "answers":null, + "answer_value":"CURRENT_DATE", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + } + ] + }, + { + "section_id":"19", + "section_name":"Photograph's", + "onsubmit":[ + { + "expression":"(function () {let sum_val=null;let ques_key=[];if(control.question_key == submitProperty.key_name && control.answer_value == ''){return false}else{return true}return sum_val}())", + "key_name":"selfie_with_person_met", + "msg":"Please take selfie with person met" + } + ], + "questions":[ + { + "question":"Selfie with person met", + "question_key":"selfie_with_person_met", + "type":"6", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + + ] + }, + { + "question":[ + { + "question":"Approach to PD Location", + "question_key":"approach_to_pd_location", + "type":"6", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + + ] + } + ], + "is_repeatable":"1", + "group_title":"Approach to PD Location", + "group_type":"6" + }, + { + "question":[ + { + "question":"Name Board Seen", + "question_key":"name_board_seen", + "type":"6", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + + ] + } + ], + "is_repeatable":"1", + "group_title":"Name Board Seen", + "group_type":"6" + }, + { + "question":[ + { + "question":"Stock Photograph's", + "question_key":"stock_image", + "type":"6", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + + ] + } + ], + "is_repeatable":"1", + "group_title":"Stock Photograph's", + "group_type":"6" + }, + { + "question":[ + { + "question":"Workplace interior photographs", + "question_key":"workplace_interior_image", + "type":"6", + "answers":null, + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "validations":[ + + ] + } + ], + "is_repeatable":"1", + "group_title":"Workplace interior photographs", + "group_type":"6" + } + ] + } + ] +} \ No newline at end of file diff --git a/ng6-seed/src/assets/styles/scss/core/_main-panel.scss b/ng6-seed/src/assets/styles/scss/core/_main-panel.scss index 0362f82..baae9f6 100755 --- a/ng6-seed/src/assets/styles/scss/core/_main-panel.scss +++ b/ng6-seed/src/assets/styles/scss/core/_main-panel.scss @@ -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 {