FlyHi Implenment

This commit is contained in:
venbainfotech 2022-07-01 12:55:44 +05:30
parent 98bdd3e065
commit 53caf5a93b
63 changed files with 8110 additions and 306 deletions

Binary file not shown.

View File

@ -35,6 +35,10 @@ export const AppRoutes: Routes = [{
path:'sales-pd-list',
loadChildren:'./sales-pd/sales-pd.module#SalesPdModule'
},
{
path:'fly-hi',
loadChildren:'./fly-hi/fly-hi.module#FlyHiModule'
},
// {
// path:'credit_pd',
// loadChildren:'./lender-credit-pd/lender-credit-pd.module#LenderCreditPdModule'

View File

@ -0,0 +1,140 @@
<mat-card class="p-2" style="box-shadow: 0 0 1px rgba(0,0,0,.18), 0 0 1px rgba(0,0,0,.15) !important">
<div fxLayout="row">
<div fxFlex="50" class="pb-0 text-sm-left">
<mat-form-field dividerColor="primary" style="width: 50%;">
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Search">
</mat-form-field>
</div>
<div fxFlex="50" class="pb-0 text-sm-left" fxLayoutAlign="end center">
<div class="example-button-container">
<button (click)="newForm()" mat-mini-fab matTooltip="Add Verification" matTooltipPosition="left" [ngStyle]="{'background-color':roleID == 20 ? '#0d93a9' :'#f44336'}" aria-label="Example icon button with a menu icon">
<mat-icon>add</mat-icon>
</button>
</div>
</div>
</div>
<mat-tab-group class="mt-1">
<mat-tab>
<!-- <ng-template mat-tab-label>Fly Hi</ng-template> -->
<mat-card-content style="padding: 0px !important;">
<!-- <app-advance-filter [drop_down_datas]="filter_drop_down_data" (filteredlistData)="filteredDataSource($event)"
></app-advance-filter> -->
<p class="note" *ngIf="!recordStatus && limitMsg">Showing data for last {{common}}. To see older records, please use advanced filter</p>
<br/>
<div class="example-container">
<!--Start Mobile View Code-->
<div fxLayout="row wrap" *ngFor="let details of flyHiData" class="webhide">
<div fxFlex.xs="40" fxFlex.sm="40" class="webhide" style="text-align: left;" (click)="editForm(details)">
<small mat-line *ngIf="details.applicant_name == null">Name Not Given</small>
<small mat-line *ngIf="details.applicant_name != null">{{details.applicant_name}}</small><br/>
<small style="font-size: 10px;color:black" mat-line>{{details.sales_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}}</small>
</div>
<div fxFlex.xs="50" fxFlex.sm="50" class="webhide" style="text-align: right;" (click)="editForm(details)" >
<!-- <div fxLayout="row wrap" style="margin-left: 6px;" fxLayoutAlign="end"> -->
<!-- <div fxFlex.xs="85" fxFlex.sm="85" class="webhide"> -->
<span style="font-size: 10px;color:black" mat-line>
{{details.createdon | date:'dd-MM-yy h:mm:ss a'}}
</span> <br/>
<span> <span style="font-size:13px">{{details.abbr}}</span>&nbsp;<span style="font-weight: bold">|</span>&nbsp;<span style="font-weight:bold;font-size:13px" [ngStyle]="{'color':details.status == 'COMPLETED' ? 'green' : 'orange'}">{{details.status}}</span></span>
</div>
<!-- <div fxFlex.xs="10" fxFlex.sm="10" class="webhide" style="text-align: right;">
<button style="width: 43px !important;height: 23px !important;line-height: 0px !important;" mat-button mat-icon-button type="button" [disabled]="details.status != 'COMPLETED'"
color="primary" (click)="salesPDpdf(details.sales_pd_id)"><mat-icon>file_download</mat-icon></button><br>
<button mat-button mat-icon-button (click)="newPortal()" type="button" matTooltip="link" matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
</div> -->
<mat-divider></mat-divider>
</div>
<!--End Mobile View Code-->
<!--Start Web View Code-->
<div fxLayout="row wrap" *ngFor="let details of flyHiData">
<div class="cell" fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="6" fxFlex.lg="6" fxFlex.xl="9" style="justify-content:flex-end">
<small mat-line>{{details.sales_pd_id}}</small>
</div>
<div fxFlex.xs="14" fxFlex.sm="14" fxFlex.md="14" fxFlex.lg="14" fxFlex.xl="14" class="cell fontTitle" style="justify-content:flex-end" [ngStyle]="{'color':roleID == 20 ? '#0d93a9' :'#f44336'}">
<small mat-line>{{details.sales_pd_sno}}</small><br/>
<small style="color: black;text-align:center;font-weight: normal;font-size: 15px;">{{details.sales_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}}</small>
</div>
<div fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="13" fxFlex.lg="13" fxFlex.xl="13" class="cell" style="justify-content:flex-end">
<span *ngIf="!details.applicant_name" mat-line>
<small>--</small>
</span>
<span *ngIf="details.applicant_name" mat-line>
<b>{{details.applicant_name}}</b>
</span><br>
<span class="fontsize" mat-line> {{details.applicant_id}}</span>
</div>
<div fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="8" fxFlex.lg="8" fxFlex.xl="8" class="cell center" style="justify-content:flex-end">
<span style="font-weight:500"> <small mat-line>{{details.short_name}}</small></span><br/>
<span style="text-align: center;font-weight:400;font-size: 17px;"> <small mat-line>{{details.abbr}}</small></span>
</div>
<div fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="13" fxFlex.lg="13" fxFlex.xl="13" class="center no-pad cell" style="justify-content:flex-end">
<span *ngIf="!details.officer_name" mat-line>
<small>--</small>
</span>
<span *ngIf="details.officer_name" mat-line>
<small mat-line >{{details.officer_name}}</small>
</span>
</div>
<div fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="13" fxFlex.lg="13" fxFlex.xl="13" class="center no-pad cell" style="justify-content:flex-end">
<span *ngIf="!details.status" mat-line>
<small>--</small>
</span>
<span *ngIf="details.status" mat-line>
<small mat-line [ngStyle]="{'color':details.status == 'COMPLETED' ? 'green' :'orange'}">{{details.status}}</small>
</span>
</div>
<div fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="12" fxFlex.lg="12" fxFlex.xl="12" class="center no-pad cell" style="justify-content:flex-end">
<small mat-line>{{details.createdon | date: 'dd/MM/yyyy'}}</small>
</div>
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
<div fxFlex="row">
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
<button style="float: right" mat-button mat-icon-button class="hover-icon" type="button" matTooltip="PDF Download" [disabled]="details.status != 'COMPLETED'"
matTooltipPosition="left" [ngStyle]="{'color':roleID == 20 ? '#0d93a9' :'#f44336'}" (click)="salesPDpdf(details.sales_pd_id)"><mat-icon>file_download</mat-icon></button>
</div>
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
<button [disabled]="details.status === 'COMPLETED'" mat-button mat-icon-button class="hover-icon" type="button" [ngStyle]="{'color':roleID == 20 ? '#0d93a9' :'#f44336'}" (click)="editForm(details)"
matTooltip="View" matTooltipPosition="left"><mat-icon>visibility</mat-icon></button>
</div>
<!-- <div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
<button mat-button mat-icon-button (click)="newPortal()" type="button" matTooltip="link" matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
</div> -->
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
<button *ngIf="roleID == 30" mat-button mat-icon-button class="hover-icon" type="button" matTooltip="ReGenerate"
matTooltipPosition="above" color="primary" [matMenuTriggerFor]="menu1"><mat-icon>more_vert</mat-icon></button>
<mat-menu #menu1="matMenu">
<button mat-menu-item (click)="regeneratereport(details.sales_pd_id,'report')">
<mat-icon>autorenew</mat-icon>
<span>Re-Generate Report</span>
</button>
<button mat-menu-item (click)="regeneratereport(details.sales_pd_id,'location')">
<mat-icon>location_on</mat-icon>
<span>Re-Generate Location</span>
</button>
<button mat-menu-item (click)="regeneratereport(details.sales_pd_id,'mail')">
<mat-icon>email</mat-icon>
<span>Resent Mail</span>
</button>
</mat-menu>
</div>
</div>
</div>
<mat-divider></mat-divider>
</div>
<!--End Web View Code-->
</div>
</mat-card-content>
</mat-tab>
</mat-tab-group>
</mat-card>

View File

@ -0,0 +1,142 @@
// .mat-ink-bar{
// background-color:green;
// }
// .mat-tab-label-active{
// color: green !important;
// }
// .primary{
// background-color: #e2412f;
// }
// .accent{
// background-color: #0d93a9;
// }
::ng-deep .mat-tab-group.mat-primary .mat-ink-bar, .mat-tab-nav-bar.mat-primary .mat-ink-bar {
background-color: #0d93a9;
}
.fontTitle{
font-weight:bold;
text-align: left;
}
.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;
}
.ic-change:hover {
transform: scale(1.1);
color: green;
}
.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;
}
// .example-container {
// display: flex;
// flex-direction: column;
// max-height: 500px;
// min-width: 300px;
// }
// .mat-table {
// overflow: auto;
// max-height: 500px;
// }
.mobile-label {
display: none;
}
@media(min-width: 600px) {
.webhide{
display: none !important;
}
}
@media(max-width: 600px) {
.body-container {
padding: 0px !important;
}
.mat-expansion-panel-body {
padding: 0 10px 16px !important;
}
.cell{
display: none !important;
}
.mat-form-field{
display: inline !important;
}
// .no-pad{
// text-align: left !important;
// padding-left: 0px !important;
// }
.mobile-label {
width: 80px;
display: inline-block;
font-weight: bold;
}
.mat-header-row {
display: none;
}
.mat-row {
flex-direction: column;
align-items: start;
padding: 8px 24px;
}
.lettericon{
// background-color: cadetblue;
// padding: 6px 7px 6px 7px;
border-radius: 10px;
color: #e2412f;
font-size: 75%;
font-weight: bold;
min-width: 4.4em;
text-align: center;
margin: 10px 0px 0px 0px !important;
}
.lettertext{
font-size: 80%;
}
}

View File

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

View File

@ -0,0 +1,337 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FlyhiService } from '../services/flyhi.service';
import { Router, ActivatedRoute } from '@angular/router';
import { MatDialog, MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
import { ConstantsProvider } from 'app/providers/constants/constants';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import { SalesPdService } from 'app/sales-pd/services/sales-pd.service';
@Component({
selector: 'app-fly-hi-list',
templateUrl: './fly-hi-list.component.html',
styleUrls: ['./fly-hi-list.component.scss']
})
export class FlyHiListComponent implements OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
public dataLengthTab4: number;
public dataSourceTab4 = new MatTableDataSource();
is_sales_login:boolean = false
common: any;
roleID: string;
errorMessage:any[]=[];
flyHiData: any;
recordStatus: boolean;
limitMsg: boolean = false;
finallink: string;
filter_drop_down_data: { product_ids: any[]; lender_ids: any[]; pd_status: any[]; };
constructor(private loaderService:LoaderService,private constantProvider:ConstantsProvider,private dialog:MatDialog,private route: ActivatedRoute, private router: Router,private _fly_Hi:FlyhiService,private SalesPDService:SalesPdService) {
this.roleID = localStorage.getItem('user_role');
setTimeout(()=>{
let userDetails = localStorage.getItem('user_details');
console.log('userdetails');
console.log(userDetails);
let role= this.constantProvider.takeDecisionRouting(JSON.parse(userDetails))
console.log(role)
if(role == 'sales'){
this.is_sales_login = true
this.getListofFlyhi()
}
else {
this.is_sales_login = false
this.getListofFlyhi()
}
},4000)
setTimeout(()=>{
this.common = JSON.parse(localStorage.getItem('commonSettings'))
if(this.common){
this.common = this.common.default_pd_list_count;
this.common = this.common.count+' '+this.common.factor
}
},300)
}
ngOnInit() {
this.getListofFlyhi()
}
getListofFlyhi(){
this._fly_Hi.getFlyHiList(this.is_sales_login).subscribe(res=>{
if(res['dataStatus']){
let user1 = localStorage.getItem('user_details');
let user=(JSON.parse(user1))
this.roleID = localStorage.getItem('user_role')
this.flyHiData = res['records'];
this.dataLengthTab4 = res['records'].length;
this.dataSourceTab4.data = this.flyHiData;
this.recordStatus=false
this.limitMsg = true
if(this.flyHiData.length > 0){
let products=[]
let lenders=[]
let pd_status=[]
this.flyHiData.map(val=>{
// https://gstapp.smcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&PDID=123&Email=manojsahrawat@smcfinance.com
//let link = "http://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U"
let link ="https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
var string:any = {
EmpName:user.user_first_name,
EmpCode:"",
PDID:val.sales_pd_sno,
//PD_NO:val.sales_pd_sno,
}
//console.log(string);
//var encodedString = btoa(JSON.stringify(string));
//console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh"
//var decodedString = atob(encodedString);
//console.log("decode",JSON.parse(decodedString));
//let email="mwisesales1@sine.com";
let PDID=val.sales_pd_sno;
// let mail="&Email=manojsahrawat@smcfinance.com"
this.finallink=link+"&PDID="+PDID+"&Email="+user.email;
console.log('this.finallink')
console.log(this.finallink);
val.link = this.finallink;
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.flyHiData=[];
this.dataLengthTab4= null;
this.recordStatus=true;
this.limitMsg = false
}
}
// , error => this.errorMessage = <any> error);
,error => {
this.errorMessage.push(error);
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
alert(error.html_format);
});
}
editForm(value_obj){
console.log(value_obj.sales_pd_id,value_obj.rand_string)
// alert('abc');
console.log('value');
console.log(value_obj);
let campletedCase = JSON.stringify(value_obj)
localStorage.setItem('completedPD',campletedCase)
// let product= localStorage.getItem('product_id_salesPD')
// storing the sales_pd_id and product id in local storagey
let primary_key= 'sales_pd_id'
if(value_obj.hasOwnProperty('local_pd_id') && value_obj.local_pd_id != null && value_obj.sales_pd_id == null && value_obj.hasOwnProperty('is_pd_synced') && value_obj.is_pd_synced == false) {
primary_key = 'local_pd_id'
}
console.log(value_obj[primary_key])
localStorage.setItem('sales_pd_id_PRIMARYKEY',value_obj[primary_key]);
localStorage.setItem('sales_rand_string',value_obj.rand_string);
// this.salesPDService.insertData_Replace('sales_pd_id_PRIMARYKEY',value_obj[primary_key]).then(()=>{
//this.salesPDService.insertData_Replace('sales_rand_string',value_obj['rand_string']).then(()=>{
localStorage.setItem('product_id_salesPD',value_obj.product_id)
if(!value_obj.hasOwnProperty('sales_pd_type')&& !value_obj.sales_pd_type) {
value_obj.sales_pd_type = '2'
}
console.log('value');
console.log(value_obj);
localStorage.setItem('sales_pd_type',value_obj.sales_pd_type)
// this.router.navigate(['../sectionlist',value_obj.product_id,value_obj.sales_pd_type,value_obj.link],{ relativeTo: this.route })
this.router.navigate(['../sectionlist'],{ relativeTo: this.route })
// })
//})
}
filteredDataSource(res){
console.log("From Parent",res);
if(res['dataStatus']){
let user1 = localStorage.getItem('user_details');
let user=(JSON.parse(user1))
this.roleID = localStorage.getItem('user_role')
this.flyHiData=res['records']
this.dataLengthTab4 = res['records'].length;
this.dataSourceTab4.data = this.flyHiData;
this.recordStatus=false
this.limitMsg = false
if(this.flyHiData.length > 0){
let products=[]
let lenders=[]
let pd_status=[]
this.flyHiData.map(val=>{
// https://gstapp.smcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&PDID=123&Email=manojsahrawat@smcfinance.com
//let link = "http://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U"
let link ="https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
var string:any = {
EmpName:user.user_first_name,
EmpCode:"",
PDID:val.sales_pd_sno,
//PD_NO:val.sales_pd_sno,
}
//console.log(string);
//var encodedString = btoa(JSON.stringify(string));
//console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh"
//var decodedString = atob(encodedString);
//console.log("decode",JSON.parse(decodedString));
//let email="mwisesales1@sine.com";
let PDID=val.sales_pd_sno;
// let mail="&Email=manojsahrawat@smcfinance.com"
this.finallink=link+"&PDID="+PDID+"&Email="+user.email;
console.log('this.finallink')
console.log(this.finallink);
val.link = this.finallink;
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.flyHiData=[];
this.dataLengthTab4= null;
this.recordStatus=true;
this.limitMsg = false
}
}
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();
}
newPortal() {
console.log(this.finallink)
window.open(this.finallink);
}
newForm(){
// this.salesPDService.getData_fromLocal('sec1').then(result=>{
// console.log("image",result);
// if(result){
// this.alertDecision()
// }
// else{
// this.navCtrl.push(HomePage)
// }
// });
// this.SalesPDService.clearLocalData()
// this.SalesPDService.clear_local_key('sales_pd_id_PRIMARYKEY');
// localStorage.removeItem('sales_pd_id_PRIMARYKEY')
// localStorage.removeItem('product_id_salesPD')
// localStorage.removeItem('sales_pd_type')
// // this.navCtrl.push(HomePage)
this.router.navigate([ '../sectionlist'], { relativeTo: this.route });
}
salesPDpdf(pdfdetail){
this.loaderService.showMatSpinnerDialog('Processing...')
this.SalesPDService.getSalesPdpdf(pdfdetail)
.subscribe(
data => {
if (data.status == 200) {
// window.location.href=res['records'];
window.open(data.records, '_blank');
}
this.loaderService.closeMatSpinnerDialog()
}
// , error => this.errorMessage = <any> error);
,error => {
this.loaderService.closeMatSpinnerDialog()
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);
});
}
// regeneratereport(data,option)
// {
// const dialogRef = this.dialog.open(ReGenerateReportComponent,{
// data: {pdid: data,option: option},
// disableClose: true,
// minWidth: '30%',
// maxWidth: '40%',
// })
// dialogRef.afterClosed()
// .subscribe(dataresult => {
// // this.viewPdDetails(this.viewID,this.masterRandomString)
// })
// }
}

View File

@ -0,0 +1,47 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FlyHiListComponent } from './fly-hi-list/fly-hi-list.component';
import { SectionListComponent } from 'app/sales-pd/section-list/section-list.component';
const routes: Routes = [
{
path:'',
redirectTo:'flyhi-list-pd',
pathMatch:'full'
},
{
path:'flyhi-list-pd',
component:FlyHiListComponent
},
// {
// path:'add-pd',
// component:HomePage
// },
// {
// path:'section9',
// component:HomePage
// },
{
path:'sectionlist',
component:SectionListComponent
},
// // {
// // path:'sectionlist/:product_id/:sales_pd_type/:link',
// // component:SectionListComponent
// // },
// {
// path:'',
// component:HomePage
// }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class FlyHiRoutingModule {
static forRoot: any;
}

View File

@ -0,0 +1,13 @@
import { FlyHiModule } from './fly-hi.module';
describe('FlyHiModule', () => {
let flyHiModule: FlyHiModule;
beforeEach(() => {
flyHiModule = new FlyHiModule();
});
it('should create an instance', () => {
expect(flyHiModule).toBeTruthy();
});
});

View File

@ -0,0 +1,91 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FlyHiRoutingModule } from './fly-hi-routing.module';
import { FlyHiListComponent } from './fly-hi-list/fly-hi-list.component';
import { MatDialogModule, MatMenuModule, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS, MatDialogRef, MAT_DIALOG_DATA, MatAutocomplete, MatAutocompleteModule, MatCardModule, MatIconModule, MatRadioModule, MatInputModule, MatTableModule, MatPaginatorModule, MatButtonModule, MatProgressBarModule, MatToolbarModule, MatChipsModule, MatProgressSpinnerModule, MatSlideToggleModule, MatSelectModule, MatListModule, MatGridListModule, MatTabsModule, MatBadgeModule, MatCheckboxModule, MatStepperModule, MatSidenavModule, MatButtonToggleModule, MatBottomSheetModule, MatRippleModule, MatDividerModule, MatNativeDateModule, MatSliderModule, MatSnackBarModule, MatTreeModule, MatDatepickerModule, MatExpansionModule, MatTooltipModule, MatSortModule, MatDialogActions } from '@angular/material';
import { SharedModule } from 'app/shared/shared.module';
import { MaterialModule } from 'app/lender-credit-pd/lender-credit-pd.module';
import { ConstantsProvider } from 'app/providers/constants/constants';
import { MomentDateAdapter, MAT_MOMENT_DATE_FORMATS } from '@angular/material-moment-adapter';
import { SalesPdModule } from 'app/sales-pd/sales-pd.module';
import { StartPd2Component } from './start-pd2/start-pd2.component';
import { DynamicFormComponent } from './forms-dynamic/dynamic-form/dynamic-form/dynamic-form.component';
import { DynamicQuestionTemplateComponent } from './forms-dynamic/dynamic-form/dynamic-question-template/dynamic-question-template.component';
import { CKEditorModule } from 'ng2-ckeditor';
import { PdfViewerModule } from 'ng2-pdf-viewer';
import { FlexLayoutModule } from '@angular/flex-layout';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FileUploadModule } from 'ng2-file-upload';
import { TreeModule } from 'angular-tree-component';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
import { ResizableModule } from 'angular-resizable-element';
import { OwlDateTimeModule, OwlNativeDateTimeModule } from 'ng-pick-datetime';
import { AgmCoreModule } from '@agm/core';
import { environment } from 'environments/environment';
import { MatVideoModule } from 'mat-video';
import { AngularSplitModule } from 'angular-split';
import { FormComponent } from './forms-dynamic/form/form.component';
import { ImageVideoComponent } from './image-video/image-video.component';
@NgModule({
imports: [
CommonModule,
FlyHiRoutingModule,
MaterialModule,
MatMenuModule,
SharedModule,
MatDialogModule,
SalesPdModule,
CKEditorModule,
PdfViewerModule,
MatCardModule,
MatIconModule,
MatAutocompleteModule,
MatInputModule,
MatRadioModule,
MatTableModule,
MatPaginatorModule,
MatButtonModule,
MatProgressBarModule,
MatToolbarModule,
FlexLayoutModule,
NgxDatatableModule,
MatChipsModule,MatProgressSpinnerModule,
FormsModule,MatSlideToggleModule,
MatSelectModule, MatListModule,MatGridListModule, MatTabsModule, MatBadgeModule, MatCheckboxModule,MatStepperModule,MatSidenavModule ,MatMenuModule, MatButtonToggleModule,
ReactiveFormsModule,
MatBottomSheetModule,
MatDividerModule,
MatNativeDateModule,
MatRippleModule,
MatSliderModule,
MatSnackBarModule,
MatTreeModule,
FileUploadModule,
TreeModule,
MatDatepickerModule,
MatDialogModule,MatSortModule,
NgxMatSelectSearchModule,MatTooltipModule, MatExpansionModule,ResizableModule,
OwlDateTimeModule,
OwlNativeDateTimeModule,
AngularSplitModule,
MatVideoModule
],
declarations:[StartPd2Component,DynamicFormComponent,DynamicQuestionTemplateComponent,FormComponent],
exports:[StartPd2Component],
entryComponents:[FlyHiListComponent,DynamicFormComponent,DynamicQuestionTemplateComponent,FormComponent],
providers:[ConstantsProvider,{ provide: MAT_DATE_LOCALE, useValue: 'en-GB' },{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},{ provide: MatDialogRef, useValue: {} },{ provide: MAT_DIALOG_DATA, useValue: [] }],
bootstrap: [FlyHiListComponent],
})
export class FlyHiModule { }

View File

@ -0,0 +1,75 @@
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" style="padding: 1% !important;">
Add New Address
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<!-- <button *ngIf="data.fk_pd_type == 2" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate Vendor" matTooltipPosition="above" (click)="viewVendorOfficer()"><mat-icon>verified_user</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" mat-dialog-close matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content class="mat-typography" style="border-bottom: 2px solid #e2412f8f;">
<form [formGroup]="newAddressForm">
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap.xs="0" fxLayoutGap="10px">
<mat-form-field [appearance]="field_appearance" fxFlex="100%" >
<mat-label>Address</mat-label>
<textarea matInput formControlName="address" placeholder="Enter the address"></textarea>
<mat-error *ngIf="newAddressForm.get('address').hasError('required')">Required</mat-error>
</mat-form-field>
<mat-form-field [appearance]="field_appearance" fxFlex="30%" fxFlex.xs="100%">
<mat-label>State</mat-label>
<mat-select formControlName="state" (selectionChange)="getCityList($event.value.state_id)">
<mat-option>
<ngx-mat-select-search [formControl]="stateSearch"
[placeholderLabel]="'Search State...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let SL of filteredstateList | async" [value]="SL">
{{SL.name}}
</mat-option>
</mat-select>
<mat-error *ngIf="newAddressForm.get('state').hasError('required')">Required</mat-error>
</mat-form-field>
<mat-form-field [appearance]="field_appearance" fxFlex="45%" fxFlex.xs="100%">
<mat-label>City</mat-label>
<mat-select formControlName="city">
<mat-option>
<ngx-mat-select-search [formControl]="citySearch"
[placeholderLabel]="'Search City...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let CL of filteredcityList | async" [value]="CL">
{{CL.city_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="newAddressForm.get('city').hasError('required')">Required</mat-error>
</mat-form-field>
<mat-form-field [appearance]="field_appearance" fxFlex="20%" fxFlex.xs="100%">
<mat-label>Pincode</mat-label>
<mat-select formControlName="pincode">
<mat-option>
<ngx-mat-select-search [formControl]="pinSearch"
[placeholderLabel]="'Search Pincode...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let PL of filteredpincodeList | async" [value]="PL">{{PL.pincode}}</mat-option>
</mat-select>
<mat-error *ngIf="newAddressForm.get('pincode').hasError('required')">Required</mat-error>
</mat-form-field>
</div>
</form>
</mat-dialog-content>
<mat-dialog-actions align="end">
<div fxFlex="50" align="left">
<p *ngIf="errormsg" style="color: red;">{{errormsg}}</p>
</div>
<div fxFlex="50" align="right">
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button> -->
<button mat-raised-button mat-icon-button (click)="addNewAddress()" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Submit" matTooltipPosition="below"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>

View File

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

View File

@ -0,0 +1,183 @@
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
import { ReplaySubject } from 'rxjs';
import { QuesFormService } from '../dynamic-form/ques-form/ques-form.service';
@Component({
selector: 'app-answer-option-create-dialog',
templateUrl: './answer-option-create-dialog.component.html',
styleUrls: ['./answer-option-create-dialog.component.scss']
})
export class AnswerOptionCreateDialogComponent implements OnInit {
stateList:any = []
cityList:any = []
pincodeList:any = []
filteredstateList:ReplaySubject<any>= new ReplaySubject<any>(1)
filteredcityList:ReplaySubject<any> = new ReplaySubject<any>(1)
filteredpincodeList:ReplaySubject<any> = new ReplaySubject<any>(1)
stateSearch:FormControl = new FormControl('')
citySearch:FormControl = new FormControl('')
pinSearch:FormControl = new FormControl('')
newAddressForm:FormGroup;
field_appearance="outline"
errormsg: string = null;
constructor(@Inject(MAT_DIALOG_DATA) public data:any, private _pdService:PdTrigerService, private _fb:FormBuilder,
private dialogRef:MatDialogRef<AnswerOptionCreateDialogComponent>, private quesService:QuesFormService) {
this.newAddressForm = this._fb.group({
address:['',Validators.required],
state:['',Validators.required],
city:['',Validators.required],
pincode:['',Validators.required]
})
console.log(this.data)
}
ngOnInit() {
this._pdService.getAllMasterDatas('STATE').subscribe(
data => {
if (data.status == 200) {
this.stateList = data.records.filter(item => item.isactive == 1);
this.filteredstateList.next(this.stateList);
}
});
this.filterList()
}
filterList() {
this.stateSearch.valueChanges.pipe().subscribe(()=>{
this.applyFilter(this.stateSearch.value,this.filteredstateList,this.stateList,'name')
})
this.citySearch.valueChanges.pipe().subscribe(()=>{
this.applyFilter(this.citySearch.value,this.filteredcityList,this.cityList,'city_name')
})
this.pinSearch.valueChanges.pipe().subscribe(()=>{
this.applyFilter(this.pinSearch.value,this.filteredpincodeList,this.pincodeList,'pincode')
})
}
applyFilter(filtered_text,filter_list,raw_list,obj_name) {
if (!raw_list) {
return;
}
// get the search keyword
let search = filtered_text;
if (!search) {
filter_list.next(raw_list.slice());
return;
} else {
search = search.toLowerCase();
}
// filter the banks
filter_list.next(
raw_list.filter(bank => bank[obj_name].toLowerCase().indexOf(search) > -1)
);
}
//get city list details based on state id
getCityList(stateID: string) {
this._pdService.getStateWiseCities(stateID).subscribe(data => {
if (data.status == 200) {
this.cityList = data.records.cities;
this.pincodeList = data.records.pincode;
this.filteredcityList.next(this.cityList)
this.filteredpincodeList.next(this.pincodeList)
}
});
}
addNewAddress() {
console.log(this.newAddressForm.getRawValue())
if(this.newAddressForm.invalid) {
this.showMsg("Please Fill all the fields")
// this.findInvalidControls()
return;
}
let formValue=this.newAddressForm.getRawValue()
let params = {pd_id:this.data.pd_all_details.pdmaster_details.pd_id,file_id:null, addressline:formValue.address, state:formValue.state.state_id, city:formValue.city.city_id, pincode:formValue.pincode.pincode_id}
let display_address= formValue.address+ ', '+formValue.state.name+', '+formValue.city.city_name+', '+formValue.pincode.pincode
console.log(this.newAddressForm.getRawValue(),display_address)
this._pdService.saveNewSMCTempAddresses(params).subscribe(res=>{
if(res['dataStatus']) {
this._pdService.getSMCTempAddresses(this.data.pd_all_details.pdmaster_details.pd_id).subscribe(rr=>{
if(rr && rr['dataStatus'] && rr['records']) {
let address_data = this.quesService.convertArrayNames(["display","display"],rr['records'])
this.dialogRef.close({update:true, address_for_display:address_data})
}
else {
this.dialogRef.close({update:false, error_msg:"Unable to get the address"})
}
},err=> {
this.dialogRef.close({update:false, error_msg:"Network error. Unable to get the address"})
})
// this.dialogRef.close({update:true, address_for_display:display_address})
}
else {
this.showMsg("Something went wrong")
}
},err=>{
this.showMsg("Network Error")
})
}
showMsg(msg) {
this.errormsg = msg
setTimeout(()=>{
this.errormsg = null
}, 3000)
}
public findInvalidControls() {
const invalid = [];
for (const name in <any>(this.newAddressForm.controls)) {
console.log(this.newAddressForm.controls[name],name)
if (this.newAddressForm.controls[name].invalid) {
invalid.push(name);
let invalidFields = [].slice.call(document.getElementsByClassName('ng-invalid'));
let firstInvalidField;
for(let val in invalidFields){
if( invalidFields[val].nodeName == 'MAT-FORM-FIELD' || invalidFields[val].nodeName == 'MAT-SELECT' || invalidFields[val].nodeName == 'TEXTAREA' || invalidFields[val].nodeName == 'MAT-RADIO-GROUP' ){ //INPUT FOR INPUT FIELD
firstInvalidField=invalidFields[val]
break;
}
}
if(firstInvalidField != undefined){
// firstInvalidField.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"})
setTimeout(()=>{
firstInvalidField.scrollIntoView({block: "start", inline: "nearest"})
setTimeout(()=>{
firstInvalidField.focus()
},0)
// firstInvalidField.style.background = 'red'
firstInvalidField.classList.remove('field_highlight')
setTimeout(()=>{
firstInvalidField.classList.add('field_highlight')
},300)
},300)
}
break
}
}
// }
// }
// let business_group_ctrl = formArray.at(2).get('business_group') as FormArray
// const controls = this.getQuestionControl().at(1)['controls']
// for (const name in controls) {
// if (controls[name].invalid) {
// invalid.push(name);
// }
// }
return invalid;
}
}

View File

@ -0,0 +1,167 @@
<div *ngIf="questions_JSON.questions.length > 0" #whole_form>
<form [formGroup]="form_group_name" fxLayout="row wrap" >
<!-- <form [formGroup]="form_group_name" fxLayout="row wrap" fxLayoutWrap fxFlex="100" fxLayout.xs="column" fxLayoutGap="33px"> -->
<!-- <form [formGroup]="form_group_name" fxLayout="row wrap" fxLayoutWrap fxFlex="100" fxLayoutAlign="space-between" fxLayout.xs="column" fxLayoutGap="33px"> -->
<!-- {{form_group_name.value | json}} -->
<!-- <div *ngIf="form_group_name.controls['questions']"> -->
<!-- <section formArrayName="questions">fxFlex.md="33" fxFlex.lg="33" fxFlex.xl="33" -->
<!-- {{form_group_name.value | json}} -->
<div *ngFor="let parent_ques of questions_JSON.questions;let p_i =index; let p_last=last" fxFlex.xs="100" fxFlex.sm="100" [fxFlex]="parent_ques.hasOwnProperty('field_width') && parent_ques.field_width ? parent_ques.field_width : '100'"
[fxLayoutGap.xs]="(parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword') ? '5%' : '0' ">
<!-- {{parent_ques.hasOwnProperty('field_width') && parent_ques.field_width ? parent_ques.field_width : '100'}} -->
<!-- <div *ngFor="let parent_ques of form_group_name.controls['questions']['controls'];let p_i=index; let p_l=last" [formGroupName]="p_i"> -->
<!-- {{parent_ques | json}} -->
<!-- <div *ngIf="parent_ques.sub_title" fxLayout="row" >
<mat-card-subtitle *ngIf="parent_ques.sub_title" fxFlex="100%">
{{parent_ques.sub_title}}
</mat-card-subtitle>
<br style="clear: both;"/>
</div> -->
<div *ngIf="parent_ques.is_repeatable != '1'" >
<app-dynamic-question-template [currFormArrayObj]="parent_ques" [json_answers] = "json_answers" [formGroupN]="form_group_name"
[whole_json]="questions_JSON.questions" [json_index]="p_i"></app-dynamic-question-template>
</div>
<div *ngIf="parent_ques.is_repeatable == '1' && parent_ques.disable != true">
<!-- {{form_group_name.value[parent_ques.group_key] | json}} -->
<div [formArrayName]="parent_ques.group_key" *ngIf="parent_ques.group_type != '6'" >
<!-- {{g_i}} {{g_l}} -->
<mat-accordion *ngIf="parent_ques.group_type != '6'" #accordion="matAccordion" [multi]="true">
<div *ngFor="let group_ques of form_group_name.get(parent_ques.group_key)['controls'];let g_i=index;let g_l=last"
[formGroupName]="g_i">
<mat-expansion-panel [expanded]="step === g_i" #mapanel="matExpansionPanel" >
<mat-expansion-panel-header>
<mat-panel-title *ngIf="parent_ques.group_title_shown != '0'">
{{parent_ques.group_title}} {{g_i+1}}
<div *ngFor="let singleQues of parent_ques.group_questions[g_i];let s_i=index">
<div *ngFor="let s of singleQues.questions_level_two">{{singleQues.group_key | json}}</div>
</div>
</mat-panel-title>
<!-- <mat-panel-description>
Type your name and age
</mat-panel-description> -->
</mat-expansion-panel-header>
<!-- {{json_answers[parent_ques.group_key][0] | json}} -->
<div *ngFor="let singleQues of parent_ques.group_questions[g_i];let s_i=index" fxFlex.xs="100" fxFlex.sm="100" [fxFlex]="singleQues.hasOwnProperty('field_width') && singleQues.field_width ? singleQues.field_width : '100'"
[ngStyle.xs]="{'margin-bottom' : (singleQues.field_type == 'numtoword' || singleQues.field_type == 'str&numtoword') ? '5%' : '0' }">
<!-- {{s_i}} -->
<!-- {{json_answers[parent_ques.group_key][s_i] | json}} -->
<div *ngIf="singleQues.is_repeatable != '2'">
<app-dynamic-question-template [group_key] = parent_ques.group_key [currFormArrayObj]="singleQues" [json_answers] = "json_answers != null && json_answers ? json_answers[parent_ques.group_key] : null" [formGroupN]="group_ques" [whole_form]="form_group_name"
[whole_json]="parent_ques.group_questions[g_i]" [json_index]="g_i" (generateGroupControls) = generateGroupControls($event)></app-dynamic-question-template>
</div>
<!-- Child REPEATABLE QUES -->
<div *ngIf="singleQues.is_repeatable == '2'">
<!-- {{singleQues.questions_level_two | json}} -->
<!-- {{form_group_name.value[parent_ques.group_key] | json}} -->
<div [formArrayName]="singleQues.group_key" *ngIf="singleQues.group_type != '6'" >
<!-- {{g_i}} {{g_l}} -->
<mat-accordion *ngIf="singleQues.group_type != '6'" #accordion="matAccordion" [multi]="true">
<!-- {{group_ques.value | json}} -->
{{singleQues | json}}
<div *ngFor="let group_ques_child of group_ques.get(singleQues.group_key)['controls'];let g_c_i=index;let g_c_l=last"
[formGroupName]="g_c_i">
{{group_ques_child.value | json}}
<mat-expansion-panel [expanded]="step_child === g_c_i" #mapanel="matExpansionPanel" >
<mat-expansion-panel-header>
<mat-panel-title *ngIf="singleQues.group_title_shown != '0'">
{{singleQues.group_title}} {{g_c_i+1}}
</mat-panel-title>
<!-- <mat-panel-description>
Type your name and age
</mat-panel-description> -->
</mat-expansion-panel-header>
<!-- {{json_answers[parent_ques.group_key][0] | json}} -->
<div *ngFor="let singleQues_child of singleQues.questions_level_two[g_c_i];let s_i=index" fxFlex.xs="100" fxFlex.sm="100" [fxFlex]="singleQues_child.hasOwnProperty('field_width') && singleQues_child.field_width ? singleQues_child.field_width : '100'"
[ngStyle.xs]="{'margin-bottom' : (singleQues_child.field_type == 'numtoword' || singleQues_child.field_type == 'str&numtoword') ? '5%' : '0' }">
<!-- {{s_i}} -->
<!-- {{json_answers[parent_ques.group_key][s_i] | json}} -->
{{singleQues_child | json}}
<!-- {{group_ques_child | json}} -->
<app-dynamic-question-template [group_key] = singleQues.group_key [currFormArrayObj]="singleQues_child" [json_answers] = "json_answers != null && json_answers ? json_answers[parent_ques.group_key] : null" [formGroupN]="group_ques_child" [whole_form]="group_ques"
[whole_json]="singleQues.questions_level_two[g_c_i]" [json_index]="g_c_i" (generateGroupControls) = generateGroupControls($event)></app-dynamic-question-template>
</div>
<br/>
<div fxLayout="row" fxLayoutAlign="flex-end" fxFlex="100" style="margin-top: 3%;">
<div >
<!-- <ion-button class="ion-float-right" fill="clear" color="optblue" *ngIf="g_i != 0" (click)="removeData(g_i,parent_ques)">
<ion-icon style="font-size: 22px" name="md-trash"></ion-icon>
</ion-button> -->
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
mat-icon-button matTooltip="Delete"
matTooltipPosition="above" *ngIf="group_ques.get(singleQues.group_key).length > 1" (click)="removeSecondLevelChild(g_c_i,singleQues,group_ques)">
<mat-icon>delete</mat-icon>
</button>
</div>
<div>
<!-- <ion-button class="ion-float-right" fill="clear" color="optblue" *ngIf="g_l"
(click)="addData(g_i,parent_ques,$event)">
<ion-icon style="font-size: 24px" name="add-circle"></ion-icon>
</ion-button> -->
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
mat-icon-button matTooltip="Add More"
matTooltipPosition="above" *ngIf="g_c_l"
(click)="addSecondLevelChild(g_c_i,singleQues,group_ques)">
<mat-icon>add</mat-icon>
</button>
</div>
</div>
</mat-expansion-panel>
</div>
</mat-accordion>
</div>
<!-- IS REPEATABLE -->
</div>
</div>
<br/>
<div fxLayout="row" fxLayoutAlign="flex-end" fxFlex="100" style="margin-top: 3%;">
<div >
<!-- <ion-button class="ion-float-right" fill="clear" color="optblue" *ngIf="g_i != 0" (click)="removeData(g_i,parent_ques)">
<ion-icon style="font-size: 22px" name="md-trash"></ion-icon>
</ion-button> -->
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button
mat-icon-button matTooltip="Delete"
matTooltipPosition="above" *ngIf="form_group_name.get(parent_ques.group_key).length > 1" (click)="removeData(g_i,parent_ques)">
<mat-icon>delete</mat-icon>
</button>
</div>
<div>
<!-- <ion-button class="ion-float-right" fill="clear" color="optblue" *ngIf="g_l"
(click)="addData(g_i,parent_ques,$event)">
<ion-icon style="font-size: 24px" name="add-circle"></ion-icon>
</ion-button> -->
<button type="button" class="ml-1 mr-1 hover-icon" mat-raised-button [disabled]="parent_ques.disable == true"
mat-icon-button matTooltip="Add More"
matTooltipPosition="above" *ngIf="g_l"
(click)="addData(g_i,parent_ques)">
<mat-icon>add</mat-icon>
</button>
</div>
</div>
</mat-expansion-panel>
</div>
</mat-accordion>
</div>
<!-- IS REPEATABLE -->
</div>
<!-- </div> -->
<!-- </section> -->
</div>
</form>
</div>

View File

@ -0,0 +1,15 @@
::ng-deep {
.mat-expansion-panel-body{
flex-flow: wrap;
}
form{
flex-flow: row wrap;
box-sizing: border-box;
display: flex;
/* place-content: stretch space-between; */
align-items: stretch;
flex: 1 1 100%;
max-width: 100%;
}
}

View File

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

View File

@ -0,0 +1,294 @@
import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { FormBuilder, FormArray, FormGroup } from '@angular/forms';
import { MatExpansionPanel,MatAccordion } from '@angular/material';
import { QuesFormService } from '../ques-form/ques-form.service';
import {SelectionModel} from '@angular/cdk/collections';
import {FlatTreeControl} from '@angular/cdk/tree';
import {Injectable} from '@angular/core';
import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree';
import {BehaviorSubject} from 'rxjs';
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
@Component({
selector: 'app-dynamic-form',
templateUrl: './dynamic-form.component.html',
styleUrls: ['./dynamic-form.component.scss'],
})
export class DynamicFormComponent {
@Input() form_group_name:FormGroup;
@Input() questions_JSON:any;
@Input() json_answers:any;
length:any;
step: number=0;
isDefaultGenerated:boolean = false
step_child:number = 0
@ViewChild('mapanel') matExpansionPanel:MatExpansionPanel
@ViewChild('accordion') Accordion: MatAccordion
vr: boolean = false;
constructor(private _fb:FormBuilder,private questionService:QuesFormService ) {
this.questionService.currentMessageSubscriber.subscribe((data : any)=>{
console.log(data)
})
}
ngOnInit() {
console.log(this.form_group_name)
console.log(this.questions_JSON.questions)
this.form_group_name=this.questionService.assignFormControl_array(this.form_group_name,this.questions_JSON.questions)
this.generateGroupControls();
console.log( this.questions_JSON.questions)
this.questionService.notify(this.questions_JSON)
if(this.questions_JSON.questions){
this.questions_JSON.questions.forEach(element => {
if(element.question instanceof Array){
element.question.forEach(e => {
console.log(e.question)
});
}else{
console.log(this.questions_JSON.questions)
}
});
}
}
generateGroupControls() {
if(this.json_answers && this.json_answers != null){
this.isDefaultGenerated = true;
console.log( this.questions_JSON.questions)
this.questions_JSON.questions.forEach(parent_ques=>{
// debugger;
// FOR ADDING THE GROUP QUES TO DISPLAY WITHOUT CONSIDERING INDEX 0
if(parent_ques.is_repeatable == '1'){
if(this.json_answers[parent_ques.group_key] && this.json_answers[parent_ques.group_key].length > this.form_group_name.value[parent_ques.group_key].length) {
// this.json_answers[parent_ques.group_key].mobile_numbers= [{mobile_no:93299},{mobile_no:948392}]
this.json_answers[parent_ques.group_key].forEach((group_ques,g_i)=>{
// debugger;
if(g_i != 0){
// let parent_control=this.form_group_name
// if(parent_control.value.hasOwnProperty('questions_group')){
this.addData(g_i,parent_ques)
// }
}
// FOR CHILD REPEATABLE
let keys= Object.keys(group_ques)
keys.forEach((vv,key_index)=>{
if(typeof(group_ques[vv]) != 'string') {
if(group_ques[vv] && group_ques[vv].length > 0) {
//
group_ques[vv].forEach((child_val,child_index)=>{
if(child_index != 0) {
let find_json = parent_ques.group_questions[g_i].filter(val=>val.hasOwnProperty('group_key') && val.group_key == vv)
if(find_json.length > 0) {
find_json = find_json[0]
this.addSecondLevelChild(g_i,find_json,this.form_group_name.get(parent_ques.group_key)['controls'][g_i])
}
}
})
}
}
})
})
}
}
})
}
}
ngOnChanges() {
// console.log(this.questions_JSON,this.json_answers,this.questionService);
// debugger
// if(this.json_answers && this.json_answers != null ){
// this.questions_JSON.questions.forEach(parent_ques=>{
// console.log(parent_ques);
// // debugger;
// // FOR ADDING THE GROUP QUES TO DISPLAY WITHOUT CONSIDERING INDEX 0
// if(parent_ques.is_repeatable == '1'){
// console.log(this.json_answers[parent_ques.group_key]);
// debugger;
// this.json_answers[parent_ques.group_key].forEach((group_ques,g_i)=>{
// console.log(parent_ques,g_i)
// debugger;
// if(g_i != 0){
// // let parent_control=this.form_group_name
// // if(parent_control.value.hasOwnProperty('questions_group')){
// this.addData(g_i,parent_ques)
// // }
// }
// })
// }
// })
// }
// this.form_group_name=new FormGroup({questions:this._fb.array([])})
// this.form_group_name.valueChanges.subscribe(()=>{
// this.form_group_name.updateValueAndValidity();
// })
// debugger;
// this.form_group_name.patchValue(this.json_answers)
}
addData(index,json_obj) {
let control_names:any= {}
let control = this.form_group_name.get(json_obj.group_key) as FormArray
json_obj.question.map(val=>{
// FOR CHILD REPEATABLE
if(val.is_repeatable == '2') {
val.question.map(rr=>{
control_names[val.group_key]=this._fb.array([this._fb.group({[rr.question_key]:''})])
// control_names[val.group_key].push({[rr.question_key]:''})
})
}
else {
control_names[val.question_key] = ''
}
})
// debugger;
json_obj.group_questions.push(json_obj.question);
control.push(this._fb.group(control_names))
json_obj.question.forEach((group_indi,arr_index)=>{
if(group_indi.is_repeatable == '2' && group_indi.hasOwnProperty('questions_level_two') && group_indi.questions_level_two.length > 0) {
group_indi.questions_level_two[0].forEach((child_val,child_index)=> {
// console.log("sd",group_indi,arr_index,control.at(control.length-1),control)
// debugger;
let child_control = control.at(control.length-1).get(group_indi.group_key) as FormArray
this.questionService.addAdditionalControl(child_val, child_control.controls[child_control.length-1], child_index)
})
}
else{
this.questionService.addAdditionalControl(group_indi, control.controls[control.length-1], arr_index)
}
})
json_obj.question = JSON.parse(JSON.stringify(json_obj.question))
control.updateValueAndValidity();
control.controls[control.length-1].updateValueAndValidity();
this.form_group_name.updateValueAndValidity();
this.step = control.length-1
// debugger;
}
// ADDING A CHILD REPEATABLE OBJ IN A EXISTING FORM ARRYA
addSecondLevelChild(index,json_obj,parent_group) {
let control_names:any= {}
let control = parent_group.get(json_obj.group_key) as FormArray
json_obj.question.map(val=>{
control_names[val.question_key] = ''
})
json_obj.questions_level_two.push(json_obj.question);
control.push(this._fb.group(control_names))
json_obj.question.forEach((group_indi,arr_index)=>{
// console.log("sd",childControl)
this.questionService.addAdditionalControl(group_indi, control.controls[control.length-1], arr_index)
})
json_obj.question = JSON.parse(JSON.stringify(json_obj.question))
control.updateValueAndValidity();
control.controls[control.length-1].updateValueAndValidity();
parent_group.updateValueAndValidity();
this.step_child = control.length-1
// debugger;
}
// REMOVE OF CHILD REPEATABLE OBJ
removeSecondLevelChild(index,json_obj,parent_group) {
// debugger;
let control = parent_group.get(json_obj.group_key)
control.removeAt(index)
json_obj.questions_level_two.splice(index,1)
this.step_child = control.length-1
}
removeData(index,json_obj) {
// debugger;
let control = this.form_group_name.get(json_obj.group_key) as FormArray
control.removeAt(index)
if(this.json_answers[json_obj.group_key] ){
if(this.json_answers[json_obj.group_key] != null && this.json_answers[json_obj.group_key] instanceof Array){
this.json_answers[json_obj.group_key].splice(index,1)
}
}
json_obj.group_questions.splice(index,1)
this.step = control.length-1
}
openMatExpansionPanel() {
if(this.matExpansionPanel!= undefined){
this.matExpansionPanel.open()
}
}
openAllPanels(){
this.Accordion.openAll();
return;
}
updateAllComplete(a,b){
console.log(a)
console.log(b.checked)
if(b.checked){
this.vr = true
}else{
this.vr = false
}
}
}

View File

@ -0,0 +1,230 @@
<section [formGroup]="formGroupN">
<!-- <mat-checkbox [checked]="check == true || false" (change)="updateAllComplete(parent_ques.question_key,$event)"> -->
<div *ngIf="parent_ques.title && parent_ques.disable != true" fxLayout="row" style=" width: 100%" >
<mat-card-header>
<mat-card-title> {{parent_ques.title}} </mat-card-title>
</mat-card-header>
<br />
<br style="clear: both;"/>
</div>
<div *ngIf="parent_ques.sub_title" fxLayout="row" >
<mat-card-subtitle style="font-size: 18px;color: #0d93a9 !important;font-weight: bold;"*ngIf="parent_ques.sub_title" >
{{parent_ques.sub_title}}
</mat-card-subtitle>
<!-- <br />
<br style="clear: both;"/> -->
</div>
<!-- {{formGroupN.value | json}} -->
<mat-card-content>
<mat-form-field style="width: 100%" *ngIf="parent_ques.disable != true && parent_ques.type == '1' && !parent_ques.is_hidden"
>
<mat-label>{{parent_ques.question}}</mat-label>
<input matInput [required]="parent_ques.required == true"
[type]="parent_ques.field_type == 'num' || parent_ques.field_type == 'numtoword' ? 'number' : parent_ques.field_type== 'string' ? 'text' : parent_ques.field_type"
[formControlName]="parent_ques.question_key" [placeholder]="parent_ques.place_holder" autocomplete="off"
(change)="onChangeProperty($event,parent_ques,parent_ques.question_key)">
<!-- [placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" -->
<mat-hint
*ngIf="formGroupN.value[parent_ques.question_key] != '' && (parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword')"
align="end" style="font-size: 12px;">{{"&#8377;"}} {{formGroupN.value[parent_ques.question_key] | numberToWords}}
</mat-hint>
<!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> -->
<!-- {{formGroupN.value | json}} -->
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<mat-form-field style="width:100%"
*ngIf="parent_ques.disable != true && parent_ques.type == '9'" >
<mat-label>{{parent_ques.question}}</mat-label>
<input matInput [type]="parent_ques.field_type == 'num' || parent_ques.field_type == 'numtoword' ? 'number' : parent_ques.field_type== 'string' || parent_ques.field_type == 'str&numtoword' ? 'text' : parent_ques.field_type"
[formControlName]="parent_ques.question_key" [placeholder]="parent_ques.place_holder" [required]="parent_ques.required == true"
(change)="onChangeProperty($event,parent_ques,parent_ques.question_key)"
[matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" (optionSelected) = "onChangeProperty($event,parent_ques,parent_ques.question_key)">
<mat-option *ngFor="let val of autoCompleteAns | async" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer"
>
<span>{{val.answer}}</span>
</mat-option>
</mat-autocomplete>
<mat-hint
*ngIf="formGroupN.value[parent_ques.question_key] != '' && (parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword')"
align="end" style="font-size: 12px;">{{"&#8377;"}} {{formGroupN.value[parent_ques.question_key] | numberToWords}}
</mat-hint>
<!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> -->
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<!-- <mat-form-field> -->
<div class="radio-gap" *ngIf="parent_ques.disable != true && parent_ques.type == '2'">
<mat-label >{{parent_ques.question}}</mat-label><br />
<mat-radio-group aria-label="Select an option" [formControlName]="parent_ques.question_key" [required]="parent_ques.required == true"
(change)="onChangeProperty($event,parent_ques,'','','')">
<mat-radio-button class="radio-btn-gap" *ngFor="let val of parent_ques.answers" [required]="parent_ques.required == true"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br /><br />
</mat-radio-group>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error style="font-size:12px" align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.disable != true && parent_ques.type == '3'">
<mat-label>{{parent_ques.question}}</mat-label>
<mat-select [formControlName]="parent_ques.question_key" (selectionChange)="onChangeProperty($event,parent_ques,'','','')" [required]="parent_ques.required == true">
<mat-option>Select</mat-option>
<mat-option *ngFor="let val of parent_ques.answers"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer"
(click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option"><mat-icon *ngIf="val.is_others == '-1'">add_circle_outline</mat-icon> <span>{{val.answer}}</span></mat-option>
</mat-select>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<div class="radio-gap" [formArrayName]="parent_ques.question_key" *ngIf=" parent_ques.disable != true && parent_ques.type == '5'">
<mat-label>{{parent_ques.question}}</mat-label>
<mat-checkbox class="radio-btn-gap" *ngFor="let val of parent_ques.answers;let i=index" [checked]="checkCat(val.answer,parent_ques)"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer" [required]="parent_ques.required == true"
(change)="onChange_checkbox($event,parent_ques);onChangeProperty($event,parent_ques,'','','')">{{val.answer}}</mat-checkbox><br />
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
<!-- {{formGroupN.value[parent_ques.question_key] | json}} -->
</div>
<div class="toggle" fxLayout="row nowrap" *ngIf=" parent_ques.disable != true && parent_ques.type == '12'">
<mat-label>{{parent_ques.question}}</mat-label>&nbsp;&nbsp;
<mat-slide-toggle [formControlName]="parent_ques.question_key" [required]="parent_ques.required == true" color="primary"></mat-slide-toggle>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</div>
<mat-form-field style="width: 100%" *ngIf="parent_ques.disable != true && parent_ques.type == '11'">
<mat-label>{{parent_ques.question}}</mat-label>&nbsp;&nbsp;
<input matInput [formControlName]="parent_ques.question_key" [matDatepicker]="picker">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="parent_ques.disable != true && parent_ques.type == '4'">
<mat-label>{{parent_ques.question}}</mat-label>
<mat-select multiple [formControlName]="parent_ques.question_key" [required]="parent_ques.required == true"
(selectionChange)="onChangeProperty($event,parent_ques,'','','')">
<!-- <mat-option>Select</mat-option> -->
<mat-option *ngFor="let val of parent_ques.answers"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-option>
</mat-select>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<!-- <div *ngIf="parent_ques.type == '6'">
<ion-grid>
<ion-row>
<ion-col col-6 no-padding align-self: center text-center>
<div>
<img *ngIf="parent_ques.get('answer_value').value != ''" [src]="parent_ques.get('answer_value').value"
imageViewer class="doc-image-bucket"><br />
<label><strong>{{parent_ques.get('question').value}}</strong></label>
</div>
<ion-row style="justify-content: center">
<ion-col col-8>
<button ion-button clear color="optblue" [disabled]="sales_pd_type == '2'"
(click)="captureImg('',parent_ques)">
<ion-icon style="font-size: 30px" name="md-camera"></ion-icon>
</button>
</ion-col>
<ion-col col-4 *ngIf="parent_ques.get('is_image_status').value == true">
<ion-spinner name="crescent" style="width: 20px;
height: 20px;" (click)="cancelLoader(parent_ques)" *ngIf="parent_ques.get('is_loader').value == true">
</ion-spinner>
<ion-icon style="color: #008828;float: right;
margin-right: 30%;" *ngIf="parent_ques.get('is_saved').value == true" name="checkmark-circle-outline">
</ion-icon>
<span style="margin:0px;" *ngIf="(parent_ques.get('is_saved').value == false &&
parent_ques.get('is_loader').value == false) && (parent_ques.value.hasOwnProperty('is_saved') &&
parent_ques.value.hasOwnProperty('is_loader'))" (click)="imageReupload(parent_ques)">
<ion-row style="margin-top: -17px;padding:0px;"><button ion-button clear>
<ion-icon style="color:lightcoral;" name="refresh-circle"></ion-icon>
</button></ion-row>
<ion-row style="margin-top: -20px;padding:0px;">
<p style="font-size: 10px">Click to ReUpload</p>
</ion-row>
</span>
</ion-col>
</ion-row>
</ion-col>
<hr />
</ion-row>
</ion-grid>
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</div> -->
<mat-form-field style="width: 100%" *ngIf="parent_ques.disable != true && parent_ques.type == '7'" >
<mat-label>{{parent_ques.question}}</mat-label>
<textarea matInput type="text" rows="3" [formControlName]="parent_ques.question_key" placeholder="Enter the Text"
autocomplete="off" (change)="onChangeProperty($event,parent_ques,parent_ques.question_key)" [required]="parent_ques.required == true"></textarea>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="parent_ques.disable != 'true' && parent_ques.type == '8'" (click)="ngxFilteredValue.next(parent_ques.answers)">
<mat-label>{{parent_ques.question}}</mat-label>
<mat-select [formControlName]="parent_ques.question_key" (selectionChange)="onChangeProperty($event,parent_ques,'','','')" [required]="parent_ques.required == true">
<mat-option>
<ngx-mat-select-search [formControl]="commonFilterCtrl" [placeholderLabel]="'Search'"
[noEntriesFoundLabel]="'No Matching Result'" >
<mat-icon ngxMatSelectSearchClear>close</mat-icon>
</ngx-mat-select-search>
</mat-option>
<mat-option>Select</mat-option>
<mat-option
*ngFor="let val of ngxFilteredValue | async"
[value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer"
(click)="newAnswerCreateDialog(val,parent_ques)" class="large-select-option"><mat-icon *ngIf="val.is_others == '-1'">add_circle_outline</mat-icon> <span>{{val.answer}}</span></mat-option>
</mat-select>
<ng-container *ngFor="let validation of parent_ques.validations" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="formGroupN.get(parent_ques.question_key).hasError(validation.name.toLowerCase())">
{{validation.message}}</mat-error>
</ng-container>
</mat-form-field>
</mat-card-content>
<!-- </mat-checkbox> -->
</section>

View File

@ -0,0 +1,90 @@
mat-radio-button,mat-checkbox{
margin-top: 13px;
}
mat-form-field {
width: 100%;
}
.radio-gap{
margin-top: 10px;
margin-bottom: 10px;
}
.radio-btn-gap{
margin:10px;
}
::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle{
border-color:rgb(212, 15, 15);
}
::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle{
color:rgb(212, 15, 15);
background-color:rgb(212, 15, 15);
}
::ng-deep .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
background-color:rgba(224, 22, 22, 0.308);
}
input {
// width: 100px;
// border-radius: 4px;
// border-color: gray;
// font-size: 12px;
height: 31px;
}
.mat-select, .text-area {
margin-top: 8px;
}
@-webkit-keyframes highlight-fade {
0% {
background: orange;
}
100% {
background: white;
}
}
@-moz-keyframes highlight-fade {
0% {
background: orange;
}
100% {
background: white;
}
}
@-ms-keyframes highlight-fade {
0% {
background: orange;
}
100% {
background: white;
}
}
@keyframes highlight-fade {
0% {
background: orange;
}
100% {
background: white;
}
}
.field_highlight {
-webkit-animation: highlight-fade 4s ease-out;
-moz-animation: highlight-fade 4s ease-out;
-o-animation: highlight-fade 4s ease-out;
animation: highlight-fade 4s ease-out;
// background: blue;
}
::ng-deep .mat-form-field-label{
white-space: pre-wrap;
}
.large-select-option {
height: unset !important;
line-height: 1.2em !important;
padding-top: 0.9em !important;
padding-bottom: 0.9em !important;
span {
white-space: normal;
}
}

View File

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

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { QuesFormService } from './ques-form.service';
describe('QuesFormService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: QuesFormService = TestBed.get(QuesFormService);
expect(service).toBeTruthy();
});
});

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="75" align="left" style="padding: 1% !important" [ngStyle.xs]="{'font-size':'16px','font-weight':'bold'}" [ngStyle]="{'background-color':role_id == '20' ? '#0d93a9' :'#f44336'}">
<!-- <span>{{main_applicant}} {{lender_applicant_id ? '('+lender_applicant_id+')' : ''}}, {{customer_segment_abbr}} - {{subproduct_abbr}} </span><br> -->
{{questions_JSON.section_name}}
</div>
<div fxFlex="25" align="end" style="padding: 10px !important;" [ngStyle]="{'background-color':role_id == '20' ? '#0d93a9' :'#f44336'}">
<button style="background-color: white;" [ngStyle]="{'color':role_id == '20' ? '#0d93a9' :'#f44336'}" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
matTooltipPosition="right" mat-dialog-close>
<mat-icon>close</mat-icon>
</button>
</div>
</h2>
<!-- <form [formGroup]="docsCollectedForm"> -->
<mat-dialog-content [ngStyle]="{'border-bottom':role_id == '20' ? '2px solid #0d93a9' :'2px solid #f44336'}">
<h5 style="text-align: center;" *ngIf="questions_JSON.questions.length == 0 && !is_loading">No Templates Found</h5>
<h5 style="text-align: center;" *ngIf="questions_JSON.questions.length == 0 && is_loading">Loading...</h5>
<mat-card *ngIf="questions_JSON.questions.length > 0">
<!-- <mat-card-header>
<mat-card-title>
<h5>{{questions_JSON.section_name}}</h5>
</mat-card-title>
</mat-card-header> -->
<mat-card-content>
<app-dynamic-form [questions_JSON]="questions_JSON" [form_group_name] = "commonFormGroup" [json_answers]="quesService.formanswers"></app-dynamic-form>
</mat-card-content>
</mat-card>
</mat-dialog-content>
<!-- <mat-dialog-actions *ngIf="questions_JSON.questions.length > 0">
<div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="common_remarks"></textarea>
</mat-form-field>
</div>
<div fxFlex="40" align="end" >
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit"
matTooltipPosition="above" (click)="saveForm()" [disabled]="disableAfterSubmit===true">
<mat-icon>save</mat-icon>
</button>
</div>
</mat-dialog-actions> -->
<mat-dialog-actions>
<div fxFlex="60" class="pb-0 text-sm-left" align="left" *ngIf="questions_JSON.questions.length > 0" >
<!-- <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Other Remarks" ></textarea>
</mat-form-field> -->
</div>
<div fxFlex="40" align="end">
<button [ngStyle]="{'color':role_id == '20' ? '#0d93a9' :'#f44336'}" class="float" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit"
matTooltipPosition="above" (click)="saveForm(1)" >
<mat-icon>save</mat-icon>
</button>
</div>
</mat-dialog-actions>
<!-- <notifier-container></notifier-container> -->

View File

@ -0,0 +1,43 @@
.float{
float: right;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
}
::ng-deep { .no-padding > mat-dialog-container {
// background: black;
padding: 0;
overflow-y: scroll !important;
}
}
::ng-deep .mat-dialog-content {
margin: inherit !important;
}
.mat-dialog-content{
// margin:0px !important;
margin: inherit !important;
}
// mat-placeholder{
// margin-top: 20px;
// word-wrap: break-word;
// }
// input{
// height:40px;
// }
.mat-form-field-label {
white-space: normal;
}
textarea.mat-input-element {
padding: 0px 0;
margin: 5px 0;
}
.mat-input-placeholder {
white-space: normal;
}

View File

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

View File

@ -0,0 +1,638 @@
import { Component, Inject, OnInit, ViewChild, Input } from '@angular/core';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material';
import { ActivatedRoute, Router } from '@angular/router';
import { AwsService } from 'app/AwsService/aws.service';
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import { environment } from 'environments/environment';
// import { environment } from 'environments/environment';
import { DynamicFormComponent } from '../dynamic-form/dynamic-form/dynamic-form.component';
import { QuesFormService } from '../dynamic-form/ques-form/ques-form.service';
import { FlyhiService } from 'app/fly-hi/services/flyhi.service';
import { FormGroup, FormBuilder } from '@angular/forms';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.scss'],
})
export class FormComponent implements OnInit {
anslength:any;
form_id: number;
parent_pdid: any;
pdid: any;
private notifier: NotifierService;
main_applicant: any;
lender_applicant_id: any;
subproduct_abbr: any;
customer_segment_abbr: any;
lenderShortName: any;
fk_pd_type: any;
image_doc_params: { pdid: any; form_id: any; company_id: string; };
questions_JSON: any = {questions:[],section_name:''};
commonFormGroup:FormGroup;
@Input() json_answers:any;
@ViewChild(DynamicFormComponent) formComponent:DynamicFormComponent
is_loading: boolean = false;
pd_all_details: any=[];
pdMasterList:any=[];
template_id: any;
sales_pd_id: any;
completeStatus: any;
role_id: string;
constructor(notifier: NotifierService,
private fb: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService,
private questionService:QuesFormService,
private dialogRef: MatDialogRef<FormComponent>,
private dialog: MatDialog, public quesService:QuesFormService,
@Inject(MAT_DIALOG_DATA) public jsonData: any,private _flyhi:FlyhiService,
private awsService:AwsService,private loaderService:LoaderService) {
this.role_id = localStorage.getItem('LenderRoleID')
console.log(jsonData)
this.questions_JSON = this.jsonData.Json['sections'][0];
// this.questions_JSON = this.jsonData.Json['sections'][0];
this.notifier = notifier;
}
ngOnInit() {
this.loadTemplate()
// this.getSectionData()
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
let resultData=null;
// let key_value='43';
this.sales_pd_id = key_value
console.log('key value',key_value,this.sales_pd_id);
if(key_value != null){
this.loaderService.showMatSpinnerDialog('Please wait')
console.log('key value',key_value,this.sales_pd_id);
this._flyhi.getPDSectionData(this.sales_pd_id,this.questions_JSON.section_id,'').subscribe(result=>{
if(result['dataStatus']) {
let records = result['records'][0].section_data
console.log(JSON.parse(records))
let values = JSON.parse(records)
console.log(values)
let formValues:any ={};
// console.log(records.hasOwnProperty('json'))
// if(records && records.hasOwnProperty('json') && records.json) {
formValues = values.json
console.log(formValues)
this.quesService.formanswers= formValues
this.loaderService.closeMatSpinnerDialog()
// if(formValues.key_stakeholders[0].stakeholder_length=='2')
// {
// let controlcount='2';
// this.quesService.ques_length(controlcount)
// this.loadTemplate()
// }
// else
// {
// let controlcount1='3';
// this.quesService.ques_length(controlcount1)
// this.loadTemplate()
// }
// if(formValues.key_stakeholders[0].stakeholder_length=="undefined")
// {
// }
// }
}
// else
// {
// let params = {"pd_id":this.pdMasterList.pd_id,"random_string":this.pdMasterList.random_string,"form_id":this.pd_all_details.form_id}
// this._flyhi.loadDataFromExcel(params).subscribe(result=>{
// if(result['dataStatus']) {
// let records = result['records']
// let formValues1:any ={};
// if(records ) {
// formValues1 = records
// if(formValues1.key_stakeholders[0].stakeholder_length=='2')
// {
// let controlcount='2';
// this.quesService.ques_length(controlcount)
// this.loadTemplate()
// }
// else
// {
// let controlcount1='3';
// this.quesService.ques_length(controlcount1)
// this.loadTemplate()
// }
// }
// }
// })
// }
})
}
else{
this.loaderService.closeMatSpinnerDialog()
}
// if(this.pd_all_details.form_id=='5' && this.pdMasterList.product_abbr=='LFMP')
// {
// let params = {"fk_pd_id":this.pdMasterList.pd_id,"fk_form_id":this.pd_all_details.form_id}
// this._flyhi.getPDSectionData(params,params,params).subscribe(result=>{
// if(result['dataStatus']) {
// let records = result['records']
// let formValues:any ={};
// if(records && records.hasOwnProperty('json') && records.json) {
// formValues = JSON.parse(records.json)
// if(formValues.key_stakeholders[0].stakeholder_length=='2')
// {
// let controlcount='2';
// this.quesService.ques_length(controlcount)
// this.loadTemplate()
// }
// else
// {
// let controlcount1='3';
// this.quesService.ques_length(controlcount1)
// this.loadTemplate()
// }
// // if(formValues.key_stakeholders[0].stakeholder_length=="undefined")
// // {
// // }
// }
// }
// // else
// // {
// // let params = {"pd_id":this.pdMasterList.pd_id,"random_string":this.pdMasterList.random_string,"form_id":this.pd_all_details.form_id}
// // this._flyhi.loadDataFromExcel(params).subscribe(result=>{
// // if(result['dataStatus']) {
// // let records = result['records']
// // let formValues1:any ={};
// // if(records ) {
// // formValues1 = records
// // if(formValues1.key_stakeholders[0].stakeholder_length=='2')
// // {
// // let controlcount='2';
// // this.quesService.ques_length(controlcount)
// // this.loadTemplate()
// // }
// // else
// // {
// // let controlcount1='3';
// // this.quesService.ques_length(controlcount1)
// // this.loadTemplate()
// // }
// // }
// // }
// // })
// // }
// })
// if(this.pd_all_details.is_answered == '1') {
// this.getSectionData()
// }
// else{
// this.getExcelData();
// }
// }
// else
// {
// this.loadTemplate()
// if(this.pd_all_details.is_answered == '1') {
// this.getSectionData()
// }
// else{
// this.getExcelData();
// }
// }
}
loadTemplate() {
this.commonFormGroup = new FormGroup({})
this.questions_JSON = this.jsonData.Json['sections'][0];
console.log(this.questions_JSON)
}
getSectionData() {
// let params = {"fk_pd_id":this.pdMasterList.pd_id,"fk_form_id":this.pd_all_details.form_id}
// let params = { "pd_id":this.pdMasterList.pd_id,"pd_form_id":this.jsonData.FormData.form_id}
// console.log(params)
console.log(this.jsonData)
let form_group = this.jsonData.FormData.is_group_form
//let params :any = {"pdid":this.pdMasterList.pd_id,"parent_pdid":this.pdMasterList.pd_id,formid:this.jsonData.FormData.form_id,"json":this.commonFormGroup.getRawValue(),fk_createdby:''}
this._flyhi.getPDSectionData(this.pdMasterList,this.jsonData.FormData.form_id,form_group).subscribe(result=>{
console.log(result)
if(result['dataStatus']) {
let records = result['records']
let formValues:any ={};
if(records && records.hasOwnProperty('json') && records.json) {
//formValues = JSON.parse(records.json)
formValues = records.json
this.quesService.formanswers= formValues
this.loaderService.showMatSpinnerDialog("")
// setTimeout(()=>{
// this.quesService.formanswers = null
// },2000)
// this.commonFormGroup.patchValue(formValues)
}
}
if(this.pdMasterList.re_uploaded == '1' && this.pd_all_details.is_reupload_data_fetched != '1') {
// console.log("Reuploaded excel")
// let data = {"permanant_employees_person_met":"1","temporary_employees_person_met":"2","permanant_employees_cm":"3","temporary_employees_cm":"45","permanant_employees_salary":"55","temporary_employees_salary":"55","common_remarks":"dummy datas"}
// setTimeout(()=>{
// this.commonFormGroup.patchValue(data)
// },1000)
this.getExcelData(1)
}
})
}
getExcelData(re_uploaded?) {
// let params = {"pd_id":this.pdMasterList.pd_id,"random_string":this.pdMasterList.random_string,"form_id":this.pd_all_details.form_id}
// this._flyhi.loadDataFromExcel(params).subscribe(result=>{
// if(result['dataStatus']) {
// let records = result['records']
// let formValues:any ={};
// if(records ) {
// formValues = records
// // records.forEach(val=>{
// // if(val) {
// // formValues[val.key_name] = val.value
// // }
// // })
// // console.log(formValues)
// // debugger;
// if(re_uploaded && re_uploaded == '1') {
// this.commonFormGroup.patchValue(formValues)
// }
// else {
// this.loaderService.showMatSpinnerDialog("")
// this.quesService.formanswers= formValues
// // setTimeout(()=>{
// // this.quesService.formanswers = null
// // },2500)
// }
// // this.commonFormGroup.patchValue(formValues)
// }
// }
// })
}
getLocalFormId() {
// console.log(this.pd_all_details)
switch(this.pd_all_details.form_id) {
case '5':
return 2
break
case '18':
return 1
break;
case '10':
return 3
break;
}
}
private markFormGroupTouched(formGroup: FormGroup) {
(<any>Object).values(formGroup.controls).forEach(control => {
control.markAsTouched();
if (control.controls) {
this.markFormGroupTouched(control);
}
});
}
public findInvalidControls() {
const invalid = [];
let msg=''
// let formArray:any = this.commonFormGroup ;
// console.log(formArray);
// for( const group in <any>(this.commonFormGroup.controls)) {
// if(group.invalid) {
// console.log(group,group.value.form_name,this.commonFormGroup.controls);
// debugger;
// msg= group.value.form_name+" are not complete"
// let index = this.stepperInfo.findIndex(vv=>vv.form_id == group.value.form_id);
// console.log("Index",index);
// if(index != -1) {
// msg = this.stepperInfo[index].form_name+" are not complete"
// this.myStepper.selectedIndex = this.stepperInfo[index].stepper_index
// }
for (const name in <any>(this.commonFormGroup.controls)) {
// console.log(this.commonFormGroup.controls[name],name)
if (this.commonFormGroup.controls[name].invalid) {
invalid.push(name);
let invalidFields = [].slice.call(document.getElementsByClassName('ng-invalid'));
let firstInvalidField;
for(let val in invalidFields){
if( invalidFields[val].nodeName == 'MAT-FORM-FIELD' || invalidFields[val].nodeName == 'MAT-SELECT' || invalidFields[val].nodeName == 'TEXTAREA' || invalidFields[val].nodeName == 'MAT-RADIO-GROUP' ){ //INPUT FOR INPUT FIELD
firstInvalidField=invalidFields[val]
break;
}
}
if(firstInvalidField != undefined){
// firstInvalidField.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"})
this.formComponent.openMatExpansionPanel()
setTimeout(()=>{
firstInvalidField.scrollIntoView({block: "start", inline: "nearest"})
setTimeout(()=>{
firstInvalidField.focus()
},0)
// firstInvalidField.style.background = 'red'
firstInvalidField.classList.remove('field_highlight')
setTimeout(()=>{
firstInvalidField.classList.add('field_highlight')
},300)
},300)
// this.myStepper.selectedIndex = 0;
}
else {
// msg = this.stepperInfo[index].form_name+" images are not taken"
}
// console.log("kkdd",group['controls'][name],firstInvalidField)
// if(typeof(group['controls'][name].value) == 'string') {
// return name+' field is not '
// }
break
}
}
// }
// }
// let business_group_ctrl = formArray.at(2).get('business_group') as FormArray
// const controls = this.getQuestionControl().at(1)['controls']
// for (const name in controls) {
// if (controls[name].invalid) {
// invalid.push(name);
// }
// }
return invalid;
}
saveForm(flag) {
console.log(this.commonFormGroup.getRawValue())
let jsonParamData = this.commonFormGroup.getRawValue()
this.completeStatus = flag
console.log(this.jsonData)
//console.log("values",this.commonFormGroup.getRawValue(),this.questions_JSON)
if(this.commonFormGroup.invalid) {
this.commonFormGroup.markAsDirty();
this.commonFormGroup.markAsTouched()
this.markFormGroupTouched(this.commonFormGroup)
let invalidfield = this.findInvalidControls()
console.log("Invalid field",invalidfield)
this.notifier.notify("info","Please fill all the required fields");
this.formComponent.openAllPanels()
return
}
let checkProperty=this.onSubmitProperty()
console.log("check rp",checkProperty)
if(checkProperty == false){
return;
}
this.loaderService.showMatSpinnerDialog('')
// "pdid":"2888","parent_pdid":"2888","formid":"5","fk_createdby":"165"
// let params:any ;
console.log(this.jsonData)
// if(this.jsonData.hasOwnProperty("Form_parent")){
// console.log(this.jsonData)
// let form_group = this.jsonData.Form_parent.is_group_form
// let company_id = this.jsonData.Form_parent.is_business_form
// if(company_id == 1){
// params = {"pdid":this.pdMasterList.pd_id,"parent_pdid":this.pdMasterList.pd_id,formid:this.jsonData.FormData.form_id,"json":this.commonFormGroup.getRawValue(),fk_createdby:'',"company_id":company_id,"template_id": this.template_id}
// }
// }else{
// params = {"pdid":this.pdMasterList.pd_id,"parent_pdid":this.pdMasterList.pd_id,formid:this.jsonData.FormData.form_id,"json":this.commonFormGroup.getRawValue(),fk_createdby:'',"template_id": this.template_id}
// }
// if(this.pdMasterList.re_uploaded == '1') {
// params.is_reupload_data_fetched = '1'
// }
// console.log(params)
this._flyhi.get_Pd_Id(jsonParamData).subscribe(result=>{
console.log(result)
if(result['dataStatus']) {
console.log(result)
this.sales_pd_id = result['records']
if(result['records'] != true && typeof(result['records']) != 'object'){
console.log('1710')
this.sales_pd_id = result['records']
localStorage.setItem('sales_pd_id_PRIMARYKEY',String(result['records']))
// this.SalesPdService.insertData_Replace('sales_pd_id_PRIMARYKEY',String(apiresult['records'])).then(local_result=>{
localStorage.setItem('sales_rand_string',String(result['rand_string']))
// this.SalesPdService.insertData_Replace('sales_rand_string',String(apiresult['rand_string'])).then(()=>{
// console.log(this.submit_btn)
this.sendSectionData(this.jsonData,this.completeStatus)
// if(!this.submit_btn){
// console.log('1718')
// this.sendSectiontoApi(section_data)
}else{
this.sendSectionData(this.jsonData,this.completeStatus)
}
// this.notifier.notify("success","Saved successfully..")
// setTimeout(()=>{
// this.dialogRef.close('refresh')
// },1500)
}
// else {
// this.notifier.notify("warning","Something went wrong");
// }
// this.loaderService.closeMatSpinnerDialog()
},err=>{
// this.loaderService.closeMatSpinnerDialog()
// this.notifier.notify("warning","Network Error");
})
}
sendSectionData(JSONData,completeStatus){
console.log(JSONData)
let userid:any=localStorage.getItem("user_details")
userid=JSON.parse(userid).userid;
console.log(userid)
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
let orderid
if(this.questions_JSON.section_id == 1){
orderid = 1
}else{
orderid = 2
}
let params:any
params = {"fk_createdby":userid,"order_id":orderid,"is_complete":completeStatus,'onsubmit': null,"json":this.commonFormGroup.getRawValue(),"sales_pd_id":key_value,"section_id":this.questions_JSON.section_id,"section_name":this.questions_JSON.section_name}
console.log(params)
this._flyhi.saveForm(params).subscribe(result=>{
if(result['dataStatus']) {
this.loaderService.closeMatSpinnerDialog()
// this.notifier.notify("success","Saved Successfully");
setTimeout(()=>{
this.dialogRef.close('refresh')
},1500)
}
else {
this.notifier.notify("warning","Something went wrong");
}
this.loaderService.closeMatSpinnerDialog()
},err=>{
this.loaderService.closeMatSpinnerDialog()
this.notifier.notify("warning","Network Error");
})
}
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.questions_JSON.hasOwnProperty('onsubmit') && this.questions_JSON.onsubmit != null){
for(let i=0; i<this.questions_JSON.onsubmit.length ; i++){
// this.quesAnsForm.value.questions.forEach(parent_ques=>{
// let parent_ques
// for( parent_ques of this.commonFormGroup.getRawValue()){
// this.local_ques_JSON.onsubmit.forEach(submitProperty=>{
let submitProperty=this.questions_JSON.onsubmit[i]
if((submitProperty.hasOwnProperty('group_key') && submitProperty.group_key)){
return_val.length = 0
let val=this.calculation(this.commonFormGroup.getRawValue()[submitProperty.group_key],submitProperty)
if(val != true && val != 100){
this.notifier.notify("info",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}());`
let exp1 = `(function (){let sum_val=null;let ques_key=[];
control.forEach(ques_obj=>{ques_key.push(ques_obj[submitProperty.key_name])});console.log('none',ques_key);return new Set(ques_key).size === ques_key.length}())`
let exp2 = `(function (){let sum_val=null;let ques_key=[];
control.forEach(ques_obj=>{ques_key.push(ques_obj[submitProperty.key_name])});console.log('none',ques_key);return new Set(ques_key).size === ques_key.length}())`
//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);
// let val= eval(exp1);
console.log(val)
return val
}
}

View File

@ -0,0 +1,137 @@
<!--Start Image Code-->
<div *ngIf="details.flag == 0">
<h2 mat-dialog-title>
<div fxFlex="70" style="padding: 10px !important;font-weight: bold;">
Image Capture URL
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
</div>
</h2>
<div fxLayout="row" *ngIf="hideDetails == false">
<div fxFlex.xs="70%" fxFlex.sm="70%" fxFlex.md="70%" fxFlex.lg="70%" fxFlex.xl="70%" fxLayoutAlign="start center">
<mat-card class="linkStyle">{{details.Link}}</mat-card>
</div>
<div fxFlex.xs="8%" fxFlex.sm="8%" fxFlex.md="8%" fxFlex.lg="8%" fxFlex.xl="8%" fxLayoutAlign="start center">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="copyToClipBoard(details.Link,'imageURL')" matTooltip="Copy To ClipBoard" matTooltipPosition="below"><mat-icon>file_copy</mat-icon></button>
</div>
<div fxFlex.xs="8%" fxFlex.sm="8%" fxFlex.md="8%" fxFlex.lg="8%" fxFlex.xl="8%" fxLayoutAlign="start center">
<button mat-raised-button class="mr-1 mb-1" color="primary" type="button" (click)="smsCheck(1)" matTooltip="Send Link Via SMS" matTooltipPosition="above" >
<mat-icon>textsms</mat-icon></button>
</div>
</div>
<div fxLayout="row" *ngIf="hideDetails == true" fxLayoutAlign="center center">
<mat-card>
<div fxFlex.xs="100%" fxFlex.sm="100%" fxFlex.md="100%" fxFlex.lg="100%" fxFlex.xl="100%" fxLayoutAlign="center center">
<h3 class="linkStyle">This link will be sent as SMS to (<span>{{details.applicantNo}}</span>). Please proceed if this number is correct, else close this window and edit the applicant mobile number</h3>
</div>
<div fxFlex.xs="100%" fxFlex.sm="100%" fxFlex.md="100%" fxFlex.lg="100%" fxFlex.xl="100%" fxLayoutAlign="center end">
<button mat-raised-button class="mr-1 mb-1" color="primary" type="button" (click)="onClickSmsLink()" matTooltip="Send Link Via SMS" matTooltipPosition="above" ><mat-icon>textsms</mat-icon> Send SMS</button>
</div>
</mat-card>
</div>
</div>
<!--End Image Code-->
<!--Start Video Code-->
<div *ngIf="details.flag == 1">
<h2 mat-dialog-title>
<div fxFlex="50" style="padding: 10px !important;font-weight: bold;">
VIDEO CALL
</div>
<div fxFlex="50" align="end" style="padding: 10px !important;">
<span matTooltip="{{!videoplayback.enableBtn ? 'Recorded video is available after the PD is completed' : 'Play Recorded Video'}}" matTooltipPosition="above">
<!-- [disabled]="!videoplayback.enableBtn" -->
<button [ngStyle]="{'color':roleID == '20' ? '#0d93a9' :'#f44336'}" *ngIf="master.sales_pd_type == '3' || master.sales_pd_type == '4'" mat-stroked-button class="mr-1 mb-1" (click)="openPlayer()" >
<mat-icon>play_circle_filled</mat-icon>&nbsp;
<strong>Play Recorded Video</strong>
</button>
</span>
<button [ngStyle]="{'color':roleID == '20' ? '#0d93a9' :'#f44336'}" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
</div>
</h2>
<div *ngIf="hideDetails == false">
<div fxLayout="row" fxLayoutAlign="center center" style="margin-bottom: 10px;">
<div fxFlex.xs="20%" fxFlex.sm="20%" fxFlex.md="20%" fxFlex.lg="20%" fxFlex.xl="20%" fxLayoutAlign="start center">
<h4 style="color: green !important;padding: 0px;margin: 0px;"> <strong>PDGenie Chat :</strong></h4>
</div>
<div fxFlex.xs="10%" fxFlex.sm="10%" fxFlex.md="10%" fxFlex.lg="10%" fxFlex.xl="10%" fxLayoutAlign="start center">
<button [ngStyle]="{'color':roleID == '20' ? '#0d93a9' :'#f44336'}" disabled="{{pdgenie_hide_button}}" mat-raised-button mat-icon-button class="hover-icon" type="button" (click)="copyToClipBoard(details.videoChatLink,'videoChat')" matTooltip="Copy PDGenie Customer link" matTooltipPosition="below"><mat-icon>file_copy</mat-icon></button>
</div>
<div fxFlex.xs="30%" fxFlex.sm="30%" fxFlex.md="30%" fxFlex.lg="30%" fxFlex.xl="30%" fxLayoutAlign="start center">
<!-- <mat-card class="linkStyle">{{details.videoChatLink}}</mat-card> -->
<button [ngStyle]="{'background-color':roleID == '20' ? '#0d93a9' :'#f44336'}" disabled="{{pdgenie_hide_button}}" mat-button mat-raised-button color="primary" (click)="open_PDGenie_GMeet('PDGenie')" style="width: 184px;">
<mat-icon>video_call</mat-icon>&nbsp;
<strong>Join PDGenie Meet</strong>
</button>
</div>
</div>
<!-- <div fxLayout="row" fxLayoutAlign="center center">
<div fxFlex.xs="20%" fxFlex.sm="20%" fxFlex.md="20%" fxFlex.lg="20%" fxFlex.xl="20%" fxLayoutAlign="start center">
<h4 style="color: green !important;padding: 0px;margin: 0px;"> <strong>Google Meet :</strong></h4>
</div>
<div fxFlex.xs="10%" fxFlex.sm="10%" fxFlex.md="10%" fxFlex.lg="10%" fxFlex.xl="10%" fxLayoutAlign="start center">
<button disabled="{{g_meet_hide_button}}" mat-raised-button mat-icon-button class="hover-icon" type="button" (click)="copyToClipBoard(google_Meet_Link,'G_Meet')" matTooltip="Copy Google Meet link" matTooltipPosition="below"><mat-icon>file_copy</mat-icon></button>
</div>
<div fxFlex.xs="30%" fxFlex.sm="30%" fxFlex.md="30%" fxFlex.lg="30%" fxFlex.xl="30%" fxLayoutAlign="start center">
<button disabled="{{g_meet_hide_button}}" mat-button mat-raised-button color="primary" (click)="open_PDGenie_GMeet('G_Meet')" style="width: 184px;">
<mat-icon>video_call</mat-icon>&nbsp;
<strong>Join Google Meet</strong>
</button>
</div>
</div> -->
<div fxLayout="row" fxLayoutAlign="center center" *ngIf="showLinkCard == true" style="margin-top: 20px;">
<div fxFlex.xs="70%" fxFlex.sm="70%" fxFlex.md="70%" fxFlex.lg="70%" fxFlex.xl="70%" fxLayoutAlign="center center">
<mat-card class="linkStyle">{{pdGenie_GMeet_Link}}</mat-card>
</div>
<!-- <div fxFlex.xs="8%" fxFlex.sm="8%" fxFlex.md="8%" fxFlex.lg="8%" fxFlex.xl="8%" fxLayoutAlign="start center">
<button mat-raised-button class="mr-1 mb-1" color="primary" type="button" (click)="smsCheck(1)" matTooltip="Send Link Via SMS" matTooltipPosition="above" >
<mat-icon>textsms</mat-icon></button>
</div> -->
</div>
</div>
<div fxLayout="row" *ngIf="hideDetails == true" fxLayoutAlign="center center">
<mat-card>
<div fxFlex.xs="100%" fxFlex.sm="100%" fxFlex.md="100%" fxFlex.lg="100%" fxFlex.xl="100%" fxLayoutAlign="center center">
<h3 class="linkStyle">This link will be sent as SMS to (<span>{{details.applicantNo}}</span>). Please proceed if this number is correct, else close this window and edit the applicant mobile number</h3>
</div>
<div fxFlex.xs="100%" fxFlex.sm="100%" fxFlex.md="100%" fxFlex.lg="100%" fxFlex.xl="100%" fxLayoutAlign="center end">
<button mat-raised-button class="mr-1 mb-1" color="primary" type="button" (click)="onClickSmsLink()" matTooltip="Send Link Via SMS" matTooltipPosition="above" ><mat-icon>textsms</mat-icon> Send SMS</button>
</div>
</mat-card>
</div>
</div>
<div *ngIf="details.flag == 2">
<h2 mat-dialog-title>
<div fxFlex="70" style="padding: 10px !important;font-weight: bold;">
VIDEO CALL
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
</div>
</h2>
<div fxLayout="row" fxLayoutAlign="center center" style="margin-top: 20px;">
<div fxFlex.xs="70%" fxFlex.sm="70%" fxFlex.md="70%" fxFlex.lg="70%" fxFlex.xl="70%" fxLayoutAlign="center center">
<button *ngIf="master.fk_pd_type == '3' || master.fk_pd_type == '2'" mat-stroked-button class="mr-1 mb-1" color="primary" (click)="uploadRecordedVideo()">
<mat-icon>videocam</mat-icon>&nbsp;
<strong>Upload</strong>
</button>
<button *ngIf="master.fk_pd_type == '3' || master.fk_pd_type == '2'" mat-stroked-button matTooltip="Play Recorded Video" matTooltipPosition="above" class="mr-1 mb-1" color="primary" (click)="openPlayer()" [disabled]="!videoplayback.enableBtn">
<mat-icon>play_circle_filled</mat-icon>&nbsp;
<strong>Play Recorded Video</strong>
</button>
</div>
</div>
</div>
<!--Start Video Code-->
<notifier-container></notifier-container>

View File

@ -0,0 +1,12 @@
.linkStyle{
width: 100% !important;
padding: 15px !important;
letter-spacing: .00625em !important;
font-family: Roboto,Arial,sans-serif !important;
font-size: 1rem !important;
font-weight: 400 !important;
line-height: 1.5rem !important;
color: #202124 !important;
box-flex: 1 !important;
background-color: #8080803b !important;
}

View File

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

View File

@ -0,0 +1,192 @@
import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material';
import { SectionListComponent } from 'app/sales-pd/section-list/section-list.component';
import { FlyhiService } from '../services/flyhi.service';
import { VideoPlayerComponent } from 'app/video-player/video-player.component';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-image-video',
templateUrl: './image-video.component.html',
styleUrls: ['./image-video.component.scss']
})
export class ImageVideoComponent implements OnInit {
private notifier: NotifierService;
hideDetails: boolean = false;
details: any;
master: any;
g_code: Object | any[];
google_Meet_Link: string;
pdGenie_GMeet_Link: any;
showLinkCard: boolean = false;
videoplayback: any = {enableBtn:true,url:null};
g_meet_hide_button: boolean = false;
pdgenie_hide_button: boolean = false;
roleID: string;
constructor(notifier: NotifierService,
private _fb: FormBuilder,
private dialogRef: MatDialogRef<SectionListComponent>,
private _flyhi: FlyhiService, private dialog: MatDialog,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.details =data
this.notifier = notifier;
console.log(this.details)
this.roleID = localStorage.getItem('user_role')
// if(this.details.flag == 1){
// let masterDetailsData = this.details.masterDetails
// if(masterDetailsData.gmeet_code == '' || masterDetailsData.gmeet_code == null){
// console.log('711 createG_Meet')
// this.createG_Meet()
// // cus_link = 'http://meet.google.com/'+this.pdMasterData[0].gmeet_code;
// } else {
// let g_link = this.details.masterDetails.gmeet_code
// let cus_link = 'http://meet.google.com/'+g_link;
// this.google_Meet_Link = cus_link
// }
// }
// this.master = this.details.masterDetails
this.master = localStorage.getItem('completedPD')
console.log(this.master)
this.master = JSON.parse(this.master)
}
ngOnInit() {
}
/** For Popup Close Button */
closeComponent(): void {
this.dialogRef.close();
}
copyToClipBoard(linkData,iconDetails){
if(iconDetails == 'imageURL'){
this._flyhi.copyToClipBoard(linkData);
this.notifier.notify('info','Image Capture Customer link copied');
}else if(iconDetails == 'videoChat'){
this.g_meet_hide_button = true
this.showLinkCard = true
this._flyhi.copyToClipBoard(linkData);
this.pdGenie_GMeet_Link = this.details.videoChatLink
this.notifier.notify('info','Video Chat Customer link copied');
}else if(iconDetails == 'G_Meet'){
this.pdgenie_hide_button = true
this.showLinkCard = true
this._flyhi.copyToClipBoard(linkData);
this.pdGenie_GMeet_Link = this.google_Meet_Link
this.notifier.notify('info','Google Meet Customer link copied');
}
}
createG_Meet(){
console.log('727 createG_Meet')
let pdid = this.details.masterDetails.pd_id
console.log(pdid)
this._flyhi.create_G_Video_Status(pdid).subscribe(data => {
console.log(data)
if (data['status'] == 200) {
console.log('732')
// console.log('create_G_Video_Status',data)
this.g_code = data
console.log(this.g_code)
if(data['dataStatus'] == true){
let cus_link_Gmeet = 'http://meet.google.com/'+this.g_code['data'].gmeet_code
console.log(cus_link_Gmeet)
this.google_Meet_Link = cus_link_Gmeet
}
} else {
console.log('743')
let msg_G_meet = data['msg']
console.log(msg_G_meet)
this.notifier.notify('info',msg_G_meet);
}
}, error => {
console.log('%c Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!', 'font-weight: bold; font-size: 50px;color: red; ');
});
}
smsCheck(event){
if(event == 1){
this.hideDetails = true
}
}
onClickSmsLink(){
let param={
pd_id: this.master.pd_id,
mobile_no: this.details.applicantNo,
random_string: this.master.random_string,
sms_flag:'1'
// pd_type:master.fk_pd_type
}
// sms_flag options
// 1 - Image Capture for Telepd and smart pd
// 2 - Image Recapture for Telepd and smart pd
this._flyhi.smsLink(param).subscribe(res=>{
if(res['dataStatus']){
this.notifier.notify("info","SMS Sent Successfully")
this.hideDetails = false
}
})
}
open_PDGenie_GMeet(event){
// let dialogRef = this.dialog.open(VideoChatComponent,{
// data:{type:'init',random_string:this.pdMasterData[0].random_string,pd_id:this.viewID},
// maxWidth: '100vw',
// maxHeight: '100vh',
// height: '100%',
// width: '100%',
// disableClose: true,
// panelClass:'video-chat'
// })
if(event == 'PDGenie'){
let url = window.location.origin+'/vchat/#/chat/'+this.master.rand_string+';id='+this.master.sales_pd_id+';type=2'
window.open(url,'_blank')
} else if(event == 'G_Meet'){
let url = this.google_Meet_Link
window.open(url,'_blank')
}
}
openPlayer(){
// if(this.videoplayback.url == null) {
// this.notifier.notify('info',"No Videos Found");
// return;
// }
let params = {"pd_id":this.master.sales_pd_id,"random_string":this.master.rand_string,"pd_category":2}
this._flyhi.getRecordedPlaybackUrl(params).subscribe(result=>{
if(result && result['dataStatus'] && result['records'] && result['records'].length > 0) {
let dialogRef = this.dialog.open(VideoPlayerComponent,{
data:{videoUrl:result['records'],masterData:this.master},
maxWidth: '100vw',
maxHeight: '100vh',
height: '90%',
width: '70%',
disableClose: false,
panelClass:'video-player'
})
}
else {
this.notifier.notify('info',"No Videos Found");
}
})
}
// uploadRecordedVideo() {
// const dialogRef = this.dialog.open(UploadVideoComponent,{
// minWidth:'50vw',
// disableClose:true,
// data:{pd_id:this.master.pd_id,random_string:this.master.random_string}
// // maxWidth:'75vw'
// })
// }
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { FlyhiService } from './flyhi.service';
describe('FlyhiService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: FlyhiService = TestBed.get(FlyhiService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,233 @@
import { Injectable } from '@angular/core';
import { environment } from 'environments/environment';
import { Observable, of, forkJoin } from 'rxjs';
import { HttpClient, HttpParams } from '@angular/common/http';
import { catchError, map } from 'rxjs/operators';
import { Observer } from 'rxjs';
const api_url = environment.apiEndpoint;
@Injectable({
providedIn: 'root'
})
export class FlyhiService {
constructor(private _http:HttpClient) { }
getFlyHiList(is_sales_login){
// let params = new HttpParams().set("paramName",paramValue)
// console.log("Api Stauts ",this.networkProvider.getCurrentNetworkStatus())
let det:any=localStorage.getItem('user_details')
console.log('494',det,localStorage.getItem('user_details'))
det=JSON.parse(det)
console.log('494',det)
// let params = {'fk_entity_id':det.fk_entity_id,userid:det.userid}
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
let complete_url = api_url+'listFlyhiPD'
if(is_sales_login) {
complete_url = complete_url
}
return this._http.get(complete_url).map(res=>{
// this.ionicStorageProvider.checkAndInsertApiDataLocally(res,params,'listSalesPD');
return res;
})
// }
// else{
// return this.ionicStorageProvider.getApiDataFromLocally(params,'listSalesPD');
// }
}
loadPDTemplates2(pdId: string,randomString): Observable<any> {
let httpParams = new HttpParams().set('pd_id', pdId);
httpParams = httpParams.append('random_string',randomString);
// console.log('loadFullTemplate api load httpParams are',httpParams);
const options = pdId ? { params: httpParams } : {};
console.log(options)
//return this._http.get<any[]>(this.apiUrl + "loadFullTemplate", options)
return this._http.get<any[]>(api_url + "loadFullTemplateV2", options)
// .pipe(
// catchError(this.handleError('operation', []))
// )
}
getPDSectionData(sales_pd_id,section_id,form_group) {
let params = {
"sales_pd_id":sales_pd_id,
"section_id":section_id
}
console.log(params)
// if(form_group == 1){
// return this._http.post(api_url+'getPDFormDetails',{ "pd_id":pd_id,"pd_form_id":pd_form_id,"company_id":1})
// }else{
return this._http.post(api_url+'getFlyhiPDSectionData',{"records":params})
// }
}
loadCreditPDTemplate2(form_id,mapid,Formname,template_id):Observable<any> {
//return this._http.get<any[]>(this.apiUrl + "formWiseJSONTemplateV2?form_id=5&map_id=7").map(result)
// return this._http.get<any[]>(this.apiUrl + "formWiseJSONTemplateV2?form_id=5&map_id=7").map(result=>{
// console.log(result)
// let apivalue ={dataStatus:true,records:{template:JSON.stringify(result)}}
// console.log(apivalue)
// return apivalue
// })
// if( Formname == 'Business Information'){
// return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json').map(rr=>{
// let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
// // this.raw_credit_pd_template= returnValue.records.template
// return returnValue
// })
// }else{
if(template_id != null){
return this._http.get<any[]>(api_url + "formWiseJSONTemplateV2?form_id="+form_id+"&map_id="+mapid+"&template_id="+template_id+"").map(result=>{
console.log(result)
let apivalue ={dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
console.log(apivalue)
return apivalue
})
}else{
return this._http.get<any[]>(api_url + "formWiseJSONTemplateV2?form_id="+form_id+"&map_id="+mapid+"").map(result=>{
console.log(result)
let apivalue ={dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
console.log(apivalue)
return apivalue
})
}
// }
}
loadTemplate(form_id,mapid,Formname) {
console.log( Formname)
// return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/'+form_id+'.json').map(rr=>{
// return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/LFMP/16.json').map(rr=>{
if( Formname == 'Business Information'){
return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/LFMP/1.json').map(rr=>{
// return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/LFMP/'+form_id+'.json').map(rr=>{
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
// this.raw_credit_pd_template= returnValue.records.template
return returnValue
})
}else{
// return this._http.get<any[]>(this.apiUrl + "formWiseJSONTemplateV2?form_id="+form_id+"&map_id="+mapid+"").map(result=>{
// console.log(result)
// let apivalue ={dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
// console.log(apivalue)
// return apivalue
// })
//return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/all/'+form_id+'.json').map(rr=>{
return this._http.get('assets/data/SMC_CREDIT_TEMPLATES/DONE/6.json').map(rr=>{
let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}}
// this.raw_credit_pd_template= returnValue.records.template
console.log("12345")
return returnValue
})
}
}
saveForm(records: any): Observable<any> {
// records.fk_createdby = this._aws.getlocale();
let params = records
console.log(params)
return this._http.post(api_url + 'saveFlyhiPDsection',{"records":params}
).map(res=>{
// console.log(res,curr_vendor_ans_fetch_status,res['dataStatus'],curr_vendor_ans_fetch_status == '0');
// // for UPDATING THE VENDOR FORM STATUS (SMART PD ONLY)
// if (curr_vendor_ans_fetch_status == '0') {
// if (res['dataStatus']) {
// console.log("inside")
// this.updateVendorFormStatus({"fk_pd_id":records.pdid,"fk_form_id":records.formid}).subscribe(re=>{
// })
// }
// }
// end of UPDATING THE VENDOR FORM STATUS (SMART PD ONLY)
return res
})
// .pipe(
// catchError(this.handleError('role', []))
// )
}
get_Pd_Id(jsonParamsData){
let userid:any=localStorage.getItem("user_details")
userid=JSON.parse(userid).userid;
let lender_id = localStorage.getItem("LocalSetEntity")
console.log(lender_id)
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
console.log(key_value)
let sales_pd_type
if(jsonParamsData.verification_type == 'Residence verification'){
sales_pd_type = 4
}
if(jsonParamsData.verification_type == 'Office verification'){
sales_pd_type = 3
}
let createdby = userid
let params = {
"createdby" : createdby,
"sales_pd_id" : key_value,
"lender_id": lender_id,
"product_id":jsonParamsData.product_name,
"sales_pd_type":sales_pd_type,
}
console.log(params)
// let params = { records }
return this._http.post(api_url + 'saveFlyhiPD', {"records":params}).map(res=>{
return res
})
}
copyToClipBoard(message) {
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);
}
create_G_Video_Status(pdid: any){
return this._http.get(api_url+'createGmeetLink?pdid='+pdid)
// .pipe(
// catchError(this.handleError('role', []))
// )
}
getRecordedPlaybackUrl(params){
return this._http.post(api_url+'getVideoURL',params)
}
/** To get SMS Link
* List PD
*/
smsLink(params): Observable<any> {
return this._http.post(api_url + 'sendCusLinkViaSMS', params)
// .pipe(
// catchError(this.handleError('role', []))
// )
}
// getSalesPdpdf(pdfdetail){
// return this._http.get<any[]>(api_url + "downloadFlyhiPDReport/" + pdfdetail)
// }
}

View File

@ -0,0 +1,84 @@
// .child_mat_card mat-card {
// margin: 2 0%;
// }
::ng-deep .mat-dialog-container{
overflow: hidden !important;
}
::ng-deep .mat-card-header-text{
margin:0px !important;
}
.mat-purple{
background-color: gray !important;
}
.cdk-global-overlay-wrapper{
justify-content: center !important;
}
mat-card.parent_mat_card > {
mat-card-header {
display: flex;
flex-direction: column;
}
mat-card-content {
min-height:auto;
max-height:52vh;
overflow:auto;
}
.user-thumb {
position: absolute;
bottom: -35%;
// img {
// border: 5px solid $white;
// border-radius: 100%;
// height: 75px;
// width: 75px;
// }
}
// @media only screen and (max-width:319px) {
// mat-card-content {
// max-height: 350px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:320px) and (max-width:767px) {
// mat-card-content {
// max-height: 350px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:768px) and (max-width:1023px) {
// mat-card-content {
// max-height: 350px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:1024px) and (max-width:1899px) {
// mat-card-content {
// max-height: 400px;
// overflow: auto;
// }
// }
// @media only screen and (min-width:1900px) {
// mat-card-content {
// max-height: 500px;
// overflow: auto;
// }
// }
}
$base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important;
mat-card .child_mat_card > mat-card {
border-radius: 0px 0px 0px 15px;
box-shadow: $base-card-box-shadow;
transform: scale(0.95);
transition: box-shadow 0.5s, transform 0.5s;
border: 1px solid lavender;
&:hover {
cursor: pointer;
// background-color: #e00201 !important;
transform: scale(1);
box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2);
}
}

View File

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

View File

@ -0,0 +1,300 @@
import {Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy} from '@angular/core';
import {FormBuilder, FormGroup, Validators, FormControl, FormArray, AbstractControl} from '@angular/forms';
import {ActivatedRoute, Router} from '@angular/router';
import {MatDialog } from '@angular/material';
import {NotifierService} from 'angular-notifier';
// import {ListPdComponent} from './../../list-pd.component';
// import {PdTrigerService} from '../../../../pd-service/pd-triger.service';
// import {GeneralInfoComponent} from './../forms/general-info/general-info.component';
// import {PdStatusChangeDialogueComponent } from './../../pd-status-change-dialogue/pd-status-change-dialogue.component';
// import { ImagesAllComponent } from './../forms/images-all/images-all.component';
import { FormComponent } from './../forms-dynamic/form/form.component';
// import { ImageCaptureComponent } from './Form-Dynamic/image-capture/image-capture.component';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service';
import { FlyhiService } from '../services/flyhi.service';
@Component({
selector: 'app-start-pd2',
templateUrl: './start-pd2.component.html',
styleUrls: ['./start-pd2.component.scss']
})
export class StartPd2Component implements OnInit, OnDestroy {
public startPD: string;
public mainApplicantName: string;
public randomString: string;
//public remarks: string;
errorMessage: any;
selectedCategory: any = [];
categoryList: any = [];
pdMasterList: any = [];
pdFullDetails:any=[];
// category static form buttons
categoryFormButtons: any;
formsCategoryEnable: boolean = false;
selectedFormsCategory: any;
// create values for status check
pdStatusCheck: any = {
"DRAFT": 'DRAFT',
"TRIGGERED": 'TRIGGERED',
"ALLOCATED": 'ALLOCATED',
"SCHEDULED": 'SCHEDULED',
"INPROGRESS": 'INPROGRESS',
"COMPLETED": 'COMPLETED',
"QC_COMPLETED": 'QC_COMPLETED',
};
currentPDStatus: boolean;
actualQuestions: number;
answeredQuestions: number;
private notifier: NotifierService;
vendor_status_arr: any = [];
photographButtons: any[];
constructor(notifier: NotifierService, private dialog: MatDialog, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,private _flyhi:FlyhiService,
private loaderService:LoaderService) {
this.startPD = this.route.snapshot.params['pdid'];
this.randomString = this.route.snapshot.params['rdmstr'];
// console.log(this.route.snapshot.params['pdid'],this.route.snapshot.params['rdmstr']);
this.notifier = notifier;
this.currentPDStatus = false;
}
ngOnInit() {
// this.listPDComponent.showListView(false);
// const elemSidebar = <HTMLElement>document.querySelector('.app-inner .mail-sidebar');
// const elemContent = <HTMLElement>document.querySelector('.app-inner .main-content');
// if (window.matchMedia(`(min-width: 960px)`).matches && !this.isMac()) {
// // Ps.initialize(elemSidebar, { wheelSpeed: 2, suppressScrollX: true });
// // Ps.initialize(elemContent, { wheelSpeed: 2, suppressScrollX: true });
// }
this.loadTemplates(this.startPD,1,this.randomString);
// this.getCreditPDTemplate();
}
// getCreditPDTemplate() {
// // let params = { "fk_entity_id":this.pddetails.fk_lender_id,"fk_product_id":this.pddetails.fk_product_id,"pd_form_id":this.pddetails.pd_id }
// let params = { "fk_entity_id":"","fk_product_id":"","pd_form_id":"24","fk_pd_id": this.startPD }
// this._flyhi.loadCreditPDTemplate(params).subscribe(result=> {
// let creditTemplate:any = null;
// if(result['dataStatus']) {
// if(result.hasOwnProperty('records') && result['records']) {
// creditTemplate = result['records'];
// }
// }
// localStorage.setItem("dynamicQuesTemplate",JSON.stringify(creditTemplate));
// })
// }
isMac(): boolean {
let bool = false;
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0 || navigator.platform.toUpperCase().indexOf('IPAD') >= 0) {
bool = true;
}
return bool;
}
isOver(): boolean {
return window.matchMedia(`(max-width: 960px)`).matches;
}
// load templates details
loadTemplates(startID:string,type:number,randomString:string){
// console.log('start pd component inside - loadTemplates params are,',startID,type,randomString);
this._flyhi.loadPDTemplates2(startID,randomString).subscribe(
data => {
console.log("after reponse = ", data);
console.log("after reponse = ", data.records.pdmaster_details);
if (data.status == 200) {
this.pdMasterList=data.records.pdmaster_details;
// this.categoryList=data.records.question_answers;
let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
this.mainApplicantName = filterApplicantName.length > 0 ? filterApplicantName[0].applicant_name : '';
this.currentPDStatus = data.records.pdmaster_details.pd_status=='INPROGRESS' ? true : data.records.pdmaster_details.pd_status=='SCHEDULED' ? true :data.records.pdmaster_details.pd_status=='ALLOCATED' ? true : false;
//let categoryFormButtons1 = Object.keys(data.records.template_forms).map((item)=>data.records.template_forms[item]).filter(item=>item.isAnswerable===true);
//this.categoryFormButtons =categoryFormButtons1.filter(item=>item.form_id!=26);
this.categoryFormButtons = data.records.template_forms
this.categoryFormButtons.sort((a,b) => a.pd_form_order - b.pd_form_order )
// let s = this.categoryFormButtons.sort((a,b) => a.pd_form_order < b.pd_form_order);
console.log( this.categoryFormButtons);
// this.photographButtons=categoryFormButtons1.filter(item=>item.form_id==26);
// console.log(this.photographButtons);
this.categoryFormButtons = this.categoryFormButtons.filter(item=>item.isAnswerable===true);
this.actualQuestions = this.categoryFormButtons.length;
let getAnsweredFormsCount = this.categoryFormButtons.filter(item=>item.isAnswered===true);
this.answeredQuestions = getAnsweredFormsCount.length;
console.log("ans",this.answeredQuestions,this.actualQuestions)
this.pdFullDetails = data.records;
// VENDOR FORM ANSWER FETCH STATUS START(SMART PD ONLY)
// if(this.pdMasterList.fk_pd_type == '2') {
// if(data.records.vendor_form_status && data.records.vendor_form_status.length > 0) {
// this.vendor_form_status_arr = JSON.stringify(data.records.vendor_form_status)
// localStorage.setItem("vendorFormStatus_arr",this.vendor_form_status_arr)
// }
// }
console.log(this.pdMasterList)
console.log(this.pdMasterList.fk_pd_type)
if(this.pdMasterList.fk_pd_type == '2') {
// let temp_vendor_status = localStorage.getItem("vendorFormStatus_arr")
if(data.records.hasOwnProperty('vendor_form_status') && data.records.vendor_form_status && data.records.vendor_form_status.length > 0) {
// temp_vendor_status = JSON.parse(temp_vendor_status)
// if(temp_vendor_status && temp_vendor_status.length > 0 ) {
this.vendor_status_arr = data.records.vendor_form_status
// }
}
}
// END OF VENDOR FORM ANSWER FETCH
// if(type==1 && (data.records.pdmaster_details.pd_status=='SCHEDULED' || data.records.pdmaster_details.pd_status=='ALLOCATED')) {
// this.pdStatusDialogue(this.pdStatusCheck.INPROGRESS,1)
// }
}
else{
this.pdMasterList = "";
this.mainApplicantName = "";
this.categoryList = [];
this.currentPDStatus = false;
}
// this.getAnswers(serachQuestions);
});
}
// load pd status change dialogue
// pdStatusDialogue(status: string, checkType: number): void {
// const dialogRef = this.dialog.open(PdStatusChangeDialogueComponent, {
// data: { pdid: this.startPD, pd_status: status ,random_string:this.randomString,pd_type:this.pdMasterList.fk_pd_type },
// disableClose: true,
// minWidth:'30%',
// maxWidth:'40%',
// });
// dialogRef.afterClosed()
// .subscribe(dataresult => {
// if(dataresult.update_status==true){
// setTimeout(()=>{
// checkType==2 ? this.router.navigate(['../../viewpd', this.pdMasterList.parent_pd_id], {relativeTo: this.route}) : this.loadTemplates(this.startPD,2,this.randomString);
// let data = {
// "pd_id": this.startPD,
// "regenerate":0,
// "random_string":this.randomString
// };
// },2000)
// // this._flyhi.archivePDImages(data).subscribe(data => {
// // })
// let data1 = {
// "pd_id": this.startPD,
// "regenerate":0,
// "random_string":this.randomString
// };
// this._flyhi.photoPDFDownload(data1).subscribe(data => {
// })
// }
// else {
// checkType==1 ? this.router.navigate(['../../viewpd', this.pdMasterList.parent_pd_id], {relativeTo: this.route}) : this.loadTemplates(this.startPD,2,this.randomString);
// }
// if(checkType == 2){
// // this.loadTemplates(this.startPD,2,this.randomString);
// }
// });
// }
// start
// direct form based questions
OnSelectDirectForms(details: any,id:any) {
console.log(details.form_name)
console.log( this.vendor_status_arr )
// this.formsCategoryEnable = true;
this.selectedFormsCategory = details;
let curr_vendor_ans_fetch_status = null
if(this.pdMasterList.fk_pd_type == '2') {
if(this.vendor_status_arr && this.vendor_status_arr.length > 0 && this.selectedFormsCategory.form_id != 13) {
console.log(this.vendor_status_arr,this.selectedFormsCategory)
curr_vendor_ans_fetch_status =this.vendor_status_arr.filter(val=>val.fk_form_id == String(this.selectedFormsCategory.form_id))
if(curr_vendor_ans_fetch_status.length > 0) {
curr_vendor_ans_fetch_status = curr_vendor_ans_fetch_status[0].form_status
}
else {
curr_vendor_ans_fetch_status = null
}
}
}
this.pdFullDetails.pdmaster_details.curr_vendor_ans_fetch_status = curr_vendor_ans_fetch_status
// this.pdFullDetails.form_id= this.selectedFormsCategory.fk_form_id
// this.pdFullDetails.is_answered = this.selectedFormsCategory.is_answered
this.pdFullDetails.pdmaster_details = this.pdMasterList
console.log(this.pdFullDetails);
console.log(this.pdMasterList);
console.log(details);
console.log(this.startPD,2,this.randomString)
let data:any;
data = {pd_FullDetails:this.pdFullDetails,pdMasterList:this.pdMasterList,FormData:details,Formname:details.form_name,pdmaster_details:this.pdMasterList};
let componen_name:any = FormComponent
// if(details.is_business_form == 1) {
// componen_name = FormGroupComponent
// }else if(details.form_id == '26'){
// componen_name = ImagesAllComponent
// }else if(details.form_id == '18'){
// componen_name = GeneralInfoComponent
// data = this.pdFullDetails;
// }
const dialogRef = this.dialog.open(componen_name, {
data: data,
position: { right: '0'},
maxWidth: '100vw',
maxHeight: '100vh',
height: '100%',
width: '100%',
disableClose: true,
closeOnNavigation:true,
panelClass:'no-padding'
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
// if(dataresult == 'refresh') {
this.loadTemplates(this.startPD,2,this.randomString);
// }
});
}
ngOnDestroy(): void {
// this.listPDComponent.showListView(true);
}
// load pd view component
loadPdViewCompoent() {
this.router.navigate(['../../../viewpd', this.pdMasterList.parent_pd_id,this.randomString], {relativeTo: this.route});
}
}

View File

@ -95,7 +95,7 @@
</div>
<div class="bg-overlay"></div>
</mat-sidenav>
<mat-toolbar class="main-header" style="border-bottom:2px solid #f44336;">
<mat-toolbar class="main-header" [ngStyle]="{'border-bottom':userRoleType == 20 ? '2px solid #0d93a9' :'2px solid #f44336'}">
<div class="horizontal-top-bar w-100">
<div fxFlex.sm="100" fxFlex.xs="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" fxFlex="100">
<div class="horizontal-logo">
@ -290,7 +290,7 @@
<mat-icon>person</mat-icon>
</button>
<mat-menu #user="matMenu" class="opt-menu" x-position="before">
<div mat-menu-item class="head-menu grad-blue">
<div mat-menu-item class="head-menu grad-blue" [ngStyle]="{'background-color':currentUser.user_role == '20' ? '#0d93a9' :'#f44336'}">
{{fullName}}
</div>
<!--<button mat-menu-item>

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>{{data.title}}</h1>
<h1 mat-dialog-title [ngStyle]="{'color':roleID == '20' ? '#0d93a9' :'#f44336'}">{{data.title}}</h1>
<div mat-dialog-content>
<p>{{data.msg}}</p>
@ -10,6 +10,6 @@
</div> -->
</div><br/>
<div mat-dialog-actions align="end">
<button *ngIf="data.buttons[1].visible" mat-stroked-button color="primary" (click)="onSubmit(data.buttons[1].id)">{{data.buttons[1].name}}</button>&nbsp;&nbsp;&nbsp;&nbsp;
<button *ngIf="data.buttons[0].visible" mat-raised-button color="primary" (click)="onSubmit(data.buttons[0].id)" cdkFocusInitial>{{data.buttons[0].name}}</button>
<button [ngStyle]="{'color':roleID == '20' ? '#0d93a9' :'#f44336'}" *ngIf="data.buttons[1].visible" mat-stroked-button color="primary" (click)="onSubmit(data.buttons[1].id)">{{data.buttons[1].name}}</button>&nbsp;&nbsp;&nbsp;&nbsp;
<button [ngStyle]="{'background-color':roleID == '20' ? '#0d93a9' :'#f44336'}" *ngIf="data.buttons[0].visible" mat-raised-button color="primary" (click)="onSubmit(data.buttons[0].id)" cdkFocusInitial>{{data.buttons[0].name}}</button>
</div>

View File

@ -7,12 +7,14 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
styleUrls: ['./alert-dialog.component.scss']
})
export class AlertDialogComponent implements OnInit {
roleID: string;
constructor(
public dialogRef: MatDialogRef<AlertDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data) {
// this.notifier=notifier
console.log('AlertDialogComponent',data)
this.roleID = localStorage.getItem('user_role')
}
onNoClick(): void {

View File

@ -1,4 +1,4 @@
<button (click)="capture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<button [ngStyle]="{'color':role_id == '20' ? '#0d93a9' :'#f44336'}" (click)="capture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<mat-icon name="camera" *ngIf="!addMoreBtn">camera_alt</mat-icon>
<mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon>
</button>

View File

@ -13,8 +13,10 @@ export class CaptureBtnComponent implements OnInit {
@Output() imageDataEmitter = new EventEmitter
@Output() singleDataEmitter = new EventEmitter
sales_pd_type: string;
role_id: string;
constructor(private ng2ImgMax:Ng2ImgMaxService,private loaderService:LoaderService) {
this.role_id = localStorage.getItem('user_role')
this.sales_pd_type = localStorage.getItem('sales_pd_type')
console.log(this.sales_pd_type)
}

View File

@ -449,23 +449,28 @@
</div>
</div> -->
<div *ngIf="roleID == 30">
<div *ngIf="local_ques_JSON.section_id != 9">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
<div *ngIf="local_ques_JSON.section_id == 9 && pdstatus != 'COMPLETED'">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
</div>
<div *ngIf="roleID != 30">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
<!-- <div *ngIf="roleID == 20">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; Save</button>
</div> -->
</form>
</div>
<div *ngIf="roleID == 30">
<div *ngIf="local_ques_JSON.section_id != 9">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
<div *ngIf="local_ques_JSON.section_id == 9 && pdstatus != 'COMPLETED'">
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>
</div>
<div *ngIf="roleID != 30">
<button [ngStyle]="{'background-color':roleID == '20' ? '#0d93a9' :'#f44336'}" style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon>&nbsp; {{submit_btn ? 'Complete' : 'Save'}} </button>
</div>

View File

@ -82,6 +82,8 @@ export class QuesTemplateComponent {
tmp:any =[];
roleID: string;
pdstatus: string;
local_city1: any;
local_pincode1: any;
constructor( private cameraService: CameraService,public dialogRef: MatDialogRef<SectionListComponent>,private route: ActivatedRoute,private router: Router,private dialog:MatDialog,private _fb:FormBuilder,private questionService:QuestionServiceService,private SalesPdService:SalesPdService,notifier: NotifierService,private loaderService:LoaderService) {
console.log('Hello QuesTemplateComponent Component');
this.text = 'Hello World';
@ -89,6 +91,8 @@ export class QuesTemplateComponent {
//this.cameraProvider.checkGPSPermission();
//alert('abi1');
//this.ngOnChanges()
this.roleID = localStorage.getItem('user_role')
console.log(this.roleID)
}
ngOnChanges(){
@ -1072,18 +1076,93 @@ this.proceedonChangeProperty(modified)
onChangeProperties_value.forEach(onChangeProperty=>{
console.log("api",onChangeProperty)
if(onChangeProperty.purpose == 'api2'){
if(onChangeProperty.api == 'getListOfStatesAndCities'){
this.SalesPdService.getCityPincode(event.value).subscribe(res=>{
console.log('1082')
if(res['dataStatus']){
console.log('1084')
this.local_city1=res['records'].cities
this.local_pincode1=res['records'].pincode
console.log(this.quesAnsForm.controls.questions['controls'])
this.quesAnsForm.controls.questions['controls'].forEach((val,index)=>{
console.log(val)
// if(val.value.hasOwnProperty('questions_group')){
// console.log('1089',val.value.questions_group[0]['questions'])
// console.log('1089',val.value.questions_group)
// val.value.questions_group[0]['questions'].forEach((getCity2,index)=>{
// console.log(getCity2)
// if(getCity2.api_properties == 'local_city1'){
// console.log('1091',getCity2.controls)
// this.local_city1=this.questionService.convertArrayNames(['city_id','city_name'],this.local_city1)
// console.log('1096',getCity2)
// getCity2.answers =(this.local_city1)
// console.log(getCity2.answer)
// }
// else if(getCity2.api_properties == 'local_pincode1'){
// this.local_pincode1=this.questionService.convertArrayNames(['pincode_id','pincode'],this.local_pincode1)
// getCity2.answers=(this.local_pincode1)
// }
// })
// // })
// }
// console.log('1089',val.value.hasOwnProperty('questions_group'))
if(val.value.api_properties == 'local_city1'){
console.log('1091')
this.local_city1=this.questionService.convertArrayNames(['city_id','city_name'],this.local_city1)
val.controls.answers.setValue(this.local_city1)
}
else if(val.value.api_properties == 'local_pincode1'){
this.local_pincode1=this.questionService.convertArrayNames(['pincode_id','pincode'],this.local_pincode1)
val.controls.answers.setValue(this.local_pincode1)
}
})
}
})
}
else{
this.SalesPdService.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 == 'api'){
if(onChangeProperty.api == 'getListOfStatesAndCities'){
this.SalesPdService.getCityPincode(event.value).subscribe(res=>{
if(res['dataStatus']){
this.local_city=res['records'].cities
this.local_pincode=res['records'].pincode
console.log(this.quesAnsForm.controls.questions['controls'])
this.quesAnsForm.controls.questions['controls'].forEach((val,index)=>{
console.log(val)
if(val.value.api_properties == 'local_city'){
this.local_city=this.questionService.convertArrayNames(['city_id','city_name'],this.local_city)
console.log(this.local_city)
console.log(val.controls)
val.controls.answers.setValue(this.local_city)
}
else if(val.value.api_properties == 'local_pincode'){
@ -1699,7 +1778,7 @@ this.proceedonChangeProperty(modified)
// alert('b');
const dialogRef = this.dialog.open(AlertDialogComponent, {
width: '500px',
data: {buttons:[{name:"Complete",visible:true,id:'Complete'},{name:'Cancel',visible:'true',id:'cancel'}],title:'Complete sales PD',
data: {buttons:[{name:"Complete",visible:true,id:'Complete'},{name:'Cancel',visible:'true',id:'cancel'}],title:'Complete PD',
msg:'You are completing this PD, once completed you will not be able to make changes'}
});

View File

@ -1,4 +1,4 @@
<button (click)="singlecapture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<button [ngStyle]="{'color':role_id == '20' ? '#0d93a9' :'#f44336'}" (click)="singlecapture($event)" mat-button mat-raised-button [disabled]="sales_pd_type == '2'">Capture
<mat-icon name="camera" *ngIf="!addMoreBtn">camera_alt</mat-icon>
<mat-icon name="camera" *ngIf="addMoreBtn">add_a_photo</mat-icon>
</button>

View File

@ -14,8 +14,10 @@ export class SingleCaptureBtnComponent implements OnInit {
@Output() singleDataEmitter = new EventEmitter
sales_pd_type: string;
role_id: string;
constructor(private ng2ImgMax:Ng2ImgMaxService,private loaderService:LoaderService) {
this.role_id = localStorage.getItem('user_role')
this.sales_pd_type = localStorage.getItem('sales_pd_type')
console.log(this.sales_pd_type)
}

View File

@ -1,4 +1,4 @@
<div mat-dialog-title class="paragraph_change" style="background-color: #f34436;">
<div mat-dialog-title class="paragraph_change" [ngStyle]="{'background-color':role_id == '20' ? '#0d93a9' :'#f44336'}">
<div fxLayoutAlign=" center" fxFlex="75" class="ml-1 sectionHeading" [ngStyle]="{'font-size':'22px','font-weight': 'bold','color': 'white'}" [ngStyle.xs]="{'font-size':'16px','font-weight':'bold','color':'white'}">
{{question_data.section_name}}
</div>

View File

@ -683,9 +683,11 @@ export class Section9 {
all_sections:any;
formGroupValue: any=null;
sec_id: any;
role_id: string;
//network_status: ConnectionStatus
constructor(public dialogRef: MatDialogRef<SectionListComponent>,notifier: NotifierService,private route: ActivatedRoute,private router: Router,private dialog: MatDialog,private MatDialogModule:MatDialogModule,@Inject(MAT_DIALOG_DATA) public data: any) {
this.role_id = localStorage.getItem('user_role')
// alert('section9')
console.log('data',data)
this.notifier = notifier;

View File

@ -167,7 +167,14 @@ current_section:any;
}
saveSalesPDSection(params){
let users:any=localStorage.getItem('user_details')
users=JSON.parse(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'saveSalesPDsection'
}else if(users.user_role == '20'){
apiName = 'getFlyhiPDSectionData'
}
params.fk_createdby=users.userid
return Observable.create((observer:Observer<any>)=>{
this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
@ -177,7 +184,7 @@ current_section:any;
let modified_params = params
console.log("###################$%%",(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true ) : true));
if(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true ) : true) {
return this.http.post(this.apiUrl+'saveSalesPDsection',{records:params}).pipe().subscribe(response=>{
return this.http.post(this.apiUrl+apiName,{records:params}).pipe().subscribe(response=>{
// delete modified_params.questions
modified_params.is_synced = true;
modified_params.section_data = section_data
@ -196,7 +203,7 @@ current_section:any;
else if(modified_params.section_id != '9'){
// console.log("#######params",modified_params)
let offline_params = modified_params
offline_params.request_items={url:this.apiUrl+'saveSalesPDsection',
offline_params.request_items={url:this.apiUrl+apiName,
params:JSON.stringify({records:params}),method:'POST'}
offline_params.is_synced = false
offline_params.section_data = section_data

View File

@ -4,6 +4,7 @@ import { Routes, RouterModule } from '@angular/router';
import { SectionListComponent } from './section-list/section-list.component';
import { SalesPdComponent } from './sales-pd-list/sales-pd.component';
import { HomePage } from './home/home';
import { FlyHiListComponent } from 'app/fly-hi/fly-hi-list/fly-hi-list.component';
//import {Section9} from './home/home'
const routes: Routes = [
@ -28,10 +29,10 @@ const routes: Routes = [
path:'sectionlist/:product_id/:sales_pd_type',
component:SectionListComponent
},
// {
// path:'sectionlist/:product_id/:sales_pd_type/:link',
// component:SectionListComponent
// },
{
path:'flyhi-list-pd',
component:FlyHiListComponent
},
{
path:'',
component:HomePage

View File

@ -21,6 +21,8 @@ import { SingleCaptureBtnComponent } from './components/ques-template/single-cap
import { HomePageModule } from './home/home.module';
import { CommonModule } from '@angular/common';
import { ReGenerateReportComponent } from './sales-pd-list/re-generate-report/re-generate-report.component';
import { FlyHiListComponent } from 'app/fly-hi/fly-hi-list/fly-hi-list.component';
import { ImageVideoComponent } from 'app/fly-hi/image-video/image-video.component';
@NgModule({
imports: [
SalesPdRoutingModule,
@ -30,10 +32,11 @@ import { ReGenerateReportComponent } from './sales-pd-list/re-generate-report/re
StartPdModule,
HomePageModule,
CommonModule,
MatDialogModule
MatDialogModule,
MatTooltipModule
],
declarations: [AlertDialogComponent,SalesPdComponent,AdvanceFilterComponent, ReGenerateReportComponent],
entryComponents:[AlertDialogComponent,SalesPdComponent,ReGenerateReportComponent],
declarations: [ImageVideoComponent,AlertDialogComponent,FlyHiListComponent,SalesPdComponent,AdvanceFilterComponent, ReGenerateReportComponent],
entryComponents:[ImageVideoComponent,AlertDialogComponent,SalesPdComponent,ReGenerateReportComponent],
providers:[ConstantsProvider,{ provide: MAT_DATE_LOCALE, useValue: 'en-GB' },{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},{ provide: MatDialogRef, useValue: {} },{ provide: MAT_DIALOG_DATA, useValue: [] }],
bootstrap: [SalesPdComponent],

View File

@ -1,11 +1,19 @@
<mat-card style="height:100% !important;">
<mat-card-header style="padding: 10px;">
<mat-card-header [ngStyle]="{'background-color':flyHiUserId.user_role == '20' ? '#0d93a9' :'#f44336'}" class="pd">
<!-- <mat-card-title> -->
<div fxFlex="66" align="left">
<h4 class="mt-0">Section List</h4>
<h4 class="mt-0" style="color: white;">Section List</h4>
</div>
<div fxFlex="33" align="end">
<!-- <div fxLayout="row wrap"> -->
<div fxFlex="33" align="end">
<span *ngIf="(flyHiUserId.user_role == '20')">
<button *ngIf="sales_pd_id_PRIMARYKEY != null" [ngStyle]="{'color':flyHiUserId.user_role == '20' ? '#0d93a9' :'#f44336'}" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="onClickVideoChat()"
matTooltip="Video Chat" matTooltipPosition="above" >
<mat-icon>videocam</mat-icon>
</button>&nbsp;&nbsp;</span>
<button *ngIf="customer_link != '' && sales_pd_type == '2'" mat-raised-button mat-icon-button class="hover-icon" type="button" matTooltip="Copy Link" matTooltipPosition="above" (click)="copyToClipBoard(customer_link_with_text, 'Customer Link is copied')"><mat-icon>file_copy</mat-icon></button>&nbsp;&nbsp;
@ -19,7 +27,7 @@
<!-- <button *ngIf="is_sync_btn" mat-raised-button mat-icon-button (click)="syncPDWithSections()"><mat-icon>sync</mat-icon>&nbsp;&nbsp;Sync</button> -->
<!-- <h4 class="mt-0"> -->
<!-- <span *ngIf="pdMasterList.subproduct_name">/{{pdMasterList.subproduct_name}}</span>&nbsp; -->
<button mat-raised-button mat-icon-button class="hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
<button [ngStyle]="{'color':flyHiUserId.user_role == '20' ? '#0d93a9' :'#f44336'}" mat-raised-button mat-icon-button class="hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdViewCompoent()"><mat-icon>close</mat-icon></button>
<!-- </h4> -->
@ -27,13 +35,14 @@
<!-- </mat-card-title> -->
</mat-card-header>
<mat-card-content>
<!-- <div class="completed_note" *ngIf ="is_sync_btn && pd_completed.is_synced == false && pd_completed.is_completed &&
pd_completed.pd_complete_request_items != null">
<p >
PD is completed. Please click the sync button above to send the data to server when internet is available.</p>
</div> -->
<!-- <p *ngIf="categoryFormButtons.length == 0" style="text-align: center;">No Template Found</p> -->
<div fxLayout="row wrap">
<div fxLayout="row wrap" *ngIf="flyHiUserId.user_role != 20">
<mat-card fxFlex.xs="100" fxFlex.sm="45" fxFlex.md="32" fxFlex.lg="32" fxFlex.xl="33" class="card-class" *ngFor="let sec of section_template" [ngClass]="{'border-disabled': sales_pd_id == null && sec.is_disabled,'border-saved-local': sales_pd_id != null && sec.hasOwnProperty('status') && sec.status == '1' && sec.hasOwnProperty('is_synced') && sec.is_synced == false,'border-saved': sales_pd_id != null && sec.hasOwnProperty('status') && sec.status == '1'}" (click)="goto(sec.order_id)">
<!-- {{sec | json}} -->
<div fxLayout="row">
@ -67,6 +76,19 @@ pd_completed.pd_complete_request_items != null">
</ion-fab-list>
</ion-fab> -->
</div>
<div fxLayout="row wrap" *ngIf="flyHiUserId.user_role == 20" fxLayoutAlign="center center">
<mat-card fxFlex.xs="100" fxFlex.sm="45" fxFlex.md="32" fxFlex.lg="32" fxFlex.xl="33" class="card-class" *ngFor="let sec of section_template" [ngClass]="{'border-disabled': sales_pd_id == null && sec.is_disabled,'border-saved-local': sales_pd_id != null && sec.hasOwnProperty('status') && sec.status == '1' && sec.hasOwnProperty('is_synced') && sec.is_synced == false,'border-saved': sales_pd_id != null && sec.hasOwnProperty('status') && sec.status == '1'}" (click)="goto(sec.order_id)">
<!-- {{sec | json}} -->
<div fxLayout="row" fxLayoutAlign="center center">
<div fxFlex.xs="90" fxFlex.sm="90" fxFlex.md="90" fxFlex.lg="90" fxFlex.xl="90">
<h6>{{sec.section_name}}</h6>
</div>
<div fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="10" fxFlex.lg="10" fxFlex.xl="10" *ngIf="sec.hasOwnProperty('status') && sec.status == '1'">
<mat-icon>check_circle_outline</mat-icon>
</div>
</div>
</mat-card>
</div>
</mat-card-content>
<!-- <mat-card-actions align="end">
<button matTooltip="Complete Discussion" matTooltipPosition="above" [disabled]="actualQuestions==0 || actualQuestions!=answeredQuestions || currentPDStatus===false" mat-raised-button color="primary" (click)="pdStatusDialogue(pdStatusCheck.COMPLETED,2);"><span>{{currentPDStatus === true ? 'COMPLETE':'COMPLETED' }}</span></button>

View File

@ -103,4 +103,7 @@ button[ion-fab] {
::ng-deep .mat-card-header-text{
margin: 0px !important;
}
.pd{
padding: 10px;
}

View File

@ -5,11 +5,12 @@ import { ActivatedRoute, Router } from '@angular/router';
import { SalesPdService } from '../services/sales-pd.service';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import {Section9,HomePage} from '../home/home';
import { FormComponent } from 'app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component';
import {MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { Observable, Observer } from 'rxjs';
import { NotifierService } from 'angular-notifier';
import { ConstantsProvider } from 'app/providers/constants/constants';
import { FormComponent } from 'app/fly-hi/forms-dynamic/form/form.component';
import { ImageVideoComponent } from 'app/fly-hi/image-video/image-video.component';
@Component({
selector: 'app-section-list',
@ -32,9 +33,22 @@ export class SectionListComponent implements OnInit {
config_expression: any;
is_sales_login:boolean = false
link: any;
flyhiLender: any;
flyHiUserId: any;
sales_pd_id_PRIMARYKEY: string;
rand_string: string;
constructor(public dialogRef: MatDialogRef<SectionListComponent>,private constantProvider:ConstantsProvider,notifier: NotifierService,private dialog: MatDialog, private fb: FormBuilder, private route: ActivatedRoute,private SalesPDService:SalesPdService,
private router: Router,private loaderService:LoaderService ) {
let users:any=localStorage.getItem('user_details')
console.log(users)
this.flyHiUserId = JSON.parse(users)
if(this.flyHiUserId.user_role == '20'){
this.rand_string = localStorage.getItem('sales_rand_string')
this.sales_pd_type = localStorage.getItem('sales_pd_type')
this.sales_pd_id_PRIMARYKEY = localStorage.getItem('sales_pd_id_PRIMARYKEY')
}
if(this.route.snapshot.params['product_id']){
this.product_id = this.route.snapshot.params['product_id'];
this.link = this.route.snapshot.params['link'];
@ -332,19 +346,66 @@ export class SectionListComponent implements OnInit {
// console.log(this.section_template)
// }
// )}
OnSelectDirectForms(section_id) {
console.log('339')
let componen_name:any = FormComponent
// if(details.is_business_form == 1) {
// componen_name = FormGroupComponent
// }else if(details.form_id == '26'){
// componen_name = ImagesAllComponent
// }else if(details.form_id == '18'){
// componen_name = GeneralInfoComponent
// data = this.pdFullDetails;
// }
const dialogRef = this.dialog.open(componen_name, {
data: {Json:this.raw_data, section_id:section_id},
position: { right: '0'},
maxWidth: '100vw',
maxHeight: '100vh',
height: '100%',
width: '100%',
disableClose: true,
closeOnNavigation:true,
panelClass:'no-padding'
});
dialogRef.afterClosed()
.subscribe(dataresult => {
console.log(dataresult);
// this.notifier.notify('success', 'Successfully allocated.!');
// if(dataresult == 'refresh') {
this.getSectionStats()
this.loadTemplates(this.product_id,2,this.sales_pd_type);
// }
if(dataresult != undefined){
if(dataresult.hasOwnProperty('is_completed') && dataresult.is_completed == true){
console.log('396')
this.loadPdViewCompoent()
}
}
});
}
getTemplate(){
console.log(this.product_id,this.sales_pd_type)
this.SalesPDService.getData(this.product_id,this.sales_pd_type).subscribe(result=>{
console.log("result",result)
if(result['dataStatus'] && result.hasOwnProperty('records')){
this.flyhiLender = result['records']
this.raw_data=JSON.parse(result['records'].template)
// this.raw_data=result['records'].template
console.log(this.raw_data)
// 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
// })
this.raw_data.sections.forEach((val,index)=>{
val.order_id=index+1
})
@ -386,6 +447,14 @@ export class SectionListComponent implements OnInit {
}
goto(section_id){
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
if(users.user_role == '20' && section_id == 1){
this.OnSelectDirectForms(section_id)
}else{
// alert('sectionid');
// alert(section_id);
//this.router.navigate(['../../../section9'],{ relativeTo: this.route })
@ -399,7 +468,7 @@ export class SectionListComponent implements OnInit {
}
let componen_name:any = Section9
const dialogRef = this.dialog.open(componen_name, {
data: {data:this.raw_data,section_id:section_id},
data: {data:this.raw_data,section_id:section_id,flyhiLender:this.flyhiLender},
// position: { right: '0'},
maxWidth: '100vw',
maxHeight: '100vh',
@ -424,6 +493,7 @@ export class SectionListComponent implements OnInit {
}
}
});
}
// setTimeout(()=>{
//this.router.navigate(['Section9',section_id],{ relativeTo: this.route })
//this.router.navigate(Section9,{section_id:section_id})
@ -497,7 +567,14 @@ copyToClipBoard(message,user_msg?) {
// load pd view component
loadPdViewCompoent() {
this.router.navigate(['../../../list-pd'], {relativeTo: this.route});
let user_role = localStorage.getItem('user_role')
if(user_role != '20'){
this.router.navigate(['../../../list-pd'], {relativeTo: this.route});
}else if(user_role == '20'){
this.router.navigate(['../flyhi-list-pd'], {relativeTo: this.route});
localStorage.removeItem('sales_pd_id_PRIMARYKEY')
}
}
getListofPD() {
@ -539,4 +616,23 @@ getListofPD() {
});
}
onClickVideoChat() {
let videoChatLink = window.location.origin+'/vchat/#/chat/'+this.rand_string+';id='+this.sales_pd_id_PRIMARYKEY+';type=1'
console.log(videoChatLink)
const dialogApplicant = this.dialog.open(ImageVideoComponent, {
data: {videoChatLink:videoChatLink,flag:1},
// position: { right: '0' },
maxWidth: '70vw',
maxHeight: '60vw',
height: '60%',
width: '70%',
disableClose: true
});
dialogApplicant.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
// this.viewPdDetails(this.viewID,this.masterRandomString)
});
}
}

View File

@ -60,21 +60,35 @@ export class SalesPdService {
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let params = {records:{lender_id:users.fk_entity_id,product_id:product_id,sales_pd_type:sales_pd_type}}
let apiName
let params
if(users.user_role != '20'){
apiName = 'loadSalesPDTemplate'
params = {records:{lender_id:users.fk_entity_id,product_id:product_id,sales_pd_type:sales_pd_type}}
}else if(users.user_role == '20'){
apiName = 'loadFlyhiPDTemplate'
params = {records:{lender_id:users.fk_entity_id,sales_pd_type:null,pd_type:'2'}}
}
console.log(params)
return new Observable((observer:any)=>{
console.log('111111')
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
// console.log(this.platform.is('cordova'))
let api_properties = {method:'post', api_name:api_url+'loadSalesPDTemplate',params : params}
console.log(api_properties)
// let api_properties
// if(users.user_role != '20'){
let api_properties = {method:'post', api_name:api_url+apiName,params : params}
// console.log(api_properties)
// }else if(users.user_role == '20'){
// let api_properties = {method:'get', api_name:`assets/data/flyhi.json`,params : params}
// }
// START OF GETTING LOCAL TEMPLATE ONLY ON BROWSER
// if(!this.platform.is('cordova')) {
// let fileName = product_id
// if(sales_pd_type) {
// fileName += '-'+sales_pd_type
// }
// api_properties = {method:'get', api_name:`assets/data/sales_pd_templates/${fileName}.json`,params : params}
// }
// END OF GETTIG LOCAL TEMPLATE
@ -83,6 +97,7 @@ export class SalesPdService {
// result = {dataStatus:true,status:200,records:{template:JSON.stringify(result)}}
// }
if(result['dataStatus']) {
console.log(result)
// return this.ioniz2acStorageProvider.checkAndInsertApiDataLocally(result,params,'loadSalesPDTemplate',true).then(res=>{
observer.next(result)
observer.complete();
@ -158,15 +173,22 @@ saveQuestions(params): Observable<Response>{
let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY')
// this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
console.log(key_value)
params.sales_pd_id=key_value,
params.lender_id=users.fk_entity_id,
params.product_id=product_id
params.sales_pd_type = sales_pd_type
let modified_values =params;
console.log(params)
params.sales_pd_id=key_value
let apiName
if(users.user_role != '20'){
params.lender_id=users.fk_entity_id,
params.product_id=product_id
params.sales_pd_type = sales_pd_type
console.log(params)
apiName = 'saveSalesPD'
}else if(users.user_role == '20'){
apiName = 'saveFlyhiPD'
}
let modified_values =params;
if(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true) : true) {
console.log('160',params)
return this._http.post(api_url+'saveSalesPD',{records:params}).pipe().subscribe(result => {
return this._http.post(api_url+apiName,{records:params}).pipe().subscribe(result => {
console.log(result)
// let result = {dataStatus:false,records:{}};
result_from_api =result
@ -216,7 +238,7 @@ saveQuestions(params): Observable<Response>{
console.log('216')
modified_values.sales_pd_id = null
}
let req_params = {url:api_url+'saveSalesPD',
let req_params = {url:api_url+apiName,
params:JSON.stringify({records:params}),method:'POST'}
let dd = {product_id:modified_values.product_id,lender_id:modified_values.lender_id}
this.getProductAbbrbyId(dd).then(product_abbr=>{
@ -259,10 +281,20 @@ saveSalesPDSection(params){
let values={sales_pd_id:params.sales_pd_id,dataStatus:true}
let section_data=JSON.stringify({section_id:params.section_id,section_name:params.section_name,onsubmit:null,questions:params.questions})
let modified_params = params
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'saveSalesPDsection'
}else if(users.user_role == '20'){
apiName = 'saveFlyhiPDsection'
}
// console.log("###################$%%",(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true ) : true));
// if((key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true ) : true)) {
// alert('positive');
return this._http.post(api_url+'saveSalesPDsection',{records:params}).pipe().subscribe(response=>{
return this._http.post(api_url+apiName,{records:params}).pipe().subscribe(response=>{
// delete modified_params.questions
modified_params.is_synced = true;
modified_params.section_data = section_data
@ -349,14 +381,32 @@ getData_fromLocal(key){
// return localStorage.getItem(key)
}
getSalesPdpdf(pdfdetail): Observable<any> {
return this._http.get<any[]>(api_url + "downloadSalesPDReport/" + pdfdetail)
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'downloadSalesPDReport'
}else if(users.user_role == '20'){
apiName = 'downloadFlyhiPDReport'
}
return this._http.get<any[]>(api_url +apiName+"/"+ pdfdetail)
}
getSalesPDSectionData(params){
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'getSalesPDSectionData'
}else if(users.user_role == '20'){
apiName = 'getFlyhiPDSectionData'
}
console.log(params)
return Observable.create((observer:Observer<any>)=>{
let values={sales_pd_id:params.sales_pd_id,dataStatus:true}
this._http.post(api_url+'getSalesPDSectionData',{records:params}).subscribe(result =>{
this._http.post(api_url+apiName,{records:params}).subscribe(result =>{
console.log(result)
let modified_values:any =result
modified_values.section_id = params.section_id
@ -428,6 +478,12 @@ let modified_params = form_structure
// })
})
}
// getMasterForFlyhiPD(){
// return this._http.get(api_url+'getMasterForFlyhiPD').map(result=>{
// return result;
// })
// }
getAllMasterDatas(TableName: string): Observable<any> {
let params = { "master_name": TableName }
@ -539,11 +595,20 @@ getCityPincode(value){
console.log(key_value)
params.fk_sales_pd_id=key_value
console.log(params)
let users:any=localStorage.getItem('user_details')
console.log(users)
users=JSON.parse(users)
let apiName
if(users.user_role != '20'){
apiName = 'saveSalesPDImage'
}else if(users.user_role == '20'){
apiName = 'saveFlyhiPDImage'
}
// let values={sales_pd_id:key_value,dataStatus:true}
// let section_data=JSON.stringify({section_id:form_structure.section_id,section_name:form_structure.section_name,onsubmit:null,questions:form_structure.questions})
// let modified_params = form_structure
if(key_value != null ? (typeof(key_value) == 'string' ? !key_value.includes('local') : true) : true) {
this._http.post(api_url+'saveSalesPDImage',{records:params},{
this._http.post(api_url+apiName,{records:params},{
reportProgress: true,
}).pipe().subscribe(result => {
console.log(result)

View File

@ -85,13 +85,14 @@ export class LoginComponent implements OnInit{
{
// this.router.navigate(['sales-pd-list/list-pd']);
this.router.navigate(['/sales-pd-list']);
} else if(res.idToken.payload ["custom:role_id"] == '20'){
this.router.navigate(['/fly-hi'])
}
else
else
{
alert('Sales User Roles only allowed');
this.aws.logout().subscribe(res=>{
//alert("res");
//alert("res")
this.router.navigate(['/authentication/login']);
})

View File

@ -4,7 +4,8 @@
"onsubmit":null,
"questions":[
{
"question":[{
"question":[
{
"question":"Borrower Type",
"question_key":"borrower_type",
"type":"1",

View File

@ -6,247 +6,7 @@
"questions":[
{
"question":[
{
"question":"Name of the Entity",
"question_key":"company_name",
"place_holder":"Enter text",
"type":"3",
"api_properties":{
"api":"getCompanyListForSMCList",
"api_method":"POST",
"params":{"records":{
"pd_id":"VAR_PD_ID",
"random_string":"VAR_RANDOM_STRING"
}},
"fields":[
"company_id",
"borrower_name"
]
},
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"field_type":"string",
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Entity Name Required",
"value":null
}
]
},
{
"question":"length",
"question_key":"stakeholder_length",
"type":"hidden",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"field_type":"string"
},
{
"question":"Name of key Stakeholder",
"question_key":"stakeholder_name0",
"place_holder":"Enter text",
"type":"1",
"field_width":"19",
"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
}
]
},
{
"question":"Share Holding (%)",
"question_key":"share_holding0",
"place_holder":"Enter number",
"type":"1",
"field_width":"19",
"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":"Vintage in Current Business (in years)",
"question_key":"vintage_in_current_biz0",
"place_holder":"Enter in years",
"type":"1",
"field_width":"19",
"api_properties":null,
"answers":null,
"is_repeatable":null,
"field_type":"num",
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Current vintage Required",
"value":null
}
],
"onchange_properties":[
{
"purpose":"FORM_CTRL",
"form_controls":[
{
"insert_index":"started_biz0",
"expression":"(total_work_exp0 > vintage_in_current_biz0)",
"value_keys":[
"total_work_exp0",
"vintage_in_current_biz0"
],
"questions":[
{
"question_key":"previous_experience_details0",
"question":"Previous Experience Details",
"place_holder":"Enter text",
"type":"1",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"field_type":"string",
"parent_question_key":"vintage_in_current_biz0",
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Previous Experience Required",
"value":null
}
]
}
]
}
]
}
]
},
{
"question":"Total Work Experience (in years)",
"question_key":"total_work_exp0",
"place_holder":"Enter in years",
"type":"1",
"field_width":"19",
"api_properties":null,
"answers":null,
"is_repeatable":null,
"field_type":"num",
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Total experience Required",
"value":null
}
],
"onchange_properties":[
{
"purpose":"FORM_CTRL",
"form_controls":[
{
"insert_index":"started_biz0",
"expression":"(total_work_exp0 > vintage_in_current_biz0)",
"value_keys":[
"total_work_exp0",
"vintage_in_current_biz0"
],
"questions":[
{
"question":"Previous Experience Details",
"question_key":"previous_experience_details0",
"place_holder":"Enter text",
"type":"1",
"api_properties":null,
"answers":null,
"onchange_properties":null,
"is_repeatable":null,
"field_type":"string",
"parent_question_key":"total_work_exp0",
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Previous Experience Required",
"value":null
}
]
}
]
}
]
}
]
},
{
"question":"Started Business (Yes / No)",
"question_key":"started_biz0",
"type":"2",
"field_width":"19",
"api_properties":null,
"onchange_properties":null,
"is_repeatable":null,
"answers":[
{
"answer_id":"Yes",
"answer":"Yes"
},
{
"answer_id":"No",
"answer":"No"
}
],
"validations":[
{
"name":"required",
"isactive":"1",
"validator":"Validators.required",
"message":"Started Business Required",
"value":null
}
]
}
],

View File

@ -0,0 +1,74 @@
{
"dataStatus": true,
"status": 200,
"records": {
"lender": [
{
"entity_id": "49",
"full_name": "Fly Hi Financial Services Limited",
"short_name": "FHFSL",
"billing_address": [
{
"entity_billing_id": "34",
"fk_entity_id": "49",
"billing_name": "Fly Hi Financial Services Limited",
"addressline1": "25",
"addressline2": "North street",
"addressline3": "New Delhi, Delhi",
"pincode": "122002",
"email": "flyhi@flyhi.com",
"mobileno": "9988998899",
"gstno": "GST22558888",
"pan": "AGTNM5813K",
"gststatecode": "",
"isactive": "1",
"updatedon": "2022-06-07 07:24:11",
"updatedby": "298",
"createdon": null,
"createdby": null,
"is_dist_cal_enabled": "0",
"geo_loc": null
}
],
"branches": [
{
"entity_lender_branch_id": "59",
"branch_name": "Fly Hi Financial Services Limited- New Delhi"
}
]
}
],
"products": [
{
"product_id": "26",
"product_name": "Siksha Loan",
"product_abbr": "SL",
"prod_catagory": null
}
],
"lender_contact_persons": [
{
"userid": "415",
"user_name": "Flyhi Demo",
"fk_entity_id": "49",
"fk_city": "869",
"user_role": "20",
"fk_entity_type_id": "2",
"role_name": "Branch Credit",
"role_type": "CREDIT"
},
{
"userid": "119",
"user_name": "FLYHI Sales Person Demo",
"fk_entity_id": "49",
"fk_city": "869",
"user_role": "19",
"fk_entity_type_id": "2",
"role_name": "Branch Sales",
"role_type": "SALES"
}
],
"default_lender": 49,
"default_product": 26
}
}

File diff suppressed because it is too large Load Diff

View File

@ -91,7 +91,7 @@ mat-toolbar {
.head-menu {
font-size: 1.3rem !important;
border-bottom: 2px solid rgba(255, 255, 255, 0.2);
background: linear-gradient(58deg, #ca2126, #ca2126);
// background: linear-gradient(58deg, #ca2126, #ca2126);
color: #fff;
&:hover {
background: linear-gradient(58deg, #ca2126, #673ab7);

BIN
salespd_pwa.zip Normal file

Binary file not shown.