latest updates @APR 20, 2022
This commit is contained in:
parent
90b15f5e00
commit
a0bdbc7c55
1657 changed files with 301942 additions and 0 deletions
204
src/app/kyc-approval/device-doc/device-doc.component.html
Normal file
204
src/app/kyc-approval/device-doc/device-doc.component.html
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
|
||||
|
||||
<div class="card" style="height: 90vh;">
|
||||
<div class="card-header">
|
||||
<h4>Documents</h4>
|
||||
|
||||
</div>
|
||||
<div *ngIf="!hide" class="card-body" style="height: 80vh;
|
||||
overflow-y: scroll;">
|
||||
<div id="toast">
|
||||
<div id="desc">{{ data_descip }}</div>
|
||||
</div>
|
||||
<div class="loading" *ngIf="Load">Loading…</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Image</th>
|
||||
<th>Doc Number</th>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of imageDoc">
|
||||
<td><img style="width: 100px;" [src]="'https://www.oneqlik.in'+item.image.substring(6)" (click)="openModal(template,item)"></td>
|
||||
<td>{{item.phone}}</td>
|
||||
<td>{{item.doctype}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="collapse" id="collapseExample">
|
||||
<div class="card card-body" *ngIf="!show">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
Vahan Certificate
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" (change)="onFileChanged($event,'vahan')">
|
||||
</td>
|
||||
<!-- <td>
|
||||
<input id="docdate" bsDatepicker [bsConfig]="bsConfig" name="docdate" style="background: grey;height: 30px"
|
||||
placeholder="mm/dd/yyyy" [(ngModel)]="vaahan_certifcate_date" type="text" style="width: 40%">
|
||||
</td> -->
|
||||
<td>
|
||||
<button class="btn btn-primary btn-sm" (click)="onUpload('vahan')"><i class="fas fa-upload"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
State RTO Certificate
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" (change)="onFileChanged($event,'state')">
|
||||
</td>
|
||||
<!-- <td>
|
||||
<input id="docdate" bsDatepicker [bsConfig]="bsConfig" name="docdate" style="background: grey;height: 30px"
|
||||
placeholder="mm/dd/yyyy" [(ngModel)]="state_certifcate_date" type="text" style="width: 40%">
|
||||
</td> -->
|
||||
<td>
|
||||
<button class="btn btn-primary btn-sm" (click)="onUpload('state')"><i class="fas fa-upload"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" (click)="submit()">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card-body" *ngIf="show">
|
||||
<table class="table table-striped">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Image</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>State RTO Certificate</td>
|
||||
<td>
|
||||
<img style="width: 100px;" [src]="'https://www.oneqlik.in'+statePic.substring(6)"
|
||||
(click)="openModal1(template,statePic.substring(6))">
|
||||
</td>
|
||||
<td>
|
||||
{{state_certifcate_date |date:"medium"}}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vahan Certificate</td>
|
||||
<td>
|
||||
<img style="width: 100px;" [src]="'https://www.oneqlik.in'+vahanPic.substring(6)"
|
||||
(click)="openModal1(template,vahanPic.substring(6))">
|
||||
</td>
|
||||
<td>
|
||||
{{vaahan_certifcate_date |date:"medium"}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="hide && show" class="card-body">
|
||||
<table class="table table-striped">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Image</th>
|
||||
<th>Date</th>
|
||||
<th>Download</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>State RTO Certificate</td>
|
||||
<td>
|
||||
<img style="width: 100px;" [src]="'https://www.oneqlik.in'+statePic.substring(6)"
|
||||
(click)="openModal1(template,statePic.substring(6))">
|
||||
</td>
|
||||
<td>
|
||||
{{state_certifcate_date |date:"medium"}}
|
||||
</td>
|
||||
<td>
|
||||
<a (click)="downloadImage('https://www.oneqlik.in'+statePic.substring(6),'State_RTO_Certificate.jpg')" class="btn btn-primary btn-sm"><i class="fas fa-download"></i></a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vahan Certificate</td>
|
||||
<td>
|
||||
<img style="width: 100px;" [src]="'https://www.oneqlik.in'+vahanPic.substring(6)"
|
||||
(click)="openModal1(template,vahanPic.substring(6))">
|
||||
</td>
|
||||
<td>
|
||||
{{vaahan_certifcate_date |date:"medium"}}
|
||||
</td>
|
||||
<td>
|
||||
<a (click)="downloadImage('https://www.oneqlik.in'+vahanPic.substring(6),'Vahan_Certificate.jpg')" class="btn btn-primary btn-sm" ><i class="fas fa-download"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div *ngIf="hide && !show" class="text-center">
|
||||
<h4>Documents Not Uploaded</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-footer float-right">
|
||||
<button *ngIf="!hide" class="btn btn-primary" [disabled]='disabled' (click)="submit1('approved')">Approve</button>
|
||||
<button *ngIf="!hide" class="btn btn-danger" [disabled]='disabled' (click)="submit1('reject')">Reject</button>
|
||||
<button class="btn btn-warning" md-dialog-close>Cancel</button>
|
||||
<button *ngIf="!hide" class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample"
|
||||
aria-expanded="false" aria-controls="collapseExample">
|
||||
{{title}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ng-template #template>
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title pull-left">{{titleForDoc}}</h4>
|
||||
<button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body row">
|
||||
<div class="col-md-6">
|
||||
<img style="width: -webkit-fill-available;" src={{image}}>
|
||||
|
||||
</div>
|
||||
<div class="col-md-6" style="padding: 64px;font-size: larger;">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr >
|
||||
<th *ngFor="let item of key;">
|
||||
{{item}}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr >
|
||||
<td *ngFor="let item of value;index as i">
|
||||
{{value[i]}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- <div class="col" *ngFor="let item of key; let i = index">
|
||||
<b>{{ key[i]}}</b> : {{value[i]}}
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
121
src/app/kyc-approval/device-doc/device-doc.component.scss
Normal file
121
src/app/kyc-approval/device-doc/device-doc.component.scss
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
.mainClass {
|
||||
padding-top: 80px;
|
||||
|
||||
margin-right: 10px;
|
||||
box-shadow: 4px 5px #ececec;
|
||||
}
|
||||
|
||||
.mainClass p.head_style {
|
||||
padding-top: 8px;
|
||||
color: white;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
/* .mainClass p.head_style1{
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: #615c5c;
|
||||
text-align: left;
|
||||
padding-left: 1%;
|
||||
} */
|
||||
|
||||
/* .rowStyle{
|
||||
padding-right: 15%;
|
||||
} */
|
||||
|
||||
.formfieldstyle {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
// .rowHeight {
|
||||
// height: 145px;
|
||||
// overflow: auto;
|
||||
// }
|
||||
|
||||
#toast {
|
||||
visibility: hidden;
|
||||
max-width: 150px;
|
||||
height: 50px;
|
||||
/*margin-left: -125px;*/
|
||||
margin: auto;
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 60%;
|
||||
right: 0;
|
||||
bottom: 80%;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#toast #img {
|
||||
width: 150px;
|
||||
height: 50px;
|
||||
|
||||
float: left;
|
||||
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
||||
background-color: #111;
|
||||
color: #fff;
|
||||
}
|
||||
#toast #desc {
|
||||
color: #fff;
|
||||
|
||||
padding: 16px;
|
||||
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#toast.show {
|
||||
visibility: visible;
|
||||
-webkit-animation: fadein 0.5s, expand 0.5s 0.5s, stay 3s 1s, shrink 0.5s 2s,
|
||||
fadeout 0.5s 2.5s;
|
||||
animation: fadein 0.5s, expand 0.5s 0.5s, stay 3s 1s, shrink 0.5s 4s,
|
||||
fadeout 0.5s 4.5s;
|
||||
}
|
||||
|
||||
/deep/ .mat-input-flex {
|
||||
border: 1px solid #c1c1c1;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
.modal-class {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
#toast {
|
||||
visibility: hidden;
|
||||
max-width: 250px;
|
||||
height: 50px;
|
||||
/*margin-left: -125px;*/
|
||||
margin: auto;
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 60%;
|
||||
right: 0;
|
||||
bottom: 80%;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.modal-lg {
|
||||
max-width: 1068px;
|
||||
}
|
||||
::ng-deep .modal-dialog {
|
||||
max-width: 1200px !important;
|
||||
width: 1200px;
|
||||
}
|
||||
25
src/app/kyc-approval/device-doc/device-doc.component.spec.ts
Normal file
25
src/app/kyc-approval/device-doc/device-doc.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DeviceDocComponent } from './device-doc.component';
|
||||
|
||||
describe('DeviceDocComponent', () => {
|
||||
let component: DeviceDocComponent;
|
||||
let fixture: ComponentFixture<DeviceDocComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeviceDocComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeviceDocComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
458
src/app/kyc-approval/device-doc/device-doc.component.ts
Normal file
458
src/app/kyc-approval/device-doc/device-doc.component.ts
Normal file
|
|
@ -0,0 +1,458 @@
|
|||
import { Component, Inject, OnInit, TemplateRef } from '@angular/core';
|
||||
import { MdDialogRef, MdSnackBar, MD_DIALOG_DATA } from '@angular/material';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { BsDatepickerConfig, BsModalRef, BsModalService } from 'ngx-bootstrap';
|
||||
import { ViewCustomerDetailsComponent } from '../../add/view-customer-details/view-customer-details.component';
|
||||
import { ContactService } from '../../contact.service';
|
||||
declare var swal: any;
|
||||
import { Observable, Observer } from "rxjs";
|
||||
@Component({
|
||||
selector: 'app-device-doc',
|
||||
templateUrl: './device-doc.component.html',
|
||||
styleUrls: ['./device-doc.component.scss']
|
||||
})
|
||||
export class DeviceDocComponent implements OnInit {
|
||||
docRow:boolean=false;
|
||||
|
||||
// adhar front - mandatory
|
||||
// adhar back - mandatory
|
||||
// warranty card - mandatory
|
||||
// vehicle sales invoice/vehicle RC - mandatory
|
||||
// vehicle RC -
|
||||
// vehicle Photo -
|
||||
modalRef: BsModalRef;
|
||||
disabled:boolean=false
|
||||
imageuploadObject = [{doctype:'Adhar card1',image:'',phone:'',docdate:''},
|
||||
{doctype:'Adhar card2',image:'',phone:'',docdate:''},
|
||||
{doctype:'Warrenty Card',image:'',phone:'',docdate:''},
|
||||
{doctype:'vehicle sales invoice',image:'',phone:'',docdate:''},
|
||||
{doctype:'vehicle RC',image:'',phone:'',docdate:''},
|
||||
{doctype:'vehicle Photo',image:'',phone:'',docdate:''},
|
||||
];
|
||||
uploadStatus: any = 'Upload';
|
||||
documentList = [
|
||||
{
|
||||
"docId": "Adhar card1",
|
||||
"docName": "Adhar Card Front"
|
||||
},
|
||||
{
|
||||
"docId": "Adhar card2",
|
||||
"docName": "Adhar Card Back"
|
||||
},
|
||||
{
|
||||
"docId": "vehicle sales invoice",
|
||||
"docName": "vehicle sales invoice"
|
||||
},
|
||||
{
|
||||
"docId": "voter Id",
|
||||
"docName": "Voter Id"
|
||||
},
|
||||
{
|
||||
"docId": "vehicle RC",
|
||||
"docName": "vehicle RC"
|
||||
},
|
||||
{
|
||||
"docId": "vehicle Photo",
|
||||
"docName": "vehicle Photo"
|
||||
},
|
||||
{
|
||||
"docId": "PAN card",
|
||||
"docName": "Pan Card"
|
||||
},
|
||||
{
|
||||
"docId": "Driving License",
|
||||
"docName": "Driving License"
|
||||
},
|
||||
{
|
||||
"docId": "RC Book",
|
||||
"docName": "RC Book"
|
||||
},
|
||||
{
|
||||
"docId": "Device Image",
|
||||
"docName": "Device Image"
|
||||
},
|
||||
{
|
||||
"docId": "Co.registered Card",
|
||||
"docName": "Co.registered Card"
|
||||
},
|
||||
{
|
||||
"docId": "Nepal Citizenship",
|
||||
"docName": "Nepal Citizenship"
|
||||
},
|
||||
{
|
||||
"docId": "Blue Book",
|
||||
"docName": "Blue Book"
|
||||
},
|
||||
{
|
||||
"docId": "Warrenty Card",
|
||||
"docName": "Warrenty Card"
|
||||
},
|
||||
{
|
||||
"docId": "Other",
|
||||
"docName": "Other"
|
||||
}
|
||||
|
||||
];
|
||||
bsConfig: Partial<BsDatepickerConfig>;
|
||||
imageDoc;
|
||||
show:boolean=false;
|
||||
hide:boolean=false
|
||||
title="Upload Certificates"
|
||||
data_descip: string;
|
||||
constructor(private modalService: BsModalService,public dialogRef: MdDialogRef<ViewCustomerDetailsComponent>,public snackBar: MdSnackBar,
|
||||
private contactService: ContactService, private _flashMessagesService: FlashMessagesService,@Inject(MD_DIALOG_DATA) public data: any) {
|
||||
console.log(data);
|
||||
this.hide=data.dealer_payload.hide?data.dealer_payload.hide:false;
|
||||
if(data.dealer_payload.vaahan_certificate && data.dealer_payload.state_rto_certificate_path){
|
||||
this.show=true;
|
||||
console.log(this.hide,this.show);
|
||||
|
||||
this.title="Show Certificates";
|
||||
this.statePic=data.dealer_payload.state_rto_certificate_path;
|
||||
this.vahanPic=data.dealer_payload.vaahan_certificate;
|
||||
this.state_certifcate_date=data.dealer_payload.state_certifcate_date;
|
||||
this.vaahan_certifcate_date=data.dealer_payload.vaahan_certifcate_date
|
||||
}
|
||||
if(data.dealer_payload.kycStatus=="Approved" || data.dealer_payload.kycStatus=="Reject"){
|
||||
this.disabled=true
|
||||
}
|
||||
this.imageDoc=data.dealer_payload.imageDoc
|
||||
}
|
||||
ngOnInit() {
|
||||
this.bsConfig = Object.assign({}, { containerClass: 'theme-dark-blue' });
|
||||
}
|
||||
|
||||
|
||||
|
||||
AddDocumentsField(addedRow:any){
|
||||
console.log("Inside function !!!");
|
||||
if(addedRow){
|
||||
this.docRow = true;
|
||||
}
|
||||
|
||||
var obj={doctype:'',image:'',phone:'',docdate:''};
|
||||
this.imageuploadObject.push(obj);
|
||||
console.log(this.imageuploadObject);
|
||||
// console.log("ImageuploadObject=>",this.imageuploadObject);
|
||||
}
|
||||
selectedFile: File;
|
||||
statePic;
|
||||
vahanPic
|
||||
onFileChanged(event1,type) {
|
||||
this.selectedFile = <File>event1.target.files[0];
|
||||
console.log(this.selectedFile,type);
|
||||
|
||||
var fileToUpload = event1.target.files.item(0);
|
||||
|
||||
//Show image preview
|
||||
if(type=="state"){
|
||||
console.log("in STATE");
|
||||
|
||||
let reader = new FileReader();
|
||||
reader.onload = (event: any) => {
|
||||
this.statePic = event.target.result;
|
||||
reader.readAsDataURL(fileToUpload);
|
||||
}
|
||||
|
||||
}else{
|
||||
let reader = new FileReader();
|
||||
reader.onload = (event: any) => {
|
||||
this.vahanPic = event.target.result;
|
||||
reader.readAsDataURL(fileToUpload);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Load:Boolean=false;
|
||||
ifuploadArr:Boolean=false;
|
||||
onUpload(imgIndex) {
|
||||
console.log(imgIndex);
|
||||
console.log(this.imageuploadObject);
|
||||
const fd = new FormData();
|
||||
console.log("selected file name =>",this.selectedFile.name);
|
||||
if(this.selectedFile.name == " "){
|
||||
swal(
|
||||
'Upload Error',
|
||||
'Please select document type before upload !!!',
|
||||
'error'
|
||||
)
|
||||
}else{
|
||||
fd.append('photo',this.selectedFile,this.selectedFile.name)
|
||||
console.log("imgURL=>",fd) ;
|
||||
this.Load = true;
|
||||
this.contactService.imageupload(fd)
|
||||
.subscribe(res=>{
|
||||
this.Load = false;
|
||||
this.ifuploadArr = true;
|
||||
// this.uploadStatus = 'Uploaded';
|
||||
console.log(res);
|
||||
var resImage ='';
|
||||
resImage = res['_body'];
|
||||
console.log(res['_body']);
|
||||
if(imgIndex=='vahan'){
|
||||
this.vahanPic=resImage
|
||||
}else{
|
||||
this.statePic=resImage
|
||||
}
|
||||
// this.imageuploadObject[imgIndex].image = resImage;
|
||||
// console.log(this.imageuploadObject);
|
||||
// console.log(res);
|
||||
},err=>{
|
||||
this.Load= false;
|
||||
this._flashMessagesService.show('Internal server error , try again', { cssClass: 'alert-success', timeout: 2000 });
|
||||
})
|
||||
}
|
||||
}
|
||||
showUpload
|
||||
DeleteDocumentsField(index){
|
||||
console.log(this.imageuploadObject.length);
|
||||
if(this.imageuploadObject.length == 1){
|
||||
this.docRow = false;
|
||||
this.showUpload = false;
|
||||
}
|
||||
this.imageuploadObject.splice(index, 1);
|
||||
|
||||
}
|
||||
// vaahan_certificate:{
|
||||
// type:String
|
||||
// },
|
||||
// state_rto_certificate_path:{
|
||||
// type:String
|
||||
// },
|
||||
// vaahan_certifcate_date:{
|
||||
// type:Date
|
||||
// },
|
||||
// state_certifcate_date:{
|
||||
// type:Date
|
||||
// },
|
||||
vaahan_certifcate_date;
|
||||
state_certifcate_date;
|
||||
submit(){
|
||||
|
||||
if(this.vahanPic && this.statePic){
|
||||
var request={
|
||||
_id:this.data.dealer_payload._id,
|
||||
device_model: this.data.dealer_payload.device_model._id,
|
||||
vehicleType:this.data.dealer_payload.device_model._id,
|
||||
vaahan_certificate:this.vahanPic,
|
||||
state_rto_certificate_path:this.statePic,
|
||||
vaahan_certifcate_date:new Date(),
|
||||
state_certifcate_date:new Date()
|
||||
}
|
||||
console.log(request);
|
||||
|
||||
this.contactService.editdevice(request).subscribe((res)=>{
|
||||
this.dialogRef.close('yes')
|
||||
})
|
||||
|
||||
}else{
|
||||
this.data_descip = "All Documents are mandatory !!!";
|
||||
launch_toast();
|
||||
|
||||
|
||||
this._flashMessagesService.show('All Documents are mandatory', { cssClass: 'alert-danger', timeout: 2000 });
|
||||
}
|
||||
function launch_toast() {
|
||||
// console.log(divid);
|
||||
var x = document.getElementById("toast")
|
||||
//console.log(x);
|
||||
x.className = "show";
|
||||
setTimeout(function () { x.className = x.className.replace("show", ""); }, 4500);
|
||||
}
|
||||
|
||||
}
|
||||
image
|
||||
number
|
||||
key=[];
|
||||
value=[];
|
||||
titleForDoc
|
||||
|
||||
openModal(template: TemplateRef<any>,doc){
|
||||
this.modalRef = this.modalService.show(template,{'backdrop':'static',class:'modal-dialog-centered'});
|
||||
// this.number=doc.phone;
|
||||
var name=(this.data.dealer_payload.user?this.data.dealer_payload.user.first_name?this.data.dealer_payload.user.first_name:"":''+" "+
|
||||
this.data.dealer_payload.user?this.data.dealer_payload.user.last_name?this.data.dealer_payload.user.last_name:"":'')
|
||||
this.titleForDoc=doc.doctype?doc.doctype=="Adhar card1"?"Adhar card Front":doc.doctype=="Adhar card2"?"Adhar card Back":doc.doctype:doc.doctype
|
||||
this.key=[];
|
||||
this.value=[]
|
||||
if(doc.doctype=="Adhar card1" || doc.doctype=="Adhar card1 *"){
|
||||
this.key=['Name',"Address","Adhaar no"];
|
||||
this.value=[name,
|
||||
this.data.dealer_payload.user?this.data.dealer_payload.user.address?this.data.dealer_payload.user.address:"":'',
|
||||
doc.phone]
|
||||
|
||||
}else if(doc.doctype=="Adhar card2" || doc.doctype=="Adhar card2 *"){
|
||||
this.key=['Name',"Address","Adhaar no"];
|
||||
this.value=[this.data.dealer_payload.user?this.data.dealer_payload.user.first_name?this.data.dealer_payload.user.first_name:"":''+" "+
|
||||
this.data.dealer_payload.user?this.data.dealer_payload.user.last_name?this.data.dealer_payload.user.last_name:"":'',
|
||||
this.data.dealer_payload.user?this.data.dealer_payload.user.address?this.data.dealer_payload.user.address:"":'',
|
||||
doc.phone]
|
||||
|
||||
}else if(doc.doctype=="vehicle sales invoice"|| doc.doctype=="vehicle sales invoice *" ){
|
||||
this.key=['Name',"Address","Chassis no","Engine no","Number"];
|
||||
this.value=[name,
|
||||
this.data.dealer_payload.user?this.data.dealer_payload.user.address?this.data.dealer_payload.user.address:"":'',
|
||||
this.data.dealer_payload.engineNo?this.data.dealer_payload.engineNo:"",
|
||||
this.data.dealer_payload.ChassisNo?this.data.dealer_payload.ChassisNo:"",
|
||||
doc.phone]
|
||||
|
||||
|
||||
}else if(doc.doctype=="vehicle RC"|| doc.doctype=="vehicle RC"){
|
||||
this.key=['Name',"Vehicle Number","Address","Engine No.","Chassis No.","Number"];
|
||||
this.value=[name,
|
||||
this.data.dealer_payload.user?this.data.dealer_payload.user.address?this.data.dealer_payload.user.address:"":'',
|
||||
this.data.dealer_payload.Device_Name?this.data.dealer_payload.Device_Name:"",
|
||||
this.data.dealer_payload.engineNo?this.data.dealer_payload.engineNo:"",
|
||||
this.data.dealer_payload.ChassisNo?this.data.dealer_payload.ChassisNo:"",
|
||||
doc.phone]
|
||||
}
|
||||
else if(doc.doctype=="vehicle Photo"){
|
||||
this.key=['Name',"Vehicle Number","IMEI.","Number"];
|
||||
this.value=[name,
|
||||
this.data.dealer_payload.Device_Name?this.data.dealer_payload.Device_Name:"",
|
||||
this.data.dealer_payload.Device_ID?this.data.dealer_payload.Device_ID:"",
|
||||
|
||||
doc.phone]
|
||||
// Warranty card
|
||||
// 1. Name
|
||||
// 2. IMEI no
|
||||
// 3. Mobile no
|
||||
// 4. Address
|
||||
// 5. Vehicle chassi no
|
||||
// 6. Engine number
|
||||
// 7 vehicle RC
|
||||
} else if(doc.doctype=="Warrenty Card" || doc.doctype=="Warrenty Card *"){
|
||||
this.key=['Name',"Vehicle Number","IMEI.","Address","Engine No.","Chassis No","Number"];
|
||||
this.value=[name,
|
||||
this.data.dealer_payload.Device_Name?this.data.dealer_payload.Device_Name:"",
|
||||
this.data.dealer_payload.Device_ID?this.data.dealer_payload.Device_ID:"",
|
||||
this.data.dealer_payload.user?this.data.dealer_payload.user.address?this.data.dealer_payload.user.address:"":'',
|
||||
this.data.dealer_payload.engineNo?this.data.dealer_payload.engineNo:"",
|
||||
this.data.dealer_payload.ChassisNo?this.data.dealer_payload.ChassisNo:"",
|
||||
|
||||
doc.phone]
|
||||
|
||||
}
|
||||
this.image='https://www.oneqlik.in'+doc.image.substring(6)
|
||||
}
|
||||
|
||||
openModal1(template: TemplateRef<any>,doc){
|
||||
this.modalRef = this.modalService.show(template,{'backdrop':'static',class:'modal-lg modal-dialog-centered'});
|
||||
this.number=doc.phone
|
||||
this.image='https://www.oneqlik.in'+doc
|
||||
}
|
||||
|
||||
submit1(status){
|
||||
|
||||
if(status=="reject"){
|
||||
swal({
|
||||
title: 'Please Enter Remark',
|
||||
input: 'text',
|
||||
inputAttributes: {
|
||||
autocapitalize: 'off'
|
||||
},
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Submit',
|
||||
showLoaderOnConfirm: true,
|
||||
|
||||
}).then((result) => {
|
||||
console.log(result)
|
||||
if(!result){
|
||||
swal({
|
||||
title: "Remark is mandatory",
|
||||
})
|
||||
}else{
|
||||
var request={
|
||||
_id:this.data.dealer_payload._id,
|
||||
device_model: this.data.dealer_payload.device_model._id,
|
||||
vehicleType:this.data.dealer_payload.device_model._id,
|
||||
kycStatus:'Reject',
|
||||
remark:result,
|
||||
kycApprovalDate:new Date()
|
||||
}
|
||||
console.log(request);
|
||||
var title
|
||||
if(status=="reject"){
|
||||
title="KYC Rejected"
|
||||
}else{
|
||||
title="KYC Approved"
|
||||
}
|
||||
this.contactService.editdevice(request).subscribe((res)=>{
|
||||
swal({
|
||||
title:title,
|
||||
})
|
||||
this.dialogRef.close('yes')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
}else{
|
||||
var request={
|
||||
_id:this.data.dealer_payload._id,
|
||||
device_model: this.data.dealer_payload.device_model._id,
|
||||
vehicleType:this.data.dealer_payload.device_model._id,
|
||||
kycStatus:'Approved',
|
||||
kycApprovalDate:new Date()
|
||||
|
||||
}
|
||||
this.contactService.editdevice(request).subscribe((res)=>{
|
||||
swal({
|
||||
title: "KYC approved successfully",
|
||||
})
|
||||
this.dialogRef.close('yes')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
base64Image
|
||||
downloadImage(imageUrl,name) {
|
||||
|
||||
this.getBase64ImageFromURL(imageUrl).subscribe(base64data => {
|
||||
this.base64Image = "data:image/jpg;base64," + base64data;
|
||||
// save image to disk
|
||||
var link = document.createElement("a");
|
||||
|
||||
document.body.appendChild(link); // for Firefox
|
||||
|
||||
link.setAttribute("href", this.base64Image);
|
||||
link.setAttribute("download", name);
|
||||
link.click();
|
||||
});
|
||||
}
|
||||
|
||||
getBase64ImageFromURL(url: string) {
|
||||
return Observable.create((observer: Observer<string>) => {
|
||||
const img: HTMLImageElement = new Image();
|
||||
img.crossOrigin = "Anonymous";
|
||||
img.src = url;
|
||||
if (!img.complete) {
|
||||
img.onload = () => {
|
||||
observer.next(this.getBase64Image(img));
|
||||
observer.complete();
|
||||
};
|
||||
img.onerror = err => {
|
||||
observer.error(err);
|
||||
};
|
||||
} else {
|
||||
observer.next(this.getBase64Image(img));
|
||||
observer.complete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getBase64Image(img: HTMLImageElement) {
|
||||
const canvas: HTMLCanvasElement = document.createElement("canvas");
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
const ctx: CanvasRenderingContext2D = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0);
|
||||
const dataURL: string = canvas.toDataURL("image/png");
|
||||
|
||||
return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
|
||||
}
|
||||
|
||||
}
|
||||
361
src/app/kyc-approval/device-kyc/device-kyc.component.html
Normal file
361
src/app/kyc-approval/device-kyc/device-kyc.component.html
Normal file
|
|
@ -0,0 +1,361 @@
|
|||
<div class="container mt-3 mb-3">
|
||||
<div class="row">
|
||||
<div
|
||||
*ngFor="let item of inventoryCount"
|
||||
class="card shadow-sm col-sm rounded p-1 mr-1 text-center"
|
||||
[ngStyle]="{
|
||||
'background-color':
|
||||
item._id === 'Pending'
|
||||
? '#00c0ef'
|
||||
: item._id === 'Reject'
|
||||
? '#f39c12'
|
||||
: '#00a65a'
|
||||
}"
|
||||
>
|
||||
<h6>{{ item._id }}</h6>
|
||||
<span class="text-white">{{ item.TotalDev }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="card-header"
|
||||
style="
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
background: #426e86;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
color: white;
|
||||
box-shadow: 3px 1px 5px 0px rgb(178, 176, 174);
|
||||
"
|
||||
>
|
||||
<!-- style="float: left;background: #efecec;margin-right: 5px;height: 33px;margin-top: 6px;" -->
|
||||
<select
|
||||
[(ngModel)]="limit"
|
||||
(ngModelChange)="callDataTable()"
|
||||
style="
|
||||
background: #efecec;
|
||||
height: 35px;
|
||||
width: 63px;
|
||||
float: left;
|
||||
margin-top: 3px;
|
||||
"
|
||||
>
|
||||
<option *ngFor="let page of pageLengthArr; let i = index" [value]="page">
|
||||
{{ page }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<button
|
||||
class="btn btn-default"
|
||||
[disabled]="previewButton"
|
||||
(click)="pre()"
|
||||
style="border-right-color: #2d4262"
|
||||
>
|
||||
<< {{ "Previous" | translate }}
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-default"
|
||||
[disabled]="nextButton"
|
||||
(click)="next()"
|
||||
style="margin-right: 10px"
|
||||
>
|
||||
{{ "Next" | translate }} >>
|
||||
</button>
|
||||
|
||||
<select
|
||||
[(ngModel)]="status"
|
||||
(ngModelChange)="changeStatus($event)"
|
||||
style="background: #efecec; height: 35px"
|
||||
>
|
||||
<option value="" selected>Please select status</option>
|
||||
<option value="Pending">Pending</option>
|
||||
<option value="Approved">Approved</option>
|
||||
<option value="Reject">Reject</option>
|
||||
</select>
|
||||
|
||||
<select
|
||||
[(ngModel)]="state"
|
||||
id="state"
|
||||
(ngModelChange)="changeStatus($event)"
|
||||
style="background: #efecec; height: 35px"
|
||||
>
|
||||
<option value="" selected>Please select state</option>
|
||||
<option *ngFor="let ustate of Indianstate" [value]="ustate">
|
||||
{{ ustate }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<div style="float: right">
|
||||
<input
|
||||
type="search"
|
||||
style="
|
||||
width: 225px;
|
||||
float: right;
|
||||
border-radius: 0px;
|
||||
line-height: 1.9;
|
||||
background: #efecec;
|
||||
box-shadow: 3px 2px 5px 0px rgb(178, 176, 174);
|
||||
"
|
||||
class="form-control"
|
||||
id="myInput"
|
||||
name="myInput"
|
||||
type="text"
|
||||
[(ngModel)]="myInput"
|
||||
(ngModelChange)="searchFilter($event)"
|
||||
placeholder="{{ 'Device Search' | translate }}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive" style="height: 71vh">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{{ "NAME" | translate }}
|
||||
</th>
|
||||
<!-- <th >
|
||||
{{ "USER ID" | translate }}
|
||||
</th> -->
|
||||
<th>
|
||||
{{ "EMAIL ID" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "PHONE" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "Dealer" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "Distributer" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "DEVICE NAME" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "IMEI" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "E sim Validity" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "KYC Date" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "KYC Approval Date" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "RTO Cer. Date" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "Vaahan Cer. Date" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "Remarks" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "RTO State" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "RTO City" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "KYC Status" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "Installation Certificates" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "View" | translate }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let cust_array of custumer">
|
||||
<td>
|
||||
{{
|
||||
cust_array.user
|
||||
? cust_array.user.first_name
|
||||
? cust_array.user.first_name
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
{{
|
||||
cust_array.user
|
||||
? cust_array.user.last_name
|
||||
? cust_array.user.last_name
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<!-- <td>
|
||||
{{cust_array.user? cust_array.user.user_id ? cust_array.user.user_id : "NA":'' }}
|
||||
</td> -->
|
||||
<td>
|
||||
{{
|
||||
cust_array.user
|
||||
? cust_array.user.email
|
||||
? cust_array.user.email
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.user
|
||||
? cust_array.user.phone
|
||||
? cust_array.user.phone
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.Dealer
|
||||
? cust_array.Dealer.first_name
|
||||
? cust_array.Dealer.first_name
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
{{
|
||||
cust_array.Dealer
|
||||
? cust_array.Dealer.last_name
|
||||
? cust_array.Dealer.last_name
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.supAdmin
|
||||
? cust_array.supAdmin.first_name
|
||||
? cust_array.supAdmin.first_name
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
{{
|
||||
cust_array.supAdmin
|
||||
? cust_array.supAdmin.last_name
|
||||
? cust_array.supAdmin.last_name
|
||||
: ""
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{ cust_array.Device_Name ? cust_array.Device_Name : "" }}
|
||||
</td>
|
||||
<td>
|
||||
{{ cust_array.Device_ID ? cust_array.Device_ID : "" }}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.esim_validity
|
||||
? (cust_array.esim_validity | date: "medium")
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.created_on
|
||||
? (cust_array.created_on | date: "medium")
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.kycApprovalDate
|
||||
? (cust_array.kycApprovalDate | date: "medium")
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.state_certifcate_date
|
||||
? (cust_array.state_certifcate_date | date: "medium")
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.vaahan_certifcate_date
|
||||
? (cust_array.vaahan_certifcate_date | date: "medium")
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{ cust_array.remark ? cust_array.remark : "" }}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.transportOfficeState
|
||||
? cust_array.transportOfficeState
|
||||
: ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
cust_array.transportOfficeCity ? cust_array.transportOfficeCity : ""
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
<button
|
||||
class="btn btn-warning btn-sm"
|
||||
style="
|
||||
border-radius: 40px;
|
||||
font-size: x-small;
|
||||
background-color: orange;
|
||||
"
|
||||
*ngIf="cust_array.kycStatus == undefined"
|
||||
>
|
||||
Pending
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-warning btn-sm"
|
||||
style="
|
||||
border-radius: 40px;
|
||||
font-size: x-small;
|
||||
background-color: orange;
|
||||
"
|
||||
*ngIf="cust_array.kycStatus == 'Pending'"
|
||||
>
|
||||
{{ cust_array.kycStatus }}
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-success btn-sm"
|
||||
style="
|
||||
border-radius: 40px;
|
||||
font-size: x-small;
|
||||
background-color: green;
|
||||
"
|
||||
*ngIf="cust_array.kycStatus == 'Approved'"
|
||||
>
|
||||
{{ cust_array.kycStatus }}
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-danger btn-sm"
|
||||
style="
|
||||
border-radius: 40px;
|
||||
font-size: x-small;
|
||||
background-color: red;
|
||||
"
|
||||
*ngIf="cust_array.kycStatus == 'Reject'"
|
||||
>
|
||||
{{ cust_array.kycStatus }}
|
||||
</button>
|
||||
</td>
|
||||
<td style="text-align: center; cursor: pointer">
|
||||
<i
|
||||
*ngIf="cust_array.kycStatus == 'Approved'"
|
||||
class="fas fa-file"
|
||||
(click)="exportCertificate(cust_array)"
|
||||
></i>
|
||||
</td>
|
||||
<td style="text-align: center; cursor: pointer">
|
||||
<i class="fas fa-eye" (click)="viewDocuments(cust_array)"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
65
src/app/kyc-approval/device-kyc/device-kyc.component.scss
Normal file
65
src/app/kyc-approval/device-kyc/device-kyc.component.scss
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
.btn {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background-image: none;
|
||||
|
||||
padding: 6px 12px;
|
||||
font-size: 1.4rem;
|
||||
border-radius: 0px;
|
||||
border: 1px solid transparent;
|
||||
text-decoration: none;
|
||||
user-select: none;
|
||||
background: #d8d8d8;
|
||||
font-size: 12px;
|
||||
|
||||
&,
|
||||
&:active,
|
||||
&.active {
|
||||
&:focus {
|
||||
outline: thin dotted;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.focus {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:active,
|
||||
&.active {
|
||||
outline: 0;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
&.disabled,
|
||||
&[disabled],
|
||||
fieldset[disabled] & {
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&.btn-xs {
|
||||
padding: 3px 6px;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
&.btn-sm {
|
||||
padding: 4px 8px;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
&.btn-lg {
|
||||
padding: 8px 16px;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
}
|
||||
25
src/app/kyc-approval/device-kyc/device-kyc.component.spec.ts
Normal file
25
src/app/kyc-approval/device-kyc/device-kyc.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DeviceKYCComponent } from './device-kyc.component';
|
||||
|
||||
describe('DeviceKYCComponent', () => {
|
||||
let component: DeviceKYCComponent;
|
||||
let fixture: ComponentFixture<DeviceKYCComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeviceKYCComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeviceKYCComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
631
src/app/kyc-approval/device-kyc/device-kyc.component.ts
Normal file
631
src/app/kyc-approval/device-kyc/device-kyc.component.ts
Normal file
|
|
@ -0,0 +1,631 @@
|
|||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Contact } from '../../contact';
|
||||
|
||||
import {MdSnackBar} from '@angular/material';
|
||||
// import {Md5} from 'ts-md5/dist/md5';
|
||||
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { MdDialog, MdDialogRef, MD_DIALOG_DATA } from '@angular/material';
|
||||
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import 'rxjs/add/operator/debounceTime';
|
||||
import { ContactService } from '../../contact.service';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { DeviceDocComponent } from '../device-doc/device-doc.component';
|
||||
import { ReportService } from '../../report/report.service';
|
||||
import { NormalCertComponent } from '../../device/normal-cert/normal-cert.component';
|
||||
import { CertOptionComponent } from '../../device/cert-option/cert-option.component';
|
||||
import { EditDeviceMasterComponent } from '../../device/edit-device-master/edit-device-master.component';
|
||||
declare var swal: any;
|
||||
|
||||
@Component({
|
||||
selector: 'app-device-kyc',
|
||||
templateUrl: './device-kyc.component.html',
|
||||
styleUrls: ['./device-kyc.component.scss']
|
||||
})
|
||||
export class DeviceKYCComponent implements OnInit {
|
||||
modelChanged: Subject<string> = new Subject<string>();
|
||||
status
|
||||
pageLengthArr=[10,25,50,100,200,500,"All"];
|
||||
state
|
||||
kycStatus=[{Name:'Approved',value:'Approved'},{Name:'Reject',value:'Reject'},{Name:'Pending',value:'Pending'}]
|
||||
dealerChk: boolean = false;
|
||||
ev: any;
|
||||
show1: boolean = false;
|
||||
show2: boolean = true;
|
||||
show3: boolean = false;
|
||||
first_name: any;
|
||||
logoutbut: boolean;
|
||||
last_name: any;
|
||||
passwordd: any;
|
||||
org_name: any;
|
||||
allUser:boolean=false;
|
||||
emaill: any;
|
||||
phone: any;
|
||||
executed: any;
|
||||
$event2: any;
|
||||
dealer: any;
|
||||
contacts: Contact[] = [];
|
||||
contact: Contact;
|
||||
login1: any;
|
||||
mess2: any;
|
||||
mess: any;
|
||||
otp: any;
|
||||
switchVal: any;
|
||||
str: boolean = false;
|
||||
password2: any;
|
||||
cust_load: any;
|
||||
errmsg: boolean =true;
|
||||
serviceResponse: string;
|
||||
errorMsg: boolean;
|
||||
showNav: boolean =false;
|
||||
url: any;
|
||||
dealer_Permission: any;
|
||||
adbtn: string;
|
||||
myInput: string;
|
||||
|
||||
before: any;
|
||||
emmnerr: any;
|
||||
Load: any
|
||||
$event: any;
|
||||
Indianstate = [ "Andhra Pradesh",
|
||||
"Arunachal Pradesh",
|
||||
"Assam",
|
||||
"Bihar",
|
||||
"Chhattisgarh",
|
||||
"Goa",
|
||||
"Gujarat",
|
||||
"Haryana",
|
||||
"Himachal Pradesh",
|
||||
"Jammu and Kashmir",
|
||||
"Jharkhand",
|
||||
"Karnataka",
|
||||
"Kerala",
|
||||
"Madhya Pradesh",
|
||||
"Maharashtra",
|
||||
"Manipur",
|
||||
"Meghalaya",
|
||||
"Mizoram",
|
||||
"Nagaland",
|
||||
"Odisha",
|
||||
"Punjab",
|
||||
"Rajasthan",
|
||||
"Sikkim",
|
||||
"Tamil Nadu",
|
||||
"Telangana",
|
||||
"Tripura",
|
||||
"Uttarakhand",
|
||||
"Uttar Pradesh",
|
||||
"West Bengal",
|
||||
"Andaman and Nicobar Islands",
|
||||
"Chandigarh",
|
||||
"Dadra and Nagar Haveli",
|
||||
"Daman and Diu",
|
||||
"Delhi",
|
||||
"Lakshadweep",
|
||||
"Puducherry"]
|
||||
organisation: any;
|
||||
constructor(private contactService: ContactService, public snackBar: MdSnackBar, private router: Router, private _flashMessagesService: FlashMessagesService, public dialog: MdDialog,private reportService:ReportService) {
|
||||
this.reportService.deviceExcel.subscribe(value=>{
|
||||
if(value){
|
||||
this.downloadExcel()
|
||||
}
|
||||
})
|
||||
this.modelChanged
|
||||
.debounceTime(1000) // wait 300ms after the last event before emitting last event
|
||||
.distinctUntilChanged() // only emit if value is different from previous value
|
||||
.subscribe(myInput => {
|
||||
this.myInput = myInput;
|
||||
console.log('myInput')
|
||||
// this.dealerDetail();
|
||||
|
||||
this.ngOnInit();
|
||||
});
|
||||
|
||||
var script = document.createElement("script");
|
||||
script.setAttribute("type", "text/javascript");
|
||||
script.setAttribute("src", "https://unpkg.com/multiple-select@1.3.1/dist/multiple-select.min.js");
|
||||
document.getElementsByTagName("head")[0].appendChild(script);
|
||||
}
|
||||
|
||||
data_descip: any;
|
||||
table1ch() {
|
||||
|
||||
myFunction();
|
||||
function myFunction() {
|
||||
var input, filter, table, tr, td, i, td1;
|
||||
input = document.getElementById("myInput");
|
||||
filter = input.value.toUpperCase();
|
||||
table = document.getElementById("myTable");
|
||||
tr = table.getElementsByTagName("tr");
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
td = tr[i].getElementsByTagName("td")[1];
|
||||
td1 = tr[i].getElementsByTagName("td")[0]
|
||||
if (td) {
|
||||
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
}
|
||||
else if (td1.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
}
|
||||
else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
searchFilter(text: string) {
|
||||
this.modelChanged.next(text);
|
||||
// this.myInput;
|
||||
// console.log(this.myInput);
|
||||
// this.sidebarData()
|
||||
|
||||
}
|
||||
tost1(divid) {
|
||||
if (divid == "EmM") {
|
||||
this.data_descip = this.emmnerr.split(":")[1]
|
||||
launch_toast();
|
||||
}
|
||||
else if (divid == "succ") {
|
||||
this.data_descip = "Custumer Successfully Added"
|
||||
launch_toast();
|
||||
}else if(divid == "reportPref"){
|
||||
this.data_descip = "Report Preference updated !!!"
|
||||
launch_toast();
|
||||
}else if(divid == "password_changed"){
|
||||
this.data_descip = "Password updated !!!";
|
||||
launch_toast();
|
||||
}else if(divid == "alertset"){
|
||||
this.data_descip = "Alert preference updated !!!";
|
||||
launch_toast();
|
||||
}else if(divid=="kyc"){
|
||||
this.data_descip = "KYC Status updated !!!";
|
||||
launch_toast();
|
||||
}
|
||||
function launch_toast() {
|
||||
// console.log(divid);
|
||||
var x = document.getElementById("toast")
|
||||
//console.log(x);
|
||||
x.className = "show";
|
||||
setTimeout(function () { x.className = x.className.replace("show", ""); }, 4500);
|
||||
}
|
||||
}
|
||||
|
||||
changeStatus(ev){
|
||||
console.log(ev);
|
||||
this.getCustomer()
|
||||
|
||||
}
|
||||
|
||||
valclear() {
|
||||
this._flashMessagesService.show("Cleared", { cssClass: 'alert-warning', timeout: 2000 });
|
||||
|
||||
}
|
||||
|
||||
click1(event) {
|
||||
this.show2 = false;
|
||||
this.show3 = true;
|
||||
if ((event.keyCode >= 48 && event.keyCode <= 57) || event.keyCode == 9 || event.keyCode == 8 || event.keyCode == 46 || event.keyCode == 37 || event.keyCode == 39) {
|
||||
}
|
||||
/* if(event.keyCode===13){
|
||||
this.otp_window();
|
||||
} */
|
||||
|
||||
else
|
||||
event.preventDefault();
|
||||
}
|
||||
click2(event2) {
|
||||
this.show2 = true;
|
||||
this.show3 = false;
|
||||
|
||||
}
|
||||
call(e) {
|
||||
{
|
||||
if (e.keyCode == 32) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
geo() {
|
||||
this.router.navigateByUrl("geofencing");
|
||||
|
||||
}
|
||||
devicess: any;
|
||||
final: any;
|
||||
|
||||
cond: Boolean = false;
|
||||
point: any = 0;
|
||||
aa() {
|
||||
// console.log(this.point);
|
||||
if (this.point == 0) {
|
||||
this.cond = true;
|
||||
this.point++;
|
||||
}
|
||||
else if (this.point % 2 == 0) {
|
||||
this.cond = true;
|
||||
this.point++;
|
||||
}
|
||||
else {
|
||||
this.cond = false
|
||||
this.point++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
run() {
|
||||
|
||||
}
|
||||
|
||||
devicesss: any;
|
||||
subscription: any;
|
||||
timer: any;
|
||||
messageSuccess: any = true;
|
||||
selectedlanguage :any;
|
||||
|
||||
|
||||
|
||||
fs: any;
|
||||
ls: any;
|
||||
emailid: any;
|
||||
or: any;
|
||||
useridd: any;
|
||||
custtype: any;
|
||||
custumer: any=[];
|
||||
mb: any;
|
||||
cust: boolean = false;
|
||||
logo: any;
|
||||
text: any;
|
||||
superAdmin: Boolean = false;
|
||||
ngOnInit() {
|
||||
|
||||
this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin;
|
||||
console.log('whatishere=>',this.superAdmin);
|
||||
this.fs = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).fn;
|
||||
this.ls = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).ln;
|
||||
this.emailid = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).email;
|
||||
this.or = JSON.parse(window.atob(window.localStorage.token.split(".")[1]))._orgName;
|
||||
this.useridd = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).supAdmin;
|
||||
this.mb = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn;
|
||||
let test = JSON.parse(window.atob(window.localStorage.token.split('.')[1]));
|
||||
this.dealer_Permission = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).cust_add_permission;
|
||||
this.organisation = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).organisation;
|
||||
// console.log(test);
|
||||
this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer;
|
||||
this.adbtn = localStorage.getItem("dlrchk");
|
||||
localStorage.setItem("dlrchk", this.custtype);
|
||||
// this.getdev();
|
||||
if (this.custtype == true) {
|
||||
this.cust = true;
|
||||
}
|
||||
if (this.mb.charAt(0) == "n") {
|
||||
this.mb = ' '
|
||||
}
|
||||
if (window.localStorage['Custumer'] == 'ON') {
|
||||
this.logoutbut = false
|
||||
this.dealer = true
|
||||
}
|
||||
else {
|
||||
this.logoutbut = true
|
||||
}
|
||||
|
||||
this.logo = window.localStorage['logo'];
|
||||
this.text = window.localStorage['text'];
|
||||
|
||||
|
||||
history.pushState(null, null, document.URL);
|
||||
window.addEventListener('popstate', function () {
|
||||
history.pushState(null, null, document.URL);
|
||||
});
|
||||
|
||||
this.logo = window.localStorage['logo'];
|
||||
this.text = window.localStorage['text'];
|
||||
this.getSupAdmin();
|
||||
}
|
||||
|
||||
getSupAdmin(){
|
||||
this.contactService.get('/users/shareProfileImage?uid='+this.useridd).subscribe((res:any)=>{
|
||||
this.emailid=res.email;
|
||||
this. getCustomer();
|
||||
this.getDeviceCount()
|
||||
})
|
||||
}
|
||||
|
||||
callDataTable(){
|
||||
this.skip = 0;
|
||||
// that.limit = len;
|
||||
this.getCustomer();
|
||||
}
|
||||
getCustomer(){
|
||||
this.Load = true;
|
||||
var url="/devices/getAllVehi?id="+this.organisation+"&skip="+this.skip+'&limit='+this.limit
|
||||
if(this.myInput){
|
||||
url=url+'&search='+this.myInput
|
||||
console.log(this.myInput,url);
|
||||
}
|
||||
if(this.status){
|
||||
url=url+'&status='+this.status
|
||||
}
|
||||
// else{
|
||||
// url="/devices/getAllVehi?id="+this.organisation+"&skip="+this.skip+'&limit='+this.limit
|
||||
|
||||
// }
|
||||
if(this.state){
|
||||
url=url+'&state='+this.state
|
||||
}
|
||||
var group,statuss,dateObj,DealerID,status1
|
||||
// this.contactService.getAllVehi()
|
||||
this.contactService.get(url)
|
||||
.subscribe(
|
||||
(data:any) => {
|
||||
this.Load = false;
|
||||
this.custumer=[];
|
||||
if(data.length==0){
|
||||
this.nextButton=true;
|
||||
this.previewButton=false;
|
||||
}
|
||||
this.custumer = data;
|
||||
|
||||
console.log("custDetail=>", this.custumer);
|
||||
}, err => {
|
||||
// console.log("errlog");
|
||||
this.Load = false;
|
||||
this.custumer=[];
|
||||
this.nextButton = true;
|
||||
this.previewButton = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
skip: number = 0;
|
||||
limit: number = 25;
|
||||
nextButton: boolean = false;
|
||||
previewButton: boolean = true;
|
||||
next() {
|
||||
this.previewButton = false;
|
||||
this.skip += 1;
|
||||
this.ngOnInit();
|
||||
// this.sidebarData();
|
||||
}
|
||||
pre() {
|
||||
console.log(this.skip)
|
||||
if (this.skip > 0) {
|
||||
this.skip -= 1;
|
||||
this.previewButton = false;
|
||||
this.nextButton = false;
|
||||
this.ngOnInit();
|
||||
// this.sidebarData();
|
||||
} else {
|
||||
this.previewButton = true;
|
||||
this.nextButton = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
custPhone(dlr){
|
||||
var dphn = '';
|
||||
if(dlr.std_code != undefined){
|
||||
dphn = '+' + dlr.std_code.dialcode + ' ' + dlr.phone ;
|
||||
return dphn ;
|
||||
}else{
|
||||
dphn = dlr.phone ;
|
||||
return dphn ;
|
||||
}
|
||||
}
|
||||
|
||||
allUserFunction(ev){
|
||||
console.log('event=>',ev);
|
||||
this.allUser = ev.checked ;
|
||||
|
||||
this.skip = 1;
|
||||
this.getCustomer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
changeKYC(data,event){
|
||||
console.log(event);
|
||||
var req={
|
||||
user:data._id,
|
||||
status:event
|
||||
}
|
||||
this.contactService.changeKycStatus(req).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.tost1('kyc');
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
tab:any;
|
||||
|
||||
downloadExcel() {
|
||||
|
||||
this.Load = true;
|
||||
// this.contactService.get('/users/getCustomer?uid='+this.useridd).subscribe(
|
||||
// (data:any) => {
|
||||
// this.Load = false;
|
||||
// var custumer=[];
|
||||
// custumer = data;
|
||||
for(var i=0;i<this.custumer.length;i++){
|
||||
this.custumer[i].email=this.custumer[i].user.email?this.custumer[i].user.email:''
|
||||
this.custumer[i].user_id=this.custumer[i].user.user_id?this.custumer[i].user.user_id:''
|
||||
this.custumer[i].phone=this.custumer[i].user.phone?this.custumer[i].user.phone:''
|
||||
this.custumer[i].fullName=this.custumer[i].user.first_name?this.custumer[i].user.first_name:''+" "+this.custumer[i].user.last_name?this.custumer[i].user.last_name:'';
|
||||
if(i==(this.custumer.length-1)){
|
||||
|
||||
this.downloadFile(this.custumer);
|
||||
}
|
||||
}
|
||||
// console.log("custDetail=>", custumer);
|
||||
// }, err => {
|
||||
// console.log("errlog");
|
||||
this.Load = false;
|
||||
// custumer=[];
|
||||
// this.nextButton = true;
|
||||
// this.previewButton = false;
|
||||
// });
|
||||
|
||||
|
||||
// for(var i=0;i<this.custumer.length;i++){
|
||||
// // this.custumer[i].user.fullName=this.custumer[i].first_name?this.custumer[i].first_name:''+" "+this.custumer[i].last_name?this.custumer[i].last_name:'';
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
downloadFile(data) {
|
||||
|
||||
let arrHeader = ["fullName", "email", "phone", "user_id","kycStatus","Device_Name","Device_ID","esim_validity","remark","RtoState","RtoCity"];
|
||||
let csvData = this.ConvertToCSV(data, arrHeader);
|
||||
let blob = new Blob(['\ufeff' + csvData], { type: 'text/csv;charset=utf-8;' });
|
||||
let dwldLink = document.createElement("a");
|
||||
let url = URL.createObjectURL(blob);
|
||||
let isSafariBrowser = navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1;
|
||||
if (isSafariBrowser) { //if Safari open in new window to save file with random filename.
|
||||
dwldLink.setAttribute("target", "_blank");
|
||||
}
|
||||
dwldLink.setAttribute("href", url);
|
||||
dwldLink.setAttribute("download", "Customer List.csv");
|
||||
dwldLink.style.visibility = "hidden";
|
||||
document.body.appendChild(dwldLink);
|
||||
dwldLink.click();
|
||||
document.body.removeChild(dwldLink);
|
||||
this.Load = false;
|
||||
}
|
||||
ConvertToCSV(objArray, headerList) {
|
||||
let array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
|
||||
// console.log(array,"<===");Distance 126.94
|
||||
// Running 2:1
|
||||
// Idle 1:56
|
||||
// Stop
|
||||
|
||||
let str = 'Customer List \r\n';
|
||||
let row = 'S.No,';
|
||||
// name,emial,phone,id,password and status no of vehicles
|
||||
let newHeaders =["Name", "Email", "Phone", "User id","KYC Status","Device Name","IMEI","E Sim Validity","Remark","RTO State","RTO City"];
|
||||
|
||||
for (let index in newHeaders) {
|
||||
row += newHeaders[index] + ',';
|
||||
}
|
||||
row = row.slice(0, -1);
|
||||
str += row + '\r\n';
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let line = (i + 1) + '';
|
||||
if(i<array.length){}
|
||||
for (let index in headerList) {
|
||||
let head = headerList[index];
|
||||
line += ',' + this.strRep(array[i][head]);
|
||||
}
|
||||
str += line + '\r\n';
|
||||
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
strRep(data) {
|
||||
if(typeof data == "string") {
|
||||
let newData = data.replace(/,/g, " ");
|
||||
return newData;
|
||||
}
|
||||
else if(typeof data == "undefined") {
|
||||
return "-";
|
||||
}
|
||||
else if(typeof data == "number") {
|
||||
return data.toString();
|
||||
}
|
||||
else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
viewDocuments(docs){
|
||||
console.log("Documents=>", docs);
|
||||
var that =this;
|
||||
docs.ID = 'viewDoc';
|
||||
console.log(docs);
|
||||
let dialogRef = this.dialog.open(DeviceDocComponent, {
|
||||
width: '900px',
|
||||
// height:'900px',
|
||||
data: { dealer_payload: docs }
|
||||
});
|
||||
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result == "yes") {
|
||||
this.getCustomer();
|
||||
this.getDeviceCount()
|
||||
}
|
||||
|
||||
if (result == "no") {
|
||||
|
||||
}
|
||||
if(result == 'imageupdated'){
|
||||
swal(
|
||||
'Updated',
|
||||
'Documents has been Updated.',
|
||||
'success'
|
||||
)
|
||||
this.ngOnInit();
|
||||
}
|
||||
});
|
||||
}
|
||||
inventoryCount=[{_id: "Pending", TotalDev: 0},{_id: "Approved", TotalDev: 0},{_id: "Reject", TotalDev: 0}]
|
||||
getDeviceCount(){
|
||||
this.contactService.get("/devices/getStatusCount?id="+this.organisation).subscribe((res:any)=>{
|
||||
for(var i=0;i<res.length;i++){
|
||||
for(var j=0;j<this.inventoryCount.length;j++){
|
||||
if(res[i]._id==null){
|
||||
this.inventoryCount[0].TotalDev=res[i].TotalDev
|
||||
}
|
||||
if(this.inventoryCount[j]._id==res[i]._id){
|
||||
this.inventoryCount[j].TotalDev=res[i].TotalDev
|
||||
}
|
||||
}
|
||||
}
|
||||
// this.inventoryCount=res;
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
exportCertificate(data){
|
||||
|
||||
data.actionId = "exportPdf";
|
||||
|
||||
data.OwnerName = JSON.parse(JSON.stringify(data)).user.first_name + " " + JSON.parse(JSON.stringify(data)).user.last_name;
|
||||
// data.Dealer_name = JSON.parse(JSON.stringify(data))
|
||||
var fstname = (JSON.parse(JSON.stringify(data)).Dealer != undefined) ? JSON.parse(JSON.stringify(data)).Dealer.first_name : "";
|
||||
var lsname = (JSON.parse(JSON.stringify(data)).Dealer != undefined) ? JSON.parse(JSON.stringify(data)).Dealer.last_name : "";
|
||||
var dlraddress = (JSON.parse(JSON.stringify(data)).Dealer != undefined) ? JSON.parse(JSON.stringify(data)).Dealer.address : "";
|
||||
data.Dealer_name = fstname + " " + lsname;
|
||||
data.DealerAddress = dlraddress;data.deviceImage=data.deviceImage
|
||||
|
||||
let dialogRef = this.dialog.open(CertOptionComponent, {
|
||||
data: { "deviceInfo": data }
|
||||
});
|
||||
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
// console.log(result);
|
||||
|
||||
if (result == "advance") {
|
||||
let dialogRef_1 = this.dialog.open(EditDeviceMasterComponent, {
|
||||
data: { "deviceInfo": data },
|
||||
width: '650px',
|
||||
height: '700px',
|
||||
});
|
||||
}
|
||||
|
||||
if (result == "basic") {
|
||||
let dialogRef_2 = this.dialog.open(NormalCertComponent, {
|
||||
data: { "deviceInfo": data }
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
232
src/app/kyc-approval/kyc-approval.component.html
Normal file
232
src/app/kyc-approval/kyc-approval.component.html
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
|
||||
|
||||
<div class="limiter">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-primary" style="height: 65px;">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo03"
|
||||
aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<h6 class="navbar-brand" >KYC</h6>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
|
||||
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
|
||||
<li class="nav-item active">
|
||||
<i style="cursor: pointer;float: left;font-size: 24px;margin-left: 16px;touch-action: none;user-select: none;"
|
||||
class="fas fa-file-excel" (click)="downloadExcel()"></i>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<i style="cursor: pointer;float: left;font-size: 24px;margin-left: 16px;touch-action: none;user-select: none;"
|
||||
class="fas fa-file-pdf" (click)="downloadExcel()"></i>
|
||||
|
||||
</li> -->
|
||||
|
||||
</ul>
|
||||
<ul style="position: absolute;left: 50%;transform: translatex(-50%);" class="nav nav-tabs nav-tabs-neutral justify-content-center" role="tablist" data-background-color="orange">
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#CustomerKYC" (click)="changeTab('customerKYC')" role="tab">Customer KYC</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#DeviceKYC" (click)="changeTab('deviceKYC')" role="tab">Device KYC</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<form class="form-inline my-2 my-lg-0">
|
||||
<div style="float: right;">
|
||||
<div style="width: 80px; float: right; margin-top: -8px;">
|
||||
|
||||
<button md-icon-button mdTooltip="Logout" style="float:right;outline:none;padding-top: 6px;" (click)="logout()">
|
||||
<i class="fas fa-sign-out-alt" style=" color: white; font-size: 20px;"></i>
|
||||
</button>
|
||||
<app-notification></app-notification>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> -->
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="toast">
|
||||
<div id="desc">{{ data_descip }}</div>
|
||||
</div>
|
||||
<div class="loading" *ngIf="Load">Loading…</div>
|
||||
<div class="card">
|
||||
<div>
|
||||
<!-- <div class="row card-header"> -->
|
||||
<!-- <div class="col-5" style="
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
background: #426e86;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
color: white;
|
||||
box-shadow: 3px 1px 5px 0px rgb(178, 176, 174);
|
||||
"> -->
|
||||
<!-- <i style="cursor: pointer;float: left;font-size: 24px;margin-left: 16px;touch-action: none;user-select: none;"
|
||||
class="fas fa-file-excel" (click)="downloadExcel()"></i> -->
|
||||
<!-- <ul class="nav nav-tabs nav-tabs-neutral justify-content-center" role="tablist" data-background-color="orange">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#CustomerKYC" role="tab">Customer KYC</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#DeviceKYC" role="tab">Device KYC</a>
|
||||
</li>
|
||||
|
||||
</ul> -->
|
||||
|
||||
<!-- </div> -->
|
||||
<!-- <div class="col-7" style="
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
background: #426e86;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
color: white;
|
||||
box-shadow: 3px 1px 5px 0px rgb(178, 176, 174);
|
||||
"> -->
|
||||
<!-- <div style="float: right;">
|
||||
<div style="width: 80px; float: right; margin-top: -8px;">
|
||||
|
||||
<button md-icon-button mdTooltip="Logout" style="float:right;outline:none;padding-top: 6px;" (click)="logout()">
|
||||
<i class="fas fa-sign-out-alt" style=" color: white; font-size: 20px;"></i>
|
||||
</button>
|
||||
<app-notification></app-notification>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<flash-messages class='fmsg'></flash-messages>
|
||||
<div>
|
||||
|
||||
<div class=card-body style="padding-top: 0px;">
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane" id="CustomerKYC" role="tabpanel">
|
||||
|
||||
<div class="card-header" style="
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
background: #426e86;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
color: white;
|
||||
box-shadow: 3px 1px 5px 0px rgb(178, 176, 174);
|
||||
">
|
||||
<button class="btn btn-default" [disabled]="lastcall" (click)="pre()" style="border-right-color: #2d4262">
|
||||
<< {{ "Previous" | translate }} </button>
|
||||
|
||||
<button class="btn btn-default" [disabled]="firstcall" (click)="next()" style="margin-right: 10px">
|
||||
{{ "Next" | translate }} >>
|
||||
</button>
|
||||
|
||||
<select [(ngModel)]="status" (ngModelChange)="changeStatus($event)" style="background: #efecec;height: 35px;">
|
||||
<option value="" selected disabled>Please select status</option>
|
||||
<option value="Pending">Pending</option>
|
||||
<option value="Approved">Approved</option>
|
||||
<option value="Reject">Reject</option>
|
||||
</select>
|
||||
|
||||
<div style="float: right;">
|
||||
<input type="search"
|
||||
style="width: 225px;float: right;border-radius: 0px;line-height: 1.9;background: #efecec;box-shadow: 3px 2px 5px 0px rgb(178, 176, 174);"
|
||||
class="form-control" id="myInput" name="myInput" type="text" [(ngModel)]="myInput"
|
||||
(ngModelChange)="searchFilter($event)" placeholder="{{ 'Customer Search' | translate }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{{ "NAME" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "USER ID" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "EMAIL ID" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "Dealer" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "Distributer" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "PHONE" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "KYC Status" | translate }}
|
||||
</th>
|
||||
<th>
|
||||
{{ "View" | translate }}
|
||||
</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let cust_array of custumer">
|
||||
|
||||
<td >
|
||||
{{ cust_array.first_name ? cust_array.first_name : "" }}
|
||||
{{ cust_array.last_name ? cust_array.last_name : "" }}
|
||||
</td>
|
||||
<td >
|
||||
{{ cust_array.user_id ? cust_array.user_id : "NA" }}
|
||||
</td>
|
||||
<td >
|
||||
{{ cust_array.email }}
|
||||
</td>
|
||||
<td>
|
||||
{{ cust_array.DealerDetails?cust_array.DealerDetails[0].first_name ? cust_array.DealerDetails[0].first_name : "" :''}}
|
||||
{{ cust_array.DealerDetails?cust_array.DealerDetails[0].last_name ? cust_array.DealerDetails[0].last_name : "" :''}}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
{{ cust_array.AdminDetails?cust_array.AdminDetails[0].first_name ? cust_array.AdminDetails[0].first_name : "" :''}}
|
||||
{{ cust_array.AdminDetails?cust_array.AdminDetails[0].last_name ? cust_array.AdminDetails[0].last_name : "" :''}}
|
||||
</td>
|
||||
<td>
|
||||
{{ custPhone(cust_array) }}
|
||||
</td>
|
||||
|
||||
<td >
|
||||
<button class="btn btn-warning btn-sm" style="border-radius: 40px; font-size: x-small; background-color: orange;"
|
||||
*ngIf="cust_array.kycStatus==undefined">Pending</button>
|
||||
<button class="btn btn-warning btn-sm" style="border-radius: 40px; font-size: x-small; background-color: orange;" *ngIf="cust_array.kycStatus=='Pending'">{{cust_array.kycStatus}}</button>
|
||||
<button class="btn btn-success btn-sm" style="border-radius: 40px; font-size: x-small; background-color: green;" *ngIf="cust_array.kycStatus=='Approved'">{{cust_array.kycStatus}}</button>
|
||||
<button class="btn btn-danger btn-sm" style="border-radius: 40px; font-size: x-small; background-color: red;" *ngIf="cust_array.kycStatus=='Reject'">{{cust_array.kycStatus}}</button>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<i class="fas fa-eye" (click)="viewDocuments(cust_array)"></i>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- --------------------DEVICE KYC-------------------- -->
|
||||
<div class="tab-pane active" id="DeviceKYC" role="tabpanel">
|
||||
<app-device-kyc></app-device-kyc>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
372
src/app/kyc-approval/kyc-approval.component.scss
Normal file
372
src/app/kyc-approval/kyc-approval.component.scss
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
.btn {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background-image: none;
|
||||
|
||||
padding: 6px 12px;
|
||||
font-size: 1.4rem;
|
||||
border-radius: 0px;
|
||||
border: 1px solid transparent;
|
||||
text-decoration: none;
|
||||
user-select: none;
|
||||
background: #d8d8d8;
|
||||
font-size: 12px;
|
||||
|
||||
&,
|
||||
&:active,
|
||||
&.active {
|
||||
&:focus {
|
||||
outline: thin dotted;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.focus {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:active,
|
||||
&.active {
|
||||
outline: 0;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
&.disabled,
|
||||
&[disabled],
|
||||
fieldset[disabled] & {
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&.btn-xs {
|
||||
padding: 3px 6px;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
&.btn-sm {
|
||||
padding: 4px 8px;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
&.btn-lg {
|
||||
padding: 8px 16px;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
}
|
||||
button,
|
||||
input {
|
||||
font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #f96332;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:focus {
|
||||
color: #f96332;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 1.61em;
|
||||
font-weight: 300;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.category {
|
||||
text-transform: capitalize;
|
||||
font-weight: 700;
|
||||
color: #9a9a9a;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #2c2c2c;
|
||||
font-size: 14px;
|
||||
font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
|
||||
overflow-x: hidden;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.nav-item .nav-link,
|
||||
.nav-tabs .nav-link {
|
||||
-webkit-transition: all 300ms ease 0s;
|
||||
-moz-transition: all 300ms ease 0s;
|
||||
-o-transition: all 300ms ease 0s;
|
||||
-ms-transition: all 300ms ease 0s;
|
||||
transition: all 300ms ease 0s;
|
||||
}
|
||||
|
||||
.card a {
|
||||
-webkit-transition: all 150ms ease 0s;
|
||||
-moz-transition: all 150ms ease 0s;
|
||||
-o-transition: all 150ms ease 0s;
|
||||
-ms-transition: all 150ms ease 0s;
|
||||
transition: all 150ms ease 0s;
|
||||
}
|
||||
|
||||
[data-toggle="collapse"][data-parent="#accordion"] i {
|
||||
-webkit-transition: transform 150ms ease 0s;
|
||||
-moz-transition: transform 150ms ease 0s;
|
||||
-o-transition: transform 150ms ease 0s;
|
||||
-ms-transition: all 150ms ease 0s;
|
||||
transition: transform 150ms ease 0s;
|
||||
}
|
||||
|
||||
[data-toggle="collapse"][data-parent="#accordion"][aria-expanded="true"] i {
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
|
||||
-webkit-transform: rotate(180deg);
|
||||
-ms-transform: rotate(180deg);
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.now-ui-icons {
|
||||
display: inline-block;
|
||||
font: normal normal normal 14px/1 "Nucleo Outline";
|
||||
font-size: inherit;
|
||||
// speak: none;
|
||||
text-transform: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
@-webkit-keyframes nc-icon-spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes nc-icon-spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-moz-transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes nc-icon-spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
-ms-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
-ms-transform: rotate(360deg);
|
||||
-o-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.now-ui-icons.objects_umbrella-13:before {
|
||||
content: "\ea5f";
|
||||
}
|
||||
|
||||
.now-ui-icons.shopping_cart-simple:before {
|
||||
content: "\ea1d";
|
||||
}
|
||||
|
||||
.now-ui-icons.shopping_shop:before {
|
||||
content: "\ea50";
|
||||
}
|
||||
|
||||
.now-ui-icons.ui-2_settings-90:before {
|
||||
content: "\ea4b";
|
||||
}
|
||||
|
||||
.nav-tabs {
|
||||
border: 0;
|
||||
padding: 15px 0.7rem;
|
||||
}
|
||||
|
||||
.nav-tabs:not(.nav-tabs-neutral) > .nav-item > .nav-link.active {
|
||||
box-shadow: 0px 5px 35px 0px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.card .nav-tabs {
|
||||
border-top-right-radius: 0.1875rem;
|
||||
border-top-left-radius: 0.1875rem;
|
||||
}
|
||||
|
||||
.nav-tabs > .nav-item > .nav-link {
|
||||
color: #888888;
|
||||
margin: 0;
|
||||
margin-right: 5px;
|
||||
background-color: transparent;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 30px;
|
||||
font-size: 14px;
|
||||
padding: 11px 23px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.nav-tabs > .nav-item > .nav-link:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.nav-tabs > .nav-item > .nav-link.active {
|
||||
background-color: #444;
|
||||
border-radius: 30px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.nav-tabs > .nav-item > .nav-link i.now-ui-icons {
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.nav-tabs.nav-tabs-neutral > .nav-item > .nav-link {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.nav-tabs.nav-tabs-neutral > .nav-item > .nav-link.active {
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 0;
|
||||
border-radius: 0.1875rem;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
// margin-bottom: 30px;
|
||||
// box-shadow: 0px 5px 25px 0px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.card .card-header {
|
||||
background-color: transparent;
|
||||
border-bottom: 0;
|
||||
background-color: transparent;
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.card[data-background-color="orange"] {
|
||||
// background-color: #2d4262;
|
||||
}
|
||||
|
||||
.card[data-background-color="red"] {
|
||||
background-color: #ff3636;
|
||||
}
|
||||
|
||||
.card[data-background-color="yellow"] {
|
||||
background-color: #ffb236;
|
||||
}
|
||||
|
||||
.card[data-background-color="blue"] {
|
||||
background-color: #2ca8ff;
|
||||
}
|
||||
|
||||
.card[data-background-color="green"] {
|
||||
background-color: #15b60d;
|
||||
}
|
||||
|
||||
[data-background-color="orange"] {
|
||||
// background-color: #2d4262;
|
||||
}
|
||||
|
||||
[data-background-color="black"] {
|
||||
// background-color: #2c2c2c;
|
||||
}
|
||||
|
||||
[data-background-color]:not([data-background-color="gray"]) {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
[data-background-color]:not([data-background-color="gray"]) p {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
[data-background-color]:not([data-background-color="gray"])
|
||||
a:not(.btn):not(.dropdown-item) {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
[data-background-color]:not([data-background-color="gray"])
|
||||
.nav-tabs
|
||||
> .nav-item
|
||||
> .nav-link
|
||||
i.now-ui-icons {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Nucleo Outline";
|
||||
src: url("https://github.com/creativetimofficial/now-ui-kit/blob/master/assets/fonts/nucleo-outline.eot");
|
||||
src: url("https://github.com/creativetimofficial/now-ui-kit/blob/master/assets/fonts/nucleo-outline.eot")
|
||||
format("embedded-opentype");
|
||||
src: url("https://raw.githack.com/creativetimofficial/now-ui-kit/master/assets/fonts/nucleo-outline.woff2");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.now-ui-icons {
|
||||
display: inline-block;
|
||||
font: normal normal normal 14px/1 "Nucleo Outline";
|
||||
font-size: inherit;
|
||||
// speak: none;
|
||||
text-transform: none;
|
||||
/* Better Font Rendering */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: 50px;
|
||||
color: #555;
|
||||
background: #fff;
|
||||
padding: 25px;
|
||||
font-weight: 300;
|
||||
background: #f7f7f7;
|
||||
}
|
||||
.footer p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
footer p a {
|
||||
color: #555;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
footer p a:hover {
|
||||
color: #e86c42;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.nav-tabs {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
padding-left: 100px;
|
||||
padding-right: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nav-tabs .nav-item > .nav-link {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
.mat-dialog-container {
|
||||
padding: 0px !important;
|
||||
}
|
||||
25
src/app/kyc-approval/kyc-approval.component.spec.ts
Normal file
25
src/app/kyc-approval/kyc-approval.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { KycApprovalComponent } from './kyc-approval.component';
|
||||
|
||||
describe('KycApprovalComponent', () => {
|
||||
let component: KycApprovalComponent;
|
||||
let fixture: ComponentFixture<KycApprovalComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ KycApprovalComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(KycApprovalComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
548
src/app/kyc-approval/kyc-approval.component.ts
Normal file
548
src/app/kyc-approval/kyc-approval.component.ts
Normal file
|
|
@ -0,0 +1,548 @@
|
|||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Contact } from '../contact';
|
||||
import { ContactService } from '../contact.service';
|
||||
import {MdSnackBar} from '@angular/material';
|
||||
// import {Md5} from 'ts-md5/dist/md5';
|
||||
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { MdDialog, MdDialogRef, MD_DIALOG_DATA } from '@angular/material';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { AddCustComponent } from '../add-cust/add-cust.component';
|
||||
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import 'rxjs/add/operator/debounceTime';
|
||||
import { EditCostumerComponent } from '../edit-costumer/edit-costumer.component';
|
||||
import { ReportService } from '../report/report.service';
|
||||
|
||||
declare var swal: any;
|
||||
@Component({
|
||||
selector: 'app-kyc-approval',
|
||||
templateUrl: './kyc-approval.component.html',
|
||||
styleUrls: ['./kyc-approval.component.scss']
|
||||
})
|
||||
export class KycApprovalComponent implements OnInit {
|
||||
modelChanged: Subject<string> = new Subject<string>();
|
||||
status
|
||||
isCustomerKYC:Boolean=false;
|
||||
kycStatus=[{Name:'Approved',value:'Approved'},{Name:'Reject',value:'Reject'},{Name:'Pending',value:'Pending'}]
|
||||
dealerChk: boolean = false;
|
||||
ev: any;
|
||||
show1: boolean = false;
|
||||
show2: boolean = true;
|
||||
show3: boolean = false;
|
||||
first_name: any;
|
||||
logoutbut: boolean;
|
||||
last_name: any;
|
||||
passwordd: any;
|
||||
org_name: any;
|
||||
allUser:boolean=false;
|
||||
emaill: any;
|
||||
phone: any;
|
||||
executed: any;
|
||||
$event2: any;
|
||||
dealer: any;
|
||||
contacts: Contact[] = [];
|
||||
contact: Contact;
|
||||
login1: any;
|
||||
mess2: any;
|
||||
mess: any;
|
||||
otp: any;
|
||||
switchVal: any;
|
||||
str: boolean = false;
|
||||
password2: any;
|
||||
cust_load: any;
|
||||
errmsg: boolean =true;
|
||||
serviceResponse: string;
|
||||
errorMsg: boolean;
|
||||
showNav: boolean =false;
|
||||
url: any;
|
||||
dealer_Permission: any;
|
||||
adbtn: string;
|
||||
myInput: string;
|
||||
report() {
|
||||
this.cond = false
|
||||
this.router.navigateByUrl("device-report");
|
||||
|
||||
}
|
||||
clear() {
|
||||
this.first_name = ' '
|
||||
this.last_name = ' '
|
||||
this.emaill = null
|
||||
this.phone = null
|
||||
}
|
||||
before: any;
|
||||
emmnerr: any;
|
||||
Load: any
|
||||
$event: any;
|
||||
openDialog() {
|
||||
|
||||
let dialogRef = this.dialog.open(AddCustComponent, {
|
||||
width: '800px',
|
||||
// height: '600px',
|
||||
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
// console.log(result);
|
||||
if (result == "succ") {
|
||||
this.tost1("succ");
|
||||
this.ngOnInit();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
constructor(private contactService: ContactService, public snackBar: MdSnackBar, private router: Router, private _flashMessagesService: FlashMessagesService, public dialog: MdDialog,private reportService:ReportService) {
|
||||
this.modelChanged
|
||||
.debounceTime(1000) // wait 300ms after the last event before emitting last event
|
||||
.distinctUntilChanged() // only emit if value is different from previous value
|
||||
.subscribe(myInput => {
|
||||
this.myInput = myInput;
|
||||
// console.log('debounce')
|
||||
// this.dealerDetail();
|
||||
|
||||
this.ngOnInit();
|
||||
});
|
||||
|
||||
var script = document.createElement("script");
|
||||
script.setAttribute("type", "text/javascript");
|
||||
script.setAttribute("src", "https://unpkg.com/multiple-select@1.3.1/dist/multiple-select.min.js");
|
||||
document.getElementsByTagName("head")[0].appendChild(script);
|
||||
}
|
||||
|
||||
data_descip: any;
|
||||
table1ch() {
|
||||
|
||||
myFunction();
|
||||
function myFunction() {
|
||||
var input, filter, table, tr, td, i, td1;
|
||||
input = document.getElementById("myInput");
|
||||
filter = input.value.toUpperCase();
|
||||
table = document.getElementById("myTable");
|
||||
tr = table.getElementsByTagName("tr");
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
td = tr[i].getElementsByTagName("td")[1];
|
||||
td1 = tr[i].getElementsByTagName("td")[0]
|
||||
if (td) {
|
||||
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
}
|
||||
else if (td1.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
}
|
||||
else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
searchFilter(text: string) {
|
||||
this.modelChanged.next(text);
|
||||
// this.myInput;
|
||||
// console.log(this.myInput);
|
||||
// this.sidebarData()
|
||||
|
||||
}
|
||||
tost1(divid) {
|
||||
if (divid == "EmM") {
|
||||
this.data_descip = this.emmnerr.split(":")[1]
|
||||
launch_toast();
|
||||
}
|
||||
else if (divid == "succ") {
|
||||
this.data_descip = "Custumer Successfully Added"
|
||||
launch_toast();
|
||||
}else if(divid == "reportPref"){
|
||||
this.data_descip = "Report Preference updated !!!"
|
||||
launch_toast();
|
||||
}else if(divid == "password_changed"){
|
||||
this.data_descip = "Password updated !!!";
|
||||
launch_toast();
|
||||
}else if(divid == "alertset"){
|
||||
this.data_descip = "Alert preference updated !!!";
|
||||
launch_toast();
|
||||
}else if(divid=="kyc"){
|
||||
this.data_descip = "KYC Status updated !!!";
|
||||
launch_toast();
|
||||
}
|
||||
function launch_toast() {
|
||||
// console.log(divid);
|
||||
var x = document.getElementById("toast")
|
||||
//console.log(x);
|
||||
x.className = "show";
|
||||
setTimeout(function () { x.className = x.className.replace("show", ""); }, 4500);
|
||||
}
|
||||
}
|
||||
|
||||
changeStatus(ev){
|
||||
console.log(ev);
|
||||
this.getCustomer()
|
||||
|
||||
}
|
||||
|
||||
valclear() {
|
||||
this._flashMessagesService.show("Cleared", { cssClass: 'alert-warning', timeout: 2000 });
|
||||
|
||||
}
|
||||
|
||||
click1(event) {
|
||||
this.show2 = false;
|
||||
this.show3 = true;
|
||||
if ((event.keyCode >= 48 && event.keyCode <= 57) || event.keyCode == 9 || event.keyCode == 8 || event.keyCode == 46 || event.keyCode == 37 || event.keyCode == 39) {
|
||||
}
|
||||
/* if(event.keyCode===13){
|
||||
this.otp_window();
|
||||
} */
|
||||
|
||||
else
|
||||
event.preventDefault();
|
||||
}
|
||||
click2(event2) {
|
||||
this.show2 = true;
|
||||
this.show3 = false;
|
||||
|
||||
}
|
||||
call(e) {
|
||||
{
|
||||
if (e.keyCode == 32) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
geo() {
|
||||
this.router.navigateByUrl("geofencing");
|
||||
|
||||
}
|
||||
devicess: any;
|
||||
final: any;
|
||||
|
||||
cond: Boolean = false;
|
||||
point: any = 0;
|
||||
aa() {
|
||||
// console.log(this.point);
|
||||
if (this.point == 0) {
|
||||
this.cond = true;
|
||||
this.point++;
|
||||
}
|
||||
else if (this.point % 2 == 0) {
|
||||
this.cond = true;
|
||||
this.point++;
|
||||
}
|
||||
else {
|
||||
this.cond = false
|
||||
this.point++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
run() {
|
||||
|
||||
}
|
||||
|
||||
devicesss: any;
|
||||
subscription: any;
|
||||
timer: any;
|
||||
messageSuccess: any = true;
|
||||
selectedlanguage :any;
|
||||
|
||||
|
||||
|
||||
fs: any;
|
||||
ls: any;
|
||||
emailid: any;
|
||||
or: any;
|
||||
useridd: any;
|
||||
custtype: any;
|
||||
custumer: any=[];
|
||||
mb: any;
|
||||
cust: boolean = false;
|
||||
logo: any;
|
||||
text: any;
|
||||
superAdmin: Boolean = false;
|
||||
ngOnInit() {
|
||||
|
||||
this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin;
|
||||
console.log('whatishere=>',this.superAdmin);
|
||||
this.fs = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).fn;
|
||||
this.ls = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).ln;
|
||||
this.emailid = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).email;
|
||||
this.or = JSON.parse(window.atob(window.localStorage.token.split(".")[1]))._orgName;
|
||||
this.useridd = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).supAdmin;
|
||||
this.mb = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn;
|
||||
let test = JSON.parse(window.atob(window.localStorage.token.split('.')[1]));
|
||||
this.dealer_Permission = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).cust_add_permission;
|
||||
|
||||
// console.log(test);
|
||||
this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer;
|
||||
this.adbtn = localStorage.getItem("dlrchk");
|
||||
localStorage.setItem("dlrchk", this.custtype);
|
||||
// this.getdev();
|
||||
if (this.custtype == true) {
|
||||
this.cust = true;
|
||||
}
|
||||
if (this.mb.charAt(0) == "n") {
|
||||
this.mb = ' '
|
||||
}
|
||||
if (window.localStorage['Custumer'] == 'ON') {
|
||||
this.logoutbut = false
|
||||
this.dealer = true
|
||||
}
|
||||
else {
|
||||
this.logoutbut = true
|
||||
}
|
||||
|
||||
this.logo = window.localStorage['logo'];
|
||||
this.text = window.localStorage['text'];
|
||||
|
||||
|
||||
history.pushState(null, null, document.URL);
|
||||
window.addEventListener('popstate', function () {
|
||||
history.pushState(null, null, document.URL);
|
||||
});
|
||||
|
||||
this.logo = window.localStorage['logo'];
|
||||
this.text = window.localStorage['text'];
|
||||
this.getCustomer();
|
||||
}
|
||||
|
||||
|
||||
getCustomer(){
|
||||
this.Load = true;
|
||||
this.contactService.getCustumer1(this.useridd, this.skip, this.limit,this.myInput,this.allUser,this.status).subscribe(
|
||||
data => {
|
||||
this.Load = false;
|
||||
this.custumer=[];
|
||||
this.custumer = data;
|
||||
for(var i=0;i<this.custumer.length;i++){
|
||||
if(this.custumer[i].adminAlert == undefined){
|
||||
this.custumer[i]['adminAlert'] = false;
|
||||
}
|
||||
if(this.custumer[i].dealerAlert == undefined){
|
||||
this.custumer[i]['dealerAlert'] = false;
|
||||
}
|
||||
}
|
||||
console.log("custDetail=>", this.custumer);
|
||||
}, err => {
|
||||
// console.log("errlog");
|
||||
this.Load = false;
|
||||
this.custumer=[];
|
||||
this.firstcall = true;
|
||||
this.lastcall = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
skip: number = 1;
|
||||
limit: number = 20;
|
||||
firstcall: boolean = false;
|
||||
lastcall: boolean = true;
|
||||
next() {
|
||||
this.lastcall = false;
|
||||
this.skip += 1;
|
||||
this.ngOnInit();
|
||||
// this.sidebarData();
|
||||
}
|
||||
pre() {
|
||||
// console.log(this.skip)
|
||||
if (this.skip > 1) {
|
||||
this.skip -= 1;
|
||||
this.lastcall = false;
|
||||
this.firstcall = false;
|
||||
this.ngOnInit();
|
||||
// this.sidebarData();
|
||||
} else {
|
||||
this.lastcall = true;
|
||||
this.firstcall = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
viewDocuments(docs){
|
||||
console.log("Documents=>", docs);
|
||||
var that =this;
|
||||
docs.ID = 'viewDoc';
|
||||
console.log(docs);
|
||||
let dialogRef = this.dialog.open(EditCostumerComponent, {
|
||||
width: '900px',
|
||||
data: { dealer_payload: docs }
|
||||
});
|
||||
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result == "yes") {
|
||||
this.getCustomer()
|
||||
}
|
||||
|
||||
if (result == "no") {
|
||||
|
||||
}
|
||||
if(result == 'imageupdated'){
|
||||
swal(
|
||||
'Updated',
|
||||
'Documents has been Updated.',
|
||||
'success'
|
||||
)
|
||||
this.ngOnInit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
custPhone(dlr){
|
||||
var dphn = '';
|
||||
if(dlr.std_code != undefined){
|
||||
dphn = '+' + dlr.std_code.dialcode + ' ' + dlr.phone ;
|
||||
return dphn ;
|
||||
}else{
|
||||
dphn = dlr.phone ;
|
||||
return dphn ;
|
||||
}
|
||||
}
|
||||
|
||||
allUserFunction(ev){
|
||||
console.log('event=>',ev);
|
||||
this.allUser = ev.checked ;
|
||||
|
||||
this.skip = 1;
|
||||
this.getCustomer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
changeKYC(data,event){
|
||||
console.log(event);
|
||||
var req={
|
||||
user:data._id,
|
||||
status:event
|
||||
}
|
||||
this.contactService.changeKycStatus(req).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.tost1('kyc');
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
tab:any;
|
||||
|
||||
downloadExcel() {
|
||||
|
||||
if(this.isCustomerKYC){
|
||||
this.Load = true;
|
||||
this.contactService.get('/users/getCustomer?uid='+this.useridd).subscribe(
|
||||
(data:any) => {
|
||||
this.Load = false;
|
||||
var custumer=[];
|
||||
custumer = data;
|
||||
for(var i=0;i<custumer.length;i++){
|
||||
|
||||
custumer[i].fullName=custumer[i].first_name?custumer[i].first_name:''+" "+custumer[i].last_name?custumer[i].last_name:'';
|
||||
if(i==(custumer.length-1)){
|
||||
|
||||
this.downloadFile(custumer);
|
||||
}
|
||||
}
|
||||
console.log("custDetail=>", custumer);
|
||||
}, err => {
|
||||
// console.log("errlog");
|
||||
this.Load = false;
|
||||
// custumer=[];
|
||||
// this.firstcall = true;
|
||||
// this.lastcall = false;
|
||||
});
|
||||
|
||||
}else{
|
||||
this.reportService.downloadDeviceExcel(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
downloadFile(data) {
|
||||
|
||||
let arrHeader = ["fullName", "email", "phone", "user_id","kycStatus","total_vehicle"];
|
||||
let csvData = this.ConvertToCSV(data, arrHeader);
|
||||
let blob = new Blob(['\ufeff' + csvData], { type: 'text/csv;charset=utf-8;' });
|
||||
let dwldLink = document.createElement("a");
|
||||
let url = URL.createObjectURL(blob);
|
||||
let isSafariBrowser = navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1;
|
||||
if (isSafariBrowser) { //if Safari open in new window to save file with random filename.
|
||||
dwldLink.setAttribute("target", "_blank");
|
||||
}
|
||||
dwldLink.setAttribute("href", url);
|
||||
dwldLink.setAttribute("download", "Customer List.csv");
|
||||
dwldLink.style.visibility = "hidden";
|
||||
document.body.appendChild(dwldLink);
|
||||
dwldLink.click();
|
||||
document.body.removeChild(dwldLink);
|
||||
this.Load = false;
|
||||
}
|
||||
ConvertToCSV(objArray, headerList) {
|
||||
let array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
|
||||
// console.log(array,"<===");Distance 126.94
|
||||
// Running 2:1
|
||||
// Idle 1:56
|
||||
// Stop
|
||||
|
||||
let str = 'Customer List \r\n';
|
||||
let row = 'S.No,';
|
||||
// name,emial,phone,id,password and status no of vehicles
|
||||
let newHeaders =["Name", "Email", "Phone", "User id","Status","Number of Vehicle"];
|
||||
|
||||
for (let index in newHeaders) {
|
||||
row += newHeaders[index] + ',';
|
||||
}
|
||||
row = row.slice(0, -1);
|
||||
str += row + '\r\n';
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let line = (i + 1) + '';
|
||||
if(i<array.length){}
|
||||
for (let index in headerList) {
|
||||
let head = headerList[index];
|
||||
line += ',' + this.strRep(array[i][head]);
|
||||
}
|
||||
str += line + '\r\n';
|
||||
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
strRep(data) {
|
||||
if(typeof data == "string") {
|
||||
let newData = data.replace(/,/g, " ");
|
||||
return newData;
|
||||
}
|
||||
else if(typeof data == "undefined") {
|
||||
return "-";
|
||||
}
|
||||
else if(typeof data == "number") {
|
||||
return data.toString();
|
||||
}
|
||||
else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
logout() {
|
||||
window.localStorage.clear();
|
||||
this.router.navigateByUrl("login");
|
||||
}
|
||||
|
||||
changeTab(type){
|
||||
if(type=="deviceKYC"){
|
||||
this.isCustomerKYC=false
|
||||
}else{
|
||||
this.isCustomerKYC=true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue