latest updates @APR 20, 2022
This commit is contained in:
parent
90b15f5e00
commit
a0bdbc7c55
1657 changed files with 301942 additions and 0 deletions
666
src/app/dashboard/add-new-device/add-new-device.component.html
Normal file
666
src/app/dashboard/add-new-device/add-new-device.component.html
Normal file
|
|
@ -0,0 +1,666 @@
|
|||
<app-all-menus></app-all-menus>
|
||||
<div id="toast">
|
||||
<div id="desc">{{ data_descip }}</div>
|
||||
</div>
|
||||
<div class="loading" *ngIf="Load">Loading…</div>
|
||||
<div class="topDiv">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>
|
||||
Add Device
|
||||
<button type="button" class="close pull-right" (click)="back()">
|
||||
<i class="fas fa-arrow-circle-left"></i>
|
||||
</button>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form [formGroup]="deviceForm" (ngSubmit)="submit()">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4">Contact No.</label> <span>*</span>
|
||||
<input
|
||||
(input)="onSearchChange($event.target.value)"
|
||||
formControlName="contactNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputPassword4"
|
||||
placeholder="Enter Contact number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.contactNo.errors }"
|
||||
/>
|
||||
<small *ngIf="message">{{ message }}</small>
|
||||
<div
|
||||
*ngIf="submitted && f.contactNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.contactNo.errors.required">
|
||||
Contact Number is required
|
||||
</div>
|
||||
<div *ngIf="f.contactNo.errors.pattern">
|
||||
Please enter valid Contact No
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Owner Name</label> <span>*</span>
|
||||
<input
|
||||
formControlName="ownerName"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputEmail4"
|
||||
placeholder="Please Enter Owner Name"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.ownerName.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.ownerName.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.ownerName.errors.required">
|
||||
Owner Name is required
|
||||
</div>
|
||||
<div *ngIf="f.ownerName.errors.pattern">
|
||||
Please enter valid name
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Email</label>
|
||||
<!-- <span>*</span> -->
|
||||
<input
|
||||
formControlName="email"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
placeholder="Please Enter Email"
|
||||
/>
|
||||
<!-- <div *ngIf="submitted && f.email.errors.email" class="invalid-feedback">
|
||||
<div *ngIf="f.email.errors.email">Please Enter valid email id</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Dealer Followup Mobile</label> <span>*</span>
|
||||
<input
|
||||
formControlName="dealerFollowup"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.dealerFollowup.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.dealerFollowup.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.dealerFollowup.errors.required">
|
||||
Dealer Followup is required
|
||||
</div>
|
||||
<div *ngIf="f.dealerFollowup.errors.pattern">
|
||||
Please Enter Valid number
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Address</label> <span>*</span>
|
||||
<input
|
||||
formControlName="address"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.dealerFollowup.errors }"
|
||||
/>
|
||||
<div *ngIf="submitted && f.address.errors" class="invalid-feedback">
|
||||
<div *ngIf="f.address.errors.required">Address is required</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="pin">Pin Code</label> <span>*</span>
|
||||
<input
|
||||
formControlName="pin"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="pin"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.dealerFollowup.errors }"
|
||||
/>
|
||||
<div *ngIf="submitted && f.pin.errors" class="invalid-feedback">
|
||||
<div *ngIf="f.pin.errors.required">Pin Code is required</div>
|
||||
<div *ngIf="f.pin.errors.pattern">
|
||||
Please Enter valid Pin code
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputState">State</label>
|
||||
<select
|
||||
formControlName="state"
|
||||
(change)="onStateChange($event)"
|
||||
id="inputState"
|
||||
class="form-control"
|
||||
>
|
||||
<option value="" selected disabled>Choose state</option>
|
||||
<option *ngFor="let item of states" [value]="item">
|
||||
{{ item }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">City</label>
|
||||
<select
|
||||
formControlName="city"
|
||||
(change)="onCityChange($event)"
|
||||
id="inputState"
|
||||
class="form-control"
|
||||
>
|
||||
<option value="" selected disabled>Choose City</option>
|
||||
<option *ngFor="let item of cityList" [value]="item.city">
|
||||
{{ item.city }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="city" type="text" class="form-control" id="inputCity"> -->
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">RTO Office</label>
|
||||
<select
|
||||
formControlName="rtoOffice"
|
||||
id="inputState"
|
||||
class="form-control"
|
||||
>
|
||||
<option value="" selected disabled>Choose RTO</option>
|
||||
<option *ngFor="let item of RTO" [value]="item.RTO_Name">
|
||||
{{ item.RTO_Name }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="rtoOffice" type="text" class="form-control" id="inputZip"> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div *ngIf="!inventoryManagement" class="form-group col-md-4">
|
||||
<label for="inputCity">Device ID (IMEI)</label><span>*</span>
|
||||
<input
|
||||
formControlName="device_id"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.email.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.device_id.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.device_id.errors.required">
|
||||
Device Id is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="inventoryManagement" class="form-group col-md-4">
|
||||
<label for="inputCity">Device ID (IMEI)</label><span>*</span>
|
||||
<div>
|
||||
<select id="inventory" multiple="multiple">
|
||||
<option
|
||||
*ngFor="let option_1 of inventory"
|
||||
[value]="option_1.IMEI"
|
||||
>
|
||||
{{ option_1.IMEI }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
*ngIf="submitted && f.device_id.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.device_id.errors.required">
|
||||
Device Id is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4">Vehicle No.</label><span>*</span>
|
||||
<input
|
||||
formControlName="vehicleNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputPassword4"
|
||||
placeholder="Enter Vehicle number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.vehicleNo.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.vehicleNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.vehicleNo.errors.required">
|
||||
Vehicle number is required
|
||||
</div>
|
||||
<div *ngIf="f.vehicleNo.errors.maxLength">
|
||||
Vehicle number accepts max 10 digits
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Vehicle Type</label><span>*</span>
|
||||
<div>
|
||||
<select id="vehicleType" multiple="multiple">
|
||||
<option *ngFor="let option_1 of vehData" [value]="option_1._id">
|
||||
{{ option_1.vehicle_name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="iccid">ICCID</label>
|
||||
<input
|
||||
formControlName="iccid"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="iccid"
|
||||
placeholder="Enter ICCID No number"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="sim1">SIM 1</label> <span>*</span>
|
||||
<input
|
||||
formControlName="sim1"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="sim1"
|
||||
placeholder="Enter SIM number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.sim1.errors }"
|
||||
/>
|
||||
<div *ngIf="submitted && f.sim1.errors" class="invalid-feedback">
|
||||
<div *ngIf="f.sim1.errors.required">SIM 1 is required</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">SIM 2</label>
|
||||
<div>
|
||||
<input
|
||||
formControlName="sim2"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="sim1"
|
||||
placeholder="Enter SIM number"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Chassis No.</label><span>*</span>
|
||||
<input
|
||||
formControlName="chasisNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputEmail4"
|
||||
placeholder="Enter Chasis No."
|
||||
[ngClass]="{ 'is-invalid': submitted && f.chasisNo.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.chasisNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.chasisNo.errors.required">
|
||||
Chassis No is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4">Engine No.</label><span>*</span>
|
||||
<input
|
||||
formControlName="engineNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputPassword4"
|
||||
placeholder="Enter Engine number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.engineNo.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.engineNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.engineNo.errors.required">
|
||||
Engine No is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Panic Button Quality.</label>
|
||||
<select formControlName="panic" class="form-control">
|
||||
<option value="" selected disabled>Select Panic Button</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
<option value="9">9</option>
|
||||
<option value="10">10</option>
|
||||
</select>
|
||||
<!-- <input formControlName="panic" type="text" class="form-control" id="inputEmail4"
|
||||
placeholder="Enter Panic Button Quality."> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Vehicle Manufacture</label>
|
||||
<select
|
||||
class="form-control"
|
||||
formControlName="vehicleManufacture"
|
||||
(change)="selectModel($event)"
|
||||
>
|
||||
<option value="" selected disabled>Choose Manufacturer</option>
|
||||
<option *ngFor="let item of manufacturingData" [value]="item">
|
||||
{{ item }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="vehicleManufacture" type="text" class="form-control" id="inputCity"> -->
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">Model</label>
|
||||
<select class="form-control" formControlName="model">
|
||||
<option value="" selected disabled>Choose Model</option>
|
||||
<option *ngFor="let item of modelData" [value]="item.ModelName">
|
||||
{{ item.ModelName }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="vehicleCategory" type="text" class="form-control" id="inputZip"> -->
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<lable>{{ "Vehicle Category" | translate }} :</lable>
|
||||
<select formControlName="vehicleCategory" class="form-control">
|
||||
<option *ngFor="let license of vehicleCat" [value]="license">
|
||||
{{ license }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<!-- <label for="inputZip">Type Of Vehicle</label>
|
||||
<input formControlName="vehicleCategory" type="text" class="form-control" id="inputZip"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputState">Device Model</label><span>*</span>
|
||||
<div>
|
||||
<select id="dbselect" multiple="multiple">
|
||||
<option
|
||||
*ngFor="let option_1 of device_Model"
|
||||
[value]="option_1._id"
|
||||
>
|
||||
{{ option_1.modelName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">Tracking Expiry</label>
|
||||
<input
|
||||
formControlName="trackingExp"
|
||||
bsDatepicker
|
||||
[bsConfig]="bsConfig"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputZip"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">E sim Expiry</label>
|
||||
<input
|
||||
formControlName="eSimExpiry"
|
||||
bsDatepicker
|
||||
[bsConfig]="bsConfig"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputZip"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"></div>
|
||||
</form>
|
||||
<div
|
||||
style="overflow: auto; overflow-x: hidden; min-height: 200px"
|
||||
[ngClass]="{ rowHeight: docRow }"
|
||||
>
|
||||
<div class="row" *ngFor="let data of imageuploadObject; let i = index">
|
||||
<div class="col-sm-6" style="padding-top: 8px">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<span>{{ data.doctype }} : </span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="data.phone"
|
||||
placeholder="{{ 'Doc number' | translate }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<img
|
||||
*ngIf="data.image"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + data.image.substring(6)"
|
||||
(click)="openModal(template, data)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<span
|
||||
><input
|
||||
type="file"
|
||||
class="btn btn btn-success"
|
||||
style="background: #f1f1f1; border: none; color: black"
|
||||
(change)="onFileChanged($event, i)"
|
||||
/></span>
|
||||
<!-- <span>
|
||||
<button class="btn btn btn-success" (click)="onUpload(i)">
|
||||
{{ uploadStatus }}
|
||||
</button></span
|
||||
> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion" id="accordionExample">
|
||||
<div
|
||||
class="card"
|
||||
style="margin-left: 61px; margin-top: 23px; margin-right: 151px"
|
||||
>
|
||||
<div class="card-header" id="headingOne">
|
||||
<h2 class="mb-0">
|
||||
<button
|
||||
class="btn btn-link"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#collapseOne"
|
||||
aria-expanded="true"
|
||||
aria-controls="collapseOne"
|
||||
>
|
||||
Upload Device Image
|
||||
</button>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="collapseOne"
|
||||
class="collapse collapse"
|
||||
aria-labelledby="headingOne"
|
||||
data-parent="#accordionExample"
|
||||
>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<span>Device Image 1: </span>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<img
|
||||
*ngIf="deviceImg[0]"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + deviceImg[0].substring(6)"
|
||||
(click)="openModal(template, deviceImg[0])"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<input
|
||||
style="
|
||||
background: #ececec;
|
||||
width: 80%;
|
||||
margin-left: 5px;
|
||||
border: 1px solid #c1c1c1;
|
||||
"
|
||||
type="file"
|
||||
(change)="onDeviceImageChanged($event, 0)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-4">
|
||||
<i
|
||||
class="fas fa-cloud-upload-alt"
|
||||
style="
|
||||
color: #4c6ef5;
|
||||
float: left;
|
||||
font-size: 23px;
|
||||
line-height: 2.1rem;
|
||||
cursor: pointer;
|
||||
"
|
||||
title="Upload Image"
|
||||
(click)="onDeviceImageUploadUpload(0)"
|
||||
></i>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<span>Device Image 2: </span>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<img
|
||||
*ngIf="deviceImg[1]"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + deviceImg[1].substring(6)"
|
||||
(click)="openModal(template, deviceImg[1])"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input
|
||||
style="
|
||||
background: #ececec;
|
||||
width: 80%;
|
||||
margin-left: 5px;
|
||||
border: 1px solid #c1c1c1;
|
||||
"
|
||||
type="file"
|
||||
(change)="onDeviceImageChanged($event, 1)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-4">
|
||||
<i
|
||||
class="fas fa-cloud-upload-alt"
|
||||
style="
|
||||
color: #4c6ef5;
|
||||
float: left;
|
||||
font-size: 23px;
|
||||
line-height: 2.1rem;
|
||||
cursor: pointer;
|
||||
"
|
||||
title="Upload Image"
|
||||
(click)="onDeviceImageUploadUpload(1)"
|
||||
></i>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<span>Device Image 3: </span>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<img
|
||||
*ngIf="deviceImg[2]"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + deviceImg[2].substring(6)"
|
||||
(click)="openModal(template, deviceImg[2])"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input
|
||||
style="
|
||||
background: #ececec;
|
||||
width: 80%;
|
||||
margin-left: 5px;
|
||||
border: 1px solid #c1c1c1;
|
||||
"
|
||||
type="file"
|
||||
(change)="onDeviceImageChanged($event, 2)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-4">
|
||||
<i
|
||||
class="fas fa-cloud-upload-alt"
|
||||
style="
|
||||
color: #4c6ef5;
|
||||
float: left;
|
||||
font-size: 23px;
|
||||
line-height: 2.1rem;
|
||||
cursor: pointer;
|
||||
"
|
||||
title="Upload Image"
|
||||
(click)="onDeviceImageUploadUpload(2)"
|
||||
></i>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div id="toast">
|
||||
<div id="desc">{{ data_descip }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer text-center">
|
||||
<button type="submit" class="btn btn-primary" (click)="submit()">
|
||||
Add Device
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template #template>
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title pull-left">{{ docName }}</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-12">
|
||||
<img style="width: -webkit-fill-available" src="{{ image }}" />
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
.topDiv {
|
||||
padding-top: 59px;
|
||||
background: whitesmoke;
|
||||
height: 100vh;
|
||||
padding-left: 4px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
#toast #img {
|
||||
width: 250px;
|
||||
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;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AddNewDeviceComponent } from './add-new-device.component';
|
||||
|
||||
describe('AddNewDeviceComponent', () => {
|
||||
let component: AddNewDeviceComponent;
|
||||
let fixture: ComponentFixture<AddNewDeviceComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AddNewDeviceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddNewDeviceComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
985
src/app/dashboard/add-new-device/add-new-device.component.ts
Normal file
985
src/app/dashboard/add-new-device/add-new-device.component.ts
Normal file
|
|
@ -0,0 +1,985 @@
|
|||
import { Component, OnInit, TemplateRef } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { BsDatepickerConfig, BsModalRef, BsModalService } from 'ngx-bootstrap';
|
||||
import { ContactService } from '../../contact.service';
|
||||
import {Location} from '@angular/common';
|
||||
declare var $:any;
|
||||
declare var swal: any;
|
||||
@Component({
|
||||
selector: 'app-add-new-device',
|
||||
templateUrl: './add-new-device.component.html',
|
||||
styleUrls: ['./add-new-device.component.scss']
|
||||
})
|
||||
export class AddNewDeviceComponent implements OnInit {
|
||||
DeviceModelValue: any;
|
||||
modalRef: BsModalRef;
|
||||
submitted = false;
|
||||
date=new Date()
|
||||
expDate:any = new Date(this.date.getFullYear() + 1, this.date.getMonth(), this.date.getDate()).toLocaleString();
|
||||
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"]
|
||||
custtype: any;
|
||||
DealerId: any;
|
||||
constructor(private modalService: BsModalService,private location:Location,private fb:FormBuilder,private contactService:ContactService,private router:Router,private _flashMessagesService: FlashMessagesService,) { }
|
||||
deviceForm:FormGroup;
|
||||
userId
|
||||
deviceModel
|
||||
vehicleCat=[
|
||||
"Luxury Cab",
|
||||
"Three wheeled vehicles for transport of passengers/goods",
|
||||
"Goods carrier trucks or tankers or mail carriers",
|
||||
"Power tiller and Tractors using public roads",
|
||||
"Mobile clinic or X-Ray van or library vans",
|
||||
"Mobile Workshops",
|
||||
"Mobile canteens",
|
||||
"Private Service Vehicle",
|
||||
"maxi cab",
|
||||
"motor cab",
|
||||
"stage cariage",
|
||||
"contract carriage",
|
||||
"Tourist",
|
||||
"Educational Institution buses",
|
||||
"Ambulances",
|
||||
"Animal Ambulances",
|
||||
"Camper vans or trailers",
|
||||
"Cash vans",
|
||||
"Fire tenders, snorked ladders,auxiliary trailers and fire fighting vehicles",
|
||||
"Articulated vehicles",
|
||||
"Hearses",
|
||||
"Motor car",
|
||||
"Crane mounted vehicle",
|
||||
"Agricultural Tractor and Power Tiller",
|
||||
"Tow Trucks, Breakdown Van and Recovery Vehicles",
|
||||
"Construction Equipment Vehicles",]
|
||||
|
||||
// vehicleCat=['Truck','Bus','Car','School Van'];
|
||||
Load:boolean=false;
|
||||
bsConfig: Partial<BsDatepickerConfig>;
|
||||
dataDevModel: any[];
|
||||
vehicle_Type: any[];
|
||||
imageuploadObject = [{doctype:'Adhar card1 *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'Adhar card2 *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'Warrenty Card *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'vehicle sales invoice *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'vehicle RC',image:'',phone:'',docdate:new Date(),fill:true},
|
||||
{doctype:'vehicle Photo',image:'',phone:'',docdate:new Date(),fill:true},
|
||||
];
|
||||
dealerId
|
||||
sup_admin
|
||||
hrdwr
|
||||
hrdwr2
|
||||
custId
|
||||
vahanID
|
||||
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"
|
||||
}
|
||||
|
||||
];
|
||||
ngOnInit() {
|
||||
this.bsConfig = Object.assign({ dateInputFormat: 'DD-MM-YYYY' }, { containerClass: 'theme-dark-blue' });
|
||||
this.userId = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id;
|
||||
this.dealerId=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).Dealer_ID;
|
||||
if(JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin){
|
||||
this.sup_admin = JSON.parse(window.atob(window.localStorage.token.split(".")[1]))._id;
|
||||
}else{
|
||||
this.sup_admin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).supAdmin;
|
||||
}
|
||||
console.log("SUPPPERADMIN-----,",this.sup_admin);
|
||||
|
||||
this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer;
|
||||
this.custId = localStorage.getItem('custId');
|
||||
if((this.custtype == false)&&(window.localStorage['Custumer'] == 'ON')){
|
||||
|
||||
this.DealerId = JSON.parse(window.atob(window.localStorage.Dealer_token.split(".")[1]))._id;
|
||||
|
||||
}
|
||||
this.deviceForm=this.fb.group({
|
||||
ownerName:['',[Validators.required,Validators.pattern("[a-zA-Z][a-zA-Z ]+")]],
|
||||
contactNo:['',[Validators.required,Validators.pattern('[0-9 ]{10}')]],
|
||||
device_id:[''],
|
||||
address:['',Validators.required],
|
||||
state:[''],
|
||||
rtoOffice:[''],
|
||||
vehicleManufacture:[''],
|
||||
vehicleModel:[''],
|
||||
vehicleCategory:[''],
|
||||
vehicleType:[''],
|
||||
vehicleNo:['',[Validators.required,Validators.maxLength(10)]],
|
||||
chasisNo:['',Validators.required],
|
||||
engineNo:['',Validators.required],
|
||||
panic:[''],
|
||||
bsnlPlan:[''],
|
||||
hostingPlan:[''],
|
||||
SMSPlan:[''],
|
||||
city:[''],
|
||||
deviceModel:[''],
|
||||
trackingExp:new Date(this.expDate),
|
||||
eSimExpiry:[''],
|
||||
model:[''],
|
||||
email:[""],
|
||||
dealerFollowup:['',[Validators.required,Validators.pattern('[0-9 ]{10}')]],
|
||||
sim1:['',Validators.required],
|
||||
sim2:[''],
|
||||
iccid:[''],
|
||||
pin:['',[Validators.required,Validators.pattern('[0-9 ]{6}')]]
|
||||
|
||||
|
||||
})
|
||||
this.loadropdown()
|
||||
this.getDeviceModel();
|
||||
this.getvehDetail()
|
||||
this.getUserSetting(this.userId);
|
||||
this.getModelData()
|
||||
this. getAllState()
|
||||
var that=this
|
||||
$(document).on('change','#inventory',function() {
|
||||
var value = $('#inventory').val();
|
||||
for(var i=0;i<that.inventory.length;i++){
|
||||
if(value==that.inventory[i].IMEI){
|
||||
var date=new Date()
|
||||
var exp
|
||||
if(that.inventory[i].eSIMValidaity=="One Year"){
|
||||
exp= new Date(date.getFullYear() + 1, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}else if(that.inventory[i].eSIMValidaity=="Two Year"){
|
||||
exp= new Date(date.getFullYear() + 2, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}else{
|
||||
exp= new Date(date.getFullYear() + 1, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}
|
||||
that.deviceForm.patchValue({
|
||||
iccid:that.inventory[i].IccidNo,
|
||||
sim1:that.inventory[i].Mob1,
|
||||
sim2:that.inventory[i].Mob2,
|
||||
eSimExpiry:new Date(exp),
|
||||
device_id:value,
|
||||
})
|
||||
that.vahanID=that.inventory[i]['SerialNo']
|
||||
that.hrdwr=that.inventory[i].Mob1
|
||||
that.hrdwr2=that.inventory[i].Mob2
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
get f() { return this.deviceForm.controls; }
|
||||
states=[]
|
||||
getAllState(){
|
||||
this.contactService.get('/RTO_master/getAllState').subscribe((res:any)=>{
|
||||
for(var i=0;i<res.length;i++){
|
||||
this.states.push(res[i]._id.state)
|
||||
}
|
||||
// this.states=res;
|
||||
})
|
||||
}
|
||||
|
||||
submit(){
|
||||
this.submitted = true;
|
||||
|
||||
// stop here if form is invalid
|
||||
if (this.deviceForm.invalid) {
|
||||
const controls = this.deviceForm.controls;
|
||||
for (const name in controls) {
|
||||
if (controls[name].invalid) {
|
||||
// invalid.push(name);
|
||||
this.data_descip = "please enter valid "+name ;
|
||||
this.launch_toast();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var i=0;i<this.imageuploadObject.length;i++){
|
||||
if(!this.imageuploadObject[i].fill){
|
||||
swal(
|
||||
'Upload Error',
|
||||
'Please upload required documnets !!!',
|
||||
'error'
|
||||
)
|
||||
return;
|
||||
}
|
||||
if(i<=3 && this.imageuploadObject[i].phone==''){
|
||||
var err
|
||||
if(i==0 || i==1){
|
||||
err="Please Enter Adhar card number"
|
||||
}else if(i==2){
|
||||
err="Please Enter Warrenty card number"
|
||||
}else{
|
||||
err="Please Enter vehicle sales invoice number"
|
||||
}
|
||||
swal(
|
||||
'Upload Error',
|
||||
err,
|
||||
'error'
|
||||
)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.userFound){
|
||||
var data1={
|
||||
contactid:this.user._id
|
||||
}
|
||||
if(this.deviceForm.value.pin){
|
||||
data1['pin']=this.deviceForm.value.pin
|
||||
}
|
||||
this.contactService.post('/users/editUserDetails',data1).subscribe((res:any)=>{
|
||||
console.log(res);
|
||||
|
||||
if(res.message=="Saved"){
|
||||
|
||||
this.addDevice(this.user)
|
||||
|
||||
// this.addDevice(res._id)
|
||||
// this.router.navigateByUrl('/dashboard');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
var expDate = new Date();
|
||||
expDate.setFullYear(expDate.getFullYear()+1);
|
||||
|
||||
var name=this.deviceForm.value.ownerName.split(' ')
|
||||
|
||||
var data={
|
||||
// Dealer:this.reactiveForm.value.manager,
|
||||
custumer: true,
|
||||
expdate:new Date(expDate).toISOString(),
|
||||
first_name:name[0]?name[0]:'',
|
||||
last_name:name[1]?name[1]:'',
|
||||
isDealer: false,
|
||||
phone:this.deviceForm.value.contactNo,
|
||||
user_id:"",
|
||||
org_name: null,
|
||||
password:this.generatePassword(6),
|
||||
supAdmin:this.sup_admin,
|
||||
Dealer:this.userId,
|
||||
timezone: "Asia/Kolkata",
|
||||
std_code: {countryCode: "in", dialcode: "91"},
|
||||
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.pin){
|
||||
data['pin']=this.deviceForm.value.pin
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.email){
|
||||
data['email']=this.deviceForm.value.email
|
||||
}
|
||||
if(this.deviceForm.value.address){
|
||||
data['address']=this.deviceForm.value.address
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
|
||||
this.contactService.post('/users/signUp',data).subscribe((res:any)=>{
|
||||
console.log(res);
|
||||
|
||||
if(res.message=="Registered Sucessfully" || res.message=="Registered and Message Sent Successfuly" || res.message=="Registered"){
|
||||
|
||||
|
||||
this.addDevice(res._id)
|
||||
// this.router.navigateByUrl('/dashboard');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
addDevice(data){
|
||||
var model= $('#dbselect').multipleSelect('getSelects','value');
|
||||
var type= $('#vehicleType').multipleSelect('getSelects','value');
|
||||
var deviceid
|
||||
if(this.inventoryManagement){
|
||||
|
||||
var id=$('#inventory').multipleSelect('getSelects','value');
|
||||
deviceid=id[0]
|
||||
}else{
|
||||
deviceid=this.deviceForm.value.device_id
|
||||
}
|
||||
var newDevice = {
|
||||
devicename: this.deviceForm.value.vehicleNo,
|
||||
deviceid: deviceid,
|
||||
// des: this.des,
|
||||
model: model[0],
|
||||
|
||||
typdev: "Tracker",
|
||||
// emailid: this.emailid,
|
||||
Mileage : "10",
|
||||
phn: this.deviceForm.value.contactNo,
|
||||
sim_number: this.deviceForm.value.contactNo,
|
||||
created_by: this.userId,
|
||||
supAdmin: this.sup_admin,
|
||||
// driver_name: this.driver,
|
||||
// contact_number: this.dcontact,
|
||||
device_model: model[0],
|
||||
expdate: new Date(this.expDate),
|
||||
user:data._id,
|
||||
bussinessType:1
|
||||
// License : this.licenseVal,
|
||||
// deviceDistanceVariation:this.selcetedSign+(this.deviceDistanceVariation?this.deviceDistanceVariation:'0')
|
||||
|
||||
// Dealer:this.dealerObj?this.dealerObj:this.sup_admin
|
||||
}
|
||||
// if (this.custtype) {
|
||||
// newDevice['Dealer'] = this.userId;
|
||||
// } else if((this.custtype == false)&&(window.localStorage['Custumer'] == 'ON') ) {
|
||||
newDevice['Dealer'] = this.userId
|
||||
// }
|
||||
|
||||
|
||||
// hrdwr: this.deviceForm.value.sim1,
|
||||
// hrdwr1: this.deviceForm.value.sim1,
|
||||
if(this.deviceForm.value.sim1){
|
||||
newDevice['hrdwr'] = this.deviceForm.value.sim1
|
||||
}
|
||||
if(this.deviceForm.value.sim1){
|
||||
newDevice['sim_number'] = this.deviceForm.value.sim1
|
||||
}
|
||||
if(this.deviceForm.value.sim2){
|
||||
newDevice['sim_number2'] = this.deviceForm.value.sim2
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.eSimExpiry){
|
||||
newDevice['esim_validity'] = this.deviceForm.value.eSimExpiry
|
||||
}
|
||||
|
||||
|
||||
if(this.deviceForm.value.model){
|
||||
newDevice['model'] = this.deviceForm.value.model
|
||||
}
|
||||
|
||||
|
||||
if(this.deviceForm.value.dealerFollowup){
|
||||
newDevice['CID_No'] = this.deviceForm.value.dealerFollowup;
|
||||
}
|
||||
if(this.hrdwr){
|
||||
newDevice['hrdwr']=this.hrdwr
|
||||
}
|
||||
if(this.deviceForm.value.engineNo){
|
||||
newDevice['engineNo'] = this.deviceForm.value.engineNo;
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.city){
|
||||
newDevice['transportOfficeCity'] = this.deviceForm.value.city;
|
||||
}
|
||||
if(this.deviceForm.value.state){
|
||||
newDevice['transportOfficeState'] = this.deviceForm.value.state;
|
||||
}
|
||||
|
||||
|
||||
if(this.deviceForm.value.chasisNo){
|
||||
newDevice['ChassisNo'] = this.deviceForm.value.chasisNo
|
||||
}
|
||||
if(this.deviceForm.value.vehicleManufacture){
|
||||
newDevice['manufacturingCompany'] = this.deviceForm.value.vehicleManufacture;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(type){
|
||||
newDevice['typeOfVehicle'] = type[0];
|
||||
}
|
||||
if(type){
|
||||
newDevice['vehicleType'] = type[0];
|
||||
}
|
||||
|
||||
// if(this.transportOfficeCity){
|
||||
// newDevice['transportOfficeCity'] = this.transportOfficeCity;
|
||||
// }
|
||||
if(this.deviceForm.value.state){
|
||||
newDevice['transportOfficeState'] = this.deviceForm.value.state;
|
||||
}
|
||||
if(this.deviceForm.value.iccid){
|
||||
newDevice['IccidNo'] = this.deviceForm.value.iccid;
|
||||
}
|
||||
if(this.vahanID){
|
||||
newDevice['vahanID'] = this.vahanID;
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.panic){
|
||||
newDevice['numberOfSOS'] = this.deviceForm.value.panic;
|
||||
}
|
||||
|
||||
if(this.deviceImg != undefined){
|
||||
newDevice['deviceImage'] = this.deviceImg;
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.vehicleCategory){
|
||||
newDevice['vehicleCategory'] = this.deviceForm.value.vehicleCategory;
|
||||
}
|
||||
if(this.deviceForm.value.rtoOffice){
|
||||
newDevice['rto'] = this.deviceForm.value.rtoOffice;
|
||||
}
|
||||
console.log("imageuploadDocument",this.imageuploadObject);
|
||||
if((this.imageuploadObject.length !=0)){
|
||||
newDevice['imageDoc'] = this.imageuploadObject ;
|
||||
}
|
||||
console.log("=======>",newDevice)
|
||||
this.Load = false;
|
||||
this.contactService.addKycDevice(newDevice)
|
||||
.subscribe((device) => {
|
||||
console.log(device);
|
||||
|
||||
window.localStorage['DataUpdate'] = 'True';
|
||||
this.data_descip = "Device Added Successfully";
|
||||
launch_toast();
|
||||
this.router.navigateByUrl("dashboard");
|
||||
}
|
||||
// this.Load = false
|
||||
|
||||
, (err: any) => {
|
||||
console.log(err.status);
|
||||
console.log(err);
|
||||
var that = this;
|
||||
if (err.status == 400) {
|
||||
console.log(JSON.parse(err._body).deviceObj);
|
||||
var dupObj = JSON.parse(err._body).deviceObj ;
|
||||
// this.Load = false;
|
||||
that.data_descip = "Duplicate Device ID (IMEI)";
|
||||
that.launch_toast();
|
||||
var devicesupAdmin = dupObj.supAdmin;
|
||||
var deviceDealer = dupObj.Dealer;
|
||||
var devOwner = dupObj.user;
|
||||
// debugger;
|
||||
|
||||
}
|
||||
else {
|
||||
var message
|
||||
if(err.status==401){
|
||||
message="Access Denied !!!"
|
||||
this.data_descip = "Access Denied !!!";
|
||||
launch_toast();
|
||||
|
||||
}else{
|
||||
message="Network Error !!!"
|
||||
this.data_descip = "Network Error !!!";
|
||||
launch_toast();
|
||||
}
|
||||
console.log(err);
|
||||
|
||||
this._flashMessagesService.show(message, { cssClass: 'alert-danger', timeout: 2000 });
|
||||
// this.Load = false
|
||||
}
|
||||
}
|
||||
)
|
||||
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", ""); }, 1500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
generatePassword(passwordLength) {
|
||||
var numberChars = "0123456789";
|
||||
var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var lowerChars = "abcdefghijklmnopqrstuvwxyz";
|
||||
var allChars = numberChars + upperChars + lowerChars;
|
||||
var randPasswordArray = Array(passwordLength);
|
||||
randPasswordArray[0] = numberChars;
|
||||
randPasswordArray[1] = upperChars;
|
||||
randPasswordArray[2] = lowerChars;
|
||||
randPasswordArray = randPasswordArray.fill(allChars, 3);
|
||||
return this.shuffleArray(randPasswordArray.map(function(x) { return x[Math.floor(Math.random() * x.length)] })).join('');
|
||||
}
|
||||
|
||||
shuffleArray(array) {
|
||||
for (var i = array.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
var temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
message
|
||||
user
|
||||
userFound:boolean=false;
|
||||
onSearchChange(value){
|
||||
this.userFound=false
|
||||
this.message=undefined
|
||||
console.log(value);
|
||||
var phone=this.deviceForm.value.contactNo
|
||||
if(phone.length==10){
|
||||
console.log("KLDJNDKjk");
|
||||
this.contactService.get('/users/searchUserByPhone?user='+this.userId+'&phone='+phone).subscribe((res:any)=>{
|
||||
console.log(res);
|
||||
if(res.message=="User already Present"){
|
||||
this.deviceForm.patchValue({
|
||||
ownerName:res.data[0].first_name?res.data[0].first_name:""+" "+res.data[0].last_name?res.data[0].first_name:'',
|
||||
email:res.data[0].email?res.data[0].email:""
|
||||
})
|
||||
this.user=res.data[0]
|
||||
this.userFound=true;
|
||||
this.deviceForm.controls.ownerName.disable();
|
||||
this.deviceForm.controls.email.disable();
|
||||
}else{
|
||||
this.userFound=false
|
||||
this.message=res.message
|
||||
}
|
||||
},err=>{
|
||||
console.log(err);
|
||||
this.message=err.error.message
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
device_Model: any;
|
||||
getDeviceModel() {
|
||||
this.contactService.get("/deviceModel/getDeviceModel?input=Nippon")
|
||||
// this.contactService.getDevModel()
|
||||
.subscribe(res => {
|
||||
this.device_Model = res;
|
||||
var devname = [];
|
||||
console.log("Device_Model",this.device_Model);
|
||||
for(var i = 0 ; i<this.device_Model.length;i++){
|
||||
var a = {
|
||||
model :this.device_Model[i].device_type,
|
||||
id : this.device_Model[i]._id
|
||||
}
|
||||
var modelName;
|
||||
|
||||
if(this.device_Model[i].deviceport != undefined){
|
||||
modelName = this.device_Model[i].device_type + " " + "(Port : " + this.device_Model[i].deviceport + ")";
|
||||
|
||||
}else{
|
||||
modelName = this.device_Model[i].device_type;
|
||||
}
|
||||
this.device_Model[i].modelName = modelName ;
|
||||
devname.push(a);
|
||||
}
|
||||
console.log('this.device_Model',this.device_Model);
|
||||
console.log(devname);
|
||||
this.loadropdown()
|
||||
})
|
||||
}
|
||||
|
||||
loadropdown() {
|
||||
let that = this;
|
||||
|
||||
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);
|
||||
// ||(this.componentIdentifier === 'notification_master')
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
$('#dbselect').multipleSelect({
|
||||
width: 470,
|
||||
placeholder:"Select model",
|
||||
filter: true,
|
||||
single: true,
|
||||
selectAll: false
|
||||
|
||||
})
|
||||
$('#vehicleType').multipleSelect({
|
||||
width: 470,
|
||||
placeholder: "Select Type",
|
||||
filter: true,
|
||||
single: true,
|
||||
selectAll: false
|
||||
})
|
||||
$('#inventory').multipleSelect({
|
||||
width: 470,
|
||||
placeholder: 'Select IMEI',
|
||||
filter: true,
|
||||
single: true,
|
||||
selectAll: false
|
||||
|
||||
})
|
||||
|
||||
}, 100);
|
||||
|
||||
|
||||
}
|
||||
|
||||
vehData:any;
|
||||
getvehDetail(){
|
||||
this.contactService.getvehType(this.userId)
|
||||
.subscribe(res=>{
|
||||
// console.log(res);
|
||||
this.vehData=res;
|
||||
var vdata = res;
|
||||
for(var a = 0;a<this.vehData.length;a++){
|
||||
var vehtypename = vdata[a].brand + " " + vdata[a].model;
|
||||
this.vehData[a].vehicle_name = vehtypename;
|
||||
}
|
||||
console.log("allveh",this.vehData);
|
||||
this.loadropdown()
|
||||
})
|
||||
}
|
||||
docRow:boolean=false;
|
||||
// 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);
|
||||
// }
|
||||
showUpload:boolean=true;
|
||||
DeleteDocumentsField(index){
|
||||
console.log(this.imageuploadObject.length);
|
||||
if(this.imageuploadObject.length == 1){
|
||||
this.docRow = false;
|
||||
this.showUpload = false;
|
||||
}
|
||||
this.imageuploadObject.splice(index, 1);
|
||||
|
||||
}
|
||||
|
||||
selectedFile: File;
|
||||
index
|
||||
onFileChanged(event,i) {
|
||||
this.index=i
|
||||
this.selectedFile = <File>event.target.files[0];
|
||||
console.log(this.selectedFile);
|
||||
|
||||
this.imageuploadObject[this.index].fill=true;
|
||||
console.log(this.imageuploadObject);
|
||||
const fd = new FormData();
|
||||
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';
|
||||
this.data_descip = "Image Uploaded";
|
||||
this.launch_toast();
|
||||
console.log(res);
|
||||
var resImage ='';
|
||||
resImage = res['_body'];
|
||||
console.log(res['_body']);
|
||||
this.imageuploadObject[this.index].image = resImage;
|
||||
console.log(this.imageuploadObject);
|
||||
// console.log(res);
|
||||
this.selectedFile=undefined
|
||||
},err=>{
|
||||
this.selectedFile=undefined
|
||||
this.Load= false;
|
||||
this.data_descip = "Internal server error , try again";
|
||||
this.launch_toast();
|
||||
this._flashMessagesService.show('Internal server error , try again', { cssClass: 'alert-success', timeout: 2000 });
|
||||
})
|
||||
}
|
||||
ifuploadArr: boolean ;
|
||||
uploadStatus: any = 'Upload';
|
||||
onUpload(imgIndex) {
|
||||
console.log(imgIndex);
|
||||
|
||||
// console.log("selected file name =>",this.selectedFile.name);
|
||||
if(!this.selectedFile){
|
||||
swal(
|
||||
'Upload Error',
|
||||
'Please choose file before upload !!!',
|
||||
'error'
|
||||
)
|
||||
}else{
|
||||
this.imageuploadObject[this.index].fill=true;
|
||||
console.log(this.imageuploadObject);
|
||||
const fd = new FormData();
|
||||
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';
|
||||
this.data_descip = "Image Uploaded";
|
||||
this.launch_toast();
|
||||
console.log(res);
|
||||
var resImage ='';
|
||||
resImage = res['_body'];
|
||||
console.log(res['_body']);
|
||||
this.imageuploadObject[this.index].image = resImage;
|
||||
console.log(this.imageuploadObject);
|
||||
// console.log(res);
|
||||
this.selectedFile=undefined
|
||||
},err=>{
|
||||
this.selectedFile=undefined
|
||||
this.Load= false;
|
||||
this.data_descip = "Internal server error , try again";
|
||||
this.launch_toast();
|
||||
this._flashMessagesService.show('Internal server error , try again', { cssClass: 'alert-success', timeout: 2000 });
|
||||
})
|
||||
}
|
||||
}
|
||||
documentType(docType){
|
||||
console.log("doctypeObject=>",docType);
|
||||
|
||||
}
|
||||
|
||||
inventoryManagement:Boolean=false;
|
||||
inventory=[]
|
||||
getUserSetting(userId){
|
||||
|
||||
this.contactService.post('/users/get_user_setting',{uid: userId}).subscribe((res:any)=>{
|
||||
this.inventoryManagement=res.inventoryManagement;
|
||||
if(this.inventoryManagement){
|
||||
console.log(this.userId,this.dealerId=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer);
|
||||
var isDealer=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer
|
||||
var isSuperAdmin=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isSuperAdmin
|
||||
// var user
|
||||
// if(isSuperAdmin){
|
||||
// var user
|
||||
// }else if(isDealer){
|
||||
|
||||
// }
|
||||
var user=isSuperAdmin?this.userId:this.sup_admin?this.sup_admin:this.userId
|
||||
console.log(user);
|
||||
|
||||
this.contactService.get('/Device_inventory/getInventoryDropdown?user='+this.userId).subscribe((res:any)=>{
|
||||
this.inventory=res;
|
||||
this.loadropdown()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
manufacturingData
|
||||
getModelData(){
|
||||
this.contactService.get('/model_master/GetNames').subscribe((res:any)=>{
|
||||
this.manufacturingData=res
|
||||
})
|
||||
}
|
||||
modelData
|
||||
selectModel(event){
|
||||
console.log(event.target.value);
|
||||
|
||||
this.contactService.get('/model_master/getModel?name='+event.target.value).subscribe((res:any)=>{
|
||||
this.modelData=res
|
||||
})
|
||||
|
||||
}
|
||||
cityList
|
||||
onStateChange(event){
|
||||
this.contactService.get('/RTO_master/getCity?state='+event.target.value).subscribe((res:any)=>{
|
||||
this.cityList=res
|
||||
})
|
||||
}
|
||||
RTO
|
||||
onCityChange(event){
|
||||
this.contactService.get('/RTO_master/getRTO?city='+event.target.value).subscribe((res:any)=>{
|
||||
this.RTO=res
|
||||
})
|
||||
}
|
||||
back(){
|
||||
this.location.back()
|
||||
}
|
||||
imageURL:any;
|
||||
index2
|
||||
selectedDeviceFile:File;
|
||||
data_descip : any;
|
||||
onDeviceImageChanged(event,index) {
|
||||
this.index2=index
|
||||
this.selectedDeviceFile = <File>event.target.files[0];
|
||||
if(this.selectedDeviceFile){
|
||||
this.Load = true;
|
||||
const fdDevice = new FormData();
|
||||
fdDevice.append('photo',this.selectedDeviceFile,this.selectedDeviceFile.name)
|
||||
console.log("Binaryimage = > ",fdDevice );
|
||||
this.contactService.deviceImageupload(fdDevice)
|
||||
.subscribe(res=>{
|
||||
console.log(res);
|
||||
if(res){
|
||||
// if(this.deviceImg[this.index2]){
|
||||
this.deviceImg[this.index2]=res['_body']
|
||||
// }else{
|
||||
// this.deviceImg.push(res['_body'])
|
||||
// }
|
||||
}
|
||||
this.selectedDeviceFile=undefined;
|
||||
console.log('this.deviceImg',this.deviceImg);
|
||||
this.data_descip = "Image Uploaded";
|
||||
launch_toast();
|
||||
this.Load = false;
|
||||
},err=>{
|
||||
this.data_descip = "Internal Server Error";
|
||||
launch_toast();
|
||||
this.selectedDeviceFile=undefined;
|
||||
console.log(err);
|
||||
this.Load = false;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
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", ""); }, 1500);
|
||||
}
|
||||
|
||||
}
|
||||
deviceImg=['','',''];
|
||||
onDeviceImageUploadUpload(index){
|
||||
if(!this.selectedDeviceFile){
|
||||
swal(
|
||||
'Upload Error',
|
||||
'Please choose file before upload !!!',
|
||||
'error'
|
||||
)
|
||||
}else{
|
||||
this.Load = true;
|
||||
const fdDevice = new FormData();
|
||||
fdDevice.append('photo',this.selectedDeviceFile,this.selectedDeviceFile.name)
|
||||
console.log("Binaryimage = > ",fdDevice );
|
||||
this.contactService.deviceImageupload(fdDevice)
|
||||
.subscribe(res=>{
|
||||
console.log(res);
|
||||
if(res){
|
||||
// if(this.deviceImg[this.index2]){
|
||||
this.deviceImg[this.index2]=res['_body']
|
||||
// }else{
|
||||
// this.deviceImg.push(res['_body'])
|
||||
// }
|
||||
}
|
||||
this.selectedDeviceFile=undefined;
|
||||
console.log('this.deviceImg',this.deviceImg);
|
||||
this.data_descip = "Image Uploaded";
|
||||
launch_toast();
|
||||
this.Load = false;
|
||||
},err=>{
|
||||
this.data_descip = "Internal Server Error";
|
||||
launch_toast();
|
||||
this.selectedDeviceFile=undefined;
|
||||
console.log(err);
|
||||
this.Load = false;
|
||||
})
|
||||
}
|
||||
|
||||
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", ""); }, 1500);
|
||||
}
|
||||
|
||||
}
|
||||
launch_toast() {
|
||||
console.log("ihjgdfds");
|
||||
var x = document.getElementById("toast")
|
||||
//console.log(x);
|
||||
x.className = "show";
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 1500);
|
||||
}
|
||||
|
||||
image;
|
||||
docName
|
||||
openModal(template: TemplateRef<any>,doc){
|
||||
console.log(doc);
|
||||
|
||||
this.modalRef = this.modalService.show(template,{'backdrop':'static',class:'modal-lg modal-dialog-centered'});
|
||||
this.docName=doc.doctype
|
||||
this.image="https://www.oneqlik.in"+doc.image.substring(6)
|
||||
}
|
||||
}
|
||||
170
src/app/dashboard/dashboard.component.html
Normal file
170
src/app/dashboard/dashboard.component.html
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
<app-all-menus></app-all-menus>
|
||||
|
||||
<div class="limiter">
|
||||
<app-all-menus></app-all-menus>
|
||||
<div id="toast">
|
||||
<div id="desc">{{data_descip}}</div>
|
||||
</div>
|
||||
<div class="container-table100">
|
||||
<div class="wrap-table100">
|
||||
<div class="row" style="width:100%;text-align: center;align-items: center;background: #426E86;margin-left: 0px;margin-right: 0px; padding-top: 10px; padding-bottom: 10px; color: white;">
|
||||
<div class="col-12">
|
||||
<md-select [(ngModel)]="limit" ngDefaultControl (change)="callDataTable()" style="float: right;background: #efecec;margin-right: 5px;">
|
||||
<md-option *ngFor="let page of pageLengthArr; let i = index" [value]="page">
|
||||
{{page}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
<h4 style="display: inline-block;">{{'Vehicles' | translate}}</h4>
|
||||
<i style="margin-left: 20px;padding-top: 5px;cursor: pointer;float: left;" title="Add Device" class="fas fa-plus" (click)="adddev()" *ngIf="(bussinessType=='0' || bussinessType==undefined)" ></i>
|
||||
<!-- *ngIf="((custtype && ((dealer_Permission == true)||(dealer_Permission === undefined)))||superAdmin) && (bussinessType!=0 || bussinessType==undefined)"></i> -->
|
||||
<!-- (custtype && ((dealer_Permission == true)||(dealer_Permission === undefined)))||superAdmin||adbtn -->
|
||||
<i style="margin-left: 20px;padding-top: 5px;cursor: pointer;float: left;" title="Add Device" class="fas fa-plus-circle" (click)="adddevnew()" *ngIf="(bussinessType=='1')"></i>
|
||||
<!-- *ngIf="((custtype && ((dealer_Permission == true)||(dealer_Permission === undefined)))||superAdmin||adbtn) && bussinessType=='1'"></i> -->
|
||||
<i style="margin-left: 15px;padding-top: 5px;float: left;" class="fas fa-file-export" title="Export to Excel" (click)="exportExcel()" *ngIf="(bussinessType=='0' || bussinessType==undefined)"></i>
|
||||
<i style="margin-left: 15px;padding-top: 5px;float: left;" class="fas fa-file-export" title="Export to Excel" (click)="exportExcel1()" *ngIf="(bussinessType=='1')"></i>
|
||||
|
||||
<a *ngIf="showNav" href="https://youtu.be/dg1zd2geHXA" style="float: left;;margin-left: 15px;padding-top: 5px;cursor: pointer;color:white"title="Video tutorial" target="_blank"> <i class="fas fa-video"></i> </a>
|
||||
|
||||
|
||||
<md-select [(ngModel)]="devStatus" multiple style="padding-top: 0;float: right; margin-right: 10px; width: 150px;background: #efecec;"
|
||||
placeholder="--{{'Status' | translate}}--" ngDefaultControl (change)="selectedStatus($event,devStatus.name)">
|
||||
<md-option *ngFor="let devStatus of statusArray; let i = index" style="padding-left: 20px;" [value]="devStatus.name">
|
||||
{{devStatus.name}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="background: #7ba8b7;padding-top: 5px;padding-bottom: 5px;color: black;font-weight: 500;box-shadow:1px 1px white">
|
||||
<div class="col-sm-12 col-md-6 col-lg-10">
|
||||
<div class="s002">
|
||||
<form>
|
||||
<div class="inner-form">
|
||||
<div class="input-field first-wrap">
|
||||
<div class="icon-wrap">
|
||||
<i class="fas fa-search" width="24" height="24" viewBox="0 0 24 24"></i>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="myInput" name="myInput" type="text" [(ngModel)]="myInput" (ngModelChange)="searchFilter($event)" placeholder="{{'Device Search' | translate}}" />
|
||||
</div>
|
||||
<div class="input-field second-wrap">
|
||||
<div class="icon-wrap">
|
||||
<i class="far fa-calendar-alt" width="24" height="24" viewBox="0 0 24 24"></i>
|
||||
</div>
|
||||
<input id="from_date" bsDatepicker class="datepicker" [bsConfig]="bsConfig" [(ngModel)]="from_date" type="text" name="fDate" (ngModelChange)="dateChange('fdate')" placeholder="From Date">
|
||||
</div>
|
||||
<div class="input-field third-wrap">
|
||||
<div class="icon-wrap">
|
||||
<i class="far fa-calendar-alt" width="24" height="24" viewBox="0 0 24 24"></i>
|
||||
</div>
|
||||
<input id="to_date" bsDatepicker placeholder="To Date" class="datepicker" [bsConfig]="bsConfig" name="todate" [(ngModel)]="to_date" type="text" (ngModelChange)="dateChange('todate')">
|
||||
</div>
|
||||
<!-- <div class="input-field ">
|
||||
<div class="icon-wrap">
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 col-lg-2" style="padding-top: 2px;">
|
||||
<button class="btn btn-default" [disabled]="lastcall" (click)="pre()" style="width: 120px;float: left;color:white;background: #035096; border-right-color: #2d4262;line-height: 2.6;"><< {{'Previous' | translate}}</button>
|
||||
<button class="btn btn-default" [disabled]="firstcall" (click)="next()" style="width: 100px;float: left;color:white;margin-right: 10px;line-height: 2.6;background: #035096;">{{'Next' | translate}} >></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table100 ver1">
|
||||
<div class="wrap-table100-nextcols js-pscroll" style="height: 77vh;overflow-y: hidden;">
|
||||
<div class="table100-nextcols">
|
||||
<table id="deviceTable1" class="display order-column" cellspacing="0" style="font-size:15px;text-align: center;" >
|
||||
<thead style="background:#add8e6">
|
||||
<tr>
|
||||
<th style="width: 150px;text-align: left"></th>
|
||||
<th style="width: 150px;text-align: left">{{'Reg. Number' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'Group' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'IMEI' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'Int. ID' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'SIM 1' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'SIM Provider' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'SIM 2' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'SIM Provider 2' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'Device Model' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{'Vehicle Type' | translate}}</th>
|
||||
<th style="width: 300px;text-align: left">{{'Status' | translate}}</th>
|
||||
<th style="width: 200px;text-align: left">{{'User' | translate}}</th>
|
||||
<th style="width: 200px;text-align: left">{{'Owner' | translate}}</th>
|
||||
<th style="width: 200px;text-align: left">{{'Dealer' | translate}}</th>
|
||||
<th style="width: 200px;text-align: left">{{'Created On' | translate}}</th>
|
||||
<th style="width: 200px;text-align: left">{{'Exp. Date' | translate}}</th>
|
||||
<th style="width: 200px;text-align: left">{{'Renew at' | translate}}</th>
|
||||
<th style="width: 200px;text-align: left">{{'Renew by' | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{"Driver's Name" | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{"Driver's Contact" | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{"Sells Person" | translate}}</th>
|
||||
<th style="width: 150px;text-align: left">{{"Installer" | translate}}</th>
|
||||
<th style="width: 100px;text-align: center">Last Ping</th>
|
||||
<th style="width: 150px;text-align: center">{{'Device Setting' | translate}}</th>
|
||||
<th style="width: 100px;text-align: center">{{'Share Device' | translate}}</th>
|
||||
<th style="width: 100px;text-align: center">{{'Share User' | translate}}</th>
|
||||
<!-- *ngIf="superAdmin||custtype||(dealerTocust=='ON')" -->
|
||||
<!-- *ngIf="superAdmin||custtype||(dealerTocust=='ON')" -->
|
||||
<th style="text-align: center;">{{'Renewal History' | translate}}</th>
|
||||
<th style="text-align: center;">{{'Edit' | translate}}</th>
|
||||
<th style="text-align: center;">{{'Delete' | translate}}</th>
|
||||
<th style="text-align: center;">{{'E Chalan' | translate}}</th>
|
||||
<th style="text-align: center;">{{'Documents' | translate}}</th>
|
||||
<th style="text-align: center;">{{'Cert. Download' | translate}}</th>
|
||||
<th style="text-align: center;">{{'Remark' | translate}}</th>
|
||||
<th style="text-align: center;">{{'KYC Status' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- <div class="col-3">
|
||||
<i style="margin-left: 5px;cursor: pointer;" title="Add Device" class="fas fa-plus" (click)="adddev()"
|
||||
*ngIf="(custtype && ((dealer_Permission == true)||(dealer_Permission === undefined)))||superAdmin||adbtn"></i>
|
||||
<i style="margin-left: 15px" class="fas fa-file-export" title="Export to Excel" (click)="exportExcel()"></i>
|
||||
<a *ngIf="showNav" href="https://youtu.be/dg1zd2geHXA" style="margin-left: 15px;cursor: pointer;color:black"
|
||||
title="Video tutorial" target="_blank"> <i class="fas fa-video"></i> </a>
|
||||
<md-select [(ngModel)]="devStatus" multiple style="padding-top: 0;float: right; margin-right: 40px;; width: 150px;"
|
||||
placeholder="--{{'Status' | translate}}--" ngDefaultControl (change)="selectedStatus($event,devStatus.name)">
|
||||
<md-option *ngFor="let devStatus of statusArray; let i = index" [value]="devStatus.name">
|
||||
{{devStatus.name}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
<div class="col-5" style="scroll-padding-left: 0px;scroll-padding-right: 0px">
|
||||
<div class="row">
|
||||
<div class="col-md-6" style="padding-left: 0px;padding-right: 0px">
|
||||
<div class="row">
|
||||
<div class="col-4" style="padding:0;text-align: center;">
|
||||
<label style="width: inherit;margin-top: 7px">{{'From Date' | translate}}</label>
|
||||
</div>
|
||||
<div class="col-8" style="padding-left: 0">
|
||||
<input id="from_date" bsDatepicker class="form-control form-control-sm" style="height: 35px;" [bsConfig]="bsConfig" [(ngModel)]="from_date" type="text" (ngModelChange)="dateChange('fdate')" placeholder="Select Date">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-4" style="text-align: center;">
|
||||
<label style="width: inherit;margin-top: 7px">{{'To Date' | translate}}</label>
|
||||
</div>
|
||||
<div class="col-8" style="padding-left: 0">
|
||||
<input id="to_date" bsDatepicker placeholder="Select Date" class="form-control form-control-sm" style="height: 35px;" [bsConfig]="bsConfig" name="todate" [(ngModel)]="to_date" type="text" (ngModelChange)="dateChange('todate')">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button class="btn btn-default" [disabled]="firstcall" (click)="next()" style="color:white;margin-right: 10px;line-height: 1.7;background: #035096;">Next >></button>
|
||||
<button class="btn btn-default" [disabled]="lastcall" (click)="pre()" style="color:white;background: #035096; border-right-color: #2d4262;line-height: 1.7;"><< Previous</button>
|
||||
<input type="search" style="margin-right: 10px;width: 225px;float: right;border-radius: 0px;line-height: 1.9;background: white;box-shadow: 3px 2px 5px 0px rgb(178, 176, 174);line-height: 2.3;" class="form-control" id="myInput" name="myInput" type="text" [(ngModel)]="myInput" (ngModelChange)="searchFilter($event)" placeholder="{{'Device Search' | translate}}" />
|
||||
</div> -->
|
||||
3187
src/app/dashboard/dashboard.component.scss
Normal file
3187
src/app/dashboard/dashboard.component.scss
Normal file
File diff suppressed because it is too large
Load diff
25
src/app/dashboard/dashboard.component.spec.ts
Normal file
25
src/app/dashboard/dashboard.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DashboardComponent } from './dashboard.component';
|
||||
|
||||
describe('DashboardComponent', () => {
|
||||
let component: DashboardComponent;
|
||||
let fixture: ComponentFixture<DashboardComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DashboardComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DashboardComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
2177
src/app/dashboard/dashboard.component.ts
Normal file
2177
src/app/dashboard/dashboard.component.ts
Normal file
File diff suppressed because it is too large
Load diff
527
src/app/dashboard/device-edit/device-edit.component.html
Normal file
527
src/app/dashboard/device-edit/device-edit.component.html
Normal file
|
|
@ -0,0 +1,527 @@
|
|||
<div style="opacity: .9;text-align: center;background: #fcfbfb;position: relative;height: 90vh">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span style="color:#855353;font-size:20px;font-weight: 500;">Edit Device</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toast">
|
||||
<div id="desc">{{ data_descip }}</div>
|
||||
</div>
|
||||
<div class="row" style="padding:25px;">
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
Device IMEI :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="text" [(ngModel)]="dev_IMEI" name="IMEI">
|
||||
</md-form-field>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
Device name :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="text" [(ngModel)]="dname" name="dname" required>
|
||||
<md-error class="pattern">Enter Device Name</md-error>
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
Description :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="text" [(ngModel)]="desc" name="desc">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left">
|
||||
SIM Number :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="number" [(ngModel)]="sim" name="sim">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
SIM Provider :
|
||||
<md-form-field class="example-full-width width" style="float:left;width: 90%;">
|
||||
<input mdInput type="text" [(ngModel)]="SIM_provider" name="hrdwr" placeholder="SIM Provider" required>
|
||||
<md-error class="required">Enter SIM Provider</md-error>
|
||||
</md-form-field>
|
||||
</div>
|
||||
<!-- =================================== EDIT SIM2 ==================================== -->
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left">
|
||||
SIM Number 2 :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="number" [(ngModel)]="sim2" name="sim" placeholder="SIM 2">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
SIM Provider 2:
|
||||
<md-form-field class="example-full-width width" style="float:left;width: 90%;">
|
||||
<input mdInput type="text" [(ngModel)]="SIM_provider2" name="hrdwr" placeholder="SIM Provider 2">
|
||||
<md-error class="required">Enter SIM Provider</md-error>
|
||||
</md-form-field>
|
||||
</div>
|
||||
|
||||
<!-- =================================== EDIT SIM2 ==================================== -->
|
||||
<div class="col-sm-4" style="padding-bottom:10px;text-align:left;">
|
||||
Integration ID:
|
||||
<md-form-field class="example-full-width width" style="float:left;width: 90%;">
|
||||
<input mdInput type="text" [(ngModel)]="IntegrationId" placeholder="Integration ID" >
|
||||
<!-- <md-error class="required">Enter Integration ID</md-error> -->
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
Driver Name :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="text" [(ngModel)]="drname" name="drname">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
<!-- Vehicle type : -->
|
||||
<!-- <md-select name="neww" placeholder="Icon Type"[(ngModel)]="neww" style="display: initial;">
|
||||
<md-option *ngFor="let foodd of foodds" [value]="foodd" >
|
||||
{{ foodd.viewValue }}
|
||||
</md-option>
|
||||
</md-select> -->
|
||||
<!-- User : -->
|
||||
Driver's Number :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="number" [(ngModel)]="dcontact" name="dcontact" maxlength="10">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
<!-- Groups : -->
|
||||
Speed Limit :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="number" [(ngModel)]="speed" name="speed">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
<!-- Groups : -->
|
||||
Total ODO :
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="number" [(ngModel)]="totalODO" name="totalODO">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="margin-top:1px;;text-align:left;">
|
||||
<md-select placeholder="--Select Group--" [(ngModel)]="groupInfo" style="display: initial;">
|
||||
<md-option *ngFor="let group of groups" [value]="group">
|
||||
{{ group.GroupName }}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
<!-- Vehicle type : -->
|
||||
<!-- <md-select name="neww" placeholder="Device Model" [(ngModel)]="deviceModel._id" (ngModelChange)="getDevmodel($event)" style="display: initial;">
|
||||
<md-option *ngFor="let model of newArr" [value]="model._id">{{model.device_type}}</md-option>
|
||||
</md-select> -->
|
||||
<md-input-container>
|
||||
<input mdInput placeholder="Device Model" [mdAutocomplete]="tdAutoedit2" name="neww2" #state="ngModel"
|
||||
[(ngModel)]="deviceModel.device_type" (ngModelChange)="filterStates1(deviceModel)">
|
||||
<md-autocomplete #tdAutoedit2="mdAutocomplete">
|
||||
<md-option *ngFor="let model of dataSelect2" [value]="model.device_type">{{model.device_type}}</md-option>
|
||||
</md-autocomplete>
|
||||
</md-input-container>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;padding-top:1px;">
|
||||
<!-- <md-select name="neww1" placeholder="Vehicle types" [(ngModel)]="vehicleType._id" (ngModelChange)="getVehdata($event)" style="display: initial;">
|
||||
<md-option *ngFor="let vh of vehName" [value]="vh._id">{{vh.veh_type}}</md-option>
|
||||
</md-select> -->
|
||||
<md-input-container>
|
||||
<input mdInput placeholder="Vehicle types" [mdAutocomplete]="tdAutoedit1" name="neww1" #state="ngModel"
|
||||
[(ngModel)]="vehicleType.veh_type" (ngModelChange)="filterStatess(vehicleType)">
|
||||
<md-autocomplete #tdAutoedit1="mdAutocomplete">
|
||||
<md-option *ngFor="let vh of dataSelect1" [value]="vh.veh_type">{{vh.veh_type}}</md-option>
|
||||
</md-autocomplete>
|
||||
</md-input-container>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div *ngIf="showFieldsDealer && !dealerStatus" class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;padding-top: 12px;">
|
||||
<span>{{'Dealer' | translate}} :</span>
|
||||
<md-input-container style="width: 60%;">
|
||||
<input mdInput placeholder="{{'Select dealer' | translate}}" [mdAutocomplete]="tdAuto0" name="state"
|
||||
#state="ngModel" [(ngModel)]="dealerData.fullName" (ngModelChange)="filtergrpStates3(dealerData.fullName)">
|
||||
<md-autocomplete #tdAuto0="mdAutocomplete">
|
||||
<md-option *ngFor="let group of dealerSelect" [value]="group.fullName">
|
||||
<!-- (click)="selectDealer(group._id)" -->
|
||||
<span>{{ group.fullName }}</span>
|
||||
<!-- {{ group.last_name }}</span> -->
|
||||
</md-option>
|
||||
</md-autocomplete>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div *ngIf="showFieldsUser" class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;padding-top: 12px;">
|
||||
<!-- <md-select name="neww2" placeholder="Users" [(ngModel)]="userModel._id" (ngModelChange)="getUserdata($event)" style="display: initial;">
|
||||
<md-option *ngFor="let userName of newUserArr" [value]="userName._id">{{userName.user_type}}</md-option>
|
||||
</md-select> -->
|
||||
<md-input-container>
|
||||
<input mdInput placeholder="Search User" [mdAutocomplete]="tdAutoedit" name="state"
|
||||
#state="ngModel" [(ngModel)]="userModel.user_type"
|
||||
(ngModelChange)="filterStates(userModel)">
|
||||
<md-autocomplete #tdAutoedit="mdAutocomplete">
|
||||
<md-option *ngFor="let option of dataSelect" [value]="option.user_type">
|
||||
<span>{{ option.user_type }}</span>
|
||||
</md-option>
|
||||
<md-option *ngIf="costumers.length==0">
|
||||
<span>No Data Found</span>
|
||||
</md-option>
|
||||
</md-autocomplete>
|
||||
</md-input-container>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;" *ngIf="((superadminAccess == 'ON')||(this.superAdmin==true))">
|
||||
Expiration Date :
|
||||
<owl-date-time [(ngModel)]="expDate" [hourFormat]="'12'" [autoClose]="true" [dateFormat]="'DD/MM/YYYY hh:mm:a'"></owl-date-time>
|
||||
<!-- <md-form-field class="example-full-width width">
|
||||
<input disabled mdInput type="text" [(ngModel)]="expDate" placeholder="Expiration Date ">
|
||||
</md-form-field> -->
|
||||
</div>
|
||||
|
||||
<!-- -------------------------DEVICE DISTANCE VARIATION----------------------- -->
|
||||
<!-- <div class="col-sm-4 row" style="text-align: right;">
|
||||
|
||||
<span>{{'Device Distance Variation' | translate}} :</span>
|
||||
<select style="height: 30px;" [(ngModel)]="selcetedSign">
|
||||
<option value="+">+</option>
|
||||
<option value="-">-</option>
|
||||
</select>
|
||||
<input mdInput
|
||||
style="background: #ececec;float: right;width: 53%;height: 30px;margin-left: 5px;border: 1px solid #c1c1c1;"
|
||||
type="number" id="name" [(ngModel)]="deviceDistanceVariation">
|
||||
<span style="margin: 6px 2px 1px;font-weight: 700;">%</span>
|
||||
|
||||
</div> -->
|
||||
|
||||
|
||||
<div class="col-sm-4 col-md-4 row"
|
||||
style="padding-bottom:10px;text-align:left;padding-top: 12px;">
|
||||
<span>{{'Device Distance Variation' | translate}} :</span>
|
||||
<div style="width: 60%;">
|
||||
<select style="height: 30px;" [(ngModel)]="selcetedSign">
|
||||
<option value="+">+</option>
|
||||
<option value="-">-</option>
|
||||
</select>
|
||||
<input mdInput
|
||||
style="background: #ececec;float: right;width: 75%;height: 30px;margin-top: -30px;margin-left: 5px;border: 1px solid #c1c1c1;"
|
||||
type="number" id="name" [(ngModel)]="deviceDistanceVariation">
|
||||
|
||||
</div>
|
||||
<span style="margin: 6px 2px 1px;font-weight: 700;">%</span>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
Sales Person:
|
||||
<md-form-field class="example-full-width width" style="display: initial;">
|
||||
<input mdInput type="text" [(ngModel)]="sellsPerson" name="sellsPerson">
|
||||
</md-form-field>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;padding-top:1px;">
|
||||
<md-input-container>
|
||||
<input mdInput placeholder="Installer" [mdAutocomplete]="tdAutoedit11" name="neww21" #state="ngModel"
|
||||
[(ngModel)]="installer" (ngModelChange)="filtergrpStatess12(installer)">
|
||||
<md-autocomplete #tdAutoedit11="mdAutocomplete">
|
||||
<md-option *ngFor="let vh of installerSelect" [value]="vh.fullName">{{ vh.first_name }} {{ vh.last_name }}</md-option>
|
||||
</md-autocomplete>
|
||||
</md-input-container>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- style="width:95%" -->
|
||||
<div>
|
||||
<md-expansion-panel style="box-shadow: none;background: #fcfbfb;margin-top: 18px;">
|
||||
<md-expansion-panel-header>
|
||||
<md-panel-title style="font-size: 20px">
|
||||
Additional Settings
|
||||
</md-panel-title>
|
||||
</md-expansion-panel-header>
|
||||
<div class="additionalInputField">
|
||||
<div class="row" style="padding:25px;">
|
||||
<!-- <div class="col-sm-4 col-md-4" style="padding-bottom:10px;text-align:left;">
|
||||
<div class="row"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width" >
|
||||
<input mdInput type="text" [(ngModel)]="EngineNo" placeholder="Engine Number">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width" >
|
||||
<input mdInput type="text" [(ngModel)]="chassisno" placeholder="Chassis number">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width" >
|
||||
<input mdInput type="text" [(ngModel)]="manufacturingCompany" placeholder="Manufacturing Company">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<!-- </div>
|
||||
<div class="row" style="margin: 10px 0 46px 0;"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;" >
|
||||
<span>
|
||||
<span>Registration date </span>
|
||||
<owl-date-time [(ngModel)]="vehRegDate" [hourFormat]="'12'" [dateFormat]="'DD/MM/YYYY hh:mm:a'" [autoClose]="true"></owl-date-time>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<span>
|
||||
<span>Date of Manufacturing Year</span>
|
||||
<owl-date-time [(ngModel)]="vehManufacturingYear" [hourFormat]="'12'" [dateFormat]="'DD/MM/YYYY hh:mm:a'" [autoClose]="true"></owl-date-time>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<span>
|
||||
<span>Last fitness date</span>
|
||||
<owl-date-time [(ngModel)]="lastFitnessDate" [hourFormat]="'12'" [dateFormat]="'DD/MM/YYYY hh:mm:a'" [autoClose]="true"></owl-date-time>
|
||||
</span>
|
||||
</div>
|
||||
<!-- </div>
|
||||
<div class="row"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;" >
|
||||
<span>
|
||||
<span>Fitment Date</span>
|
||||
<owl-date-time [(ngModel)]="fitmentDate" [hourFormat]="'12'" [dateFormat]="'DD/MM/YYYY hh:mm:a'" [autoClose]="true"></owl-date-time>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="iccidNo" placeholder="ICCICD Number">
|
||||
</md-form-field>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<!-- <span>{{'RTO Number' | translate}} :</span> -->
|
||||
<md-input-container class="example-full-width width">
|
||||
<input mdInput placeholder="{{'Select RTO Number' | translate}}" [mdAutocomplete]="tdAuto0" name="state"
|
||||
#state="ngModel" [(ngModel)]="RTO" (ngModelChange)="filtergrpStatess2(RTO)">
|
||||
<md-autocomplete #tdAuto0="mdAutocomplete">
|
||||
<md-option *ngFor="let group of RTOSelect" [value]="group.RTO_Code">
|
||||
<span>{{ group.RTO_Code }}</span>
|
||||
</md-option>
|
||||
</md-autocomplete>
|
||||
</md-input-container>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- </div>
|
||||
<div class="row"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="UIDnumber" placeholder="Unique ID">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="CIDNO" placeholder="CID number">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width" >
|
||||
<input mdInput type="text" [(ngModel)]="typeofVeh" placeholder="Type of Vehicle">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<!-- </div>
|
||||
<div class="row"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="companyName" placeholder="Comapny Name">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="companyAddress" placeholder="Company Address">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width" >
|
||||
<input mdInput type="text" [(ngModel)]="transportOfficeCity" placeholder="Transport Office City">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<!-- </div>
|
||||
<div class="row"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;" >
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="transportOfficeState" placeholder="Transport Office State">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<span>
|
||||
<span>Invoice Date</span>
|
||||
<owl-date-time [(ngModel)]="invoice_date" [hourFormat]="'12'" [dateFormat]="'DD/MM/YYYY hh:mm:a'" [autoClose]="true"></owl-date-time>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="invoice_number" placeholder="Invoice Number">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<!-- </div>
|
||||
<div class="row"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<!-- <md-form-field class="example-full-width width"> -->
|
||||
<!-- <input mdInput type="number" [(ngModel)]="numberOfSOS" placeholder="Number of SOS"> -->
|
||||
<md-select [(ngModel)]="numberOfSOS" placeholder="Number of SOS">
|
||||
<md-option value="" selected disabled>Please select SOS</md-option>
|
||||
<md-option value="1">1</md-option>
|
||||
<md-option value="2">2</md-option>
|
||||
<md-option value="3">3</md-option>
|
||||
<md-option value="4">4</md-option>
|
||||
<md-option value="5">5</md-option>
|
||||
<md-option value="6">6</md-option>
|
||||
<md-option value="7">7</md-option>
|
||||
<md-option value="8">8</md-option>
|
||||
<md-option value="9">9</md-option>
|
||||
<md-option value="10">10</md-option>
|
||||
<md-option value="11">11</md-option>
|
||||
<md-option value="12">12</md-option>
|
||||
<md-option value="13">13</md-option>
|
||||
<md-option value="14">14</md-option>
|
||||
<md-option value="15">15</md-option>
|
||||
</md-select>
|
||||
<!-- </md-form-field> -->
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="tpin" placeholder="t-pin">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="epin" placeholder="e-pin">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div class="row"> -->
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="colour" placeholder="Colour">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="models" placeholder="Model">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="transmission" placeholder="Transmission">
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-sm-3 col-md-3" style="padding-bottom:10px;text-align:left;">
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="text" [(ngModel)]="Imsi" placeholder="IMSI">
|
||||
</md-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</md-expansion-panel>
|
||||
</div>
|
||||
|
||||
<!-- <md-dialog-actions align="end">
|
||||
<button md-button md-dialog-close>Cancel</button>
|
||||
<button md-button [md-dialog-close]="true" cdkFocusInitial>Install</button>
|
||||
</md-dialog-actions> -->
|
||||
<div>
|
||||
<button style=" width: 171px;height: 43px;letter-spacing: 5px;" class="btn btn-primary btn-block/" (click)="editRecord()">SAVE</button>
|
||||
<button style=" width: 171px;height: 43px;letter-spacing: 5px;background-color: #ff0f0f; border: 0px;" class="btn btn-primary btn-block/"
|
||||
(click)="onNoClick(null)">CANCEL</button>
|
||||
<!-- <button *ngIf="showRenewButton" style=" width: 171px;height: 43px;letter-spacing: 5px;background-color: green; border: 0px;"
|
||||
class="btn btn-primary btn-block/" (click)="renew()">RENEW</button> -->
|
||||
</div>
|
||||
|
||||
<flash-messages style="float: center;"></flash-messages>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- editRecord -->
|
||||
|
||||
<!-- previous style -->
|
||||
|
||||
<!-- <h3>Edit Device</h3>
|
||||
<hr>
|
||||
Device Name:
|
||||
<md-form-field class="example-full-width width" style="padding-left:3%;width: 69%;">
|
||||
<input mdInput type="text" [(ngModel)]="dname" name="dname" required>
|
||||
<md-error class="pattern">Enter Device Name</md-error>
|
||||
</md-form-field>
|
||||
|
||||
<br>
|
||||
Description:
|
||||
<md-form-field class="example-full-width width" style="padding-left:6%;width: 69%;" >
|
||||
<input mdInput type="text" [(ngModel)]="desc" name="desc">
|
||||
</md-form-field>
|
||||
|
||||
<br>
|
||||
Sim Number:
|
||||
<md-form-field class="example-full-width width" style="padding-left:4%;width: 69%;">
|
||||
<input mdInput type="number" [(ngModel)]="sim" name="sim">
|
||||
</md-form-field>
|
||||
<br>
|
||||
Driver Name:
|
||||
<md-form-field class="example-full-width width" style="padding-left:4%;width: 69%;">
|
||||
<input mdInput type="text" [(ngModel)]="drname" name="drname">
|
||||
</md-form-field>
|
||||
<br>
|
||||
Driver Contact:
|
||||
<md-form-field class="example-full-width width" style="padding-left:4%;width: 69%;">
|
||||
<input mdInput type="number" [(ngModel)]="dcontact" name="dcontact">
|
||||
</md-form-field>
|
||||
<br>
|
||||
Speed Limit:
|
||||
<md-form-field class="example-full-width width" style="padding-left: 17%;width: 70%;">
|
||||
<input mdInput type="number" [(ngModel)]="speed" name="speed">
|
||||
</md-form-field>
|
||||
<br>
|
||||
Vechile Type:
|
||||
<md-select name="neww" placeholder="Vechiles Type" style="padding-left: 16%;width: 69%" [(ngModel)]="neww">
|
||||
<md-option *ngFor="let foodd of foodds" [value]="foodd" >
|
||||
{{ foodd.viewValue }}
|
||||
</md-option>
|
||||
</md-select>
|
||||
<br>
|
||||
Groups:
|
||||
<md-select placeholder="--Select Group--" style="padding-left: 24%;width: 77%;" [(ngModel)]="groupInfo">
|
||||
<md-option *ngFor="let group of groups" [value]="group">
|
||||
{{ group.GroupName }}
|
||||
</md-option>
|
||||
</md-select>
|
||||
|
||||
<br>
|
||||
Fuel Tank Capacity :
|
||||
<md-form-field class="example-full-width width" style="padding-left:6%;width: 58%;">
|
||||
<input mdInput class="no-spin" [(ngModel)]="fuel_tank_capicity" name=" tankCapicity" placeholder="Enter Volume" required/>
|
||||
<md-error class="required">Enter Volume</md-error>
|
||||
</md-form-field>
|
||||
<br>
|
||||
Empty Tank Voltage :
|
||||
<md-form-field class="example-full-width width" style="padding-left:4%;width: 56%;">
|
||||
<input mdInput class="no-spin" [(ngModel)]="voltage_tank_empty" name=" when_tank_empty" placeholder="Voltage when tank empty" required/>
|
||||
<md-error class="required">Enter Voltage</md-error>
|
||||
</md-form-field>
|
||||
<br>
|
||||
Tankfull Voltage :
|
||||
<md-form-field class="example-full-width width" style="padding-left:9%;width: 61%;">
|
||||
<input mdInput class="no-spin" [(ngModel)]="tankfull_capicity" name=" tankCapicity" placeholder="Voltage When Tankfull" required/>
|
||||
<md-error class="required">Enter Voltage</md-error>
|
||||
</md-form-field>
|
||||
<br>
|
||||
|
||||
Device Model :
|
||||
|
||||
<md-select style="padding-left: 16%;width: 69%" name="neww" placeholder="Device Model" [(ngModel)]="deviceModel._id" (ngModelChange)="getDevmodel($event)">
|
||||
<md-option *ngFor="let model of newArr" [value]="model._id">{{model.device_type}}</md-option>
|
||||
</md-select>
|
||||
|
||||
<br>
|
||||
Expiration date :
|
||||
<div class="example-full-width width" style="padding-left: 39%;width: 92%;padding-bottom: 20px;">
|
||||
<owl-date-time [(ngModel)]="expDate" [hourFormat]="'12'" [dateFormat]="'DD/MM/YYYY hh:mm:a'" [autoClose]="true"></owl-date-time>
|
||||
</div>
|
||||
<p *ngIf="errorField" style="text-align:center;color:red">Expiration date must be greater then current date</p>
|
||||
<div style="padding-left:30%">
|
||||
<button class="btn btn-danger btn-block/"style="cursor:pointer;" (click)="onNoClick(null)" >Cancel</button>
|
||||
<button class="btn btn-primary btn-block/"style="cursor:pointer" (click)="editRecord()">Edit Record</button>
|
||||
</div>
|
||||
-->
|
||||
23
src/app/dashboard/device-edit/device-edit.component.scss
Normal file
23
src/app/dashboard/device-edit/device-edit.component.scss
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
::-webkit-scrollbar {
|
||||
// display: none;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
25
src/app/dashboard/device-edit/device-edit.component.spec.ts
Normal file
25
src/app/dashboard/device-edit/device-edit.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DeviceEditComponent } from './device-edit.component';
|
||||
|
||||
describe('DeviceEditComponent', () => {
|
||||
let component: DeviceEditComponent;
|
||||
let fixture: ComponentFixture<DeviceEditComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeviceEditComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeviceEditComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
1037
src/app/dashboard/device-edit/device-edit.component.ts
Normal file
1037
src/app/dashboard/device-edit/device-edit.component.ts
Normal file
File diff suppressed because it is too large
Load diff
15
src/app/dashboard/device-share/device-share.component.html
Normal file
15
src/app/dashboard/device-share/device-share.component.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<h4>Share Device</h4><hr>
|
||||
<p><b>Device Name: </b>{{dname}}</p>
|
||||
<p><b>Sharing with: </b>
|
||||
</p>
|
||||
|
||||
<md-form-field class="example-full-width width" style="width: 69%;" >
|
||||
|
||||
<input mdInput type="text" [(ngModel)]="email" name="email" placeholder="Email ID / Phone Number">
|
||||
</md-form-field>
|
||||
<div style="padding-left:30%">
|
||||
<button class="btn btn-danger btn-block/"style="cursor:pointer;" (click)="onNoClick(null)" >Cancel</button>
|
||||
<button class="btn btn-primary btn-block/"style="cursor:pointer" (click)="ShareRecord()">Share </button>
|
||||
</div>
|
||||
<flash-messages></flash-messages>
|
||||
|
||||
92
src/app/dashboard/device-share/device-share.component.scss
Normal file
92
src/app/dashboard/device-share/device-share.component.scss
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
|
||||
/* Toast Msg */
|
||||
|
||||
|
||||
#toast {
|
||||
visibility: hidden;
|
||||
max-width: 50px;
|
||||
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: 50px;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@-webkit-keyframes expand {
|
||||
from {min-width: 50px}
|
||||
to {min-width: 350px}
|
||||
}
|
||||
|
||||
@keyframes expand {
|
||||
from {min-width: 50px}
|
||||
to {min-width: 350px}
|
||||
}
|
||||
@-webkit-keyframes stay {
|
||||
from {min-width: 350px}
|
||||
to {min-width: 350px}
|
||||
}
|
||||
|
||||
@keyframes stay {
|
||||
from {min-width: 350px}
|
||||
to {min-width: 350px}
|
||||
}
|
||||
@-webkit-keyframes shrink {
|
||||
from {min-width: 350px;}
|
||||
to {min-width: 50px;}
|
||||
}
|
||||
|
||||
@keyframes shrink {
|
||||
from {min-width: 350px;}
|
||||
to {min-width: 50px;}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeout {
|
||||
from {bottom: 30px; opacity: 1;}
|
||||
to {bottom: 60px; opacity: 0;}
|
||||
}
|
||||
|
||||
@keyframes fadeout {
|
||||
from {bottom: 30px; opacity: 1;}
|
||||
to {bottom: 60px; opacity: 0;}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DeviceShareComponent } from './device-share.component';
|
||||
|
||||
describe('DeviceShareComponent', () => {
|
||||
let component: DeviceShareComponent;
|
||||
let fixture: ComponentFixture<DeviceShareComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeviceShareComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeviceShareComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
85
src/app/dashboard/device-share/device-share.component.ts
Normal file
85
src/app/dashboard/device-share/device-share.component.ts
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
import { Component, OnInit,Inject } from '@angular/core';
|
||||
import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material';
|
||||
import {Device} from '../../device';
|
||||
import {ContactService} from '../../contact.service';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { SidebarComponent } from '../../sidebar/sidebar.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-device-share',
|
||||
templateUrl: './device-share.component.html',
|
||||
styleUrls: ['./device-share.component.scss'],
|
||||
providers: [ContactService,SidebarComponent]
|
||||
})
|
||||
export class DeviceShareComponent implements OnInit {
|
||||
dname:any;
|
||||
constructor(public dialogRef: MdDialogRef<DeviceShareComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService,private _flashMessagesService: FlashMessagesService,public sidebar :SidebarComponent) {
|
||||
|
||||
//console.log(data)
|
||||
this.dname = data.name
|
||||
this.did = data.did
|
||||
console.log(this.did)
|
||||
}
|
||||
onNoClick(a): void {
|
||||
// console.log(a);
|
||||
this.dialogRef.close(a);
|
||||
}
|
||||
ShareRecord(){
|
||||
|
||||
|
||||
if(this.email == null || this.email == undefined){
|
||||
this._flashMessagesService.show('Blank Email ID or Mobile Number', { cssClass: 'alert-danger', timeout: 1500 });
|
||||
|
||||
}
|
||||
else if(this.email){
|
||||
this.contactService.ShareDevice(this.email,this.useridd,this.did).subscribe(
|
||||
|
||||
data => {
|
||||
this.device_data = data
|
||||
window.localStorage['DataUpdate'] = 'True'
|
||||
this.sidebar.sidebarData()
|
||||
this.onNoClick("OK");
|
||||
|
||||
|
||||
}, (err: any) => {
|
||||
// console.log(err.status);
|
||||
// console.log(err);
|
||||
if(err.status != 200)
|
||||
{
|
||||
|
||||
//console.log(this.mess);
|
||||
this._flashMessagesService.show( "Invalid Email ID or Mobile Number", { cssClass: 'alert-danger', timeout: 1000 });
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
fs :any;
|
||||
ls :any;
|
||||
emailid :any;
|
||||
or :any;
|
||||
useridd:any;
|
||||
device_data:any;
|
||||
email:any;
|
||||
did:any;
|
||||
devicess:any;
|
||||
final:any;
|
||||
contact:any;
|
||||
foods = []
|
||||
ngOnInit() {
|
||||
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]))._id;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,341 @@
|
|||
<!-- <div style="height: 73vh;overflow: auto;" class="card-body .html2canvas-container" id="map2">
|
||||
<div class="row">
|
||||
<div style="position: relative;left:4px;" *ngIf="supAdmin.imageDoc">
|
||||
<img src="{{supAdmin.imageDoc}}" width="100px" height="100px">
|
||||
</div>
|
||||
<div style="position: relative;right: -671px;">
|
||||
<img src="{{imgURL}}" width="150px" height="150px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h6 class="text-center mb-3">RTO COPY</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
TAC Reg.No : 84399849
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Fitment Date : 4 September 2021
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
CoP No. : 84399849
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Fitment Renewal Date : 4 September 2021
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
CoP Validity upto : 4 September 2021
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<h6 class="text-center mb-3">AIS 140 COMPLIANCE VLT INSTALLATION CERTIFICATE</h6>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Fitment Certificate : 84399849
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Device Model No. : NVT-1920
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Chassis No. : 84122399849
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
GNSS Module : NVdsaT-1920
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Engine No. : 84ss122399849
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Vahan ID : 84ss122399849
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Vehicle OEM : 84ss122399849
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Device IMEI : NVdsaT-1920
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Vehicle Model : WagnonR
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
GSM Module : NVdsaT-1920
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Vehicle Reg/temp : WagnonR
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
ICCID : 84ss122399849
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Voltage : 12V
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Primary SIM : 84122399849
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Panic Button Model : jhdks
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Primary SIM Valid till : 4 September 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Panic Button fitted : 3
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Secondary SIM : 4 September 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Dealer Name/fitted by : demo
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Secondary SIM Valid till : 4 September 2021
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
GST No. : 4345434
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<img src="{{deviceImage[0]?deviceImage[0]:img1}}" width="90px" height="90px">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<img src="{{deviceImage[1]?deviceImage[1]:img1}}" width="90px" height="90px">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<img src="{{deviceImage[2]?deviceImage[2]:img1}}" width="90px" height="90px">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<p>This is certified that, AIS 140 compliant vehicle location tracking device with panic button(SOS) has been installed properly as per AIS-140 guidelines device has been configured to state approval server</p>
|
||||
|
||||
<b class="mt-5 mb-4">Authorised
|
||||
|
||||
<p>This is certified that the device and panic button (SOS) installation has been carried out to my satisfaction and explained about the functionality of
|
||||
Device, I undertake that I will not temper the device and panic button (SOS)
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Customer Name : abc
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Contact/Login ID : 35344532
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
Customer Address : demo
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
Customer Sign :
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer text-center">
|
||||
<button class="btn btn-primary" (click)="downloadPdf()">Download</button>
|
||||
</div> -->
|
||||
|
||||
<md-dialog-content class="md-typography">
|
||||
<table id="testPdf" style="font-weight: 600">
|
||||
<tr>
|
||||
<td>
|
||||
<div *ngIf="org.imageDoc">
|
||||
<img
|
||||
src="{{ org.imageDoc }}"
|
||||
width="100px"
|
||||
height="100px"
|
||||
/><br /><br />
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center; font-weight: 700">
|
||||
<!-- {{org?org.first_name?org.first_name:"":''}} {{org?org.last_name?org.last_name:'':""}}<br><br> -->
|
||||
<!-- {{org?org.address?org.address:'':""}}<br><br> -->
|
||||
RTO COPY
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div>
|
||||
<img src="{{ imgURL }}" width="100px" height="150px" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center">
|
||||
<h6 style="font-size: 18px"> .</h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
TAC Reg.No <br />
|
||||
CoP No. <br />
|
||||
CoP Validity upto <br />
|
||||
Fitment Date <br />
|
||||
Fitment Renewal Date <br />
|
||||
</td>
|
||||
<td>
|
||||
: CK8077 <br />
|
||||
: CC0GP8551<br />
|
||||
: 30 September 2022 <br />
|
||||
: {{ kycApprovalDate ? (kycApprovalDate | date: "dd/MM/yyyy") : ""
|
||||
}}<br />
|
||||
: {{ esim_validity ? esim_validity : "" }}<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<h6 style="font-size: 18px; margin: 20px 0 10px 0px">
|
||||
AIS 140 COMPLIANCE VLT INSTALLATION CERTIFICATE
|
||||
</h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Fitment Certificate No.<br />
|
||||
Chassis No. <br />
|
||||
Engine No. <br />
|
||||
Vehicle OEM <br />
|
||||
Vehicle Model <br />
|
||||
Vehicle Reg/temp <br />
|
||||
Voltage<br />
|
||||
Panic Button Model<br />
|
||||
Panic Button fitted<br />
|
||||
Dealer Name/fitted by<br />
|
||||
Device Model No.<br />
|
||||
GNSS Module<br />
|
||||
Vahan ID<br />
|
||||
Device IMEI<br />
|
||||
GSM Module<br />
|
||||
ICCID <br />
|
||||
Primary SIM<br />
|
||||
Primary SIM Valid till<br />
|
||||
Secondary SIM<br />
|
||||
Secondary SIM Valid till<br />
|
||||
</td>
|
||||
<td>
|
||||
: {{ fitmentCertificateNo ? fitmentCertificateNo : "" }}<br />
|
||||
: {{ ChassisNo ? ChassisNo : "" }}<br />
|
||||
: {{ engineNo ? engineNo : "" }}<br />
|
||||
: {{ manufacturingCompany ? manufacturingCompany : "" }}<br />
|
||||
: {{ model ? model : "" }}<br />
|
||||
: {{ devName ? devName : "" }}<br />
|
||||
: 12V & 24V<br />
|
||||
: NSS-1821<br />
|
||||
: {{ numberOfSOS ? numberOfSOS : "" }}<br />
|
||||
: {{ dealerName ? dealerName : "" }}<br />
|
||||
: {{ devicetype ? devicetype : "" }}<br />
|
||||
: {{ gnnsModule ? gnnsModule : 0 }}<br />
|
||||
: {{ vahanID ? vahanID : "" }}<br />
|
||||
: {{ deviceID ? deviceID : "" }}<br />
|
||||
: {{ gsmModule ? gsmModule : "Telit GE910" }}<br />
|
||||
: {{ ICCICD ? ICCICD : "" }}<br />
|
||||
: {{ simNum ? simNum : "" }}<br />
|
||||
: {{ expiration_date ? (expiration_date | date: "dd/MM/yyyy") : ""
|
||||
}}<br />
|
||||
: {{ simNum1 ? simNum1 : "" }}<br />
|
||||
: {{ expiration_date ? (expiration_date | date: "dd/MM/yyyy") : ""
|
||||
}}<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="padding-top: 10px">
|
||||
<td>
|
||||
<img
|
||||
src="{{ deviceImage[0] ? deviceImage[0] : img1 }}"
|
||||
width="90px"
|
||||
height="90px"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<img
|
||||
src="{{ deviceImage[1] ? deviceImage[1] : img1 }}"
|
||||
width="90px"
|
||||
height="90px"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<img
|
||||
src="{{ deviceImage[2] ? deviceImage[2] : img1 }}"
|
||||
width="90px"
|
||||
height="90px"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<p>
|
||||
This is certified that, AIS 140 compliant vehicle location tracking
|
||||
device with panic button(SOS) has been installed properly as per
|
||||
AIS-140 guidelines device has been configured to state approval server
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="padding-top: 10px">
|
||||
<td>Authorised</td>
|
||||
</tr>
|
||||
<tr style="padding-top: 10px">
|
||||
<td>Undertaking</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<p>
|
||||
This is certified that the device and panic button (SOS) installation
|
||||
has been carried out to my satisfaction and explained about the
|
||||
functionality of Device, I undertake that I will not temper the device
|
||||
and panic button (SOS)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center; margin-top: 10px">
|
||||
Customer Name : {{ user.first_name ? user.first_name : "" }}
|
||||
{{ user.last_name ? user.last_name : "" }}<br />
|
||||
Contact/Login ID : {{ user.phone ? user.phone : "" }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
Customer Address: {{ user.address ? user.address : "" }}<br />
|
||||
Customer Sign :
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</md-dialog-content>
|
||||
<md-dialog-actions align="end">
|
||||
<button md-button md-dialog-close>Cancel</button>
|
||||
<button md-button (click)="exportAsPdf()" cdkFocusInitial>Export PDF</button>
|
||||
</md-dialog-actions>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.html2canvas-container {
|
||||
width: 3000px !important;
|
||||
height: 3000px !important;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DownloadCertificateComponent } from './download-certificate.component';
|
||||
|
||||
describe('DownloadCertificateComponent', () => {
|
||||
let component: DownloadCertificateComponent;
|
||||
let fixture: ComponentFixture<DownloadCertificateComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DownloadCertificateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DownloadCertificateComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,547 @@
|
|||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material';
|
||||
declare var jsPDF : any;
|
||||
declare var html2canvas:any;
|
||||
import * as moment from 'moment';
|
||||
import { ContactService } from '../../contact.service';
|
||||
declare var $: any;
|
||||
declare var QRious:any;
|
||||
@Component({
|
||||
selector: 'app-download-certificate',
|
||||
templateUrl: './download-certificate.component.html',
|
||||
styleUrls: ['./download-certificate.component.scss']
|
||||
})
|
||||
export class DownloadCertificateComponent implements OnInit {
|
||||
devName:any;
|
||||
img1='/assets/images/liveTrackIcons/noImageAvailableIcon.jpg'
|
||||
stamp='/assets/images/liveTrackIcons/Stamp.png'
|
||||
phNum:any;
|
||||
createdOn:any;
|
||||
expOn:any;
|
||||
supAdmin
|
||||
DealerObj = [];
|
||||
userObj = [];
|
||||
// iconType:any;
|
||||
simNum:any;
|
||||
todayODO:any;
|
||||
totalODO:any;
|
||||
useridd: any;
|
||||
emailId:any ="";
|
||||
costumers: any = [];
|
||||
deviceID: any;
|
||||
userName:any;
|
||||
devmodel:any;
|
||||
newUserArr=[];
|
||||
editTemplate:boolean=true;
|
||||
deletetemplate:boolean=false;
|
||||
orignalEmail: any;
|
||||
initialUser: any;
|
||||
ExportPdf: boolean;
|
||||
devID: any;
|
||||
InvoiceDate: any;
|
||||
devicetype: any;
|
||||
fitmentDate: any;
|
||||
engineNo: any;
|
||||
typeOfVehicle: any;
|
||||
manufacturingCompany: any;
|
||||
lastFitnessDate: any;
|
||||
vehicleRegDate: any;
|
||||
vehicleManufacturingDate: any;
|
||||
|
||||
IMSI: any;
|
||||
uniqueID: any;
|
||||
lattitude: any;
|
||||
longitude: any;
|
||||
userAddress: any;
|
||||
dealerAddress: any;
|
||||
CID_No: any;
|
||||
imgUrl: any;
|
||||
imgURL: any;
|
||||
companyName: any;
|
||||
companyAddress: any;
|
||||
transportOfficeCity: any;
|
||||
transportOfficeState: { data: string; };
|
||||
ChassisNo: any;
|
||||
deviceManufacturer: any;
|
||||
invoiceNum: any;
|
||||
numberOfSOS: any;
|
||||
expiration_date: any;
|
||||
organisationFlag: any;
|
||||
distributerName:any;
|
||||
distSelect: any=[];
|
||||
superAdmin: any;
|
||||
isDealer: any;
|
||||
dealerId: any;
|
||||
lastPingOn:any
|
||||
lastDeviceTime:any
|
||||
deviceImage=[];
|
||||
dealerName
|
||||
installationDate;
|
||||
ICCICD
|
||||
simNum1
|
||||
model
|
||||
user: any;
|
||||
org
|
||||
link: string;
|
||||
kycApprovalDate
|
||||
esim_validity;
|
||||
fitmentCertificateNo
|
||||
vahanID: any;
|
||||
myImage: HTMLImageElement;
|
||||
myImage1: HTMLImageElement;
|
||||
myImage2: HTMLImageElement;
|
||||
stamp1: HTMLImageElement;
|
||||
img: HTMLImageElement;
|
||||
gnnsModule
|
||||
gsmModule
|
||||
constructor(public dialogRef: MdDialogRef<DownloadCertificateComponent>,private contactService:ContactService,
|
||||
@Inject(MD_DIALOG_DATA) public data: any ) {
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.org=JSON.parse(localStorage.getItem('ORG'))
|
||||
if(!this.data.deviceInfo.esim_validity){
|
||||
if(this.data.deviceInfo.License=="Yearly"){
|
||||
this.esim_validity=this.data.deviceInfo.kycApprovalDate?moment(new Date(this.data.deviceInfo.kycApprovalDate), "DD-MM-YYYY").add(1, 'years').format("DD/MM/YYYY"):undefined;
|
||||
}
|
||||
}else{
|
||||
this.esim_validity=this.data.deviceInfo.esim_validity?moment(new Date(this.data.deviceInfo.esim_validity)).format("DD/MM/YYYY"):undefined
|
||||
}
|
||||
this.fitmentCertificateNo=this.data.deviceInfo.fitmentCertificateNo;
|
||||
this.ChassisNo=this.data.deviceInfo.ChassisNo;
|
||||
this.lastDeviceTime=this.data.deviceInfo.last_device_time;
|
||||
this.numberOfSOS=this.data.deviceInfo.numberOfSOS
|
||||
this.kycApprovalDate=this.data.deviceInfo.kycApprovalDate
|
||||
this.model=this.data.deviceInfo.Model
|
||||
this.lastPingOn=this.data.deviceInfo.last_ping_on
|
||||
this.devName = this.data.deviceInfo.Device_Name;
|
||||
this.devID = this.data.deviceInfo.Device_ID?this.data.deviceInfo.Device_ID:"";
|
||||
this.phNum =this.data.deviceInfo.contact_number;
|
||||
this.createdOn = this.data.deviceInfo.created_on?(new Date(this.data.deviceInfo.created_on).toISOString()):"";
|
||||
this.expOn = this.data.deviceInfo.expiration_date?(new Date(this.data.deviceInfo.expiration_date).toISOString()):"";
|
||||
// this.iconType=this.data.deviceInfo.iconType;
|
||||
this.simNum =this.data.deviceInfo.sim_number;
|
||||
this.simNum1 =this.data.deviceInfo.sim_number2;
|
||||
this.orignalEmail = this.data.deviceInfo.Email_ID
|
||||
this.emailId = this.data.deviceInfo.Email_ID;
|
||||
this.deviceImage=this.data.deviceInfo.deviceImage
|
||||
if(this.org.imageDoc && this.org.imageDoc.length>0){
|
||||
this.org.imageDoc='https://www.oneqlik.in' + this.org.imageDoc[0].substring(6)
|
||||
}
|
||||
|
||||
this.supAdmin=this.data.deviceInfo.supAdmin;
|
||||
if(this.supAdmin.imageDoc && this.supAdmin.imageDoc.length>0){
|
||||
this.supAdmin.imageDoc='https://www.oneqlik.in' + this.supAdmin.imageDoc[0].substring(6)
|
||||
}
|
||||
console.log(this.deviceImage);
|
||||
this.installationDate=this.data.deviceInfo.created_on
|
||||
this.todayODO=this.data.deviceInfo.today_odo;
|
||||
this.totalODO =this.data.deviceInfo.total_odo;
|
||||
this.deviceID = this.data.deviceInfo.Device_ID;
|
||||
this.initialUser = this.data.deviceInfo.user._id;
|
||||
this.user=this.data.deviceInfo.user
|
||||
this.userName = this.data.deviceInfo.OwnerName;
|
||||
this.userAddress = this.data.deviceInfo?this.data.deviceInfo.user.address:"";
|
||||
this.dealerName = this.data.deviceInfo.Dealer_name ;
|
||||
this.dealerId = this.data.deviceInfo.Dealer?this.data.deviceInfo.Dealer._id : "";
|
||||
console.log('this.dealerId',this.dealerId);
|
||||
this.dealerAddress = this.data.deviceInfo.DealerAddress;
|
||||
this.InvoiceDate = this.data.deviceInfo.invoiceDate?(new Date(this.data.deviceInfo.invoiceDate).toISOString()):"";
|
||||
this.invoiceNum = this.data.deviceInfo.invoiceNumber
|
||||
this.CID_No = this.data.deviceInfo.CID_No
|
||||
this.devicetype = this.data.deviceInfo.device_model?this.data.deviceInfo.device_model.device_type:"";
|
||||
if(this.devicetype=="Nippon-NVT-1820"){
|
||||
this.gsmModule='Telit GE910'
|
||||
}else if(this.devicetype=="Nippon-NVT-1820"){
|
||||
this.gnnsModule="Telit, Jupiter SL869T3-| Nav|C/IRNSS";
|
||||
this.gsmModule='Telit GE910'
|
||||
}else{
|
||||
this.gnnsModule="Quectel L89(GPS+IRNSS)";
|
||||
this.gsmModule='Quectel M66'
|
||||
}
|
||||
|
||||
for(var i=0;i<this.deviceImage.length;i++){
|
||||
|
||||
this.deviceImage[i] = this.deviceImage[i] && this.deviceImage[i]!=""?'http://nipponsecura.in' + this.deviceImage[i].substring(6):''
|
||||
|
||||
|
||||
}
|
||||
this.ICCICD = this.data.deviceInfo.IccidNo;
|
||||
this.IMSI = this.data.deviceInfo.IMSI;
|
||||
this.uniqueID = this.data.deviceInfo.uniqueID;
|
||||
this.fitmentDate = this.data.deviceInfo.fitmentDate?new Date(this.data.deviceInfo.fitmentDate):"";
|
||||
this.expiration_date =this.data.deviceInfo.expiration_date?new Date(this.data.deviceInfo.expiration_date):"";
|
||||
this.engineNo = this.data.deviceInfo.engineNo;
|
||||
this.typeOfVehicle = this.data.deviceInfo.typeOfVehicle;
|
||||
this.manufacturingCompany = this.data.deviceInfo.manufacturingCompany;
|
||||
this.vahanID= this.data.deviceInfo.vahanID?this.data.deviceInfo.vahanID:'';
|
||||
this.lastFitnessDate = this.data.deviceInfo.lastFitnessDate?new Date(this.data.deviceInfo.lastFitnessDate):"";
|
||||
this.vehicleRegDate = this.data.deviceInfo.vehicleRegDate? new Date(this.data.deviceInfo.vehicleRegDate):"";
|
||||
this.vehicleManufacturingDate = this.data.deviceInfo.vehicleManufacturingDate?new Date(this.data.deviceInfo.vehicleManufacturingDate):"";
|
||||
this.lattitude = this.data.deviceInfo.last_loc?this.data.deviceInfo.last_loc.coordinates[0]:"";
|
||||
this.longitude = this.data.deviceInfo.last_loc?this.data.deviceInfo.last_loc.coordinates[1]:"";
|
||||
this.getLocationLink()
|
||||
var that=this
|
||||
this.myImage = new Image();
|
||||
this.myImage.src = this.deviceImage[0]?this.deviceImage[0]:this.img1;
|
||||
this.myImage.crossOrigin="anonymous";
|
||||
|
||||
this.myImage1 = new Image();
|
||||
this.myImage1.src = this.deviceImage[1]?this.deviceImage[1]:this.img1;
|
||||
this.myImage1.crossOrigin="anonymous";
|
||||
|
||||
this.myImage2 = new Image();
|
||||
this.myImage2.src = this.deviceImage[2]?this.deviceImage[2]:this.img1;
|
||||
this.myImage2.crossOrigin="anonymous";
|
||||
|
||||
this.stamp1=new Image();
|
||||
this.stamp1.src=this.stamp;
|
||||
this.stamp1.crossOrigin="anonymous";
|
||||
|
||||
this.img = new Image();
|
||||
this.img.src = this.org.imageDoc?this.org.imageDoc:'';
|
||||
this.img.crossOrigin="anonymous";
|
||||
// one()
|
||||
// function one(){
|
||||
// stamp.onload = function(){
|
||||
|
||||
|
||||
|
||||
// two()
|
||||
// doc.addImage(stamp , 'png', 15,210,30,30);
|
||||
// };
|
||||
// }
|
||||
|
||||
// function two(){
|
||||
// img.onload = function(){
|
||||
// console.log("-1");
|
||||
// three()
|
||||
// doc.addImage(img , 'png', 15, 9,50,40)
|
||||
// };
|
||||
// }
|
||||
|
||||
// function three(){
|
||||
// four()
|
||||
// myImage.onload = function(){
|
||||
// console.log("1");
|
||||
// doc.addImage(myImage , 'png', 40, 170, 30, 20);
|
||||
|
||||
// };
|
||||
// }
|
||||
|
||||
// function four(){
|
||||
// myImage1.onload = function(){
|
||||
// console.log("2");
|
||||
// five()
|
||||
// doc.addImage(myImage1 , 'png', 80, 170, 30, 20);
|
||||
// };
|
||||
// }
|
||||
|
||||
// function five(){
|
||||
// myImage2.onload = function(){
|
||||
// console.log("3");
|
||||
|
||||
// doc.addImage(myImage2 , 'png', 120, 170, 30, 20);
|
||||
// doc.save(name);
|
||||
|
||||
|
||||
// };
|
||||
// }
|
||||
|
||||
// var stamp=new Image();
|
||||
// stamp.src=that.stamp;
|
||||
// stamp.crossOrigin="anonymous";
|
||||
// stamp.onload = function(){
|
||||
// console.log("0");
|
||||
// doc.addImage(stamp , 'png', 15,210,30,30)
|
||||
// };
|
||||
// var img = new Image();
|
||||
// img.src = this.org.imageDoc?this.org.imageDoc:'';
|
||||
// img.crossOrigin="anonymous";
|
||||
// // if(this.org.imageDoc){
|
||||
// img.onload = function(){
|
||||
// console.log("-1");
|
||||
// doc.addImage(img , 'png', 15, 9,50,40)
|
||||
|
||||
// };doc.addImage(myImage , 'png', 40, 170, 30, 20);
|
||||
|
||||
function f1() {
|
||||
return new Promise((resolve, reject) => {
|
||||
that.myImage.onload = function(){
|
||||
console.log("1");
|
||||
};
|
||||
// var isLoaded = this.myImage.complete && this.myImage.naturalHeight !== 0;
|
||||
// if(isLoaded)
|
||||
resolve('');
|
||||
});
|
||||
}
|
||||
|
||||
function f3(){
|
||||
that.myImage2.onload = function(){
|
||||
console.log("3");
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
function f2() {
|
||||
return new Promise((resolve, reject) => {
|
||||
that.myImage1.onload = function(){
|
||||
console.log("2");
|
||||
// doc.addImage(myImage1 , 'png', 80, 170, 30, 20);
|
||||
// if(that.deviceImage.length==2){
|
||||
// doc.save(name);
|
||||
// }
|
||||
};
|
||||
// var isLoaded = this.myImage1.complete && this.myImage1.naturalHeight !== 0;
|
||||
// if(isLoaded)
|
||||
resolve('');
|
||||
})
|
||||
|
||||
}
|
||||
f1().then(res => f2().then(res1=>f3()));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
getLocationLink(){
|
||||
var data = {
|
||||
id: this.data.deviceInfo._id,
|
||||
imei: this.data.deviceInfo.Device_ID,
|
||||
sh: this.data.deviceInfo.user._id,
|
||||
ttl: 15*60
|
||||
};
|
||||
|
||||
this.contactService.shareLiveLocation(data).subscribe(res=>{
|
||||
console.log(res);
|
||||
console.log('shareToken',res);
|
||||
this.link = 'http://nipponsecura.in' + "/share/liveShare?t=" + res.t;
|
||||
console.log(this.link);
|
||||
// this.shareLocationToDevice(link);
|
||||
this.qrCodeGenerator()
|
||||
},err=>{
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
qrCodeGenerator() {
|
||||
|
||||
var qr = new QRious();
|
||||
qr.set({
|
||||
// background: 'green',
|
||||
backgroundAlpha: 0.8,
|
||||
// foreground: 'blue',
|
||||
foregroundAlpha: 0.8,
|
||||
level: 'L',
|
||||
padding: 25,
|
||||
size: 500,
|
||||
value: this.link
|
||||
});
|
||||
|
||||
|
||||
this.imgURL= qr.toDataURL();
|
||||
|
||||
|
||||
|
||||
}
|
||||
exportAsPdf() {
|
||||
var that=this
|
||||
var name="Installation Certificate "+this.devName?this.devName:"Test"+".pdf"
|
||||
console.log(this.imgURL);
|
||||
var doc = new jsPDF();
|
||||
var specialElementHandlers = {
|
||||
'#editor': function (element: any, renderer: any) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var stamp=new Image();
|
||||
stamp.src=that.stamp;
|
||||
stamp.crossOrigin="anonymous";
|
||||
// stamp.onload = function(){
|
||||
console.log("0");
|
||||
doc.addImage(that.stamp1 , 'png', 15,210,30,30)
|
||||
// };
|
||||
var img = new Image();
|
||||
img.src = this.org.imageDoc?this.org.imageDoc:'';
|
||||
img.crossOrigin="anonymous";
|
||||
// if(this.org.imageDoc){
|
||||
// img.onload = function(){
|
||||
console.log("-1");
|
||||
doc.addImage(that.img , 'png', 15, 9,50,40)
|
||||
|
||||
// };
|
||||
// doc.text("Customer Copy", 110, 12);
|
||||
doc.setFontSize(3);
|
||||
doc.autoTable({
|
||||
theme: 'plain',
|
||||
html: '#testPdf',
|
||||
|
||||
tableWidth: 'auto',
|
||||
|
||||
// styles : {
|
||||
// cellWidth : 10,
|
||||
// overflow: "linebreak"
|
||||
// },
|
||||
willDrawCell: data => {
|
||||
if(data.row.index === 0){
|
||||
data.row.height = 30;
|
||||
doc.setFontStyle('bold');
|
||||
data.row.cells[0].styles.halign = 'center';
|
||||
data.row.cells[0].styles.fontSize = 25;
|
||||
data.row.cells[0].styles.overflow= "linebreak"
|
||||
data.row.cells[0].styles.lineHeight= "2.5";
|
||||
// doc.setLineHeightFactor()
|
||||
|
||||
// }
|
||||
|
||||
// doc.addImage(this.supAdmin.imageDoc,'JPEG', 140, 9,40,40);
|
||||
|
||||
doc.addImage(this.imgURL,'JPEG',150, 9,50,40);
|
||||
|
||||
}
|
||||
if(data.row.index ===1 ){
|
||||
// data.row.cells[0].styles.halign = 'center';
|
||||
doc.halign = 'center';
|
||||
doc.setFontStyle('bold');
|
||||
doc.cellPadding=60
|
||||
}
|
||||
|
||||
if(data.row.index ===3 ){
|
||||
// data.row.cells[0].styles.halign = 'center';
|
||||
doc.halign = 'center';
|
||||
|
||||
}
|
||||
if( data.row.index ===6){
|
||||
// data.row.cells[0].styles.halign = 'center';
|
||||
doc.halign = 'center';
|
||||
|
||||
}
|
||||
|
||||
if((data.row.index ===1) ||(data.row.index ===3) || (data.row.index ===5) || (data.row.index ===7) ||(data.row.index ===8) ||(data.row.index ===11) || (data.row.index ===13)){
|
||||
doc.setFontStyle('bold');
|
||||
|
||||
}
|
||||
if(data.row.index ===5){
|
||||
data.row.height = 30;
|
||||
// data.row.cells[0].styles.halign = 'center';
|
||||
// doc.halign = 'center';
|
||||
}
|
||||
|
||||
if(data.row.index ===6){
|
||||
data.row.height = 45;
|
||||
// data.row.cells[0].styles.halign = 'center';
|
||||
// doc.halign = 'center';
|
||||
}
|
||||
doc.setLineWidth(1);
|
||||
doc.rect(7, 7, 195, 285);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// var myImage = new Image();
|
||||
// myImage.src = that.deviceImage[0]?that.deviceImage[0]:this.img1;
|
||||
// myImage.crossOrigin="anonymous";
|
||||
|
||||
// var myImage1 = new Image();
|
||||
// myImage1.src = that.deviceImage[1]?that.deviceImage[1]:this.img1;
|
||||
// myImage1.crossOrigin="anonymous";
|
||||
|
||||
// var myImage2 = new Image();
|
||||
// myImage2.src = that.deviceImage[2]?that.deviceImage[2]:this.img1;
|
||||
// myImage2.crossOrigin="anonymous";
|
||||
|
||||
// var stamp=new Image();
|
||||
// stamp.src=that.stamp;
|
||||
// stamp.crossOrigin="anonymous";
|
||||
|
||||
// var img = new Image();
|
||||
// img.src = this.org.imageDoc?this.org.imageDoc:'';
|
||||
// img.crossOrigin="anonymous";
|
||||
function f1() {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("1");
|
||||
doc.addImage(that.myImage , 'png', 40, 170, 30, 20);
|
||||
resolve('');
|
||||
})
|
||||
}
|
||||
|
||||
function f2() {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("2");
|
||||
doc.addImage(that.myImage1 , 'png', 80, 170, 30, 20);
|
||||
resolve('');
|
||||
})
|
||||
}
|
||||
|
||||
function f3(){
|
||||
// myImage2.onload = function(){
|
||||
console.log("3");
|
||||
|
||||
doc.addImage(that.myImage2 , 'png', 120, 170, 30, 20);
|
||||
doc.save(name);
|
||||
|
||||
}
|
||||
// function f1() {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// myImage.onload = function(){
|
||||
// console.log("1");
|
||||
// doc.addImage(myImage , 'png', 40, 170, 30, 20);
|
||||
|
||||
|
||||
// };
|
||||
// var isLoaded = myImage.complete && myImage.naturalHeight !== 0;
|
||||
// if(isLoaded)
|
||||
// resolve('');
|
||||
// });
|
||||
// }
|
||||
|
||||
// function f3(){
|
||||
// myImage2.onload = function(){
|
||||
// console.log("3");
|
||||
|
||||
// doc.addImage(myImage2 , 'png', 120, 170, 30, 20);
|
||||
// doc.save(name);
|
||||
|
||||
|
||||
// };
|
||||
// }
|
||||
|
||||
// function f2() {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// myImage1.onload = function(){
|
||||
// console.log("2");
|
||||
// doc.addImage(myImage1 , 'png', 80, 170, 30, 20);
|
||||
// // if(that.deviceImage.length==2){
|
||||
// // doc.save(name);
|
||||
// // }
|
||||
// };
|
||||
// var isLoaded = myImage1.complete && myImage1.naturalHeight !== 0;
|
||||
// if(isLoaded)
|
||||
// resolve('');
|
||||
// })
|
||||
|
||||
// }
|
||||
f1().then(res => f2().then(res1=>f3()));
|
||||
|
||||
}
|
||||
|
||||
toDataURL(url, callback) {
|
||||
console.log(url);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function () {
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function () {
|
||||
callback(reader.result);
|
||||
}
|
||||
reader.readAsDataURL(xhr.response);
|
||||
};
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'blob';
|
||||
xhr.send();
|
||||
}
|
||||
}
|
||||
67
src/app/dashboard/e-chalan/e-chalan.component.html
Normal file
67
src/app/dashboard/e-chalan/e-chalan.component.html
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="col-12">
|
||||
<span style="color:#855353;font-size:20px;font-weight: 500;">E Chalan</span>
|
||||
<button style="float: right !important;" class="btn btn-danger btn-sm float-left ml-2"
|
||||
(click)="this.dialogRef.close()">Close <i class="fas fa-times-circle"></i></button>
|
||||
<button style="float: right !important;" class="btn btn-danger btn-sm float-left ml-2" (click)="fetchNewChalan()">Fetch new chalan </button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toast">
|
||||
<div id="desc">{{data_descip}}</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="loading" *ngIf="Load">Loading…</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: left;">{{'Chalan No.' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Date' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Owner' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Vehicle Class' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Status' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Payment Date' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Document No' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Payment Source' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Amount' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Offence' | translate}}</th>
|
||||
<th style="text-align: left;">{{'View' | translate}}</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of main">
|
||||
<td>{{item.challan_no}}</td>
|
||||
<td>{{item.date_time | date:'medium'}}</td>
|
||||
<td>{{item.owner_name}}</td>
|
||||
<td>{{item.vehicle_class}}</td>
|
||||
<td>{{item.challan_status}}</td>
|
||||
<td>{{item.payment_date | date:'medium'}}</td>
|
||||
<td >{{item.doc_no}}</td>
|
||||
<td>{{item.payment_source}}</td>
|
||||
<td>{{item.amount}}</td>
|
||||
<td>
|
||||
<span *ngIf="item.offences[0]">{{item.offences[0].offence_name}}</span>
|
||||
<span *ngIf="!item.offences[0]">N/A</span>
|
||||
</td>
|
||||
<td>
|
||||
<a target="_blank" [href]="item.receipt_url" class="btn btn-primary white-text">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr *ngIf="main.length==0">
|
||||
<div style="text-align: center;" class="text-center">
|
||||
<h5 style="position: absolute;left: 41%;top: 82%;">No Data Found</h5>
|
||||
|
||||
</div>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- </div> -->
|
||||
|
||||
49
src/app/dashboard/e-chalan/e-chalan.component.scss
Normal file
49
src/app/dashboard/e-chalan/e-chalan.component.scss
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#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;
|
||||
}
|
||||
#toast #img {
|
||||
width: 250px;
|
||||
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;
|
||||
}
|
||||
25
src/app/dashboard/e-chalan/e-chalan.component.spec.ts
Normal file
25
src/app/dashboard/e-chalan/e-chalan.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EChalanComponent } from './e-chalan.component';
|
||||
|
||||
describe('EChalanComponent', () => {
|
||||
let component: EChalanComponent;
|
||||
let fixture: ComponentFixture<EChalanComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EChalanComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EChalanComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
75
src/app/dashboard/e-chalan/e-chalan.component.ts
Normal file
75
src/app/dashboard/e-chalan/e-chalan.component.ts
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material';
|
||||
import { ContactService } from '../../contact.service';
|
||||
declare var $: any;
|
||||
@Component({
|
||||
selector: 'app-e-chalan',
|
||||
templateUrl: './e-chalan.component.html',
|
||||
styleUrls: ['./e-chalan.component.scss']
|
||||
})
|
||||
export class EChalanComponent implements OnInit {
|
||||
tabelObj: any ;
|
||||
Load: boolean;
|
||||
main=[];
|
||||
|
||||
constructor(public dialogRef: MdDialogRef<EChalanComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService) {
|
||||
// this.main=this.data
|
||||
// this.testTable()
|
||||
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getechalanHistory()
|
||||
}
|
||||
|
||||
getechalanHistory(){
|
||||
this.Load=true
|
||||
this.contactService.get('/eChalan/getEchalanByVehicleName?vName='+(this.data.dname).replace(/\s/g,'')).subscribe((res:any)=>{
|
||||
if(res.length>0){
|
||||
this.main=res;
|
||||
this.Load=false
|
||||
}else{
|
||||
this.data_descip = res.message;
|
||||
launch_toast();
|
||||
this.Load=false
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
function launch_toast() {
|
||||
var x = document.getElementById("toast")
|
||||
//console.log(x);
|
||||
x.className = "show";
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
data_descip
|
||||
fetchNewChalan(){
|
||||
this.contactService.get('/eChalan/getEchalan?vName='+(this.data.dname).replace(/\s/g,'')).subscribe((res:any)=>{
|
||||
// console.log(res);
|
||||
if(res.length>0){
|
||||
this.main=res;
|
||||
this.Load=false
|
||||
}else{
|
||||
this.data_descip = res.message;
|
||||
launch_toast();
|
||||
this.Load=false
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
function launch_toast() {
|
||||
var x = document.getElementById("toast")
|
||||
//console.log(x);
|
||||
x.className = "show";
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
<div class="container-fluid" >
|
||||
<div class="row">
|
||||
<div class="col-12" style="font-size: 20px;text-align: center;">
|
||||
<p style="font-weight: 500">General Setting</p>
|
||||
<flash-messages style="color:green;font-size: 15px;padding:0;margin:0;"></flash-messages>
|
||||
</div>
|
||||
</div>
|
||||
<div class="formStyle">
|
||||
<form [formGroup]="generalSetings">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<md-form-field>
|
||||
<input placeholder="Device Name" type="text" formControlName="devicename" mdInput>
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<md-form-field>
|
||||
<input placeholder="Total ODO" type="Number" formControlName="total_odo" mdInput>
|
||||
</md-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6" style="margin-top: 5px;">
|
||||
<md-form-field>
|
||||
<input placeholder="Mileage (Km/hr)" type="Number" formControlName="mileage" mdInput>
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<md-select formControlName="ignDetection" placeholder="--Ignition Detection--" style="width: 202px;">
|
||||
<md-option *ngFor="let ignValue of igndtection" [value]="ignValue">
|
||||
{{ignValue}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<md-select formControlName="digitalInput" placeholder="--Digital Input--" style="width: 202px;" >
|
||||
<md-option *ngFor="let din of dInput" [value]="din">
|
||||
{{din}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<md-select formControlName="analogInput" placeholder="--Analog Input--" style="width: 202px;" >
|
||||
<md-option *ngFor="let ain of aInput" [value]="ain">
|
||||
{{ain}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<md-select formControlName="fuelMeasurment" placeholder="--Fuel Measurment--" style="width: 202px;">
|
||||
<md-option *ngFor="let fuel of fuelmeasObj" [value]="fuel">
|
||||
{{fuel}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<md-form-field>
|
||||
<input placeholder="Overspeed Limit" type="Number" formControlName="speed" mdInput>
|
||||
</md-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<md-form-field>
|
||||
<input placeholder="Over Stop Limit" type="Number" formControlName="overStoppedLimit" mdInput>
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<md-form-field>
|
||||
<input placeholder="Over Idle Limit" type="Number" formControlName="overIdleLimit" mdInput>
|
||||
</md-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" *ngIf="!driverManagement">
|
||||
<div class="col-6">
|
||||
<md-form-field>
|
||||
<input placeholder="Driver Name" type="text" formControlName="driver_name" mdInput>
|
||||
</md-form-field>
|
||||
</div>
|
||||
<div class="col-6" >
|
||||
<md-form-field>
|
||||
<input placeholder="Driver Number" type="Number" formControlName="driver_number" mdInput>
|
||||
</md-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" *ngIf="driverManagement">
|
||||
<div class="col-6">
|
||||
<md-select formControlName="driver_name" placeholder="Select Driver" style="width: 202px;" (change)="setContactNumber()">
|
||||
<md-option *ngFor="let driver of drivers" [value]="driver.name">
|
||||
{{driver.name}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<md-form-field>
|
||||
<input placeholder="Driver Number" type="Number" formControlName="driver_number" mdInput>
|
||||
</md-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row" >
|
||||
<div class="col-6">
|
||||
<md-input-container style="padding-top: 8px;">
|
||||
<input mdInput [mdAutocomplete]="tdAutoedit" name="state"
|
||||
#state="ngModel" [(ngModel)]="optiondefault"
|
||||
(ngModelChange)="filterStates(optiondefault)">
|
||||
<md-autocomplete #tdAutoedit="mdAutocomplete">
|
||||
<md-option *ngFor="let option of dataSelect" [value]="option.country">
|
||||
<span>{{ option.country }}</span>
|
||||
</md-option>
|
||||
</md-autocomplete>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<md-select [(ngModel)]="tripTypeVal" placeholder="--Trip Type--" style="width: 202px;">
|
||||
<md-option *ngFor="let trip of tripType" [value]="trip.value">
|
||||
{{trip.view}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<md-select [(ngModel)]="selected_ac_wire" placeholder="--AC wiring--" style="width: 202px;">
|
||||
<md-option *ngFor="let trip of ac_wire_setting" [value]="trip">
|
||||
{{trip}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<span>{{'Virtual Ac On ' | translate}} :</span>
|
||||
<md-slide-toggle style="float: right; padding: 8px 35.1px" md-tooltip="Include Dealer's Customers"
|
||||
[(ngModel)]="virtualAcc"></md-slide-toggle>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 30px;">
|
||||
<div class="col-12" style="text-align: center">
|
||||
<button style="background-color: #484848;color:#fdfdfd;width: 135px;" md-raised-button (click)="saveDetail()">SAVE</button>
|
||||
<button style="background-color: red;color:#fdfdfd;width: 135px;" md-raised-button (click)="closebox()">CANCEL</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GeneralSettingsComponent } from './general-settings.component';
|
||||
|
||||
describe('GeneralSettingsComponent', () => {
|
||||
let component: GeneralSettingsComponent;
|
||||
let fixture: ComponentFixture<GeneralSettingsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ GeneralSettingsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GeneralSettingsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
445
src/app/dashboard/general-settings/general-settings.component.ts
Normal file
445
src/app/dashboard/general-settings/general-settings.component.ts
Normal file
|
|
@ -0,0 +1,445 @@
|
|||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MD_DIALOG_DATA, MdDialogRef } from '@angular/material';
|
||||
import { ContactService } from '../../contact.service';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
|
||||
declare var $:any;
|
||||
|
||||
@Component({
|
||||
selector: 'app-general-settings',
|
||||
templateUrl: './general-settings.component.html',
|
||||
styleUrls: ['./general-settings.component.scss']
|
||||
})
|
||||
export class GeneralSettingsComponent implements OnInit {
|
||||
errorMsg:any;
|
||||
virtualAcc
|
||||
showError : boolean=false;
|
||||
igndtection = ['ACC','MOVEMENT'];
|
||||
dInput = ['ACC','AC','DOOR'];
|
||||
aInput = ['Fuel', 'Tempreture','Battey Status'];
|
||||
fuelmeasObj = ['GPS','MANUAL'];
|
||||
tripType = [{view : 'One WAY',value : 1},{view : 'Two Way', value : 2}]
|
||||
tripTypeVal:any
|
||||
|
||||
loader :boolean = true;
|
||||
generalSetings: FormGroup;
|
||||
devicesss: any;
|
||||
custtype: any;
|
||||
useridd: any;
|
||||
mb: any;
|
||||
emailid: any;
|
||||
superAdmin: any;
|
||||
finall: any;
|
||||
options: any=[];
|
||||
deviceArr: any =[];
|
||||
currencyValue: any;
|
||||
id: any;
|
||||
driverManagement:boolean=false;
|
||||
selected_ac_wire="Forward"
|
||||
ac_wire_setting=['Forward','Reversed']
|
||||
constructor(public dialogRef: MdDialogRef<GeneralSettingsComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService,public formBuilder: FormBuilder,private _flashMessagesService: FlashMessagesService) {
|
||||
console.log('this.data.device',this.data.device);
|
||||
this.id = this.data.device._id ;
|
||||
this.driverManagement=data.device.user.driverManagement?data.device.user.driverManagement:false
|
||||
console.log('this.id=>',this.id)
|
||||
var flmsrmnt;
|
||||
if(this.data.device.fuelMeasurement){
|
||||
if(this.data.device.fuelMeasurement == 'GPS'){
|
||||
flmsrmnt = this.fuelmeasObj[0];
|
||||
}
|
||||
if(this.data.device.fuelMeasurement == 'MANUAL'){
|
||||
flmsrmnt = this.fuelmeasObj[1];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.tripTypeVal = this.data.device?this.data.device.tripType :1 ;
|
||||
this.virtualAcc=this.data.device.virtualacc?this.data.device.virtualacc:false;
|
||||
this.selected_ac_wire=this.data.device.ac_wire_setting?this.data.device.ac_wire_setting:'Forward'
|
||||
this.generalSetings = formBuilder.group({
|
||||
driver_name : [this.data.device.driver_name?this.data.device.driver_name : ''],
|
||||
devicename : [this.data.device.Device_Name?this.data.device.Device_Name : ''],
|
||||
driver_number : [this.data.device.contact_number?this.data.device.contact_number : null],
|
||||
total_odo: [this.data.device.total_odo?this.data.device.total_odo : 0],
|
||||
speed: [this.data.device.SpeedLimit?this.data.device.SpeedLimit : 60],
|
||||
mileage: [this.data.device.Mileage?this.data.device.Mileage : 10],
|
||||
ignDetection:[this.data.device.ignitionSource?this.data.device.ignitionSource : this.igndtection[0]],
|
||||
digitalInput : [this.data.device.digitalInput?this.data.device.digitalInput:this.dInput[0]],
|
||||
analogInput:[this.data.device.analogInput?this.data.device.analogInput:this.aInput[0]],
|
||||
fuelMeasurment : [flmsrmnt],
|
||||
overStoppedLimit:[this.data.device.overStoppedLimit?this.data.device.overStoppedLimit : 0],
|
||||
overIdleLimit:[this.data.device.overIdleLimit?this.data.device.overIdleLimit : 0],
|
||||
currencyVlaue : [this.currencyValue],
|
||||
|
||||
})
|
||||
|
||||
// $('select').hide();
|
||||
|
||||
|
||||
}
|
||||
option:any;
|
||||
ngOnInit() {
|
||||
|
||||
this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin;
|
||||
this.emailid = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).email;
|
||||
this.useridd = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id;
|
||||
this.mb = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn;
|
||||
this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer;
|
||||
this.getCurrencies();
|
||||
if(this.driverManagement)
|
||||
this.getDrivers()
|
||||
}
|
||||
drivers
|
||||
getDrivers(){
|
||||
this.contactService.get("/driver/getDrivers?userid="+this.useridd).subscribe(res=>{
|
||||
this.drivers=res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
dataSelect=[];
|
||||
filterStates(val) {
|
||||
console.log(val)
|
||||
// console.log(this.dummyuserData)
|
||||
|
||||
if (val) {
|
||||
const filterValue: any = val;
|
||||
console.log(this.currency);
|
||||
this.dataSelect = this.currency.filter(function (d) {
|
||||
console.log("inside Search Method=>",d);
|
||||
return d.country.toLocaleLowerCase().indexOf(filterValue.toLocaleLowerCase()) > -1;
|
||||
});
|
||||
return this.dataSelect;
|
||||
}
|
||||
// console.log("searched user=>",this.dataSelect);
|
||||
}
|
||||
|
||||
// loadropdown() {
|
||||
// let that = this;
|
||||
// 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);
|
||||
// setTimeout(() => {
|
||||
// $('select').multipleSelect({
|
||||
// single: true,
|
||||
// width: 200,
|
||||
// placeholder: 'Select Currency.....',
|
||||
// filter: true,
|
||||
|
||||
|
||||
// })
|
||||
|
||||
|
||||
// }, 100);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ngOnDestroy(){
|
||||
|
||||
this.dialogRef.close('cancelled');
|
||||
}
|
||||
currencyArr = [];
|
||||
saveDetail(){
|
||||
|
||||
if(this.dataSelect.length == 0){
|
||||
console.log("currency",(this.optiondefault).split('-')[0]);
|
||||
var currencyyy = this.optiondefault.split('-')[0];
|
||||
}else{
|
||||
console.log(this.dataSelect[0].currencyVal);
|
||||
var currencyyy = this.dataSelect[0].currencyVal ;
|
||||
}
|
||||
console.log(this.generalSetings.value);
|
||||
// this.currencyArr =$('#select').multipleSelect('getSelects','value');
|
||||
// if(this.currencyArr.length != 0){
|
||||
// var temp = this.currencyArr[0].split(':')[1];
|
||||
// this.generalSetings.value.currencyVlaue = temp.split("'")[1];
|
||||
// }
|
||||
|
||||
var devSettingObj = {
|
||||
speed: this.generalSetings.value.speed,
|
||||
Mileage: this.generalSetings.value.mileage,
|
||||
ignDetection:this.generalSetings.value.ignDetection,
|
||||
digitalInput : this.generalSetings.value.digitalInput,
|
||||
analogInput:this.generalSetings.value.analogInput,
|
||||
fuelMeasurement :this.generalSetings.value.fuelMeasurment,
|
||||
currency : currencyyy,
|
||||
device_model:this.data.device.device_model._id,
|
||||
overStoppedLimit:this.generalSetings.value.overStoppedLimit,
|
||||
overIdleLimit:this.generalSetings.value.overIdleLimit,
|
||||
_id : this.id
|
||||
}
|
||||
console.log(this.option);
|
||||
if(this.virtualAcc != undefined){
|
||||
devSettingObj['virtualacc'] = this.virtualAcc ;
|
||||
|
||||
}
|
||||
if(this.tripTypeVal != undefined){
|
||||
devSettingObj['tripType'] = this.tripTypeVal ;
|
||||
|
||||
}
|
||||
// if((this.generalSetings.value.currencyVlaue != null)||(this.generalSetings.value.currencyVlaue != undefined)){
|
||||
// devSettingObj['currency'] = this.generalSetings.value.currencyVlaue;
|
||||
// }
|
||||
if(this.generalSetings.value.total_odo !=null){
|
||||
devSettingObj['total_odo'] = this.generalSetings.value.total_odo;
|
||||
}
|
||||
if(this.selected_ac_wire){
|
||||
devSettingObj['ac_wire_setting'] = this.selected_ac_wire;
|
||||
}
|
||||
|
||||
if(this.generalSetings.value.driver_name !=null){
|
||||
devSettingObj['drname'] = this.generalSetings.value.driver_name;
|
||||
}
|
||||
|
||||
if(this.generalSetings.value.devicename !=null){
|
||||
devSettingObj['devicename'] = this.generalSetings.value.devicename;
|
||||
}
|
||||
|
||||
if(this.generalSetings.value.driver_number !=null){
|
||||
devSettingObj['dphone'] = this.generalSetings.value.driver_number;
|
||||
}
|
||||
|
||||
console.log('devSettingObj',devSettingObj);
|
||||
this.contactService.editdevice(devSettingObj).subscribe(res=>{
|
||||
|
||||
this.dialogRef.close('done');
|
||||
|
||||
},err=>{
|
||||
this.showError=true;
|
||||
this.errorMsg= "Couldn't save Information, pLease try after sometime";
|
||||
this._flashMessagesService.show(this.errorMsg, { cssClass: 'alert-danger', timeout: 3000});
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
closebox(){
|
||||
console.log('close');
|
||||
this.dialogRef.close('cancelled');
|
||||
}
|
||||
currency = [];
|
||||
optiondefault:any;
|
||||
getCurrencies(){
|
||||
this.currency = [];
|
||||
// this.contactService.getCurrencies().subscribe(res=>{
|
||||
var currencyObj = this.currencyJson;
|
||||
for(var i in currencyObj){
|
||||
if(this.data.device.currency != undefined){
|
||||
var devicecurr = this.data.device.currency ;
|
||||
if(i == devicecurr){
|
||||
this.optiondefault = i+ '-' + currencyObj[i];
|
||||
}
|
||||
|
||||
}else{
|
||||
if(i == 'INR'){
|
||||
this.optiondefault = i+ '-' + currencyObj[i];
|
||||
}
|
||||
}
|
||||
|
||||
var tempObj = {
|
||||
currencyVal : i,
|
||||
country : i+ '-' + currencyObj[i]
|
||||
}
|
||||
this.currency.push(tempObj);
|
||||
}
|
||||
|
||||
console.log(this.currency);
|
||||
|
||||
}
|
||||
|
||||
setContactNumber(){
|
||||
console.log(this.generalSetings.value.driver_name);
|
||||
for(var i=0;i<this.drivers.length;i++){
|
||||
if(this.drivers[i].name==this.generalSetings.value.driver_name){
|
||||
this.generalSetings.patchValue({
|
||||
driver_number:Number(this.drivers[i].contactNumber)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
currencyJson = {
|
||||
"AED": "United Arab Emirates Dirham",
|
||||
"AFN": "Afghan Afghani",
|
||||
"ALL": "Albanian Lek",
|
||||
"AMD": "Armenian Dram",
|
||||
"ANG": "Netherlands Antillean Guilder",
|
||||
"AOA": "Angolan Kwanza",
|
||||
"ARS": "Argentine Peso",
|
||||
"AUD": "Australian Dollar",
|
||||
"AWG": "Aruban Florin",
|
||||
"AZN": "Azerbaijani Manat",
|
||||
"BAM": "Bosnia-Herzegovina Convertible Mark",
|
||||
"BBD": "Barbadian Dollar",
|
||||
"BDT": "Bangladeshi Taka",
|
||||
"BGN": "Bulgarian Lev",
|
||||
"BHD": "Bahraini Dinar",
|
||||
"BIF": "Burundian Franc",
|
||||
"BMD": "Bermudan Dollar",
|
||||
"BND": "Brunei Dollar",
|
||||
"BOB": "Bolivian Boliviano",
|
||||
"BRL": "Brazilian Real",
|
||||
"BSD": "Bahamian Dollar",
|
||||
"BTC": "Bitcoin",
|
||||
"BTN": "Bhutanese Ngultrum",
|
||||
"BWP": "Botswanan Pula",
|
||||
"BYN": "Belarusian Ruble",
|
||||
"BZD": "Belize Dollar",
|
||||
"CAD": "Canadian Dollar",
|
||||
"CDF": "Congolese Franc",
|
||||
"CHF": "Swiss Franc",
|
||||
"CLF": "Chilean Unit of Account (UF)",
|
||||
"CLP": "Chilean Peso",
|
||||
"CNH": "Chinese Yuan (Offshore)",
|
||||
"CNY": "Chinese Yuan",
|
||||
"COP": "Colombian Peso",
|
||||
"CRC": "Costa Rican Colón",
|
||||
"CUC": "Cuban Convertible Peso",
|
||||
"CUP": "Cuban Peso",
|
||||
"CVE": "Cape Verdean Escudo",
|
||||
"CZK": "Czech Republic Koruna",
|
||||
"DJF": "Djiboutian Franc",
|
||||
"DKK": "Danish Krone",
|
||||
"DOP": "Dominican Peso",
|
||||
"DZD": "Algerian Dinar",
|
||||
"EGP": "Egyptian Pound",
|
||||
"ERN": "Eritrean Nakfa",
|
||||
"ETB": "Ethiopian Birr",
|
||||
"EUR": "Euro",
|
||||
"FJD": "Fijian Dollar",
|
||||
"FKP": "Falkland Islands Pound",
|
||||
"GBP": "British Pound Sterling",
|
||||
"GEL": "Georgian Lari",
|
||||
"GGP": "Guernsey Pound",
|
||||
"GHS": "Ghanaian Cedi",
|
||||
"GIP": "Gibraltar Pound",
|
||||
"GMD": "Gambian Dalasi",
|
||||
"GNF": "Guinean Franc",
|
||||
"GTQ": "Guatemalan Quetzal",
|
||||
"GYD": "Guyanaese Dollar",
|
||||
"HKD": "Hong Kong Dollar",
|
||||
"HNL": "Honduran Lempira",
|
||||
"HRK": "Croatian Kuna",
|
||||
"HTG": "Haitian Gourde",
|
||||
"HUF": "Hungarian Forint",
|
||||
"IDR": "Indonesian Rupiah",
|
||||
"ILS": "Israeli New Sheqel",
|
||||
"IMP": "Manx pound",
|
||||
"INR": "Indian Rupee",
|
||||
"IQD": "Iraqi Dinar",
|
||||
"IRR": "Iranian Rial",
|
||||
"ISK": "Icelandic Króna",
|
||||
"JEP": "Jersey Pound",
|
||||
"JMD": "Jamaican Dollar",
|
||||
"JOD": "Jordanian Dinar",
|
||||
"JPY": "Japanese Yen",
|
||||
"KES": "Kenyan Shilling",
|
||||
"KGS": "Kyrgystani Som",
|
||||
"KHR": "Cambodian Riel",
|
||||
"KMF": "Comorian Franc",
|
||||
"KPW": "North Korean Won",
|
||||
"KRW": "South Korean Won",
|
||||
"KWD": "Kuwaiti Dinar",
|
||||
"KYD": "Cayman Islands Dollar",
|
||||
"KZT": "Kazakhstani Tenge",
|
||||
"LAK": "Laotian Kip",
|
||||
"LBP": "Lebanese Pound",
|
||||
"LKR": "Sri Lankan Rupee",
|
||||
"LRD": "Liberian Dollar",
|
||||
"LSL": "Lesotho Loti",
|
||||
"LYD": "Libyan Dinar",
|
||||
"MAD": "Moroccan Dirham",
|
||||
"MDL": "Moldovan Leu",
|
||||
"MGA": "Malagasy Ariary",
|
||||
"MKD": "Macedonian Denar",
|
||||
"MMK": "Myanma Kyat",
|
||||
"MNT": "Mongolian Tugrik",
|
||||
"MOP": "Macanese Pataca",
|
||||
"MRO": "Mauritanian Ouguiya (pre-2018)",
|
||||
"MRU": "Mauritanian Ouguiya",
|
||||
"MUR": "Mauritian Rupee",
|
||||
"MVR": "Maldivian Rufiyaa",
|
||||
"MWK": "Malawian Kwacha",
|
||||
"MXN": "Mexican Peso",
|
||||
"MYR": "Malaysian Ringgit",
|
||||
"MZN": "Mozambican Metical",
|
||||
"NAD": "Namibian Dollar",
|
||||
"NGN": "Nigerian Naira",
|
||||
"NIO": "Nicaraguan Córdoba",
|
||||
"NOK": "Norwegian Krone",
|
||||
"NPR": "Nepalese Rupee",
|
||||
"NZD": "New Zealand Dollar",
|
||||
"OMR": "Omani Rial",
|
||||
"PAB": "Panamanian Balboa",
|
||||
"PEN": "Peruvian Nuevo Sol",
|
||||
"PGK": "Papua New Guinean Kina",
|
||||
"PHP": "Philippine Peso",
|
||||
"PKR": "Pakistani Rupee",
|
||||
"PLN": "Polish Zloty",
|
||||
"PYG": "Paraguayan Guarani",
|
||||
"QAR": "Qatari Rial",
|
||||
"RON": "Romanian Leu",
|
||||
"RSD": "Serbian Dinar",
|
||||
"RUB": "Russian Ruble",
|
||||
"RWF": "Rwandan Franc",
|
||||
"SAR": "Saudi Riyal",
|
||||
"SBD": "Solomon Islands Dollar",
|
||||
"SCR": "Seychellois Rupee",
|
||||
"SDG": "Sudanese Pound",
|
||||
"SEK": "Swedish Krona",
|
||||
"SGD": "Singapore Dollar",
|
||||
"SHP": "Saint Helena Pound",
|
||||
"SLL": "Sierra Leonean Leone",
|
||||
"SOS": "Somali Shilling",
|
||||
"SRD": "Surinamese Dollar",
|
||||
"SSP": "South Sudanese Pound",
|
||||
"STD": "São Tomé and Príncipe Dobra (pre-2018)",
|
||||
"STN": "São Tomé and Príncipe Dobra",
|
||||
"SVC": "Salvadoran Colón",
|
||||
"SYP": "Syrian Pound",
|
||||
"SZL": "Swazi Lilangeni",
|
||||
"THB": "Thai Baht",
|
||||
"TJS": "Tajikistani Somoni",
|
||||
"TMT": "Turkmenistani Manat",
|
||||
"TND": "Tunisian Dinar",
|
||||
"TOP": "Tongan Pa'anga",
|
||||
"TRY": "Turkish Lira",
|
||||
"TTD": "Trinidad and Tobago Dollar",
|
||||
"TWD": "New Taiwan Dollar",
|
||||
"TZS": "Tanzanian Shilling",
|
||||
"UAH": "Ukrainian Hryvnia",
|
||||
"UGX": "Ugandan Shilling",
|
||||
"USD": "United States Dollar",
|
||||
"UYU": "Uruguayan Peso",
|
||||
"UZS": "Uzbekistan Som",
|
||||
"VEF": "Venezuelan Bolívar Fuerte (Old)",
|
||||
"VES": "Venezuelan Bolívar Soberano",
|
||||
"VND": "Vietnamese Dong",
|
||||
"VUV": "Vanuatu Vatu",
|
||||
"WST": "Samoan Tala",
|
||||
"XAF": "CFA Franc BEAC",
|
||||
"XAG": "Silver Ounce",
|
||||
"XAU": "Gold Ounce",
|
||||
"XCD": "East Caribbean Dollar",
|
||||
"XDR": "Special Drawing Rights",
|
||||
"XOF": "CFA Franc BCEAO",
|
||||
"XPD": "Palladium Ounce",
|
||||
"XPF": "CFP Franc",
|
||||
"XPT": "Platinum Ounce",
|
||||
"YER": "Yemeni Rial",
|
||||
"ZAR": "South African Rand",
|
||||
"ZMW": "Zambian Kwacha",
|
||||
"ZWL": "Zimbabwean Dollar"
|
||||
}
|
||||
}
|
||||
659
src/app/dashboard/new-edit-device/new-edit-device.component.html
Normal file
659
src/app/dashboard/new-edit-device/new-edit-device.component.html
Normal file
|
|
@ -0,0 +1,659 @@
|
|||
<app-all-menus></app-all-menus>
|
||||
<div id="toast">
|
||||
<!-- <div id="desc">{{data_descip}}</div> -->
|
||||
</div>
|
||||
<div class="loading" *ngIf="Load">Loading…</div>
|
||||
<div class="topDiv">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>
|
||||
Update Device
|
||||
<button type="button" class="close pull-right" (click)="back()">
|
||||
<i class="fas fa-arrow-circle-left"></i>
|
||||
</button>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form [formGroup]="deviceForm" (ngSubmit)="submit()">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4">Contact No.</label> <span>*</span>
|
||||
<input
|
||||
(input)="onSearchChange($event.target.value)"
|
||||
formControlName="contactNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputPassword4"
|
||||
placeholder="Enter Contact number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.contactNo.errors }"
|
||||
/>
|
||||
<small *ngIf="message">{{ message }}</small>
|
||||
<div
|
||||
*ngIf="submitted && f.contactNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.contactNo.errors.required">
|
||||
Contact Number is required
|
||||
</div>
|
||||
<div *ngIf="f.contactNo.errors.pattern">
|
||||
Please enter valid Contact No
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Owner Name</label> <span>*</span>
|
||||
<input
|
||||
formControlName="ownerName"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputEmail4"
|
||||
placeholder="Please Enter Owner Name"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.ownerName.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.ownerName.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.ownerName.errors.required">
|
||||
Owner Name is required
|
||||
</div>
|
||||
<div *ngIf="f.ownerName.errors.pattern">
|
||||
Please enter valid name
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Email</label>
|
||||
<!-- <span>*</span> -->
|
||||
<input
|
||||
formControlName="email"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
placeholder="Please Enter Email"
|
||||
/>
|
||||
<!-- <div *ngIf="submitted && f.email.errors.email" class="invalid-feedback">
|
||||
<div *ngIf="f.email.errors.email">Please Enter valid email id</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Dealer Followup Mobile</label> <span>*</span>
|
||||
<input
|
||||
formControlName="dealerFollowup"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.dealerFollowup.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.dealerFollowup.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.dealerFollowup.errors.required">
|
||||
Dealer Followup is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Address</label> <span>*</span>
|
||||
<input
|
||||
formControlName="address"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.dealerFollowup.errors }"
|
||||
/>
|
||||
<div *ngIf="submitted && f.address.errors" class="invalid-feedback">
|
||||
<div *ngIf="f.address.errors.required">Address is required</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="pin">Pin Code</label> <span>*</span>
|
||||
<input
|
||||
formControlName="pin"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="pin"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.dealerFollowup.errors }"
|
||||
/>
|
||||
<div *ngIf="submitted && f.pin.errors" class="invalid-feedback">
|
||||
<div *ngIf="f.pin.errors.required">Pin Code is required</div>
|
||||
<div *ngIf="f.pin.errors.pattern">
|
||||
Please Enter valid Pin code
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputState">State</label>
|
||||
<select
|
||||
formControlName="state"
|
||||
(change)="onStateChange($event)"
|
||||
id="inputState"
|
||||
class="form-control"
|
||||
>
|
||||
<option value="" selected disabled>Choose state</option>
|
||||
<option *ngFor="let item of states" [value]="item">
|
||||
{{ item }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">City</label>
|
||||
<select
|
||||
formControlName="city"
|
||||
(change)="onCityChange($event)"
|
||||
id="inputState"
|
||||
class="form-control"
|
||||
>
|
||||
<option value="" selected disabled>Choose City</option>
|
||||
<option *ngFor="let item of cityList" [value]="item.city">
|
||||
{{ item.city }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="city" type="text" class="form-control" id="inputCity"> -->
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">RTO Office</label>
|
||||
<select
|
||||
formControlName="rtoOffice"
|
||||
id="inputState"
|
||||
class="form-control"
|
||||
>
|
||||
<option value="" selected disabled>Choose RTO</option>
|
||||
<option *ngFor="let item of RTO" [value]="item.RTO_Name">
|
||||
{{ item.RTO_Name }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="rtoOffice" type="text" class="form-control" id="inputZip"> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Device ID (IMEI)</label><span>*</span>
|
||||
<input
|
||||
formControlName="device_id"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputCity"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.email.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.device_id.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.device_id.errors.required">
|
||||
Device Id is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div *ngIf="inventoryManagement" class="form-group col-md-4">
|
||||
|
||||
<label for="inputCity">Device ID (IMEI)</label><span>*</span>
|
||||
<div>
|
||||
<select formControlName="device_id" class="form-control">
|
||||
<option *ngFor="let option_1 of inventory" [value]="option_1.IMEI">{{ option_1.IMEI }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div *ngIf="submitted && f.device_id.errors" class="invalid-feedback">
|
||||
<div *ngIf="f.device_id.errors.required">Device Id is required</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4">Vehicle No.</label><span>*</span>
|
||||
<input
|
||||
formControlName="vehicleNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputPassword4"
|
||||
placeholder="Enter Vehicle number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.vehicleNo.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.vehicleNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.vehicleNo.errors.required">
|
||||
Vehicle number is required
|
||||
</div>
|
||||
<div *ngIf="f.vehicleNo.errors.maxLength">
|
||||
Vehicle number accepts max 10 digits
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Vehicle Type</label><span>*</span>
|
||||
<div>
|
||||
<select formControlName="vehicleType" class="form-control">
|
||||
<option *ngFor="let option_1 of vehData" [value]="option_1._id">
|
||||
{{ option_1.vehicle_name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="iccid">ICCID</label>
|
||||
<input
|
||||
formControlName="iccid"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="iccid"
|
||||
placeholder="Enter ICCID No number"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="sim1">SIM 1</label> <span>*</span>
|
||||
<input
|
||||
formControlName="sim1"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="sim1"
|
||||
placeholder="Enter SIM number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.sim1.errors }"
|
||||
/>
|
||||
<div *ngIf="submitted && f.sim1.errors" class="invalid-feedback">
|
||||
<div *ngIf="f.sim1.errors.required">SIM 1 is required</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">SIM 2</label>
|
||||
<div>
|
||||
<input
|
||||
formControlName="sim2"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="sim1"
|
||||
placeholder="Enter SIM number"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Chassis No.</label><span>*</span>
|
||||
<input
|
||||
formControlName="chasisNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputEmail4"
|
||||
placeholder="Enter Chasis No."
|
||||
[ngClass]="{ 'is-invalid': submitted && f.chasisNo.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.chasisNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.chasisNo.errors.required">
|
||||
Chassis No is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4">Engine No.</label><span>*</span>
|
||||
<input
|
||||
formControlName="engineNo"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputPassword4"
|
||||
placeholder="Enter Engine number"
|
||||
[ngClass]="{ 'is-invalid': submitted && f.engineNo.errors }"
|
||||
/>
|
||||
<div
|
||||
*ngIf="submitted && f.engineNo.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.engineNo.errors.required">
|
||||
Engine No is required
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4">Panic Button Quality.</label>
|
||||
<select formControlName="panic" class="form-control">
|
||||
<option value="" selected disabled>Select Panic Button</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
<option value="9">9</option>
|
||||
<option value="10">10</option>
|
||||
</select>
|
||||
<!-- <input formControlName="panic" type="text" class="form-control" id="inputEmail4"
|
||||
placeholder="Enter Panic Button Quality."> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Vehicle Manufacture</label>
|
||||
<select
|
||||
class="form-control"
|
||||
formControlName="vehicleManufacture"
|
||||
(change)="selectModel($event)"
|
||||
>
|
||||
<option value="" selected disabled>Choose Manufacturer</option>
|
||||
<option *ngFor="let item of manufacturingData" [value]="item">
|
||||
{{ item }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="vehicleManufacture" type="text" class="form-control" id="inputCity"> -->
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">Model</label>
|
||||
<select class="form-control" formControlName="model">
|
||||
<option value="" selected disabled>Choose Model</option>
|
||||
<option *ngFor="let item of modelData" [value]="item.ModelName">
|
||||
{{ item.ModelName }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <input formControlName="vehicleCategory" type="text" class="form-control" id="inputZip"> -->
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<lable>{{ "Vehicle Category" | translate }} :</lable>
|
||||
<select formControlName="vehicleCategory" class="form-control">
|
||||
<option *ngFor="let license of vehicleCat" [value]="license">
|
||||
{{ license }}
|
||||
</option>
|
||||
</select>
|
||||
<!-- <label for="inputZip">Type Of Vehicle</label>
|
||||
<input
|
||||
formControlName="vehicleCategory"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputZip"
|
||||
/> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputState">Device Model</label><span>*</span>
|
||||
<div>
|
||||
<select formControlName="deviceModel" class="form-control">
|
||||
<option
|
||||
*ngFor="let option_1 of device_Model"
|
||||
[value]="option_1._id"
|
||||
>
|
||||
{{ option_1.modelName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">Tracking Expiry</label>
|
||||
<input
|
||||
formControlName="trackingExp"
|
||||
bsDatepicker
|
||||
[bsConfig]="bsConfig"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputZip"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">E sim Expiry</label>
|
||||
<input
|
||||
formControlName="eSimExpiry"
|
||||
bsDatepicker
|
||||
[bsConfig]="bsConfig"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputZip"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"></div>
|
||||
</form>
|
||||
<div *ngIf="deviceData.remark">
|
||||
<h6><b>Remark : </b>{{ deviceData.remark }}</h6>
|
||||
</div>
|
||||
<hr />
|
||||
<div
|
||||
style="overflow: auto; overflow-x: hidden; min-height: 200px"
|
||||
[ngClass]="{ rowHeight: docRow }"
|
||||
>
|
||||
<div class="row" *ngFor="let data of imageuploadObject; let i = index">
|
||||
<div class="col-sm-6" style="padding-top: 8px">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<span>{{ data.doctype }} : </span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="data.phone"
|
||||
placeholder="{{ 'Doc number' | translate }}"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<img
|
||||
*ngIf="data.image"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + data.image.substring(6)"
|
||||
(click)="openModal(template, data)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<span
|
||||
><input
|
||||
type="file"
|
||||
class="btn btn btn-success"
|
||||
style="background: #f1f1f1; border: none; color: black"
|
||||
(change)="onFileChanged($event, i)"
|
||||
/></span>
|
||||
<!-- <span>
|
||||
<button class="btn btn btn-success" (click)="onUpload(i)">
|
||||
{{ uploadStatus }}
|
||||
</button></span
|
||||
> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="accordion" id="accordionExample">
|
||||
<div
|
||||
class="card"
|
||||
style="margin-left: 61px; margin-top: 23px; margin-right: 151px"
|
||||
>
|
||||
<div class="card-header" id="headingOne">
|
||||
<h2 class="mb-0">
|
||||
<button
|
||||
class="btn btn-link"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#collapseOne"
|
||||
aria-expanded="true"
|
||||
aria-controls="collapseOne"
|
||||
>
|
||||
Upload Device Image
|
||||
</button>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="collapseOne"
|
||||
class="collapse collapse"
|
||||
aria-labelledby="headingOne"
|
||||
data-parent="#accordionExample"
|
||||
>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<span>Device Image 1: </span>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<img
|
||||
*ngIf="deviceImg[0]"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + deviceImg[0].substring(6)"
|
||||
(click)="openModal(template, deviceImg[0])"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<input
|
||||
style="
|
||||
background: #ececec;
|
||||
width: 80%;
|
||||
margin-left: 5px;
|
||||
border: 1px solid #c1c1c1;
|
||||
"
|
||||
type="file"
|
||||
(change)="onDeviceImageChanged($event, 0)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-4">
|
||||
<i
|
||||
class="fas fa-cloud-upload-alt"
|
||||
style="
|
||||
color: #4c6ef5;
|
||||
float: left;
|
||||
font-size: 23px;
|
||||
line-height: 2.1rem;
|
||||
cursor: pointer;
|
||||
"
|
||||
title="Upload Image"
|
||||
(click)="onDeviceImageUploadUpload(0)"
|
||||
></i>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<span>Device Image 2: </span>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<img
|
||||
*ngIf="deviceImg[1]"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + deviceImg[1].substring(6)"
|
||||
(click)="openModal(template, deviceImg[1])"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input
|
||||
style="
|
||||
background: #ececec;
|
||||
width: 80%;
|
||||
margin-left: 5px;
|
||||
border: 1px solid #c1c1c1;
|
||||
"
|
||||
type="file"
|
||||
(change)="onDeviceImageChanged($event, 1)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-4">
|
||||
<i
|
||||
class="fas fa-cloud-upload-alt"
|
||||
style="
|
||||
color: #4c6ef5;
|
||||
float: left;
|
||||
font-size: 23px;
|
||||
line-height: 2.1rem;
|
||||
cursor: pointer;
|
||||
"
|
||||
title="Upload Image"
|
||||
(click)="onDeviceImageUploadUpload(1)"
|
||||
></i>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<span>Device Image 3: </span>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<img
|
||||
*ngIf="deviceImg[2]"
|
||||
style="width: 50px"
|
||||
[src]="'https://www.oneqlik.in' + deviceImg[2].substring(6)"
|
||||
(click)="openModal(template, deviceImg[2])"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input
|
||||
style="
|
||||
background: #ececec;
|
||||
width: 80%;
|
||||
margin-left: 5px;
|
||||
border: 1px solid #c1c1c1;
|
||||
"
|
||||
type="file"
|
||||
(change)="onDeviceImageChanged($event, 2)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-4">
|
||||
<i
|
||||
class="fas fa-cloud-upload-alt"
|
||||
style="
|
||||
color: #4c6ef5;
|
||||
float: left;
|
||||
font-size: 23px;
|
||||
line-height: 2.1rem;
|
||||
cursor: pointer;
|
||||
"
|
||||
title="Upload Image"
|
||||
(click)="onDeviceImageUploadUpload(2)"
|
||||
></i>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer text-center">
|
||||
<button type="submit" class="btn btn-primary" (click)="submit()">
|
||||
Update Device
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-template #template>
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title pull-left">{{ docName }}</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-12">
|
||||
<img style="width: -webkit-fill-available" src="{{ image }}" />
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
.topDiv {
|
||||
padding-top: 59px;
|
||||
background: whitesmoke;
|
||||
height: 100vh;
|
||||
padding-left: 4px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NewEditDeviceComponent } from './new-edit-device.component';
|
||||
|
||||
describe('NewEditDeviceComponent', () => {
|
||||
let component: NewEditDeviceComponent;
|
||||
let fixture: ComponentFixture<NewEditDeviceComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NewEditDeviceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NewEditDeviceComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
937
src/app/dashboard/new-edit-device/new-edit-device.component.ts
Normal file
937
src/app/dashboard/new-edit-device/new-edit-device.component.ts
Normal file
|
|
@ -0,0 +1,937 @@
|
|||
import { Component, OnInit, TemplateRef } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { BsDatepickerConfig, BsModalRef, BsModalService } from 'ngx-bootstrap';
|
||||
import { ContactService } from '../../contact.service';
|
||||
import {Location} from '@angular/common';
|
||||
declare var $:any;
|
||||
declare var swal: any;
|
||||
@Component({
|
||||
selector: 'app-new-edit-device',
|
||||
templateUrl: './new-edit-device.component.html',
|
||||
styleUrls: ['./new-edit-device.component.scss']
|
||||
})
|
||||
export class NewEditDeviceComponent implements OnInit {
|
||||
DeviceModelValue: any;
|
||||
deviceImg=["","",""];
|
||||
modalRef: BsModalRef;
|
||||
submitted = false;
|
||||
date=new Date()
|
||||
expDate:any = new Date(this.date.getFullYear() + 1, this.date.getMonth(), this.date.getDate()).toLocaleString();
|
||||
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"]
|
||||
vehicleCat=[
|
||||
"Luxury Cab",
|
||||
"Three wheeled vehicles for transport of passengers/goods",
|
||||
"Goods carrier trucks or tankers or mail carriers",
|
||||
"Power tiller and Tractors using public roads",
|
||||
"Mobile clinic or X-Ray van or library vans",
|
||||
"Mobile Workshops",
|
||||
"Mobile canteens",
|
||||
"Private Service Vehicle",
|
||||
"maxi cab",
|
||||
"motor cab",
|
||||
"stage cariage",
|
||||
"contract carriage",
|
||||
"Tourist",
|
||||
"Educational Institution buses",
|
||||
"Ambulances",
|
||||
"Animal Ambulances",
|
||||
"Camper vans or trailers",
|
||||
"Cash vans",
|
||||
"Fire tenders, snorked ladders,auxiliary trailers and fire fighting vehicles",
|
||||
"Articulated vehicles",
|
||||
"Hearses",
|
||||
"Motor car",
|
||||
"Crane mounted vehicle",
|
||||
"Agricultural Tractor and Power Tiller",
|
||||
"Tow Trucks, Breakdown Van and Recovery Vehicles",
|
||||
"Construction Equipment Vehicles",]
|
||||
custtype: any;
|
||||
DealerId: any;
|
||||
constructor(private modalService: BsModalService,private location:Location,private fb:FormBuilder,private contactService:ContactService,private router:Router,private _flashMessagesService: FlashMessagesService,) { }
|
||||
deviceForm:FormGroup;
|
||||
userId
|
||||
deviceData
|
||||
deviceModel
|
||||
Load:boolean=false;
|
||||
bsConfig: Partial<BsDatepickerConfig>;
|
||||
dataDevModel: any[];
|
||||
vehicle_Type: any[];
|
||||
|
||||
imageuploadObject = [{doctype:'Adhar card1 *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'Adhar card2 *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'Warrenty Card *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'vehicle sales invoice *',image:'',phone:'',docdate:new Date(),fill:false},
|
||||
{doctype:'vehicle RC',image:'',phone:'',docdate:new Date(),fill:true},
|
||||
{doctype:'vehicle Photo',image:'',phone:'',docdate:new Date(),fill:true},
|
||||
];
|
||||
dealerId
|
||||
sup_admin
|
||||
hrdwr
|
||||
hrdwr2
|
||||
custId
|
||||
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"
|
||||
}
|
||||
|
||||
];
|
||||
ngOnInit() {
|
||||
|
||||
this.deviceData=JSON.parse(localStorage.getItem('deviceData'));
|
||||
if(localStorage.getItem('deviceData')){
|
||||
|
||||
console.log(this.deviceData);
|
||||
var data={target:{value:this.deviceData.transportOfficeState?this.deviceData.transportOfficeState:''}}
|
||||
var data1={target:{value:this.deviceData.transportOfficeCity?this.deviceData.transportOfficeCity:''}}
|
||||
var data3={target:{value:this.deviceData.manufacturingCompany?this.deviceData.manufacturingCompany:''}}
|
||||
this.selectModel(data3)
|
||||
this.onCityChange(data1)
|
||||
this.onStateChange(data);
|
||||
this.imageuploadObject=this.deviceData.imageDoc
|
||||
this.deviceImg=this.deviceData.deviceImage?this.deviceData.deviceImage:["","",""]
|
||||
this.bsConfig = Object.assign({ dateInputFormat: 'DD-MM-YYYY' }, { containerClass: 'theme-dark-blue' });
|
||||
this.userId = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id;
|
||||
this.dealerId=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).Dealer_ID;
|
||||
this.sup_admin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).supAdmin;
|
||||
this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer;
|
||||
this.custId = localStorage.getItem('custId');
|
||||
if((this.custtype == false)&&(window.localStorage['Custumer'] == 'ON')){
|
||||
|
||||
this.DealerId = JSON.parse(window.atob(window.localStorage.Dealer_token.split(".")[1]))._id;
|
||||
|
||||
}
|
||||
|
||||
var fname=this.deviceData.user?this.deviceData.user.first_name?this.deviceData.user.first_name:'':"";
|
||||
var lname=this.deviceData.user?this.deviceData.user.last_name?this.deviceData.user.last_name:'':""
|
||||
this.deviceForm=this.fb.group({
|
||||
ownerName:[fname+' '+lname,[Validators.required,Validators.pattern("[a-zA-Z][a-zA-Z ]+")]],
|
||||
contactNo:[this.deviceData.user?this.deviceData.user.phone?this.deviceData.user.phone:'':'',[Validators.required,Validators.pattern('[0-9 ]{10}')]],
|
||||
device_id:[this.deviceData.Device_ID?this.deviceData.Device_ID:""],
|
||||
address:[this.deviceData.user?this.deviceData.user.address?this.deviceData.user.address:'':'',Validators.required],
|
||||
state:[this.deviceData.transportOfficeState?this.deviceData.transportOfficeState:''],
|
||||
rtoOffice:[this.deviceData.rto?this.deviceData.rto:''],
|
||||
vehicleManufacture:[this.deviceData.manufacturingCompany?this.deviceData.manufacturingCompany:''],
|
||||
vehicleModel:[this.deviceData.Model?this.deviceData.Model:''],
|
||||
vehicleCategory:[this.deviceData.vehicleCategory?this.deviceData.vehicleCategory:''],
|
||||
vehicleType:[this.deviceData.vehicleType?this.deviceData.vehicleType._id:''],
|
||||
vehicleNo:[this.deviceData.Device_Name?this.deviceData.Device_Name:'',[Validators.required,Validators.maxLength(10)]],
|
||||
chasisNo:[this.deviceData.ChassisNo?this.deviceData.ChassisNo:'',Validators.required],
|
||||
engineNo:[this.deviceData.engineNo?this.deviceData.engineNo:'',Validators.required],
|
||||
panic:[this.deviceData.numberOfSOS?this.deviceData.numberOfSOS:''],
|
||||
bsnlPlan:[''],
|
||||
hostingPlan:[''],
|
||||
SMSPlan:[''],
|
||||
city:[this.deviceData.transportOfficeCity?this.deviceData.transportOfficeCity:''],
|
||||
deviceModel:[this.deviceData.device_model?this.deviceData.device_model._id:''],
|
||||
trackingExp:new Date(this.expDate),
|
||||
eSimExpiry:[this.deviceData.esim_validity?new Date(this.deviceData.esim_validity):''],
|
||||
model:[this.deviceData.Model?this.deviceData.Model:''],
|
||||
email:[this.deviceData.user?this.deviceData.user.email?this.deviceData.user.email:'':''],
|
||||
dealerFollowup:[this.deviceData.CID_No?this.deviceData.CID_No:'',Validators.required],
|
||||
sim1:[this.deviceData.sim_number?this.deviceData.sim_number:'',Validators.required],
|
||||
sim2:[this.deviceData.sim_number2?this.deviceData.sim_number2:''],
|
||||
iccid:[this.deviceData.IccidNo?this.deviceData.IccidNo:''],
|
||||
pin:[this.deviceData.user?this.deviceData.user.pin?this.deviceData.user.pin:'':'',[Validators.required,Validators.pattern('[0-9 ]{6}')]]
|
||||
|
||||
|
||||
})
|
||||
console.log("DEVICEFORM=>",this.deviceForm);
|
||||
}else{
|
||||
this.location.back()
|
||||
}
|
||||
|
||||
this.loadropdown()
|
||||
this.getDeviceModel();
|
||||
this.getvehDetail()
|
||||
this.getUserSetting(this.userId);
|
||||
this.getModelData()
|
||||
this. getAllState()
|
||||
var that=this
|
||||
$(document).on('change','#inventory',function() {
|
||||
var value = $('#inventory').val();
|
||||
for(var i=0;i<that.inventory.length;i++){
|
||||
if(value==that.inventory[i].IMEI){
|
||||
var date=new Date()
|
||||
var exp
|
||||
if(that.inventory[i].eSIMValidaity=="One Year"){
|
||||
exp= new Date(date.getFullYear() + 1, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}else if(that.inventory[i].eSIMValidaity=="Two Year"){
|
||||
exp= new Date(date.getFullYear() + 2, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}else{
|
||||
exp= new Date(date.getFullYear() + 1, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}
|
||||
that.deviceForm.patchValue({
|
||||
iccid:that.inventory[i].IccidNo,
|
||||
sim1:that.inventory[i].Mob1,
|
||||
sim2:that.inventory[i].Mob2,
|
||||
eSimExpiry:new Date(exp),
|
||||
device_id:value
|
||||
})
|
||||
|
||||
that.hrdwr=that.inventory[i].Mob1
|
||||
that.hrdwr2=that.inventory[i].Mob2
|
||||
}
|
||||
}
|
||||
var value=this.deviceData.Device_ID
|
||||
for(var i=0;i<that.inventory.length;i++){
|
||||
if(value==that.inventory[i].IMEI){
|
||||
var date=new Date()
|
||||
var exp
|
||||
if(that.inventory[i].eSIMValidaity=="One Year"){
|
||||
exp= new Date(date.getFullYear() + 1, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}else if(that.inventory[i].eSIMValidaity=="Two Year"){
|
||||
exp= new Date(date.getFullYear() + 2, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}else{
|
||||
exp= new Date(date.getFullYear() + 1, date.getMonth(), date.getDate()).toLocaleString();
|
||||
}
|
||||
that.deviceForm.patchValue({
|
||||
iccid:that.inventory[i].IccidNo,
|
||||
sim1:that.inventory[i].Mob1,
|
||||
sim2:that.inventory[i].Mob2,
|
||||
eSimExpiry:new Date(exp),
|
||||
device_id:value
|
||||
})
|
||||
|
||||
that.hrdwr=that.inventory[i].Mob1
|
||||
that.hrdwr2=that.inventory[i].Mob2
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
get f() { return this.deviceForm.controls; }
|
||||
states=[]
|
||||
getAllState(){
|
||||
this.contactService.get('/RTO_master/getAllState').subscribe((res:any)=>{
|
||||
for(var i=0;i<res.length;i++){
|
||||
this.states.push(res[i]._id.state)
|
||||
}
|
||||
// this.states=res;
|
||||
})
|
||||
}
|
||||
|
||||
submit(){
|
||||
this.submitted = true;
|
||||
|
||||
// stop here if form is invalid
|
||||
if (this.deviceForm.invalid) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(var i=0;i<this.imageuploadObject.length;i++){
|
||||
if(!this.imageuploadObject[i].fill){
|
||||
swal(
|
||||
'Upload Error',
|
||||
'Please upload required documnets !!!',
|
||||
'error'
|
||||
)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.userFound){
|
||||
this.addDevice(this.user)
|
||||
|
||||
}else{
|
||||
|
||||
var expDate = new Date();
|
||||
expDate.setFullYear(expDate.getFullYear()+1);
|
||||
|
||||
var name=this.deviceForm.value.ownerName.split(' ')
|
||||
|
||||
var data={
|
||||
// Dealer:this.reactiveForm.value.manager,
|
||||
contactid:this.deviceData.user._id,
|
||||
custumer: true,
|
||||
expdate:new Date(expDate).toISOString(),
|
||||
first_name:name[0]?name[0]:'',
|
||||
last_name:name[1]?name[1]:'',
|
||||
isDealer: false,
|
||||
phone:this.deviceForm.value.contactNo,
|
||||
user_id:"",
|
||||
org_name: null,
|
||||
password:this.generatePassword(6),
|
||||
supAdmin:this.sup_admin,
|
||||
Dealer:this.userId,
|
||||
timezone: "Asia/Kolkata",
|
||||
std_code: {countryCode: "in", dialcode: "91"},
|
||||
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.pin){
|
||||
data['pin']=this.deviceForm.value.pin
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.email){
|
||||
data['email']=this.deviceForm.value.email
|
||||
}
|
||||
if(this.deviceForm.value.address){
|
||||
data['address']=this.deviceForm.value.address
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
|
||||
this.contactService.post('/users/editUserDetails',data).subscribe((res:any)=>{
|
||||
console.log(res);
|
||||
|
||||
if(res.message=="Saved"){
|
||||
|
||||
|
||||
this.addDevice(res._id)
|
||||
// this.router.navigateByUrl('/dashboard');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
addDevice(data){
|
||||
var model= $('#dbselect').multipleSelect('getSelects','value');
|
||||
var type= $('#vehicleType').multipleSelect('getSelects','value');
|
||||
var deviceid
|
||||
if(this.inventoryManagement){
|
||||
deviceid=$('#inventory').multipleSelect('getSelects','value');
|
||||
}else{
|
||||
deviceid=this.deviceForm.value.device_id
|
||||
}
|
||||
var newDevice = {
|
||||
_id:this.deviceData._id,
|
||||
devicename: this.deviceForm.value.vehicleNo,
|
||||
deviceid: this.deviceForm.value.device_id,
|
||||
// des: this.des,
|
||||
model: model[0],
|
||||
|
||||
typdev: "Tracker",
|
||||
Mileage : "10",
|
||||
phn: this.deviceForm.value.contactNo,
|
||||
sim_number: this.deviceForm.value.contactNo,
|
||||
created_by: this.userId,
|
||||
supAdmin: this.sup_admin,
|
||||
// driver_name: this.driver,
|
||||
// contact_number: this.dcontact,
|
||||
device_model: this.deviceForm.value.deviceModel,
|
||||
expdate: new Date(this.expDate),
|
||||
user:this.deviceData.user._id,
|
||||
kycStatus:'Pending',
|
||||
bussinessType:1
|
||||
}
|
||||
if (this.custtype) {
|
||||
newDevice['Dealer'] = this.userId;
|
||||
} else if((this.custtype == false)&&(window.localStorage['Custumer'] == 'ON') ) {
|
||||
newDevice['Dealer'] = this.DealerId
|
||||
}
|
||||
|
||||
|
||||
// hrdwr: this.deviceForm.value.sim1,
|
||||
// hrdwr1: this.deviceForm.value.sim1,
|
||||
if(this.deviceForm.value.sim1){
|
||||
newDevice['hrdwr'] = this.deviceForm.value.sim1
|
||||
}
|
||||
if(this.deviceForm.value.sim2){
|
||||
newDevice['hrdwr1'] = this.deviceForm.value.sim2
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.sim1){
|
||||
newDevice['manufacturingCompany'] = this.deviceForm.value.sim1
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.model){
|
||||
newDevice['model'] = this.deviceForm.value.model
|
||||
}
|
||||
|
||||
|
||||
if(this.deviceForm.value.dealerFollowup){
|
||||
newDevice['CID_No'] = this.deviceForm.value.dealerFollowup;
|
||||
}
|
||||
if(this.hrdwr){
|
||||
newDevice['hrdwr']=this.hrdwr
|
||||
}
|
||||
if(this.deviceForm.value.engineNo){
|
||||
newDevice['engineNo'] = this.deviceForm.value.engineNo;
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.city){
|
||||
newDevice['transportOfficeCity'] = this.deviceForm.value.city;
|
||||
}
|
||||
if(this.deviceForm.value.state){
|
||||
newDevice['transportOfficeState'] = this.deviceForm.value.state;
|
||||
}
|
||||
|
||||
|
||||
if(this.deviceForm.value.chasisNo){
|
||||
newDevice['ChassisNo'] = this.deviceForm.value.chasisNo
|
||||
}
|
||||
if(this.deviceForm.value.vehicleManufacture){
|
||||
newDevice['manufacturingCompany'] = this.deviceForm.value.vehicleManufacture;
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.eSimExpiry){
|
||||
newDevice['esim_validity'] = this.deviceForm.value.eSimExpiry;
|
||||
}
|
||||
if(this.deviceForm.value.vehicleCategory){
|
||||
newDevice['vehicleCategory'] = this.deviceForm.value.vehicleCategory;
|
||||
}
|
||||
if(this.deviceForm.value.rtoOffice){
|
||||
newDevice['rto'] = this.deviceForm.value.rtoOffice;
|
||||
}
|
||||
|
||||
if(type){
|
||||
newDevice['typeOfVehicle'] = type[0];
|
||||
}
|
||||
if(this.deviceForm.value.vehicleType){
|
||||
newDevice['vehicleType'] = this.deviceForm.value.vehicleType
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.state){
|
||||
newDevice['transportOfficeState'] = this.deviceForm.value.state;
|
||||
}
|
||||
|
||||
if(this.deviceForm.value.panic){
|
||||
newDevice['numberOfSOS'] = this.deviceForm.value.panic;
|
||||
}
|
||||
|
||||
if(this.deviceImg != undefined){
|
||||
newDevice['deviceImage'] = this.deviceImg;
|
||||
}
|
||||
console.log("imageuploadDocument",this.imageuploadObject);
|
||||
if((this.imageuploadObject.length !=0)){
|
||||
newDevice['imageDoc'] = this.imageuploadObject ;
|
||||
}
|
||||
console.log("=======>",newDevice)
|
||||
// this.Load = false;
|
||||
this.contactService.editdevice(newDevice)
|
||||
.subscribe((device) => {
|
||||
window.localStorage['DataUpdate'] = 'True';
|
||||
|
||||
this.router.navigateByUrl("dashboard");
|
||||
}
|
||||
// this.Load = false
|
||||
)
|
||||
, (err: any) => {
|
||||
// console.log(err.status);
|
||||
// console.log(err);
|
||||
var that = this;
|
||||
if (err.status == 400) {
|
||||
console.log(JSON.parse(err._body).deviceObj);
|
||||
var dupObj = JSON.parse(err._body).deviceObj ;
|
||||
// this.Load = false;
|
||||
var devicesupAdmin = dupObj.supAdmin;
|
||||
var deviceDealer = dupObj.Dealer;
|
||||
var devOwner = dupObj.user;
|
||||
debugger;
|
||||
|
||||
}
|
||||
else {
|
||||
var message
|
||||
if(err.status==401){
|
||||
message="Access Denied !!!"
|
||||
|
||||
}else{
|
||||
message="Network Error !!!"
|
||||
}
|
||||
console.log(err);
|
||||
|
||||
this._flashMessagesService.show(message, { cssClass: 'alert-danger', timeout: 2000 });
|
||||
// this.Load = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
generatePassword(passwordLength) {
|
||||
var numberChars = "0123456789";
|
||||
var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var lowerChars = "abcdefghijklmnopqrstuvwxyz";
|
||||
var allChars = numberChars + upperChars + lowerChars;
|
||||
var randPasswordArray = Array(passwordLength);
|
||||
randPasswordArray[0] = numberChars;
|
||||
randPasswordArray[1] = upperChars;
|
||||
randPasswordArray[2] = lowerChars;
|
||||
randPasswordArray = randPasswordArray.fill(allChars, 3);
|
||||
return this.shuffleArray(randPasswordArray.map(function(x) { return x[Math.floor(Math.random() * x.length)] })).join('');
|
||||
}
|
||||
|
||||
shuffleArray(array) {
|
||||
for (var i = array.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
var temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
message
|
||||
user
|
||||
userFound:boolean=false;
|
||||
onSearchChange(value){
|
||||
this.userFound=false
|
||||
this.message=undefined
|
||||
console.log(value);
|
||||
var phone=this.deviceForm.value.contactNo
|
||||
if(phone.length==10){
|
||||
console.log("KLDJNDKjk");
|
||||
this.contactService.get('/users/searchUserByPhone?user='+this.userId+'&phone='+phone).subscribe((res:any)=>{
|
||||
console.log(res);
|
||||
if(res.message=="User already Present"){
|
||||
this.deviceForm.patchValue({
|
||||
ownerName:res.data[0].first_name?res.data[0].first_name:""+" "+res.data[0].last_name?res.data[0].first_name:'',
|
||||
email:res.data[0].email?res.data[0].email:""
|
||||
})
|
||||
this.user=res.data[0]
|
||||
this.userFound=true;
|
||||
this.deviceForm.controls.ownerName.disable();
|
||||
this.deviceForm.controls.email.disable();
|
||||
}else{
|
||||
this.userFound=false
|
||||
this.message=res.message
|
||||
}
|
||||
},err=>{
|
||||
console.log(err);
|
||||
this.message=err.error.message
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
device_Model: any;
|
||||
getDeviceModel() {
|
||||
this.contactService.getDevModel()
|
||||
.subscribe(res => {
|
||||
this.device_Model = res;
|
||||
var devname = [];
|
||||
console.log("Device_Model",this.device_Model);
|
||||
for(var i = 0 ; i<this.device_Model.length;i++){
|
||||
var a = {
|
||||
model :this.device_Model[i].device_type,
|
||||
id : this.device_Model[i]._id
|
||||
}
|
||||
var modelName;
|
||||
|
||||
if(this.device_Model[i].deviceport != undefined){
|
||||
modelName = this.device_Model[i].device_type + " " + "(Port : " + this.device_Model[i].deviceport + ")";
|
||||
|
||||
}else{
|
||||
modelName = this.device_Model[i].device_type;
|
||||
}
|
||||
this.device_Model[i].modelName = modelName ;
|
||||
devname.push(a);
|
||||
}
|
||||
console.log('this.device_Model',this.device_Model);
|
||||
console.log(devname);
|
||||
this.loadropdown()
|
||||
})
|
||||
}
|
||||
|
||||
loadropdown() {
|
||||
let that = this;
|
||||
|
||||
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);
|
||||
// ||(this.componentIdentifier === 'notification_master')
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
$('#dbselect').multipleSelect({
|
||||
width: 470,
|
||||
placeholder:"Select model",
|
||||
filter: true,
|
||||
single: true,
|
||||
selectAll: false
|
||||
|
||||
})
|
||||
$('#vehicleType').multipleSelect({
|
||||
width: 470,
|
||||
placeholder: "Select Type",
|
||||
filter: true,
|
||||
single: true,
|
||||
selectAll: false
|
||||
})
|
||||
$('#inventory').multipleSelect({
|
||||
width: 470,
|
||||
placeholder: 'Select IMEI',
|
||||
filter: true,
|
||||
single: true,
|
||||
selectAll: false
|
||||
|
||||
})
|
||||
|
||||
}, 100);
|
||||
|
||||
|
||||
}
|
||||
|
||||
vehData:any;
|
||||
getvehDetail(){
|
||||
this.contactService.getvehType(this.userId)
|
||||
.subscribe(res=>{
|
||||
// console.log(res);
|
||||
this.vehData=res;
|
||||
var vdata = res;
|
||||
for(var a = 0;a<this.vehData.length;a++){
|
||||
var vehtypename = vdata[a].brand + " " + vdata[a].model;
|
||||
this.vehData[a].vehicle_name = vehtypename;
|
||||
}
|
||||
console.log("allveh",this.vehData);
|
||||
this.loadropdown()
|
||||
})
|
||||
}
|
||||
docRow:boolean=false;
|
||||
// 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);
|
||||
// }
|
||||
showUpload:boolean=true;
|
||||
DeleteDocumentsField(index){
|
||||
console.log(this.imageuploadObject.length);
|
||||
if(this.imageuploadObject.length == 1){
|
||||
this.docRow = false;
|
||||
this.showUpload = false;
|
||||
}
|
||||
this.imageuploadObject.splice(index, 1);
|
||||
|
||||
}
|
||||
|
||||
selectedFile: File;
|
||||
onFileChanged(event,imgIndex) {
|
||||
this.selectedFile = <File>event.target.files[0];
|
||||
console.log(this.selectedFile);
|
||||
|
||||
this.Load=true;
|
||||
console.log(imgIndex);
|
||||
this.imageuploadObject[imgIndex].fill=true;
|
||||
console.log(this.imageuploadObject);
|
||||
const fd = new FormData();
|
||||
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']);
|
||||
this.imageuploadObject[imgIndex].image = resImage;
|
||||
console.log(this.imageuploadObject);
|
||||
this.selectedFile=undefined;
|
||||
// console.log(res);
|
||||
},err=>{
|
||||
this.Load= false;
|
||||
this._flashMessagesService.show('Internal server error , try again', { cssClass: 'alert-success', timeout: 2000 });
|
||||
this.selectedFile=undefined;
|
||||
})
|
||||
}
|
||||
ifuploadArr: boolean ;
|
||||
uploadStatus: any = 'Upload';
|
||||
onUpload(imgIndex) {
|
||||
this.Load=true;
|
||||
console.log(imgIndex);
|
||||
this.imageuploadObject[imgIndex].fill=true;
|
||||
console.log(this.imageuploadObject);
|
||||
const fd = new FormData();
|
||||
// console.log("selected file name =>",this.selectedFile.name);
|
||||
if(!this.selectedFile){
|
||||
swal(
|
||||
'Upload Error',
|
||||
'Please select document type before upload !!!',
|
||||
'error'
|
||||
)
|
||||
this.Load=false;
|
||||
}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']);
|
||||
this.imageuploadObject[imgIndex].image = resImage;
|
||||
console.log(this.imageuploadObject);
|
||||
this.selectedFile=undefined;
|
||||
// console.log(res);
|
||||
},err=>{
|
||||
this.Load= false;
|
||||
this._flashMessagesService.show('Internal server error , try again', { cssClass: 'alert-success', timeout: 2000 });
|
||||
this.selectedFile=undefined;
|
||||
})
|
||||
}
|
||||
}
|
||||
documentType(docType){
|
||||
console.log("doctypeObject=>",docType);
|
||||
|
||||
}
|
||||
|
||||
inventoryManagement:Boolean=false;
|
||||
inventory=[]
|
||||
getUserSetting(userId){
|
||||
|
||||
this.contactService.post('/users/get_user_setting',{uid: userId}).subscribe((res:any)=>{
|
||||
this.inventoryManagement=res.inventoryManagement;
|
||||
if(this.inventoryManagement){
|
||||
console.log(this.userId,this.dealerId=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer);
|
||||
var isDealer=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer
|
||||
var isSuperAdmin=JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isSuperAdmin
|
||||
// var user
|
||||
// if(isSuperAdmin){
|
||||
// var user
|
||||
// }else if(isDealer){
|
||||
|
||||
// }
|
||||
var user=isSuperAdmin?this.userId:this.sup_admin?this.sup_admin:this.userId
|
||||
console.log(user);
|
||||
|
||||
this.contactService.get('/Device_inventory/getInventory?user='+this.userId).subscribe((res:any)=>{
|
||||
this.inventory=res;
|
||||
this.loadropdown()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
manufacturingData
|
||||
getModelData(){
|
||||
this.contactService.get('/model_master/GetNames').subscribe((res:any)=>{
|
||||
this.manufacturingData=res
|
||||
})
|
||||
}
|
||||
modelData
|
||||
selectModel(event){
|
||||
console.log(event.target.value);
|
||||
|
||||
this.contactService.get('/model_master/getModel?name='+event.target.value).subscribe((res:any)=>{
|
||||
this.modelData=res
|
||||
})
|
||||
|
||||
}
|
||||
cityList
|
||||
onStateChange(event){
|
||||
this.contactService.get('/RTO_master/getCity?state='+event.target.value).subscribe((res:any)=>{
|
||||
this.cityList=res
|
||||
})
|
||||
}
|
||||
RTO
|
||||
onCityChange(event){
|
||||
this.contactService.get('/RTO_master/getRTO?city='+event.target.value).subscribe((res:any)=>{
|
||||
this.RTO=res
|
||||
})
|
||||
}
|
||||
back(){
|
||||
this.location.back()
|
||||
}
|
||||
image;
|
||||
docName
|
||||
openModal(template: TemplateRef<any>,doc){
|
||||
console.log(doc);
|
||||
|
||||
this.modalRef = this.modalService.show(template,{'backdrop':'static',class:'modal-lg modal-dialog-centered'});
|
||||
this.docName=doc.doctype
|
||||
this.image="https://www.oneqlik.in"+doc.image.substring(6)
|
||||
}
|
||||
|
||||
imageURL:any;
|
||||
selectedDeviceFile:File;
|
||||
data_descip : any;
|
||||
onDeviceImageChanged(event,index) {
|
||||
this.selectedDeviceFile = <File>event.target.files[0];
|
||||
|
||||
this.Load = true;
|
||||
const fdDevice = new FormData();
|
||||
fdDevice.append('photo',this.selectedDeviceFile,this.selectedDeviceFile.name)
|
||||
console.log("Binaryimage = > ",fdDevice );
|
||||
this.contactService.deviceImageupload(fdDevice)
|
||||
.subscribe(res=>{
|
||||
console.log(res);
|
||||
if(res){
|
||||
// if(this.deviceImg.length==3){
|
||||
// if(this.deviceImg[index]){
|
||||
this.deviceImg[index]=(res['_body'])
|
||||
// }else{
|
||||
// this.deviceImg.push(res['_body'])
|
||||
// }
|
||||
// }else{
|
||||
// this.deviceImg.push(res['_body'])
|
||||
|
||||
// }
|
||||
}
|
||||
this.Load = false;
|
||||
this.selectedDeviceFile=undefined
|
||||
console.log('this.deviceImg',this.deviceImg);
|
||||
this.data_descip = "Image Uploaded";
|
||||
launch_toast();
|
||||
},err=>{
|
||||
this.data_descip = "Internal Server Error";
|
||||
launch_toast();
|
||||
this.selectedDeviceFile=undefined
|
||||
console.log(err);
|
||||
this.Load = false;
|
||||
})
|
||||
|
||||
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", ""); }, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
onDeviceImageUploadUpload(index){
|
||||
if(!this.selectedDeviceFile){
|
||||
swal(
|
||||
'Upload Error',
|
||||
'Please choose file before upload !!!',
|
||||
'error'
|
||||
)
|
||||
}else{
|
||||
this.Load = true;
|
||||
const fdDevice = new FormData();
|
||||
fdDevice.append('photo',this.selectedDeviceFile,this.selectedDeviceFile.name)
|
||||
console.log("Binaryimage = > ",fdDevice );
|
||||
this.contactService.deviceImageupload(fdDevice)
|
||||
.subscribe(res=>{
|
||||
console.log(res);
|
||||
if(res){
|
||||
if(this.deviceImg.length==3){
|
||||
if(this.deviceImg[index]){
|
||||
this.deviceImg[index]=(res['_body'])
|
||||
}else{
|
||||
this.deviceImg.push(res['_body'])
|
||||
}
|
||||
}else{
|
||||
this.deviceImg.push(res['_body'])
|
||||
|
||||
}
|
||||
}
|
||||
this.selectedDeviceFile=undefined
|
||||
console.log('this.deviceImg',this.deviceImg);
|
||||
this.data_descip = "Image Uploaded";
|
||||
launch_toast();
|
||||
},err=>{
|
||||
this.data_descip = "Internal Server Error";
|
||||
launch_toast();
|
||||
this.selectedDeviceFile=undefined
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
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", ""); }, 1500);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
105
src/app/dashboard/renew-vehicle/renew-vehicle.component.html
Normal file
105
src/app/dashboard/renew-vehicle/renew-vehicle.component.html
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
<h4 md-dialog-title>Renew Vehicle</h4>
|
||||
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form [formGroup]="renewForm">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 row">
|
||||
<label for="name" class="col-sm-3 col-form-label">Name</label>
|
||||
<input formControlName="name" type="text" readonly class="form-control-plaintext col-sm-9" id="name">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 row">
|
||||
<label for="Amount" class="col-sm-3 col-form-label">Expiry Date</label>
|
||||
<input readonly class="form-control-plaintext col-sm-9" formControlName="expDate" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 row">
|
||||
<label for="Amount" class="col-sm-3 col-form-label">Sim Number</label>
|
||||
<input readonly class="form-control-plaintext col-sm-9" formControlName="sim" type="text">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 row">
|
||||
<label for="validTill" class="col-sm-3 col-form-label">Valid Till</label>
|
||||
<input formControlName="validTill" type="text" class="form-control col-sm-9" id="validTill" bsDatepicker
|
||||
class="datepicker" [bsConfig]="bsConfig">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 row">
|
||||
<label for="type" class="col-sm-3 col-form-label">Plan</label>
|
||||
<select class="form-control col-sm-9" formControlName="plan" (ngModelChange)="changePlan($event)">
|
||||
<option value=30>Monthly</option>
|
||||
<option Value=90> Quaterly</option>
|
||||
<option value=180>Half Yearly</option>
|
||||
<option value=365>Yearly</option>
|
||||
<option value=1095>3 Years</option>
|
||||
<option value='custom'>Custom</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer text-right">
|
||||
<button class="btn btn-danger" md-dialog-close>Cancel</button>
|
||||
<button class="btn btn-primary" (click)="submit()"> Save</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- <h4 md-dialog-title>Renew Vehicle</h4>
|
||||
<div md-dialog-content>
|
||||
|
||||
<form [formGroup]="renewForm">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 row">
|
||||
<label for="name" class="col-sm-3 col-form-label">Name</label>
|
||||
<input formControlName="name" type="text" readonly class="form-control-plaintext col-sm-9" id="name">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 row">
|
||||
<label for="Amount" class="col-sm-3 col-form-label">Expiry Date</label>
|
||||
<input readonly class="form-control-plaintext col-sm-9" formControlName="expDate" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 row">
|
||||
<label for="Amount" class="col-sm-3 col-form-label">Sim Number</label>
|
||||
<input readonly class="form-control-plaintext col-sm-9" formControlName="sim" type="text">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 row">
|
||||
<label for="validTill" class="col-sm-3 col-form-label">Valid Till</label>
|
||||
<input formControlName="validTill" type="text" class="form-control col-sm-9" id="validTill" bsDatepicker class="datepicker" [bsConfig]="bsConfig">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 row">
|
||||
<label for="type" class="col-sm-3 col-form-label">Plan</label>
|
||||
<select class="form-control col-sm-9" formControlName="plan" (ngModelChange)="changePlan($event)">
|
||||
<option value=30>Monthly</option>
|
||||
<option Value=90> Quaterly</option>
|
||||
<option value=180>Half Yearly</option>
|
||||
<option value=365>Yearly</option>
|
||||
<option value=1095>3 Years</option>
|
||||
<option value='custom'>Custom</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<md-dialog-actions align="end">
|
||||
<button md-button md-dialog-close>Cancel</button>
|
||||
<button md-button (click)="submit()"> Save</button>
|
||||
|
||||
|
||||
</md-dialog-actions> -->
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RenewVehicleComponent } from './renew-vehicle.component';
|
||||
|
||||
describe('RenewVehicleComponent', () => {
|
||||
let component: RenewVehicleComponent;
|
||||
let fixture: ComponentFixture<RenewVehicleComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RenewVehicleComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RenewVehicleComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
126
src/app/dashboard/renew-vehicle/renew-vehicle.component.ts
Normal file
126
src/app/dashboard/renew-vehicle/renew-vehicle.component.ts
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material';
|
||||
import * as moment from 'moment';
|
||||
import { BsDatepickerConfig } from 'ngx-bootstrap';
|
||||
import { ContactService } from '../../contact.service';
|
||||
declare var $: any, DataTable: any, swal: any;
|
||||
|
||||
@Component({
|
||||
selector: 'app-renew-vehicle',
|
||||
templateUrl: './renew-vehicle.component.html',
|
||||
styleUrls: ['./renew-vehicle.component.scss']
|
||||
})
|
||||
export class RenewVehicleComponent implements OnInit {
|
||||
renewForm:FormGroup;
|
||||
useridd;
|
||||
disabled=true;
|
||||
isFirst=true;
|
||||
validTillDate=new Date()
|
||||
bsConfig: Partial<BsDatepickerConfig>;
|
||||
constructor(public dialogRef: MdDialogRef<RenewVehicleComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any,private fb:FormBuilder,private contactService:ContactService) {
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.useridd = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id;
|
||||
this.renewForm=this.fb.group({
|
||||
name:[this.data.Device_Name],
|
||||
expDate:[moment(this.data.expiration_date).format('lll')],
|
||||
sim:[this.data.sim_number],
|
||||
plan:[''],
|
||||
validTill:[new Date()]
|
||||
})
|
||||
|
||||
this.renewForm.controls.validTill.disable()
|
||||
}
|
||||
|
||||
submit(){
|
||||
console.log(this.renewForm.value);
|
||||
if(this.renewForm.value.plan=="custom"){
|
||||
this.validTillDate=this.renewForm.value.validTill
|
||||
}
|
||||
|
||||
if(this.isDatesEqual(new Date(this.validTillDate),new Date())){
|
||||
swal({
|
||||
icon: 'warning',
|
||||
title: 'Oops...',
|
||||
text: 'Please choose plan or set valid till date',
|
||||
|
||||
})
|
||||
}else{
|
||||
var request={
|
||||
_id: this.data._id,
|
||||
devicename: this.renewForm.value.name,
|
||||
sim: this.renewForm.value.sim,
|
||||
deviceid: this.data.Device_ID,
|
||||
device_model: this.data.device_model._id,
|
||||
vehicleType:this.data.vehicleType._id,
|
||||
expdate:new Date(this.validTillDate),
|
||||
renew_by:this.useridd
|
||||
}
|
||||
|
||||
swal({
|
||||
title: '<strong>Renew vehicle</strong>',
|
||||
icon: 'info',
|
||||
html: 'Please confirm to Renew Vehicle ?',
|
||||
showCloseButton: true,
|
||||
showCancelButton: true,
|
||||
focusConfirm: false,
|
||||
confirmButtonText: "Renew Vehicle",
|
||||
confirmButtonAriaLabel: 'Thumbs up, great!',
|
||||
|
||||
}).then((result: { value: boolean; }) => {
|
||||
if (result) {
|
||||
console.log(request);
|
||||
this.contactService.editdevice(request)
|
||||
.subscribe(device => {
|
||||
this.dialogRef.close('succ');
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
isDatesEqual(date1, date2) {
|
||||
console.log(date1,date2);
|
||||
|
||||
return date1.getFullYear() === date2.getFullYear() &&
|
||||
date1.getMonth() === date2.getMonth() &&
|
||||
date1.getDate() === date2.getDate();
|
||||
}
|
||||
|
||||
changePlan(event){
|
||||
console.log(event);
|
||||
if(event=='custom'){
|
||||
this.disabled=false;
|
||||
console.log("in");
|
||||
this.validTillDate=new Date();
|
||||
// this.renewForm.controls.validTill.enable();
|
||||
this.renewForm.value.validTill=new Date();
|
||||
this.renewForm.controls.validTill.enable();
|
||||
}else{
|
||||
this.validTillDate=new Date();
|
||||
// this.renewForm.controls.validTill.enable();
|
||||
this.renewForm.value.validTill=new Date();
|
||||
this.renewForm.patchValue({
|
||||
validTill:new Date(moment(this.renewForm.value.validTill, "DD-MM-YYYY").add('days', Number(event)).format('YYYY/MM/DD HH:mm:ss'))
|
||||
})
|
||||
this.validTillDate=new Date(moment(this.validTillDate, "DD-MM-YYYY").add('days', Number(event)).format('YYYY/MM/DD HH:mm:ss'))
|
||||
// this.renewForm.value.validTill= new Date(moment(this.renewForm.value.validTill, "DD-MM-YYYY").add('days', Number(event)).format('YYYY/MM/DD HH:mm:ss'));
|
||||
console.log(this.renewForm.value.validTill,this.validTillDate)
|
||||
this.renewForm.controls.validTill.disable()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span style="color:#855353;font-size:20px;font-weight: 500;">Renewal History</span>
|
||||
<button style="position: absolute;
|
||||
right: 0;
|
||||
top: 0" class="btn btn-danger btn-sm pull-left" (click)="this.dialogRef.close()">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="loading" *ngIf="Load">Loading…</div>
|
||||
<div style="width: 100%;height:70vh;margin-top: 32px;">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: left;">{{'Device Name' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Device IMEI' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Created On' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Expired On' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Renewed On' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Valid Till' | translate}}</th>
|
||||
<!-- <th style="text-align: left;">{{'Creation Date' | translate}}</th>
|
||||
<th style="text-align: left;">{{'Dealer name' | translate}}</th> -->
|
||||
<!-- <th style="text-align: left;">{{'Organization name' | translate}}</th> -->
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of main">
|
||||
<td>{{item.device.Device_Name}}</td>
|
||||
<td>{{item.device.Device_ID}}</td>
|
||||
<td>{{item.created_on}}</td>
|
||||
<td>{{item.expired_on}}</td>
|
||||
<td>{{item.renewed_on}}</td>
|
||||
<td *ngIf="item.validDate">{{item.validDate}}</td>
|
||||
|
||||
</tr>
|
||||
<tr *ngIf="main.length==0" class="text-center">
|
||||
<h5 style="position: absolute;right: 50%;top: 30%">No Data Found</h5>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RenewalHistoryComponent } from './renewal-history.component';
|
||||
|
||||
describe('RenewalHistoryComponent', () => {
|
||||
let component: RenewalHistoryComponent;
|
||||
let fixture: ComponentFixture<RenewalHistoryComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RenewalHistoryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RenewalHistoryComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
114
src/app/dashboard/renewal-history/renewal-history.component.ts
Normal file
114
src/app/dashboard/renewal-history/renewal-history.component.ts
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material';
|
||||
import { ContactService } from '../../contact.service';
|
||||
declare var $: any;
|
||||
|
||||
@Component({
|
||||
selector: 'app-renewal-history',
|
||||
templateUrl: './renewal-history.component.html',
|
||||
styleUrls: ['./renewal-history.component.scss']
|
||||
})
|
||||
export class RenewalHistoryComponent implements OnInit {
|
||||
tabelObj: any ;
|
||||
Load: boolean;
|
||||
main=[];
|
||||
|
||||
constructor(public dialogRef: MdDialogRef<RenewalHistoryComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService) {
|
||||
// this.main=this.data
|
||||
// this.testTable()
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getRenewalHistory()
|
||||
}
|
||||
|
||||
getRenewalHistory(){
|
||||
this.Load=true
|
||||
this.contactService.getRenewalHistory(this.data._id).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.main=res;
|
||||
this.Load=false
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
testTable(){
|
||||
const that = this;
|
||||
console.log("inside function");
|
||||
// that.Load = true;
|
||||
|
||||
$(document).ready(function() {
|
||||
that.tabelObj = $('#deviceTable').DataTable({
|
||||
"processing": false,
|
||||
"searching": true,
|
||||
pagingType: 'full_numbers',
|
||||
pageLength: 25,
|
||||
serverSide: false,
|
||||
responsive: true,
|
||||
"scrollY":'60vh',
|
||||
"scrollCollapse": true,
|
||||
|
||||
// "deferLoading": 25 ,
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
|
||||
// "rowCallback": function(row: Node, data: any | Object, index: number){
|
||||
ajax: (mainData,callback) => {
|
||||
|
||||
|
||||
that.contactService.getRenewalHistory(this.data._id).subscribe(res=>{
|
||||
console.log(res);
|
||||
that.Load = false;
|
||||
if(res.length!=0){
|
||||
callback({ data: res[0].data });
|
||||
|
||||
}else{
|
||||
callback({ data: [] });
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
"columns": [
|
||||
{
|
||||
"data": "Device_Name",
|
||||
"render": function(data, type, row) {
|
||||
return data?data.device.Device_Name : '';
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "Device_ID",
|
||||
"render": function(data, type, row) {
|
||||
return data?data.device.Device_ID : '';
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "expired_on",
|
||||
"render": function(data, type, row) {
|
||||
return data?data : '';
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "renewed_on",
|
||||
"render": function(data, type, row) {
|
||||
return data?data : '';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
],
|
||||
"columnDefs": [
|
||||
{ className: "dt-body-left", "targets": [ 0,1,2,3] },
|
||||
{ "width": "10px", "targets": 0 },
|
||||
{ "width": "40px", "targets": 1 },
|
||||
{ "width": "100px", "targets": 2 },
|
||||
{ "width": "70px", "targets": 3 },
|
||||
] , order: [[ 3, 'desc' ], [ 0, 'asc' ]]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
32
src/app/dashboard/share-user/share-user.component.html
Normal file
32
src/app/dashboard/share-user/share-user.component.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<h4>Shared Users<button mdTooltip="close" (click)="onNoClick(null)"style=" cursor: pointer;
|
||||
float: right; border:1px solid transparent; background-color: transparent;padding-top:2%"><md-icon style="float: right;width:30px;height:30px;">close
|
||||
</md-icon></button></h4><hr>
|
||||
<p ><b>Device Name: </b>{{dname}}</p>
|
||||
<table class="table table-striped table-hover " style="overflow-y: hidden;
|
||||
overflow-x: hidden;">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Remove Sharing</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr *ngFor="let device of foods">
|
||||
|
||||
<td >{{device.name}}</td>
|
||||
<td>
|
||||
<p><button md-tooltip="Remove Shared Device" style="border:1px solid transparent; background-color: transparent;"(click)="deleteshare(device.userid)">
|
||||
|
||||
<md-icon> remove_circle_outline</md-icon></button></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<flash-messages></flash-messages>
|
||||
|
||||
|
||||
0
src/app/dashboard/share-user/share-user.component.scss
Normal file
0
src/app/dashboard/share-user/share-user.component.scss
Normal file
25
src/app/dashboard/share-user/share-user.component.spec.ts
Normal file
25
src/app/dashboard/share-user/share-user.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ShareUserComponent } from './share-user.component';
|
||||
|
||||
describe('ShareUserComponent', () => {
|
||||
let component: ShareUserComponent;
|
||||
let fixture: ComponentFixture<ShareUserComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ShareUserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ShareUserComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
80
src/app/dashboard/share-user/share-user.component.ts
Normal file
80
src/app/dashboard/share-user/share-user.component.ts
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
import { Component, OnInit,Inject } from '@angular/core';
|
||||
import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material';
|
||||
import {Device} from '../../device';
|
||||
import {ContactService} from '../../contact.service';
|
||||
import { FlashMessagesService } from 'angular2-flash-messages';
|
||||
import { SidebarComponent } from '../../sidebar/sidebar.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-share-user',
|
||||
templateUrl: './share-user.component.html',
|
||||
styleUrls: ['./share-user.component.scss'],
|
||||
providers: [ContactService,SidebarComponent]
|
||||
})
|
||||
export class ShareUserComponent implements OnInit {
|
||||
//shrdeviceOwner
|
||||
d :any;
|
||||
dname:any;
|
||||
did :any;
|
||||
devv:any;
|
||||
deleteshare(uid){
|
||||
|
||||
this.contactService.deldevshr( this.d,uid)
|
||||
.subscribe(
|
||||
|
||||
data => {
|
||||
|
||||
this.devv = data
|
||||
window.localStorage['DataUpdate'] = 'True'
|
||||
this.sidebar.sidebarData()
|
||||
this.onNoClick("OKK")
|
||||
});
|
||||
|
||||
}
|
||||
constructor(public dialogRef: MdDialogRef<ShareUserComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService,private _flashMessagesService: FlashMessagesService,private sidebar: SidebarComponent) {
|
||||
this.d =data.name;
|
||||
this.dname = data.dname;
|
||||
this.did = data.did;
|
||||
}
|
||||
onNoClick(a): void {
|
||||
console.log(a);
|
||||
this.dialogRef.close(a);
|
||||
}
|
||||
devicess:any;
|
||||
final:any;
|
||||
foods = []
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
this.contactService.shrdeviceOwner(this.d).subscribe(
|
||||
|
||||
data => {
|
||||
this.devicess = data
|
||||
|
||||
for(let p=0;p<this.devicess.length;p++){
|
||||
this.devicess[p];
|
||||
let fs = this.devicess[p].first_name;
|
||||
let ls = this.devicess[p].last_name;
|
||||
let na = fs + " " + ls;
|
||||
let xz ={
|
||||
"name" : na,
|
||||
"userid" : this.devicess[p]._id
|
||||
}
|
||||
this.foods.push(xz);
|
||||
}
|
||||
|
||||
}, (err: any) => {;
|
||||
console.log(err);
|
||||
if(err.status != 200)
|
||||
{
|
||||
/* this._flashMessagesService.show( "This Device is Not Shared to anyOne", { cssClass: 'alert-danger', timeout: 1000 }
|
||||
);
|
||||
*/
|
||||
this.onNoClick("No_Dev")
|
||||
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
12
src/app/dashboard/speednotify/speednotify.component.html
Normal file
12
src/app/dashboard/speednotify/speednotify.component.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<h4>Speed Alert</h4>
|
||||
<hr>
|
||||
<b>Device Name: </b>{{dname}}<br >
|
||||
|
||||
Please Enter Speed to Get Alert :
|
||||
<md-form-field class="example-full-width width">
|
||||
<input mdInput type="number" [(ngModel)]="speed" name="speed">
|
||||
</md-form-field><br><br>
|
||||
<div style="padding-left:30%">
|
||||
<button class="btn btn-danger btn-block/"style="cursor:pointer;" (click)="onNoClick(null)" >Cancel</button>
|
||||
<button class="btn btn-primary btn-block/"style="cursor:pointer" (click)="speedAlert()">Get Alert</button>
|
||||
</div>
|
||||
0
src/app/dashboard/speednotify/speednotify.component.scss
Normal file
0
src/app/dashboard/speednotify/speednotify.component.scss
Normal file
25
src/app/dashboard/speednotify/speednotify.component.spec.ts
Normal file
25
src/app/dashboard/speednotify/speednotify.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SpeednotifyComponent } from './speednotify.component';
|
||||
|
||||
describe('SpeednotifyComponent', () => {
|
||||
let component: SpeednotifyComponent;
|
||||
let fixture: ComponentFixture<SpeednotifyComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SpeednotifyComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SpeednotifyComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
54
src/app/dashboard/speednotify/speednotify.component.ts
Normal file
54
src/app/dashboard/speednotify/speednotify.component.ts
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import { Component, OnInit,Inject } from '@angular/core';
|
||||
import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material';
|
||||
import {Device} from '../../device';
|
||||
import {ContactService} from '../../contact.service';
|
||||
import { SidebarComponent } from '../../sidebar/sidebar.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-speednotify',
|
||||
templateUrl: './speednotify.component.html',
|
||||
styleUrls: ['./speednotify.component.scss'],
|
||||
providers: [ContactService,SidebarComponent]
|
||||
})
|
||||
export class SpeednotifyComponent implements OnInit {
|
||||
|
||||
dname:any;
|
||||
did:any;
|
||||
status:any;
|
||||
speed:any;
|
||||
|
||||
speedAlert(){
|
||||
|
||||
this.contactService.speedlimit(this.did,this.speed,"true").subscribe(
|
||||
|
||||
data => {
|
||||
this.dataa = data
|
||||
window.localStorage['DataUpdate'] = 'True'
|
||||
this.sidebar.sidebarData()
|
||||
this.dialogRef.close("device_alert");
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// speeed:any;
|
||||
constructor(public dialogRef: MdDialogRef<SpeednotifyComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService,private sidebar: SidebarComponent) {
|
||||
|
||||
// console.log(data)
|
||||
this.dname = data.dname;
|
||||
this.did = data.did;
|
||||
this.status = data.status;
|
||||
this.speed = data.speed;
|
||||
//console.log(data.speed)
|
||||
}
|
||||
|
||||
onNoClick(a): void {
|
||||
this.dialogRef.close(a);
|
||||
}
|
||||
dataa:any
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
<md-dialog-content class="md-typography">
|
||||
<table id="testPdf" style="font-weight: 600;">
|
||||
<tr>
|
||||
<td>
|
||||
<div *ngIf="supAdmin.imageDoc">
|
||||
<img src="{{supAdmin.imageDoc}}" width="100px" height="100px">
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center;font-weight: 700">
|
||||
<span *ngIf="supAdmin">
|
||||
|
||||
{{supAdmin.first_name?supAdmin.first_name:""}} {{supAdmin.last_name?supAdmin.last_name:""}}<br><br>
|
||||
{{supAdmin.address?supAdmin.address:""}}<br><br>
|
||||
CERTIFICATE OF INSTALLATION<br>
|
||||
</span>
|
||||
<span *ngIf="!supAdmin">
|
||||
{{devicetype}} GPS DEVICE<br>
|
||||
(AIS-140 COMPLIANT)<br>
|
||||
INSTALLATION/FITMENT CERTIFICATE<br>
|
||||
{{companyName}}<br>
|
||||
{{companyAddress}}
|
||||
</span>
|
||||
</td>
|
||||
<td style="text-align:center">
|
||||
<div>
|
||||
<img src="{{imgURL}}" width="100px" height="150px">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<h6 style="font-size:18px;">Vehicle Details :-</h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Name of Owner : {{userName}}<br>
|
||||
Registration Number. : {{devName}}<br>
|
||||
Chassis no. : {{ChassisNo}}<br>
|
||||
Engine no. : {{engineNo}}<br>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
Vehicle Make : {{manufacturingCompany}}<br>
|
||||
Vehicle Model : {{typeOfVehicle}}<br>
|
||||
</td>
|
||||
<!-- <td>
|
||||
Registration Date : {{vehicleRegDate | date:'dd-MM-yyyy'}}<br>
|
||||
Date of Manufaturing year : {{vehicleManufacturingDate | date:'dd-MM-yyyy'}}
|
||||
</td> -->
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<h6 style="font-size:18px;margin: 20px 0 10px 0px;">GPS DEVICE DETAILS : - </h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Device Model : {{devicetype}}<br>
|
||||
IMEI Number : {{devID}}<br>
|
||||
UID Number : {{uniqueID}}<br>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
Invoice Number : <br>
|
||||
Vehicle Model : {{typeOfVehicle}}<br>
|
||||
ICCID Number: {{ICCICD}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<h6 style="font-size:18px;margin: 20px 0 10px 0px;">INSTALLATION DETAILS : - </h6>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Dealer Name : {{dealerName}}<br>
|
||||
Dealer Address : {{dealerAddress}}<br>
|
||||
RTO Certificate No : <br>
|
||||
Installation Date : {{installationDate | date:'dd-MM-yyyy'}}<br>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
Mobile No : {{user.phone?user.phone:""}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="padding-top: 10px;">
|
||||
<!-- <td colspan="3">
|
||||
<h6 style="font-size:18px;margin: 20px 0 10px 0px;">Fitment Images :- </h6>
|
||||
</td> -->
|
||||
<!-- {{deviceImage |json}} -->
|
||||
<td *ngIf="deviceImage.length && deviceImage[0]">
|
||||
<img src="{{deviceImage[0]}}" width="90px" height="90px">
|
||||
</td>
|
||||
<td *ngIf="deviceImage.length && deviceImage[1]">
|
||||
<img src="{{deviceImage[1]}}" width="90px" height="90px">
|
||||
</td>
|
||||
<td *ngIf="deviceImage.length && deviceImage[2]">
|
||||
<img src="{{deviceImage[2]}}" width="90px" height="90px">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
This installation certificate is valid till date {{data.deviceInfo.expiration_date?(data.deviceInfo.expiration_date | date:'dd-MM-yyyy') :""}}
|
||||
</tr>
|
||||
<tr style="padding-top: 10px;">
|
||||
<td colspan="2">
|
||||
Dealer Stamp
|
||||
</td>
|
||||
<td>
|
||||
Authorised Signature
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<h6 style="font-size:18px;margin: 20px 0 10px 0px;">PRODUCT SATISFACTION REPORT : - </h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:center;margin-top: 10px">
|
||||
This is to Acknowledge and confirm that we have fitted our vehicle with above vehicle location tracking unit.
|
||||
We have checked the performance of the vehicle after fitment and we confirm VLTD is functioning as per norms
|
||||
listed out in AIS-140 standards and other guidelines of MoRTH and other government departments. We are also
|
||||
satisfied with the performance of the device in all respect. We undertake not to raise any dispute or any legal
|
||||
claims against Airotrack in the event that the above mentioned function are found broken/torn/tampered hereafter.
|
||||
I also understand that telecom network connectivity doesn't come under the scope of Airotrack and will not raise
|
||||
any claim or disputes with respect to issues arising with low or no network coverage.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</md-dialog-content>
|
||||
<md-dialog-actions align="end">
|
||||
<button md-button md-dialog-close>Cancel</button>
|
||||
<button md-button (click)="exportAsPdf()" cdkFocusInitial>Export PDF</button>
|
||||
</md-dialog-actions>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewCertificateComponent } from './view-certificate.component';
|
||||
|
||||
describe('ViewCertificateComponent', () => {
|
||||
let component: ViewCertificateComponent;
|
||||
let fixture: ComponentFixture<ViewCertificateComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewCertificateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewCertificateComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
398
src/app/dashboard/view-certificate/view-certificate.component.ts
Normal file
398
src/app/dashboard/view-certificate/view-certificate.component.ts
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material';
|
||||
import * as moment from 'moment';
|
||||
declare var swal: any;
|
||||
declare var jsPDF:any;
|
||||
// declare var qrcode:any;
|
||||
// declare var QRCode :any;
|
||||
declare var QRious:any;
|
||||
declare var $:any;
|
||||
@Component({
|
||||
selector: 'app-view-certificate',
|
||||
templateUrl: './view-certificate.component.html',
|
||||
styleUrls: ['./view-certificate.component.scss']
|
||||
})
|
||||
export class ViewCertificateComponent implements OnInit {
|
||||
devName:any;
|
||||
img1='/assets/images/liveTrackIcons/noImageAvailableIcon1.jpg'
|
||||
|
||||
phNum:any;
|
||||
createdOn:any;
|
||||
expOn:any;
|
||||
supAdmin
|
||||
DealerObj = [];
|
||||
userObj = [];
|
||||
// iconType:any;
|
||||
simNum:any;
|
||||
todayODO:any;
|
||||
totalODO:any;
|
||||
useridd: any;
|
||||
emailId:any ="";
|
||||
costumers: any = [];
|
||||
deviceID: any;
|
||||
userName:any;
|
||||
devmodel:any;
|
||||
newUserArr=[];
|
||||
editTemplate:boolean=true;
|
||||
deletetemplate:boolean=false;
|
||||
orignalEmail: any;
|
||||
initialUser: any;
|
||||
ExportPdf: boolean;
|
||||
devID: any;
|
||||
InvoiceDate: any;
|
||||
devicetype: any;
|
||||
fitmentDate: any;
|
||||
engineNo: any;
|
||||
typeOfVehicle: any;
|
||||
manufacturingCompany: any;
|
||||
lastFitnessDate: any;
|
||||
vehicleRegDate: any;
|
||||
vehicleManufacturingDate: any;
|
||||
|
||||
IMSI: any;
|
||||
uniqueID: any;
|
||||
lattitude: any;
|
||||
longitude: any;
|
||||
userAddress: any;
|
||||
dealerAddress: any;
|
||||
CID_No: any;
|
||||
imgUrl: any;
|
||||
imgURL: any;
|
||||
companyName: any;
|
||||
companyAddress: any;
|
||||
transportOfficeCity: any;
|
||||
transportOfficeState: { data: string; };
|
||||
ChassisNo: any;
|
||||
deviceManufacturer: any;
|
||||
invoiceNum: any;
|
||||
numberOfSOS: any;
|
||||
expiration_date: any;
|
||||
organisationFlag: any;
|
||||
distributerName:any;
|
||||
distSelect: any=[];
|
||||
superAdmin: any;
|
||||
isDealer: any;
|
||||
dealerId: any;
|
||||
lastPingOn:any
|
||||
lastDeviceTime:any
|
||||
deviceImage=[];
|
||||
dealerName
|
||||
installationDate;
|
||||
ICCICD
|
||||
user: any;
|
||||
constructor(public dialogRef: MdDialogRef<ViewCertificateComponent>,
|
||||
@Inject(MD_DIALOG_DATA) public data: any ) {
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.lastDeviceTime=this.data.deviceInfo.last_device_time;
|
||||
this.lastPingOn=this.data.deviceInfo.last_ping_on
|
||||
this.devName = this.data.deviceInfo.Device_Name;
|
||||
this.devID = this.data.deviceInfo.Device_ID?this.data.deviceInfo.Device_ID:"";
|
||||
this.phNum =this.data.deviceInfo.contact_number;
|
||||
this.createdOn = this.data.deviceInfo.created_on?(new Date(this.data.deviceInfo.created_on).toISOString()):"";
|
||||
this.expOn = this.data.deviceInfo.expiration_date?(new Date(this.data.deviceInfo.expiration_date).toISOString()):"";
|
||||
// this.iconType=this.data.deviceInfo.iconType;
|
||||
this.simNum =this.data.deviceInfo.sim_number;
|
||||
this.orignalEmail = this.data.deviceInfo.Email_ID
|
||||
this.emailId = this.data.deviceInfo.Email_ID;
|
||||
this.deviceImage=this.data.deviceInfo.deviceImage
|
||||
|
||||
for(var i=0;i<this.deviceImage.length;i++){
|
||||
|
||||
this.deviceImage[i] = 'https://www.oneqlik.in' + this.deviceImage[i].substring(6)
|
||||
|
||||
|
||||
}
|
||||
this.supAdmin=this.data.deviceInfo.supAdmin;
|
||||
if(this.supAdmin.imageDoc && this.supAdmin.imageDoc.length>0){
|
||||
this.supAdmin.imageDoc='https://www.oneqlik.in' + this.supAdmin.imageDoc[0].substring(6)
|
||||
}
|
||||
console.log(this.deviceImage);
|
||||
this.installationDate=this.data.deviceInfo.created_on
|
||||
this.todayODO=this.data.deviceInfo.today_odo;
|
||||
this.totalODO =this.data.deviceInfo.total_odo;
|
||||
this.deviceID = this.data.deviceInfo._id;
|
||||
this.initialUser = this.data.deviceInfo.user._id;
|
||||
this.user=this.data.deviceInfo.user
|
||||
this.userName = this.data.deviceInfo.OwnerName;
|
||||
this.userAddress = this.data.deviceInfo?this.data.deviceInfo.user.address:"";
|
||||
this.dealerName = this.data.deviceInfo.Dealer_name ;
|
||||
this.dealerId = this.data.deviceInfo.Dealer?this.data.deviceInfo.Dealer._id : "";
|
||||
console.log('this.dealerId',this.dealerId);
|
||||
this.dealerAddress = this.data.deviceInfo.DealerAddress;
|
||||
this.InvoiceDate = this.data.deviceInfo.invoiceDate?(new Date(this.data.deviceInfo.invoiceDate).toISOString()):"";
|
||||
this.invoiceNum = this.data.deviceInfo.invoiceNumber
|
||||
this.CID_No = this.data.deviceInfo.CID_No
|
||||
this.devicetype = this.data.deviceInfo.device_model?this.data.deviceInfo.device_model.device_type:"";
|
||||
this.ICCICD = this.data.deviceInfo.ICCICD;
|
||||
this.IMSI = this.data.deviceInfo.IMSI;
|
||||
this.uniqueID = this.data.deviceInfo.uniqueID;
|
||||
this.fitmentDate = this.data.deviceInfo.fitmentDate?new Date(this.data.deviceInfo.fitmentDate):"";
|
||||
this.expiration_date =this.data.deviceInfo.expiration_date?new Date(this.data.deviceInfo.expiration_date):"";
|
||||
this.engineNo = this.data.deviceInfo.engineNo;
|
||||
this.typeOfVehicle = this.data.deviceInfo.typeOfVehicle;
|
||||
this.manufacturingCompany = this.data.deviceInfo.manufacturingCompany;
|
||||
|
||||
this.lastFitnessDate = this.data.deviceInfo.lastFitnessDate?new Date(this.data.deviceInfo.lastFitnessDate):"";
|
||||
this.vehicleRegDate = this.data.deviceInfo.vehicleRegDate? new Date(this.data.deviceInfo.vehicleRegDate):"";
|
||||
this.vehicleManufacturingDate = this.data.deviceInfo.vehicleManufacturingDate?new Date(this.data.deviceInfo.vehicleManufacturingDate):"";
|
||||
this.lattitude = this.data.deviceInfo.last_loc?this.data.deviceInfo.last_loc.coordinates[0]:"";
|
||||
this.longitude = this.data.deviceInfo.last_loc?this.data.deviceInfo.last_loc.coordinates[1]:"";
|
||||
this.qrCodeGenerator()
|
||||
}
|
||||
|
||||
qrCodeGenerator() {
|
||||
var qrcodeDATA ="";
|
||||
if(this.userName){
|
||||
qrcodeDATA += "Owner Name : " + this.userName + " " ;
|
||||
}
|
||||
// if(this.userAddress){
|
||||
// qrcodeDATA += "Owner Add" + this.userAddress + " " ;
|
||||
// }
|
||||
|
||||
if(this.engineNo){
|
||||
qrcodeDATA += "Engine no. :" + this.engineNo + " " ;
|
||||
}
|
||||
if(this.ChassisNo){
|
||||
qrcodeDATA += "Chassis:" + this.ChassisNo + " " ;
|
||||
}
|
||||
if(this.uniqueID){
|
||||
qrcodeDATA += "UID:" + this.uniqueID + " " ;
|
||||
|
||||
}
|
||||
if(this.devID){
|
||||
qrcodeDATA += "IMEI :" + this.devID +" " ;
|
||||
}
|
||||
if(this.devName){
|
||||
qrcodeDATA += "Device name :" + this.devName + " " ;
|
||||
}
|
||||
if(this.invoiceNum){
|
||||
qrcodeDATA += "Invoice Number :" + this.invoiceNum + " ";
|
||||
}
|
||||
if(this.ICCICD){
|
||||
qrcodeDATA += "ICCID :" + this.ICCICD + " " ;
|
||||
}
|
||||
if(this.IMSI){
|
||||
qrcodeDATA += "IMSI :" + this.IMSI + " " ;
|
||||
|
||||
}
|
||||
|
||||
if(this.simNum){
|
||||
qrcodeDATA += "SIM :" + this.simNum + " " ;
|
||||
|
||||
}
|
||||
if(this.CID_No){
|
||||
qrcodeDATA += "CID no :" + this.CID_No + " " ;
|
||||
|
||||
}
|
||||
if(this.typeOfVehicle){
|
||||
qrcodeDATA += "Vehicle:" + this.typeOfVehicle + " " ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if((this.fitmentDate != undefined)&&(this.fitmentDate != '')){
|
||||
var fdate = new Date(this.fitmentDate);
|
||||
var fDate = moment(fdate).format('l');
|
||||
|
||||
qrcodeDATA += "Fitment Date :" + fDate + " " ;
|
||||
|
||||
}
|
||||
if((this.InvoiceDate != undefined)&&(this.InvoiceDate!='')){
|
||||
var iDate = new Date(this.InvoiceDate);
|
||||
var invDate = moment(iDate).format('l');
|
||||
qrcodeDATA += "Invoice Date :" + invDate + " ";
|
||||
|
||||
}
|
||||
|
||||
if((this.vehicleRegDate != undefined)&&(this.vehicleRegDate != "")){
|
||||
console.log("vehRegistration Date =>",this.vehicleRegDate);
|
||||
var vehregD = new Date(this.vehicleRegDate);
|
||||
var vehRegDate = moment(vehregD).format('l');
|
||||
qrcodeDATA += "Reg Date :" + vehRegDate ;
|
||||
}
|
||||
|
||||
// var typeNumber = 4;
|
||||
// var errorCorrectionLevel = 'L';
|
||||
// var qr = qrcode(typeNumber, errorCorrectionLevel);
|
||||
// qr.addData(qrcodeDATA);
|
||||
// qr.make();
|
||||
// this.imgURL = qr.createDataURL();
|
||||
|
||||
|
||||
|
||||
var qr = new QRious();
|
||||
qr.set({
|
||||
// background: 'green',
|
||||
backgroundAlpha: 0.8,
|
||||
// foreground: 'blue',
|
||||
foregroundAlpha: 0.8,
|
||||
level: 'L',
|
||||
padding: 25,
|
||||
size: 500,
|
||||
value: qrcodeDATA
|
||||
});
|
||||
|
||||
|
||||
this.imgURL= qr.toDataURL();
|
||||
|
||||
|
||||
|
||||
}
|
||||
exportAsPdf() {
|
||||
var that=this
|
||||
var name="Installation Certificate "+this.devName?this.devName:"Test"+".pdf"
|
||||
console.log(this.imgURL);
|
||||
var doc = new jsPDF();
|
||||
var specialElementHandlers = {
|
||||
'#editor': function (element: any, renderer: any) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// doc.text("Customer Copy", 110, 12);
|
||||
doc.setFontSize(10);
|
||||
doc.autoTable({
|
||||
theme: 'plain',
|
||||
html: '#testPdf',
|
||||
styles : {
|
||||
cellWidth : 50
|
||||
},
|
||||
willDrawCell: data => {
|
||||
if(data.row.index === 0){
|
||||
data.row.height = 50;
|
||||
data.row.cells[1].styles.halign = 'center';
|
||||
data.row.cells[1].styles.fontSize = 11;
|
||||
// data.row.cells[1].styles.lineHeight= "2.5";
|
||||
// doc.setLineHeightFactor()
|
||||
var img = new Image();
|
||||
img.src = this.supAdmin.imageDoc?this.supAdmin.imageDoc:'';
|
||||
img.crossOrigin="anonymous";
|
||||
if(this.supAdmin.imageDoc){
|
||||
img.onload = function(){
|
||||
console.log("1");
|
||||
doc.addImage(img , 'png', 10, 12,30,30)
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
// doc.addImage(this.supAdmin.imageDoc,'JPEG', 140, 12,40,40);
|
||||
|
||||
doc.addImage(this.imgURL,'JPEG',150, 12,30,30);
|
||||
|
||||
}
|
||||
if(data.row.index ===0){
|
||||
data.row.cells[0].styles.halign = 'center';
|
||||
doc.halign = 'center';
|
||||
doc.setFontStyle('bold');
|
||||
doc.cellPadding=40
|
||||
}
|
||||
|
||||
if((data.row.index ===1) ||(data.row.index ===3) || (data.row.index ===5) || (data.row.index ===7) ||(data.row.index ===8) ||(data.row.index ===11) || (data.row.index ===13)){
|
||||
doc.setFontStyle('bold');
|
||||
|
||||
}
|
||||
if(data.row.index ===7){
|
||||
data.row.height = 45;
|
||||
// data.row.cells[0].styles.halign = 'center';
|
||||
// doc.halign = 'center';
|
||||
}
|
||||
|
||||
if(data.row.index ===13){
|
||||
data.row.height = 25;
|
||||
// data.row.cells[0].styles.halign = 'center';
|
||||
// doc.halign = 'center';
|
||||
}
|
||||
doc.setLineWidth(1);
|
||||
doc.rect(7, 7, 195, 230);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
var myImage = new Image();
|
||||
myImage.src = that.deviceImage[0]?that.deviceImage[0]:this.img1;
|
||||
myImage.crossOrigin="anonymous";
|
||||
|
||||
var myImage1 = new Image();
|
||||
myImage1.src = that.deviceImage[1]?that.deviceImage[1]:this.img1;
|
||||
myImage1.crossOrigin="anonymous";
|
||||
|
||||
var myImage2 = new Image();
|
||||
myImage2.src = that.deviceImage[2]?that.deviceImage[2]:this.img1;
|
||||
myImage2.crossOrigin="anonymous";
|
||||
|
||||
if(that.deviceImage.length==0){
|
||||
doc.save(name);
|
||||
}
|
||||
|
||||
function f1() {
|
||||
return new Promise((resolve, reject) => {
|
||||
myImage.onload = function(){
|
||||
console.log("1");
|
||||
doc.addImage(myImage , 'png', 40, 150, 30, 20);
|
||||
if(that.deviceImage.length==1){
|
||||
doc.save(name);
|
||||
}
|
||||
|
||||
};
|
||||
resolve('');
|
||||
});
|
||||
}
|
||||
|
||||
function f3(){
|
||||
myImage2.onload = function(){
|
||||
console.log("3");
|
||||
|
||||
doc.addImage(myImage2 , 'png', 120, 150, 30, 20);
|
||||
doc.save(name);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
function f2() {
|
||||
return new Promise((resolve, reject) => {
|
||||
myImage1.onload = function(){
|
||||
console.log("2");
|
||||
doc.addImage(myImage1 , 'png', 80, 150, 30, 20);
|
||||
if(that.deviceImage.length==2){
|
||||
doc.save(name);
|
||||
}
|
||||
};
|
||||
resolve('');
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
f1().then(res => f2().then(res1=>f3()));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
toDataURL(url, callback) {
|
||||
console.log(url);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function () {
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function () {
|
||||
callback(reader.result);
|
||||
}
|
||||
reader.readAsDataURL(xhr.response);
|
||||
};
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'blob';
|
||||
xhr.send();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue