sales pd B4 Auto Login : ps

This commit is contained in:
VE10-Sanjeev 2023-10-03 11:30:23 +05:30
parent d3f1b28d77
commit fabfde8335
4 changed files with 354 additions and 359 deletions

View File

@ -51,7 +51,7 @@
<div fxFlex.xs="10" fxFlex.sm="10" class="webhide" style="text-align: right;"> <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'" <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> 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> <button mat-button mat-icon-button (click)="callAPIForPortals(details)" type="button" matTooltip="link." matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
</div> </div>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</div> </div>
@ -118,7 +118,7 @@
</div> </div>
</div> </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.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> <button mat-button mat-icon-button (click)="newPortals(details)" type="button" matTooltip="link" matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
</div> </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.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" color="primary" (click)="uploadDatatoCET(details.sales_pd_id)" <button [disabled]="details.status !== 'COMPLETED'" mat-button mat-icon-button class=" hover-icon" type="button" color="primary" (click)="uploadDatatoCET(details.sales_pd_id)"
@ -248,7 +248,7 @@
</div> </div>
</div> </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.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> <button mat-button mat-icon-button (click)="callAPIForPortals(details)" type="button" matTooltip="Link." matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
</div> </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.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" color="primary" (click)="uploadDatatoCET(details.sales_pd_id)" <button [disabled]="details.status !== 'COMPLETED'" mat-button mat-icon-button class=" hover-icon" type="button" color="primary" (click)="uploadDatatoCET(details.sales_pd_id)"

View File

@ -13,20 +13,20 @@ import { environment } from 'environments/environment';
templateUrl: './sales-pd.component.html', templateUrl: './sales-pd.component.html',
styleUrls: ['./sales-pd.component.scss'] styleUrls: ['./sales-pd.component.scss']
}) })
export class SalesPdComponent implements OnInit { export class SalesPdComponent implements OnInit {
public dataLengthTab4: number; public dataLengthTab4: number;
public dataSourceTab4 = new MatTableDataSource(); public dataSourceTab4 = new MatTableDataSource();
displayedColumns = ['SalesPdId','SalesPdSno','Applicant Name','Short Name','Officer Name','status','Create On','Action']; displayedColumns = ['SalesPdId', 'SalesPdSno', 'Applicant Name', 'Short Name', 'Officer Name', 'status', 'Create On', 'Action'];
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
// data source variable details // data source variable details
salesPdData:any[] = []; salesPdData: any[] = [];
salesPdpdf:any[] = []; salesPdpdf: any[] = [];
errorMessage:any[]=[]; errorMessage: any[] = [];
recordStatus: boolean; recordStatus: boolean;
xpandStatus: boolean = false; xpandStatus: boolean = false;
@ -36,356 +36,356 @@ export class SalesPdComponent implements OnInit {
pageIndex = 0; pageIndex = 0;
pageSize = 10; pageSize = 10;
pageEvent: PageEvent; pageEvent: PageEvent;
todaydate:Date = new Date(); todaydate: Date = new Date();
filter_drop_down_data: { product_ids: any[]; lender_ids: any[]; pd_status: any[]; }; filter_drop_down_data: { product_ids: any[]; lender_ids: any[]; pd_status: any[]; };
limitMsg: boolean = false; limitMsg: boolean = false;
common: any; common: any;
user_type: string =''; user_type: string = '';
is_sales_login:boolean = false is_sales_login: boolean = false
public finallink: any; public finallink: any;
roleID: any; roleID: any;
constructor(private loaderService:LoaderService,private constantProvider:ConstantsProvider,private dialog:MatDialog,private route: ActivatedRoute, private router: Router,private _creditPdService:ApiServiceService,private SalesPDService:SalesPdService) { constructor(private loaderService: LoaderService, private constantProvider: ConstantsProvider, private dialog: MatDialog, private route: ActivatedRoute, private router: Router, private _creditPdService: ApiServiceService, private SalesPDService: SalesPdService) {
// this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count; // this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
// this.common = this.common.count+' '+this.common.factor // this.common = this.common.count+' '+this.common.factor
// this.user_type = localStorage.getItem('len_user_role') // this.user_type = localStorage.getItem('len_user_role')
setTimeout(()=>{ setTimeout(() => {
let userDetails = localStorage.getItem('user_details'); let userDetails = localStorage.getItem('user_details');
console.log('userdetails'); console.log('userdetails');
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.getListofPD()
}
else {
this.is_sales_login = false
this.getListofPD()
}
},4000)
setTimeout(()=>{ let role = this.constantProvider.takeDecisionRouting(JSON.parse(userDetails))
this.common = JSON.parse(localStorage.getItem('commonSettings')) console.log(role)
if(this.common){ if (role == 'sales') {
this.common = this.common.default_pd_list_count; this.is_sales_login = true
this.common = this.common.count+' '+this.common.factor this.getListofPD()
} }
},300) else {
this.is_sales_login = false
this.getListofPD()
}
}, 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)
// this.cameraProvider.checkGPSPermission(); // this.cameraProvider.checkGPSPermission();
// this.salesPDService.clearLocalData(); // this.salesPDService.clearLocalData();
// setTimeout(()=>{ // setTimeout(()=>{
// this.getListofPD() // this.getListofPD()
// },100) // },100)
} }
ngOnInit() { ngOnInit() {
// this.getListofPD(); // this.getListofPD();
// this.salesPDpdf(); // this.salesPDpdf();
} }
uploadDatatoCET(salespdid) { uploadDatatoCET(salespdid) {
this.SalesPDService.uploadSalesDatatoCET(salespdid).subscribe(res=>{ this.SalesPDService.uploadSalesDatatoCET(salespdid).subscribe(res => {
if(res['dataStatus']){ if (res['dataStatus']) {
let user1 = localStorage.getItem('user_details'); let user1 = localStorage.getItem('user_details');
let user=(JSON.parse(user1)) let user = (JSON.parse(user1))
this.roleID = localStorage.getItem('user_role') this.roleID = localStorage.getItem('user_role')
alert(res['msg']); alert(res['msg']);
}else{ alert(res['msg']); } } else { alert(res['msg']); }
},error => { }, error => {
this.errorMessage.push(error); this.errorMessage.push(error);
alert(error.html_format); alert(error.html_format);
}); });
} }
getListofPD() { getListofPD() {
// this.SalesPDService.getSalesPDList() // this.SalesPDService.getSalesPDList()
// .subscribe( // .subscribe(
// data => { // data => {
// if (data.status == 200) { // if (data.status == 200) {
this.SalesPDService.getSalesPDList(this.is_sales_login).subscribe(res=>{ this.SalesPDService.getSalesPDList(this.is_sales_login).subscribe(res => {
if(res['dataStatus']){ if (res['dataStatus']) {
let user1 = localStorage.getItem('user_details'); let user1 = localStorage.getItem('user_details');
let user=(JSON.parse(user1)) let user = (JSON.parse(user1))
this.roleID = localStorage.getItem('user_role') this.roleID = localStorage.getItem('user_role')
this.salesPdData = res['records']; this.salesPdData = res['records'];
this.dataLengthTab4 = res['records'].length; this.dataLengthTab4 = res['records'].length;
this.dataSourceTab4.data = this.salesPdData; this.dataSourceTab4.data = this.salesPdData;
this.recordStatus=false this.recordStatus = false
this.limitMsg = true this.limitMsg = true
if(this.salesPdData.length > 0){ if (this.salesPdData.length > 0) {
let products=[] let products = []
let lenders=[] let lenders = []
let pd_status=[] let pd_status = []
this.salesPdData.map(val=>{ this.salesPdData.map(val => {
// https://gstapp.smcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&PDID=123&Email=manojsahrawat@smcfinance.com // https://gstapp.smcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&PDID=123&Email=manojsahrawat@smcfinance.com
//let link = "http://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U" //let link = "http://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U"
console.log(environment) console.log(environment)
let link let link
if(environment.authorization == 'TnAwuc64pVpcB9xf'){ if (environment.authorization == 'TnAwuc64pVpcB9xf') {
console.log('293') console.log('293')
link ="https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U" link = "https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
}else if(environment.authorization == 'sparqvenba2018'){ } else if (environment.authorization == 'sparqvenba2018') {
console.log('296') console.log('296')
link ="http://salesapp.devopsmcfinance.com/secure?saltkey=VQDa79tyBlpu7ZuKt6U" link = "http://salesapp.devopsmcfinance.com/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
} }
var string:any = { var string: any = {
EmpName:user.user_first_name, EmpName: user.user_first_name,
EmpCode:"", EmpCode: "",
PDID:val.sales_pd_sno, PDID: val.sales_pd_sno,
//PD_NO:val.sales_pd_sno, //PD_NO:val.sales_pd_sno,
} }
//console.log(string); //console.log(string);
//var encodedString = btoa(JSON.stringify(string)); //var encodedString = btoa(JSON.stringify(string));
//console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh" //console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh"
//var decodedString = atob(encodedString); //var decodedString = atob(encodedString);
//console.log("decode",JSON.parse(decodedString)); //console.log("decode",JSON.parse(decodedString));
//let email="mwisesales1@sine.com"; //let email="mwisesales1@sine.com";
let PDID=val.sales_pd_sno; let PDID = val.sales_pd_sno;
// let mail="&Email=manojsahrawat@smcfinance.com" // let mail="&Email=manojsahrawat@smcfinance.com"
this.finallink=link+"&PDID="+PDID+"&Email="+user.email; this.finallink = link + "&PDID=" + PDID + "&Email=" + user.email;
console.log('this.finallink') console.log('this.finallink')
console.log(this.finallink); console.log(this.finallink);
val.link = this.finallink; val.link = this.finallink;
if(products.length > 0 ){ if (products.length > 0) {
if(products.filter(pro=>pro == val.product_id).length == 0 ){ if (products.filter(pro => pro == val.product_id).length == 0) {
products.push(val.product_id) products.push(val.product_id)
} }
} }
else{ else {
products.push(val.product_id) products.push(val.product_id)
} }
if(lenders.length > 0 ){ if (lenders.length > 0) {
if(lenders.filter(pro=>pro == val.lender_id).length == 0 ){ if (lenders.filter(pro => pro == val.lender_id).length == 0) {
lenders.push(val.lender_id) lenders.push(val.lender_id)
} }
} }
else{ else {
lenders.push(val.lender_id) lenders.push(val.lender_id)
} }
if(pd_status.length > 0 ){ if (pd_status.length > 0) {
if(pd_status.filter(pro=>pro == val.status).length == 0 ){ if (pd_status.filter(pro => pro == val.status).length == 0) {
pd_status.push(val.status) pd_status.push(val.status)
} }
} }
else{ else {
pd_status.push(val.status) pd_status.push(val.status)
} }
}) })
this.filter_drop_down_data={product_ids:products,lender_ids:lenders,pd_status:pd_status} this.filter_drop_down_data = { product_ids: products, lender_ids: lenders, pd_status: pd_status }
// console.log(this.filter_drop_down_data); // console.log(this.filter_drop_down_data);
}
}
else{
this.salesPdData=[];
this.dataLengthTab4= null;
this.recordStatus=true;
this.limitMsg = false
} }
} }
else {
this.salesPdData = [];
this.dataLengthTab4 = null;
this.recordStatus = true;
this.limitMsg = false
}
}
// , error => this.errorMessage = <any> error); // , error => this.errorMessage = <any> error);
,error => { , error => {
this.errorMessage.push(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.!'); // 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); alert(error.html_format);
}); });
} }
// editForm(value_obj){ // editForm(value_obj){
// alert('abc'); // alert('abc');
// console.log('value'); // console.log('value');
// console.log(value_obj); // console.log(value_obj);
// // let product= localStorage.getItem('product_id_salesPD') // // let product= localStorage.getItem('product_id_salesPD')
// // storing the sales_pd_id and product id in local storagey // // storing the sales_pd_id and product id in local storagey
// let primary_key= 'sales_pd_id' // 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) { // 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' // primary_key = 'local_pd_id'
// } // }
// // this.salesPDService.insertData_Replace('sales_pd_id_PRIMARYKEY',value_obj[primary_key]).then(()=>{ // // 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(()=>{ // //this.salesPDService.insertData_Replace('sales_rand_string',value_obj['rand_string']).then(()=>{
// // localStorage.setItem('product_id_salesPD',value_obj.product_id) // // localStorage.setItem('product_id_salesPD',value_obj.product_id)
// if(!value_obj.hasOwnProperty('sales_pd_type')&& !value_obj.sales_pd_type) { // if(!value_obj.hasOwnProperty('sales_pd_type')&& !value_obj.sales_pd_type) {
// value_obj.sales_pd_type = '1' // value_obj.sales_pd_type = '1'
// } // }
// console.log('value'); // console.log('value');
// console.log(value_obj); // console.log(value_obj);
// this.router.navigate(['../sectionlist']) // this.router.navigate(['../sectionlist'])
// // localStorage.setItem('sales_pd_type',value_obj.sales_pd_type) // // localStorage.setItem('sales_pd_type',value_obj.sales_pd_type)
// //this.navigate.push(SectionListPage,{product_id:value_obj.product_id,sales_pd_type:value_obj.sales_pd_type}) // //this.navigate.push(SectionListPage,{product_id:value_obj.product_id,sales_pd_type:value_obj.sales_pd_type})
// // }) // // })
// //}) // //})
// } // }
// editForm2(value_obj){ // editForm2(value_obj){
// // let product= localStorage.getItem('product_id_salesPD') // // let product= localStorage.getItem('product_id_salesPD')
// // storing the sales_pd_id and product id in local storagey // // storing the sales_pd_id and product id in local storagey
// let primary_key= 'sales_pd_id' // 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) { // 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' // primary_key = 'local_pd_id'
// } // }
// this.salesPDService.insertData_Replace('sales_pd_id_PRIMARYKEY',value_obj[primary_key]).then(()=>{ // 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(()=>{ // this.salesPDService.insertData_Replace('sales_rand_string',value_obj['rand_string']).then(()=>{
// localStorage.setItem('product_id_salesPD',value_obj.product_id) // localStorage.setItem('product_id_salesPD',value_obj.product_id)
// if(!value_obj.hasOwnProperty('sales_pd_type')&& !value_obj.sales_pd_type) { // if(!value_obj.hasOwnProperty('sales_pd_type')&& !value_obj.sales_pd_type) {
// value_obj.sales_pd_type = '1' // value_obj.sales_pd_type = '1'
// } // }
// console.log(value_obj); // console.log(value_obj);
// localStorage.setItem('sales_pd_type',value_obj.sales_pd_type) // localStorage.setItem('sales_pd_type',value_obj.sales_pd_type)
// this.navCtrl.push(SectionListPage,{product_id:value_obj.product_id,sales_pd_type:value_obj.sales_pd_type}) // this.navCtrl.push(SectionListPage,{product_id:value_obj.product_id,sales_pd_type:value_obj.sales_pd_type})
// }) // })
// }) // })
// } // }
editForm(value_obj){ editForm(value_obj) {
console.log(value_obj.sales_pd_id,value_obj.rand_string) console.log(value_obj.sales_pd_id, value_obj.rand_string)
// alert('abc'); // alert('abc');
console.log('value'); console.log('value');
console.log(value_obj); console.log(value_obj);
let campletedCase = JSON.stringify(value_obj) let campletedCase = JSON.stringify(value_obj)
localStorage.setItem('completedPD',campletedCase) localStorage.setItem('completedPD', campletedCase)
// let product= localStorage.getItem('product_id_salesPD') // let product= localStorage.getItem('product_id_salesPD')
// storing the sales_pd_id and product id in local storagey // storing the sales_pd_id and product id in local storagey
let primary_key= 'sales_pd_id' 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) { 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' primary_key = 'local_pd_id'
} }
console.log(value_obj[primary_key]) console.log(value_obj[primary_key])
localStorage.setItem('sales_pd_id_PRIMARYKEY',value_obj[primary_key]); localStorage.setItem('sales_pd_id_PRIMARYKEY', value_obj[primary_key]);
localStorage.setItem('sales_rand_string',value_obj.rand_string); 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_pd_id_PRIMARYKEY',value_obj[primary_key]).then(()=>{
//this.salesPDService.insertData_Replace('sales_rand_string',value_obj['rand_string']).then(()=>{ //this.salesPDService.insertData_Replace('sales_rand_string',value_obj['rand_string']).then(()=>{
localStorage.setItem('product_id_salesPD',value_obj.product_id) localStorage.setItem('product_id_salesPD', value_obj.product_id)
if(!value_obj.hasOwnProperty('sales_pd_type')&& !value_obj.sales_pd_type) { if (!value_obj.hasOwnProperty('sales_pd_type') && !value_obj.sales_pd_type) {
value_obj.sales_pd_type = '1' value_obj.sales_pd_type = '1'
}
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', value_obj.product_id, value_obj.sales_pd_type], { relativeTo: this.route })
// })
//})
} }
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',value_obj.product_id,value_obj.sales_pd_type],{ 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.salesPdData=res['records'] 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.salesPdData = res['records']
this.dataLengthTab4 = res['records'].length; this.dataLengthTab4 = res['records'].length;
this.dataSourceTab4.data = this.salesPdData; this.dataSourceTab4.data = this.salesPdData;
this.recordStatus=false this.recordStatus = false
this.limitMsg = false this.limitMsg = false
if(this.salesPdData.length > 0){ if (this.salesPdData.length > 0) {
let products=[] let products = []
let lenders=[] let lenders = []
let pd_status=[] let pd_status = []
this.salesPdData.map(val=>{ this.salesPdData.map(val => {
// https://gstapp.smcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&PDID=123&Email=manojsahrawat@smcfinance.com // https://gstapp.smcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&PDID=123&Email=manojsahrawat@smcfinance.com
//let link = "http://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U" //let link = "http://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U"
console.log(environment) console.log(environment)
let link let link
if(environment.authorization == 'TnAwuc64pVpcB9xf'){ if (environment.authorization == 'TnAwuc64pVpcB9xf') {
console.log('293') console.log('293')
link ="https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U" link = "https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
}else if(environment.authorization == 'sparqvenba2018'){ } else if (environment.authorization == 'sparqvenba2018') {
console.log('296') console.log('296')
link ="http://salesapp.devopsmcfinance.com/secure?saltkey=VQDa79tyBlpu7ZuKt6U" link = "http://salesapp.devopsmcfinance.com/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
} }
var string:any = { var string: any = {
EmpName:user.user_first_name, EmpName: user.user_first_name,
EmpCode:"", EmpCode: "",
PDID:val.sales_pd_sno, PDID: val.sales_pd_sno,
//PD_NO:val.sales_pd_sno, //PD_NO:val.sales_pd_sno,
} }
//console.log(string); //console.log(string);
//var encodedString = btoa(JSON.stringify(string)); //var encodedString = btoa(JSON.stringify(string));
//console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh" //console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh"
//var decodedString = atob(encodedString); //var decodedString = atob(encodedString);
//console.log("decode",JSON.parse(decodedString)); //console.log("decode",JSON.parse(decodedString));
//let email="mwisesales1@sine.com"; //let email="mwisesales1@sine.com";
let PDID=val.sales_pd_sno; let PDID = val.sales_pd_sno;
// let mail="&Email=manojsahrawat@smcfinance.com" // let mail="&Email=manojsahrawat@smcfinance.com"
this.finallink=link+"&PDID="+PDID+"&Email="+user.email; this.finallink = link + "&PDID=" + PDID + "&Email=" + user.email;
console.log('this.finallink') console.log('this.finallink')
console.log(this.finallink); console.log(this.finallink);
val.link = this.finallink; val.link = this.finallink;
if(products.length > 0 ){ if (products.length > 0) {
if(products.filter(pro=>pro == val.product_id).length == 0 ){ if (products.filter(pro => pro == val.product_id).length == 0) {
products.push(val.product_id) products.push(val.product_id)
} }
} }
else{ else {
products.push(val.product_id) products.push(val.product_id)
} }
if(lenders.length > 0 ){ if (lenders.length > 0) {
if(lenders.filter(pro=>pro == val.lender_id).length == 0 ){ if (lenders.filter(pro => pro == val.lender_id).length == 0) {
lenders.push(val.lender_id) lenders.push(val.lender_id)
} }
} }
else{ else {
lenders.push(val.lender_id) lenders.push(val.lender_id)
} }
if(pd_status.length > 0 ){ if (pd_status.length > 0) {
if(pd_status.filter(pro=>pro == val.status).length == 0 ){ if (pd_status.filter(pro => pro == val.status).length == 0) {
pd_status.push(val.status) pd_status.push(val.status)
} }
} }
else{ else {
pd_status.push(val.status) pd_status.push(val.status)
} }
}) })
this.filter_drop_down_data={product_ids:products,lender_ids:lenders,pd_status:pd_status} this.filter_drop_down_data = { product_ids: products, lender_ids: lenders, pd_status: pd_status }
// console.log(this.filter_drop_down_data); // console.log(this.filter_drop_down_data);
} }
} }
else{ else {
this.salesPdData=[]; this.salesPdData = [];
this.dataLengthTab4= null; this.dataLengthTab4 = null;
this.recordStatus=true; this.recordStatus = true;
this.limitMsg = false this.limitMsg = false
}
} }
}
salesPDpdf(pdfdetail){ salesPDpdf(pdfdetail) {
this.loaderService.showMatSpinnerDialog('Processing...') this.loaderService.showMatSpinnerDialog('Processing...')
this.SalesPDService.getSalesPdpdf(pdfdetail) this.SalesPDService.getSalesPdpdf(pdfdetail)
.subscribe( .subscribe(
data => { data => {
if (data.status == 200) { if (data.status == 200) {
// window.location.href=res['records']; // window.location.href=res['records'];
window.open(data.records, '_blank'); window.open(data.records, '_blank');
}
this.loaderService.closeMatSpinnerDialog()
} }
this.loaderService.closeMatSpinnerDialog() // , error => this.errorMessage = <any> error);
, error => {
} this.loaderService.closeMatSpinnerDialog()
// , error => this.errorMessage = <any> error); this.errorMessage.push(error);
,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.!');
this.loaderService.closeMatSpinnerDialog() alert(error.html_format);
this.errorMessage.push(error); });
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
alert(error.html_format);
});
} }
pageChange(e) { pageChange(e) {
@ -401,26 +401,26 @@ editForm(value_obj){
} }
newcreditTrigger(curr_list_obj) { newcreditTrigger(curr_list_obj) {
console.log(curr_list_obj); console.log(curr_list_obj);
const dialogRef = this.dialog.open(DialogOverviewExampleDialog, { const dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
width: '500px', width: '500px',
data: curr_list_obj data: curr_list_obj
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed',result); console.log('The dialog was closed', result);
if(result) { if (result) {
let new_credit_pd_info = curr_list_obj let new_credit_pd_info = curr_list_obj
// {fk_sales_pd_id:curr_list_obj.sales_pd_id,sales_pd_sno:curr_list_obj.sales_pd_sno,product_id:curr_list_obj.product_id,smc_credit_pd_type:result,smc_credit_pd:null,lender_id:curr_list_obj.lender_id,applicant_name:curr_list_obj.applicant_name,} // {fk_sales_pd_id:curr_list_obj.sales_pd_id,sales_pd_sno:curr_list_obj.sales_pd_sno,product_id:curr_list_obj.product_id,smc_credit_pd_type:result,smc_credit_pd:null,lender_id:curr_list_obj.lender_id,applicant_name:curr_list_obj.applicant_name,}
new_credit_pd_info.fk_sales_pd_id = curr_list_obj.sales_pd_id new_credit_pd_info.fk_sales_pd_id = curr_list_obj.sales_pd_id
new_credit_pd_info.smc_credit_pd_type = result new_credit_pd_info.smc_credit_pd_type = result
new_credit_pd_info.smc_credit_pd = null new_credit_pd_info.smc_credit_pd = null
this._creditPdService.curr_credit_pd_data = new_credit_pd_info this._creditPdService.curr_credit_pd_data = new_credit_pd_info
this.router.navigate(['../credit_pd/pdQuestions']) this.router.navigate(['../credit_pd/pdQuestions'])
} }
}); });
} }
newForm(){ newForm() {
// this.salesPDService.getData_fromLocal('sec1').then(result=>{ // this.salesPDService.getData_fromLocal('sec1').then(result=>{
// console.log("image",result); // console.log("image",result);
// if(result){ // if(result){
@ -436,33 +436,48 @@ editForm(value_obj){
localStorage.removeItem('product_id_salesPD') localStorage.removeItem('product_id_salesPD')
localStorage.removeItem('sales_pd_type') localStorage.removeItem('sales_pd_type')
// this.navCtrl.push(HomePage) // this.navCtrl.push(HomePage)
this.router.navigate([ '../../sales-pd-list/add-pd'], { relativeTo: this.route }); this.router.navigate(['../../sales-pd-list/add-pd'], { relativeTo: this.route });
}
callAPIForPortals(value_obj) {
let user1 = localStorage.getItem('user_details');
let user = (JSON.parse(user1))
let temp_PDID = value_obj.sales_pd_sno;
let link_url = (environment.authorization == 'TnAwuc64pVpcB9xf') ? "https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U" :
(environment.authorization == 'sparqvenba2018') ? "http://salesapp.devopsmcfinance.com/secure?saltkey=VQDa79tyBlpu7ZuKt6U" : "";
if (temp_PDID && user.email) {
link_url += "&PDID=" + temp_PDID + "&Email=" + user.email;
console.log("link = " + link_url);
this.SalesPDService.callAPIForPortals(value_obj, user, link_url).subscribe(res => {
if (res['dataStatus']) {
window.open(link_url);
} else { alert(res['message']); }
}, error => {
this.errorMessage.push(error);
alert(error.html_format);
});
} else {
alert("Email And PDID not Found");
} }
newPortal() { }
console.log(this.finallink)
window.open(this.finallink);
}
regeneratereport(data,option) regeneratereport(data, option) {
{
const dialogRef = this.dialog.open(ReGenerateReportComponent, {
const dialogRef = this.dialog.open(ReGenerateReportComponent,{ data: { pdid: data, option: option },
data: {pdid: data,option: option},
disableClose: true, disableClose: true,
minWidth: '30%', minWidth: '30%',
maxWidth: '40%', maxWidth: '40%',
}) })
dialogRef.afterClosed() dialogRef.afterClosed()
.subscribe(dataresult => { .subscribe(dataresult => {
// this.viewPdDetails(this.viewID,this.masterRandomString) // this.viewPdDetails(this.viewID,this.masterRandomString)
}) })
} }
} }
@Component({ @Component({
@ -470,81 +485,57 @@ editForm(value_obj){
templateUrl: 'trigger-confirm-dialog.html', templateUrl: 'trigger-confirm-dialog.html',
}) })
export class DialogOverviewExampleDialog { export class DialogOverviewExampleDialog {
pd_type_list:any=[{ pd_type_list: any = [{
id:"1", id: "1",
dis_name:"Physical PD" dis_name: "Physical PD"
},{ }, {
id:"2", id: "2",
dis_name:"Telephonic PD" dis_name: "Telephonic PD"
}] }]
choosedPD:any=null choosedPD: any = null
// notifier:NotifierService // notifier:NotifierService
constructor( constructor(
public dialogRef: MatDialogRef<DialogOverviewExampleDialog>, public dialogRef: MatDialogRef<DialogOverviewExampleDialog>,
@Inject(MAT_DIALOG_DATA) public data) { @Inject(MAT_DIALOG_DATA) public data) {
// this.notifier=notifier // this.notifier=notifier
} }
onNoClick(): void { onNoClick(): void {
this.dialogRef.close(); this.dialogRef.close();
} }
onSubmit(){ onSubmit() {
console.log(this.choosedPD); console.log(this.choosedPD);
if(this.choosedPD != '' && !this.choosedPD) { if (this.choosedPD != '' && !this.choosedPD) {
alert("Please choose the PD Type"); alert("Please choose the PD Type");
return return
} }
this.dialogRef.close(this.choosedPD) this.dialogRef.close(this.choosedPD)
} }
getgst(pd_id) getgst(pd_id) {
{
let link = "https://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&data=" let link = "https://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&data="
var string:any = { var string: any = {
EmpName:"John Doe", EmpName: "John Doe",
EmpCode: "",
PD_ID: "",
PD_NO: "",
}
EmpCode:"",
PD_ID:"",
PD_NO:"",
}
var encodedString = btoa(JSON.stringify(string)); var encodedString = btoa(JSON.stringify(string));
console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh" console.log("encode", encodedString); // Outputs: "SGVsbG8gV29ybGQh"
var decodedString = atob("eyJFbXBOYW1lIjoiTXdpc2UgU2FsZXMtMSIsIkVtcENvZGUiOiIiLCJQRF9JRCI6IjQzOCIsIlBEX05PIjoiTVdJU0UtV0NUTC0yMTAifQ=="); var decodedString = atob("eyJFbXBOYW1lIjoiTXdpc2UgU2FsZXMtMSIsIkVtcENvZGUiOiIiLCJQRF9JRCI6IjQzOCIsIlBEX05PIjoiTVdJU0UtV0NUTC0yMTAifQ==");
console.log('jumbo'); console.log('jumbo');
console.log("decode",JSON.parse(decodedString)); console.log("decode", JSON.parse(decodedString));
let finallink=link+encodedString; let finallink = link + encodedString;
console.log('finallink'); console.log('finallink');
console.log(finallink); console.log(finallink);
window.open(finallink, '_system', 'location=yes'); window.open(finallink, '_system', 'location=yes');
} }
// viewReport(){
// const dialogRef = this.dialog.open(componen_name, {
// data: {data: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 => {
// // this.notifier.notify('success', 'Successfully allocated.!');
// // if(dataresult == 'refresh') {
// // this.loadTemplates(this.product_id,2,this.sales_pd_type);
// // }
// });
// }
} }

View File

@ -724,6 +724,10 @@ generatesateliteimage(param:any): Observable<any>{
return this._http.get<any[]>(api_url +"uploadSalesPDDataToCETApp/"+id); return this._http.get<any[]>(api_url +"uploadSalesPDDataToCETApp/"+id);
} }
callAPIForPortals(row_obj,user_obj,link_url) {
return this._http.post<any[]>(api_url + "callAPIForPortals", {'sales_object': row_obj,'user_object':user_obj,'link_url':link_url});
}
loadTemplatelocal(){ loadTemplatelocal(){
return this._http.get('assets/data/flyhi.json').map(rr=>{ return this._http.get('assets/data/flyhi.json').map(rr=>{