From e24269c2a5a2bd1f01933aa9b65be183b812e5fb Mon Sep 17 00:00:00 2001 From: Alex beart Date: Mon, 9 Jan 2023 21:13:37 +0530 Subject: [PATCH 01/10] Replace single get Google address API to Bulk get address API and Create Local cache for address --- src/app/app.component.ts | 2 +- src/app/contact.service.ts | 18 +- .../distance-report.component.ts | 59 +- src/app/location/location.component.ts | 4769 +++++++++-------- .../current-position.component.ts | 173 +- .../day-wise-report.component.ts | 135 +- .../disatance-report.component.ts | 74 +- .../summary-report.component.ts | 117 +- 8 files changed, 2781 insertions(+), 2566 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 8c44076..f85abf2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -112,7 +112,7 @@ console.log(token); } } - this.contactService.dealerInfo(this.url == 'localhost:4200' ?'oneqlik.in':this.url ).subscribe( + this.contactService.dealerInfo(this.url == 'localhost:4200' ?'www.oneqlik.in':this.url ).subscribe( data => { this.userData = data diff --git a/src/app/contact.service.ts b/src/app/contact.service.ts index cc6c38f..5f658a9 100644 --- a/src/app/contact.service.ts +++ b/src/app/contact.service.ts @@ -25,7 +25,7 @@ import { map, take } from 'rxjs/operators'; @Injectable() export class ContactService { totalTicketCount:BehaviorSubject = new BehaviorSubject(10); - +latLongAddress={}; dev_url = environment.hostUrl; dev_url2= environment.hostUrl2 //dev_url = 'http://localhost:3000'; @@ -438,7 +438,7 @@ getCurrentLocation(id,from,to){ getCurrentLocation1(id,from,to,satelite){ if(satelite==undefined){ return this.http.get(this.dev_url + '/gps?id='+id+'&from='+from+'&to='+to) -.map(res => res.json()); + .map(res => res.json()); } else{ return this.http.get(this.dev_url + '/gps?id='+id+'&from='+from+'&to='+to+'&satelite='+satelite) @@ -1637,7 +1637,6 @@ addPOICol(poipayload){ .map(res => res.json()); } - setlanguage(payload){ return this.http.post(this.dev_url +'/users/set_user_setting',payload) .map(res => res.json()); @@ -1650,8 +1649,19 @@ getLanguages(payload){ getAddressByApi(latlng){ + if(this.latLongAddress[latlng.long+'_'+latlng.lat]) { + console.log('get address for cache'); + return Observable.of(this.latLongAddress[latlng.long+'_'+latlng.lat]); + } else { + return this.http.post(this.dev_url +'/googleAddress/getGoogleAddress',latlng) + .map(res => res.json()); + } - return this.http.post(this.dev_url +'/googleAddress/getGoogleAddress',latlng) + +} +getAddressByApiBulk(latlng){ + + return this.http.post(this.dev_url +'/googleAddress/getGoogleAddressBulk',latlng) .map(res => res.json()); } diff --git a/src/app/device-report/distance-report/distance-report.component.ts b/src/app/device-report/distance-report/distance-report.component.ts index 953ae3a..8d0b238 100644 --- a/src/app/device-report/distance-report/distance-report.component.ts +++ b/src/app/device-report/distance-report/distance-report.component.ts @@ -580,25 +580,43 @@ testTable() { if (that.reportArr.length != 0) { var j = 0; var finalArr = []; - for (var i = 0; i < that.reportArr.length; i++) { - - that.clocation_1(that.reportArr[i], function (err, succ) { - if (err) { - console.log(err); - j++; - } else { - finalArr.push(succ); - console.log(finalArr); - j++; - if (j === that.reportArr.length) { - that.Load = false; - callback({ data: finalArr }); - } + + let latLongArray :any[] = []; + that.reportArr.forEach((deData)=>{ + let latLng = { + lat: deData.startLat ? deData.startLat : 0, + long: deData.startLng ? deData.startLng : 0 + } + latLongArray.push(latLng) + }) + + that.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + that.reportArr.forEach((deData,index)=>{ + let latLng = { + lat: deData.startLat ? deData.startLat : 0, + long: deData.startLng ? deData.startLng : 0 } + that.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[index]; + that.clocation_1(deData, function (err, succ) { + if (err) { + console.log(err); + j++; + } else { + finalArr.push(succ); + console.log(finalArr); + j++; + if (j === that.reportArr.length) { + that.Load = false; + callback({ data: finalArr }); + } + } + }) }) - - - } + + }) + + + } else { that.Load = false; that.firstcall=true; @@ -792,13 +810,6 @@ tab:any; long: latlngObj.startLng ? latlngObj.startLng : 0 } - - // if () { - // latLng = { - // lat: 0, - // long: 0 - // } - // } outerThis.contactService.getAddressByApi(latLng).subscribe(res => { if (res.message == "Address not found in databse") { diff --git a/src/app/location/location.component.ts b/src/app/location/location.component.ts index e51ca93..f26ad9b 100644 --- a/src/app/location/location.component.ts +++ b/src/app/location/location.component.ts @@ -26,11 +26,11 @@ import { FormControl } from '@angular/forms'; import { ShoRoutePlanComponent } from './sho-route-plan/sho-route-plan.component'; -declare var jsPDF : any; -declare var html2canvas:any +declare var jsPDF: any; +declare var html2canvas: any declare var swal: any; -declare var ol:any; +declare var ol: any; /* import { Ng4LoadingSpinnerService } from 'ng4-loading-spinner'; */ @@ -49,19 +49,20 @@ declare var RadialGauge: any; }) export class LocationComponent implements OnInit, OnDestroy { @ViewChild(SidemenuFuelComponent) child1: SidemenuFuelComponent; - @ViewChild('main')main:ElementRef; + @ViewChild('main') main: ElementRef; modelChanged: Subject = new Subject(); - area=0; + area = 0; toppings = new FormControl(); - isLastPosition =false; + isLastPosition = false; toppingList: string[] = ['Extra cheese', 'Mushroom', 'Onion', 'Pepperoni', 'Sausage', 'Tomato']; imei + latLongAddress={}; // private fuelComponent: SidemenuFuelComponent; - showLabels:boolean=true; - showAddress:boolean=false; + showLabels: boolean = true; + showAddress: boolean = false; showSocketData: boolean = false; - satelliteDisabled:boolean=false - immobilizeChk:boolean = false; + satelliteDisabled: boolean = false + immobilizeChk: boolean = false; testData: any; reloadCOmponent: boolean; mapWidth: string; @@ -102,12 +103,12 @@ export class LocationComponent implements OnInit, OnDestroy { longitudeInDMS: any; toggleGeofence: (choice: any) => void; toggleGeofence1: (choice: any) => void; - enabletrail:boolean = false; + enabletrail: boolean = false; parkingButtonShow; selectedDevice showHistory: boolean = false; togglePOI: (choice: any) => void; - togglePOI1: (choice: any) => void; + togglePOI1: (choice: any) => void; colorTheme = 'theme-dark-blue'; last_speed: string; DealerID: any; @@ -140,9 +141,9 @@ export class LocationComponent implements OnInit, OnDestroy { navId: String; deviceList: any = []; to: string; - tab_1 : boolean =false; - tab_2:boolean =false; - tab_3:boolean= false; + tab_1: boolean = false; + tab_2: boolean = false; + tab_3: boolean = false; from: string; total_vech: any; idle_vech: any; @@ -150,7 +151,7 @@ export class LocationComponent implements OnInit, OnDestroy { maintanance: any; expiredDevices: any; OutOfReach: any; - totalDevices:any; + totalDevices: any; no_data: any; Running: any; idle_duration: any; @@ -183,36 +184,36 @@ export class LocationComponent implements OnInit, OnDestroy { liveLocationMarkerObj: any; darkModeSwitch: boolean = false; tttttt: any = []; - tabIndexValue: any = "0"; - tempDevInfo: any; - cummulative_Distance: number =0; - token_identifier: string; - contentAdd: string; - historyAdress: any = ''; - gpsDataArr: any; - ext_voltage: any; - seekBarValue: any=200; - sliderValue: number = 0; - indexValue: any; - status_cmdq: any; - intervalTimeOut:any; - immobilizeCount: number; - ImmErrMsg: string; - showErr: boolean =false; - unlocked: boolean =false; - errIcon:boolean=false; - locked: boolean=false; - shoError:any; - private socket_Notify; - dealer_Permission: any; - adbtn: string; - markerArray: any; - satelite=5; - dataSelect2:any; - newArr=[{"value":"1"},{"value":"2"},{"value":"3"},{"value":"4"},{"value":"5"},{"value":"6"},{"value":"7"},{"value":"8"},{"value":"9"}, - {"value":"10"},{"value":"11"},{"value":"12"},{"value":"13"},{"value":"14"},{"value":"15"}] - distanceVariation: any; - digitalInput: any; + tabIndexValue: any = "0"; + tempDevInfo: any; + cummulative_Distance: number = 0; + token_identifier: string; + contentAdd: string; + historyAdress: any = ''; + gpsDataArr: any; + ext_voltage: any; + seekBarValue: any = 200; + sliderValue: number = 0; + indexValue: any; + status_cmdq: any; + intervalTimeOut: any; + immobilizeCount: number; + ImmErrMsg: string; + showErr: boolean = false; + unlocked: boolean = false; + errIcon: boolean = false; + locked: boolean = false; + shoError: any; + private socket_Notify; + dealer_Permission: any; + adbtn: string; + markerArray: any; + satelite = 5; + dataSelect2: any; + newArr = [{ "value": "1" }, { "value": "2" }, { "value": "3" }, { "value": "4" }, { "value": "5" }, { "value": "6" }, { "value": "7" }, { "value": "8" }, { "value": "9" }, + { "value": "10" }, { "value": "11" }, { "value": "12" }, { "value": "13" }, { "value": "14" }, { "value": "15" }] + distanceVariation: any; + digitalInput: any; myaccount() { this.cond = false @@ -226,7 +227,7 @@ export class LocationComponent implements OnInit, OnDestroy { // dialogRef.afterClosed().subscribe(result => { // if(result == "succ"){ - // console.log("Updated") + // console.log("Updated") // } // }); @@ -235,15 +236,15 @@ export class LocationComponent implements OnInit, OnDestroy { filterStates1(val) { // console.log("===>",val) if (val) { - const filterValue: any = val ; 1 + const filterValue: any = val; 1 this.dataSelect2 = this.newArr.filter(function (d) { - // console.log("inside Search Method=>",d); - return d.value.toLocaleLowerCase().indexOf(filterValue.toLocaleLowerCase())>-1; + // console.log("inside Search Method=>",d); + return d.value.toLocaleLowerCase().indexOf(filterValue.toLocaleLowerCase()) > -1; }); - if(this.dataSelect2.length!=0){ - this.satelite=val - // console.log("searched model=>",this.dataSelect2,"----------",this.satelite); - } + if (this.dataSelect2.length != 0) { + this.satelite = val + // console.log("searched model=>",this.dataSelect2,"----------",this.satelite); + } return this.dataSelect2; } } @@ -328,7 +329,7 @@ export class LocationComponent implements OnInit, OnDestroy { else if (divid == "shrlcnd") { this.data_descip = "Please Select any Device"; launch_toast(); - }else if(divid === 'added'){ + } else if (divid === 'added') { this.data_descip = "Device added"; launch_toast(); } @@ -805,7 +806,7 @@ export class LocationComponent implements OnInit, OnDestroy { deviceToTrack = [] live(b) { // console.log(b); - + this.mappp = true; this.MapLoad = true; this.historyData = false @@ -832,18 +833,18 @@ export class LocationComponent implements OnInit, OnDestroy { // } // console.log('devId=>',devId); if (devId) { - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("11111111111111"); - + this.livetrack(devId); } - + } else { - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("111111111112222"); this.livetrack(null); } - + } } cancells() { @@ -859,8 +860,8 @@ export class LocationComponent implements OnInit, OnDestroy { //Main Declaration of LiveTrack Function ********************* livetrack(a) { // console.log("ID==========",a); - this.markerArray=[]; - var count =0 ; + this.markerArray = []; + var count = 0; var that = this; this.SpeedMeter2 = false this.PlayData = false; @@ -882,7 +883,7 @@ export class LocationComponent implements OnInit, OnDestroy { this.socket.removeAllListeners(this.deviceToTrack[e]) } this.deviceToTrack = []; - + for (let i = 0; i < this.foods.length; i++) { if (this.foods[i].deviceType == "Tracker") { @@ -938,7 +939,7 @@ export class LocationComponent implements OnInit, OnDestroy { let flag2; let locations = [] // =============== ~animation functions ===================== - + var carIcon = { // path: car, url: '/assets/images/liveTrackIcons/rcar.png', @@ -1000,7 +1001,7 @@ export class LocationComponent implements OnInit, OnDestroy { strokeColor: 'white', strokeWeight: .10, fillOpacity: 1, - fillColor: 'blue', + fillColor: 'blue', //fillColor: '#b75656', offset: '5%', // rotation: parseInt(heading[i]), @@ -1115,16 +1116,16 @@ export class LocationComponent implements OnInit, OnDestroy { "tractor": tractorIcon, "bus": busIcon, "user": userIcon, - "jcb" : jcbIcon, - "ambulance" : ambulanceIcon - + "jcb": jcbIcon, + "ambulance": ambulanceIcon + } // console.log('deviceListdeviceListdeviceListdeviceList',this.deviceToTrack); this.flightPathArr = []; this.tttttt = []; - var tempTimeInterval:any; + var tempTimeInterval: any; // console.log("Runnig ON Change"); @@ -1144,7 +1145,7 @@ export class LocationComponent implements OnInit, OnDestroy { } } - + for (var x = 0; x < this.deviceToTrack.length; x++) { var newChannel = this.deviceToTrack[x].toString(); var date = new Date().setHours(0, 0, 0, 0) @@ -1152,39 +1153,39 @@ export class LocationComponent implements OnInit, OnDestroy { this.socket.emit('initLive', newChannel, date); //console.log("newChannel",newChannel,"date",date); - + } - + var r function channelListener(newChannel) { return function (msg, initData, deviceInfo) { - + outerThis.tempDevInfo = {}; - outerThis.flightPathArr.push({ lat: msg.latDecimal, lng: msg.longDecimal }); - if(outerThis.enabletrail == true){ + outerThis.flightPathArr.push({ lat: msg.latDecimal, lng: msg.longDecimal }); + if (outerThis.enabletrail == true) { outerThis.draw_flight_trail(outerThis.flightPathArr); } - - // console.log('device object coming from service',outerThis.deviceList) + + // console.log('device object coming from service',outerThis.deviceList) // if((a != null) && (a != undefined)&&(outerThis.navId != 'locationComponent')){ // if (deviceInfo.status != 'RUNNING') { // outerThis.addressConversion(msg); // } - + // }else{ - // console.log('no address api call'); + // console.log('no address api call'); // } // console.log('outerThis.deviceList',outerThis.deviceList); outerThis.deviceList.filter(function (dd, index) { - - if(dd.Device_ID === deviceInfo.Device_ID){ - deviceInfo['checked'] = dd.checked; - } + + if (dd.Device_ID === deviceInfo.Device_ID) { + deviceInfo['checked'] = dd.checked; + } }) // console.log('1345678909876543267898765432345676543=>',deviceInfo.checked); - + if (outerThis.deviceToTrack.length == 1) { outerThis.deviceList.filter(function (colHilight, i) { outerThis.deviceList[i]['playPause'] = true; @@ -1202,33 +1203,33 @@ export class LocationComponent implements OnInit, OnDestroy { if (msg.speed) { outerThis.deviceList[i].last_speed = msg.speed; } - - + + if (outerThis.currentPage === 1) { outerThis.showSocketData = true; // console.log({"colHilight=>":colHilight}); - + // console.log({"msg=>":msg}); outerThis.showSocketData = true; // date satellites ignition port - if(msg.date== undefined){ + if (msg.date == undefined) { msg['date'] = colHilight.last_ping_on } - if(msg.satellites == undefined){ + if (msg.satellites == undefined) { msg['satellites'] = colHilight.satellites } - if(msg.ignition == undefined){ - msg['ignition'] = colHilight.last_ACC ; + if (msg.ignition == undefined) { + msg['ignition'] = colHilight.last_ACC; } - if(msg.port == undefined){ - msg['port'] = colHilight.port ; + if (msg.port == undefined) { + msg['port'] = colHilight.port; } - + outerThis.socketData = msg; outerThis.getSystemLogs(colHilight); outerThis.deviceCQ(colHilight); @@ -1239,31 +1240,32 @@ export class LocationComponent implements OnInit, OnDestroy { } }) - + } this.lat = deviceInfo.last_loc ? deviceInfo.last_loc.coordinates[1] : null; this.lng = deviceInfo.last_loc ? deviceInfo.last_loc.coordinates[0] : null; - + r = 0 if (coords[newChannel] === null || coords[newChannel] === undefined) coords[newChannel] = []; outerThis.mainmap = true; if (initData == 'ping' || (initData == 'initPing' && coords[newChannel].length == 0)) { // console.log('deviceInfo=>',deviceInfo); // addressConversion====================================================== - if(outerThis.navId != 'locationComponent'){ - outerThis.liveAdd =''; - outerThis.tempDevInfo = deviceInfo ; - - let d_lat = msg.latDecimal?msg.latDecimal : deviceInfo.last_loc ? deviceInfo.last_loc.coordinates[1] : null; - let d_lng = msg.longDecimal?msg.longDecimal : deviceInfo.last_loc ? deviceInfo.last_loc.coordinates[0] : null; - + if (outerThis.navId != 'locationComponent') { + outerThis.liveAdd = ''; + outerThis.tempDevInfo = deviceInfo; + + let d_lat = msg.latDecimal ? msg.latDecimal : deviceInfo.last_loc ? deviceInfo.last_loc.coordinates[1] : null; + let d_lng = msg.longDecimal ? msg.longDecimal : deviceInfo.last_loc ? deviceInfo.last_loc.coordinates[0] : null; + var latlng_1 = { "lat": d_lat, - "long": d_lng + "long": d_lng } - outerThis.contactService.getAddressByApi(latlng_1).subscribe(res=>{ - if(res.message == "Address not found in databse"){ + + outerThis.contactService.getAddressByApi(latlng_1).subscribe(res => { + if (res.message == "Address not found in databse") { let geocoder = new google.maps.Geocoder(); let t_latlng = new google.maps.LatLng(d_lat, d_lng); @@ -1275,29 +1277,29 @@ export class LocationComponent implements OnInit, OnDestroy { if (data[0] != null) { outerThis.liveAdd = data[0].formatted_address; // console.log(outerThis.liveAdd); - outerThis.saveAddress(d_lat, d_lng,outerThis.liveAdd) + outerThis.saveAddress(d_lat, d_lng, outerThis.liveAdd) } else { // console.log("No address available") outerThis.liveAdd = "No address available"; } } else { - + outerThis.liveAdd = 'NA'; - - + + } - + }) - }else{ - + } else { + outerThis.liveAdd = res.address; } // console.log("ADDRESS---->",outerThis.liveAdd); - + }) } - + // addressConversion========================================================= this.latLongArr = []; @@ -1308,13 +1310,13 @@ export class LocationComponent implements OnInit, OnDestroy { } outerThis.MapLoad = false outerThis.test_Data = msg.currentFuel; - + var x = msg.speed; const heading = parseFloat(msg.heading); const message = 'IMEI: ' + msg.imei + ' Speed: ' + msg.speed + 'Km/hr'; if (msg.interpolated == null || msg.interpolated === undefined) { - + this.lat = msg.latDecimal; this.lng = msg.longDecimal; // console.log("lat long= >",this.lat,this.lng); @@ -1325,28 +1327,28 @@ export class LocationComponent implements OnInit, OnDestroy { did: msg.imei } - if((a != null) && (a != undefined)&&(outerThis.navId != 'locationComponent')){ + if ((a != null) && (a != undefined) && (outerThis.navId != 'locationComponent')) { var geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(msg.latDecimal, msg.longDecimal); - + } - + var request = { latLng: latlng }; - - var latlng_1 = - { - "lat": msg.latDecimal, - "long": msg.longDecimal - } - - + var latlng_1 = + { + "lat": msg.latDecimal, + "long": msg.longDecimal + } + + + //address function end here } else { - + for (let k = 0; k < msg.interpolated.length; k++) { if (msg.interpolated[k].location.latitude == null || msg.interpolated[k].location.longitude == null) { // console.log("Lattitude Longitude if location.lattitude is null=>",msg.interpolated[k].location.latitude,msg.interpolated[k].location.longitude); @@ -1375,7 +1377,7 @@ export class LocationComponent implements OnInit, OnDestroy { // converting Address - + var geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(msg.latDecimal, msg.longDecimal); @@ -1385,73 +1387,73 @@ export class LocationComponent implements OnInit, OnDestroy { - + var latlng_1 = { "lat": msg.latDecimal, - "long": msg.longDecimal + "long": msg.longDecimal } // if((a != null) && (a != undefined) &&(outerThis.navId != 'locationComponent')){ // outerThis.contactService.getAddressByApi(latlng_1).subscribe(res=>{ - + // if(res.message == "Address not found in databse"){ // geocoder.geocode(request, function (data, status) { // if (status == google.maps.GeocoderStatus.OK) { // if (data[0] != null) { // outerThis.liveAdd = data[0].formatted_address; - console.log(outerThis.liveAdd); + console.log(outerThis.liveAdd); // outerThis.saveAddress(msg.latDecimal, msg.longDecimal,outerThis.liveAdd) // } else { - console.log("No address available") + console.log("No address available") // outerThis.liveAdd = "No address available"; // } // } // else { - + // outerThis.liveAdd = 'NA'; - - + + // } - + // }) // }else{ - + // outerThis.liveAdd = res.address; // } // }) // } - - + + //address function end here } } - + var boxCheck = deviceInfo.checked; // that.socketData=deviceInfo; // console.log('checkbox value coming from =>',deviceInfo,boxCheck); if (!isMapInit) { - - initialize(this.lat, this.lng, newChannel); - - + + initialize(this.lat, this.lng, newChannel); + + } // console.log(boxCheck); - - if(boxCheck === true){ - initializeMarker(that.elementRef, this.lat, this.lng, newChannel, deviceInfo.Device_Name, deviceInfo.status, deviceInfo.status_updated_at, deviceInfo.last_ping_on, msg, initData, deviceInfo.iconType, deviceInfo); - } - - + + if (boxCheck === true) { + initializeMarker(that.elementRef, this.lat, this.lng, newChannel, deviceInfo.Device_Name, deviceInfo.status, deviceInfo.status_updated_at, deviceInfo.last_ping_on, msg, initData, deviceInfo.iconType, deviceInfo); + } + + if ((initData == 'ping') || (status == 'RUNNING')) { - if(boxCheck === true){ + if (boxCheck === true) { animateMarker(that.elementRef, marker, speed, heading, true, newChannel, deviceInfo.Device_Name, deviceInfo.status, deviceInfo.status_updated_at, deviceInfo.last_ping_on, msg, initData, deviceInfo.iconType, deviceInfo); } - + } flag = false; } @@ -1467,7 +1469,7 @@ export class LocationComponent implements OnInit, OnDestroy { // console.log('lastPingOn=>',_devInfo.last_ping_on) - + // console.log('statusstatusstatusstatusstatus=>', status); var deviceSpeed = (status == 'STOPPED') ? 0 : msg.speed; @@ -1542,12 +1544,12 @@ export class LocationComponent implements OnInit, OnDestroy { var lastLat = _devInfo.last_location.lat; var lastlong = _devInfo.last_location.long; // console.log("INDDDDDDDDDDDDDDDDDDDDDDDDDDDDEH"); - + contentString = '
' + - '
'+ - '' + + '
' + + '' + '

' + deviceName + '

' + - '
'+ + '
' + '
' + '
' + "Last updated" + @@ -1577,7 +1579,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Name" + '
' + '
' + - '

' + (outerThis.DriverName?outerThis.DriverName:'NA') + '

' + + '

' + (outerThis.DriverName ? outerThis.DriverName : 'NA') + '

' + '
' + '
' + '
' + @@ -1585,7 +1587,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Number" + '
' + '
' + - '

' + (outerThis.DriverNumber?outerThis.DriverNumber:'NA') + '

' + + '

' + (outerThis.DriverNumber ? outerThis.DriverNumber : 'NA') + '

' + '
' + '
' + '
' + @@ -1603,8 +1605,8 @@ export class LocationComponent implements OnInit, OnDestroy { '
' + '

' + deviceData + '

' + '
' + - '
' - + '' + } else if (initData == 'ping') { @@ -1614,10 +1616,10 @@ export class LocationComponent implements OnInit, OnDestroy { var lastlong = _devInfo.last_location.long; contentString = "" contentString = '
' + - '
'+ - '' + - '

' + deviceName + '

' + - '
'+ + '
' + + '' + + '

' + deviceName + '

' + + '
' + '
' + '
' + "Last updated" + @@ -1647,7 +1649,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Name" + '
' + '
' + - '

' + ( outerThis.DriverName?outerThis.DriverName:'NA') + '

' + + '

' + (outerThis.DriverName ? outerThis.DriverName : 'NA') + '

' + '
' + '
' + '
' + @@ -1655,7 +1657,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Number" + '
' + '
' + - '

' + (outerThis.DriverNumber?outerThis.DriverNumber:'NA') + '

' + + '

' + (outerThis.DriverNumber ? outerThis.DriverNumber : 'NA') + '

' + '
' + '
' + '
' + @@ -1673,9 +1675,9 @@ export class LocationComponent implements OnInit, OnDestroy { '
' + '

' + deviceData + '

' + '
' + - '
' - // '' + - // '' + '' + // '' + + // '' // '
Device : ' // + deviceName + ' (' + device + ')

Last Updated : ' @@ -1687,13 +1689,13 @@ export class LocationComponent implements OnInit, OnDestroy { // + '

' } - + marker[device]['infowindow'].setContent(contentString); // console.log("Inside Infowindow"); - + function goToPoint() { // console.log("Inside function!!!") - + let lat = marker[device].position.lat(); let lng = marker[device].position.lng(); // tslint:disable-next-line:prefer-const @@ -1731,53 +1733,53 @@ export class LocationComponent implements OnInit, OnDestroy { function moveMarker() { // console.log("deltaLat",deltaLat,"deltaLng",deltaLng); - + lat += deltaLat; lng += deltaLng; - + i += step; let markerDOM: any; var liveSpeed = parseInt(msg.speed); if (i < distance) { - + if (status == "OUT OF REACH") { // icons[iconType].url = '/assets/images/liveTrackIcons/outofreach_car.png'; icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - } else if (status == "STOPPED") { - if(liveSpeed >= 1){ + } else if (status == "STOPPED") { + if (liveSpeed >= 1) { icons[iconType].url = "/assets/images/liveTrackIcons/running_car.png"; - markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - }else{ + markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); + } else { icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); } - + } else if (status == "RUNNING") { icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - } else if (status == "NO DATA") { + } else if (status == "NO DATA") { icons[iconType].url = "/assets/image/no_data.png"; - markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); + markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); } else if (status == "IDLING") { - - if(liveSpeed >= 1){ + + if (liveSpeed >= 1) { icons[iconType].url = "/assets/images/liveTrackIcons/running_car.png"; markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - }else{ + } else { icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); } - + } - + // console.log(msg.ignition, ) // _devInfo var head = google.maps.geometry.spherical.computeHeading(marker[device].getPosition(), new google.maps.LatLng(lat, lng)); // console.log("HEAD__===",head,"Marker==>",marker[device].getPosition(),"LAT LONG=>",new google.maps.LatLng(lat, lng),"==>",lat,lng); - + if ((head != 0) || (head == NaN)) { // icons[iconType].rotation = head; if (markerDOM) { @@ -1815,31 +1817,31 @@ export class LocationComponent implements OnInit, OnDestroy { // icons[iconType].url = '/assets/images/liveTrackIcons/outofreach_car.png'; icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - } else if (status == "STOPPED") { - if(liveSpeed >= 1){ + } else if (status == "STOPPED") { + if (liveSpeed >= 1) { icons[iconType].url = "/assets/images/liveTrackIcons/running_car.png"; markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - }else{ + } else { icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); } - + } else if (status == "RUNNING") { // icons[iconType].url = "/assets/images/liveTrackIcons/running_car.png"; icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - } else if (status == "NO DATA") { + } else if (status == "NO DATA") { icons[iconType].url = "/assets/image/no_data.png"; - markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - }else if (status == "IDLING") { - if(liveSpeed >= 1){ + markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); + } else if (status == "IDLING") { + if (liveSpeed >= 1) { icons[iconType].url = "/assets/images/liveTrackIcons/running_car.png"; markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - }else{ - icons[iconType].url = that.iconSelector(status, iconType, msg); - markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); + } else { + icons[iconType].url = that.iconSelector(status, iconType, msg); + markerDOM = elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); } - + } // ========================= commented on 1-4-2019 ================================ // console.log('STATUS2==>',status); @@ -1854,7 +1856,7 @@ export class LocationComponent implements OnInit, OnDestroy { // } // ========================= commented on 1-4-2019 ================================ - + var head = google.maps.geometry.spherical.computeHeading(marker[device].getPosition(), dest) // console.log("head : " + marker[device].getPosition() + ',' + dest) if ((head != 0) || (head == NaN)) { @@ -1910,36 +1912,38 @@ export class LocationComponent implements OnInit, OnDestroy { function initialize(lat, long, device) { // initialize: (lat, long, device)=> { - if(outerThis.showAddress){ + if (outerThis.showAddress) { // console.log("!isMapInit=______________________________________________________________________________________-----------",isMapInit); var latlng_1 = - { - "lat": lat, - "long": long - } - outerThis.contactService.getAddressByApi(latlng_1).subscribe(res=>{ - if(res.message == "Address not found in databse"){ - let geocoder = new google.maps.Geocoder(); - let t_latlng = new google.maps.LatLng(lat, long); - - let request = { - latLng: t_latlng - }; - geocoder.geocode(request, function (data, status) { - if (status == google.maps.GeocoderStatus.OK) { - if (data[0] != null) { - outerThis.liveAdd = data[0].formatted_address; - }else{ - outerThis.liveAdd ="N/A" - } - } - }) - }else{ - outerThis.liveAdd= res.address; - } - outerThis.showAddress=false - }) + { + "lat": lat, + "long": long + } + // on socket call + + outerThis.contactService.getAddressByApi(latlng_1).subscribe(res => { + if (res.message == "Address not found in databse") { + let geocoder = new google.maps.Geocoder(); + let t_latlng = new google.maps.LatLng(lat, long); + + let request = { + latLng: t_latlng + }; + geocoder.geocode(request, function (data, status) { + if (status == google.maps.GeocoderStatus.OK) { + if (data[0] != null) { + outerThis.liveAdd = data[0].formatted_address; + } else { + outerThis.liveAdd = "N/A" + } + } + }) + } else { + outerThis.liveAdd = res.address; + } + outerThis.showAddress = false + }) } // console.log("Lattitude Longitude", lat ,long,device,outerThis.liveAdd); @@ -2106,9 +2110,9 @@ export class LocationComponent implements OnInit, OnDestroy { map.setZoom(parseInt(this.value)); } - - - + + + google.maps.event.addListener(map, 'zoom_changed', function (event) { // console.log("event" + event); @@ -2262,7 +2266,7 @@ export class LocationComponent implements OnInit, OnDestroy { }); allSourceDestinationMarkers.push(marker); // console.log(allSourceDestinationMarkers); - + var destinationIcon = "http://www.googlemapsmarkers.com/v1/D/" + "FF3300" + "/FFFFFF/000000/ ";//colorForPath var pinImage1 = new google.maps.MarkerImage(destinationIcon); @@ -2337,7 +2341,7 @@ export class LocationComponent implements OnInit, OnDestroy { "lng": pois[i].poi.location.coordinates[0] }); - var poiIcon="/assets/images/liveTrackIcons/building.jpg" + var poiIcon = "/assets/images/liveTrackIcons/building.jpg" // var poiIcon="https://img.icons8.com/ios-filled/50/000000/building-with-rooftop-terrace.png" // building.jpeg // var poiIcon = "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"; @@ -2352,35 +2356,35 @@ export class LocationComponent implements OnInit, OnDestroy { poiMarkers.push(marker); var infobox_numberPlate = new InfoBox({ - content: "
" + pois[i].poi.poiname + "
", - disableAutoPan: false, - maxWidth: 150, - alignBottom: true, - pixelOffset: new google.maps.Size(-25, -20), - zIndex: null, - boxStyle: { - opacity: 1, - zIndex: 999, - width: "auto", - padding: "2px" - }, - closeBoxURL: "", - infoBoxClearance: new google.maps.Size(1, 1) - }); + content: "
" + pois[i].poi.poiname + "
", + disableAutoPan: false, + maxWidth: 150, + alignBottom: true, + pixelOffset: new google.maps.Size(-25, -20), + zIndex: null, + boxStyle: { + opacity: 1, + zIndex: 999, + width: "auto", + padding: "2px" + }, + closeBoxURL: "", + infoBoxClearance: new google.maps.Size(1, 1) + }); - infobox_numberPlate.open(map, marker); + infobox_numberPlate.open(map, marker); - // var infoWindow = new google.maps.InfoWindow; + // var infoWindow = new google.maps.InfoWindow; - - // var contentString = ''+pois[i].poi.poiname+'' - // infoWindow.setContent(contentString); - // infoWindow.setPosition(poiData[0]); - // infoWindow.open(map); + // var contentString = ''+pois[i].poi.poiname+'' + // infoWindow.setContent(contentString); + // infoWindow.setPosition(poiData[0]); + + // infoWindow.open(map); } @@ -2396,8 +2400,8 @@ export class LocationComponent implements OnInit, OnDestroy { function initializeMarker(elementRef, lat, long, device, deviceName, status, since, lastUpdatedTime, msg, initData, iconType, _devInfo) { // console.log("Initialize marker called"); // console.log("Vehicle Speed",msg.speed); - - + + outerThis.latToPass = lat; outerThis.longToPass = long; @@ -2409,37 +2413,37 @@ export class LocationComponent implements OnInit, OnDestroy { // if((a != null) && (a != undefined)&&(outerThis.navId != 'locationComponent')){ // var geocoder = new google.maps.Geocoder(); // var latlng = new google.maps.LatLng(lat, long); - + // var request = { // latLng: latlng // }; - console.log("staticLatLongVal", lat, long) - - + console.log("staticLatLongVal", lat, long) + + // geocoder.geocode(request, function (data, status) { - + // if (status == google.maps.GeocoderStatus.OK) { // if (data[0] != null) { // liveAddress = data[0].formatted_address; // var add = liveAddress; - + // } else { - + // liveAddress = "No address available"; // } // } // else { - + // liveAddress = 'static address'; - - + + // } - + // }) // } - - + + // ======================================Converting Address============================================================== @@ -2505,8 +2509,8 @@ export class LocationComponent implements OnInit, OnDestroy { } - // console.log(marker[device]); - // console.log(marker); + // console.log(marker[device]); + // console.log(marker); if (marker[device] == null || marker[device] == undefined) { // var lastPing = new Date(_devInfo.last_ping_on).getTime(); @@ -2537,30 +2541,30 @@ export class LocationComponent implements OnInit, OnDestroy { if ((icons[iconType] != null) || (icons[iconType] != undefined)) { if (status == "OUT OF REACH") { icons[iconType].url = that.iconSelector(status, iconType, msg); - - + + // markerDOM = elementRef.nativeElement.querySelector("img[src='/assets/images/liveTrackIcons/outofreach_car.png']"); } else if (status == "STOPPED") { - - icons[iconType].url = that.iconSelector(status, iconType, msg); - - - + + icons[iconType].url = that.iconSelector(status, iconType, msg); + + + // markerDOM = elementRef.nativeElement.querySelector("img[src='/assets/images/liveTrackIcons/stopped_car.png']"); } else if (status == "RUNNING") { icons[iconType].url = that.iconSelector(status, iconType, msg); - - + + // markerDOM = elementRef.nativeElement.querySelector("img[src='/assets/images/liveTrackIcons/running_car.png']"); } else if (status == "NO DATA") { icons[iconType].url = that.iconSelector(status, iconType, msg); - - + + // markerDOM = elementRef.nativeElement.querySelector("img[src='/assets/images/liveTrackIcons/running_car.png']"); } else if (status == "IDLING") { - icons[iconType].url = that.iconSelector(status, iconType, msg); - - + icons[iconType].url = that.iconSelector(status, iconType, msg); + + // markerDOM = elementRef.nativeElement.querySelector("img[src='/assets/images/liveTrackIcons/idle_car.png']"); } } @@ -2580,7 +2584,7 @@ export class LocationComponent implements OnInit, OnDestroy { var m = new google.maps.Marker({ position: new google.maps.LatLng(lat, long), map: map, - icon: icons[iconType], + icon: icons[iconType], }); @@ -2593,28 +2597,28 @@ export class LocationComponent implements OnInit, OnDestroy { // } // outerThis.markerArray.push(mtemp); // console.log('marker Temp array=>',outerThis.markerArray); - + // var sec_last_lat = _devInfo.sec_last_location?_devInfo.sec_last_location.lat:null; // var sec_last_lng = _devInfo.sec_last_location?_devInfo.sec_last_location.long:null; - var Initial_head = _devInfo?parseFloat(_devInfo.heading) : 0; + var Initial_head = _devInfo ? parseFloat(_devInfo.heading) : 0; // var Initial_head = google.maps.geometry.spherical.computeHeading(new google.maps.LatLng(sec_last_lat,sec_last_lng),new google.maps.LatLng(lat,long)); // console.log('Initial_head',Initial_head); - - if(count == 0){ + + if (count == 0) { var marker_init = setTimeout(function () { - var markerDOM_temp = that.elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - if(markerDOM_temp){ + var markerDOM_temp = that.elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); + if (markerDOM_temp) { markerDOM_temp.style.transform = 'rotate(' + Initial_head + 'deg)'; - count = 1 ; + count = 1; clearTimeout(marker_init); - } - - }, 2000) + } + + }, 2000) } - var infobox_numberPlate - if( outerThis.showLabels){ + var infobox_numberPlate + if (outerThis.showLabels) { // console.log("HOWWWWWWWWWWW"); - + infobox_numberPlate = new InfoBox({ content: "
" + deviceName + "
", disableAutoPan: false, @@ -2632,10 +2636,10 @@ export class LocationComponent implements OnInit, OnDestroy { infoBoxClearance: new google.maps.Size(1, 1) }); - }else{ + } else { // console.log("NHOWWWWWWWWWWW"); infobox_numberPlate = new InfoBox({ - content:'', + content: '', disableAutoPan: false, maxWidth: 150, alignBottom: true, @@ -2664,7 +2668,7 @@ export class LocationComponent implements OnInit, OnDestroy { } else { gsm_signal = _devInfo.gsmSignal; } - + @@ -2672,10 +2676,10 @@ export class LocationComponent implements OnInit, OnDestroy { var contentString = '' if (initData == 'initPing') { contentString = '
' + - '
'+ - ''+ - '

' + deviceName + '

' + - '
'+ + '
' + + '' + + '

' + deviceName + '

' + + '
' + '
' + '
' + "Last updated" + @@ -2705,7 +2709,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Name" + '
' + '
' + - '

' + (outerThis.DriverName?outerThis.DriverName:'NA') + '

' + + '

' + (outerThis.DriverName ? outerThis.DriverName : 'NA') + '

' + '
' + '
' + '
' + @@ -2713,7 +2717,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Number" + '
' + '
' + - '

' + (outerThis.DriverNumber?outerThis.DriverNumber:'NA') + '

' + + '

' + (outerThis.DriverNumber ? outerThis.DriverNumber : 'NA') + '

' + '
' + '
' + '
' + @@ -2731,14 +2735,14 @@ export class LocationComponent implements OnInit, OnDestroy { '
' + '

' + deviceData + '

' + '
' + - '
' - - // '
'+ - // '
'+ - // '

'+'StreetView Content'+'

'+ - // +'
' + '
' - // '' + // '
'+ + // '
'+ + // '

'+'StreetView Content'+'

'+ + // +'
' + + // '' } else if (initData == 'ping') { @@ -2746,10 +2750,10 @@ export class LocationComponent implements OnInit, OnDestroy { outerThis.last_speed = msg.speed; contentString = '' contentString = '
' + - '
'+ - ''+ - '

' + deviceName + '

' + - '
'+ + '
' + + '' + + '

' + deviceName + '

' + + '
' + '
' + '
' + "Last updated" + @@ -2779,7 +2783,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Name" + '
' + '
' + - '

' + (outerThis.DriverName?outerThis.DriverName:'NA') + '

' + + '

' + (outerThis.DriverName ? outerThis.DriverName : 'NA') + '

' + '
' + '
' + '
' + @@ -2787,7 +2791,7 @@ export class LocationComponent implements OnInit, OnDestroy { "Driver's Number" + '
' + '
' + - '

' + (outerThis.DriverNumber?outerThis.DriverNumber:'NA') + '

' + + '

' + (outerThis.DriverNumber ? outerThis.DriverNumber : 'NA') + '

' + '
' + '
' + '
' + @@ -2805,14 +2809,14 @@ export class LocationComponent implements OnInit, OnDestroy { '
' + '

' + deviceData + '

' + '
' + - '
' - - // '
'+ - // '
'+ - // '

'+'StreetView Content'+'

'+ - // +'
' + '' - // '' + // '
'+ + // '
'+ + // '

'+'StreetView Content'+'

'+ + // +'
' + + // '' } @@ -2821,7 +2825,7 @@ export class LocationComponent implements OnInit, OnDestroy { var myOptions = { content: contentString , disableAutoPan: false - + , maxWidth: 0 , pixelOffset: new google.maps.Size(-18, -25) , zIndex: null @@ -2842,22 +2846,22 @@ export class LocationComponent implements OnInit, OnDestroy { , alignBottom: true }; m['infowindow'] = new InfoBox(myOptions); - // console.log("Infowindow card",m); + // console.log("Infowindow card",m); var mtemp = { - marker : m, + marker: m, imei: _devInfo.Device_ID, - icon :icons[iconType], + icon: icons[iconType], lat: lat, - lng:long, - infowindow : new InfoBox(myOptions), - number_plate : infobox_numberPlate + lng: long, + infowindow: new InfoBox(myOptions), + number_plate: infobox_numberPlate } outerThis.markerArray.push(mtemp); google.maps.event.addListener(m, 'click', function () { // console.log('Opening Infow window',m); // { lat: , lng: } - var fenway = { lat: m.position.lat(), lng: m.position.lng() }; + var fenway = { lat: m.position.lat(), lng: m.position.lng() }; // console.log("latlnglitrals",m.position.lat(),m.position.lng()); // console.log(fenway); var panorama = new google.maps.StreetViewPanorama( @@ -2870,7 +2874,7 @@ export class LocationComponent implements OnInit, OnDestroy { } } ); - map.setStreetView(panorama); + map.setStreetView(panorama); // console.log('111111111111111111111111111111111111111111111111111=>',this) this['infowindow'].open(map, this); }); @@ -2880,11 +2884,11 @@ export class LocationComponent implements OnInit, OnDestroy { } // console.log(locations) var z = locations - } - - // this.togglePOI(true); - - } + } + + // this.togglePOI(true); + + } flightPathArr: any = []; isTraffic: boolean = false; mapTypeId: any = "roadmap"; @@ -2918,7 +2922,7 @@ export class LocationComponent implements OnInit, OnDestroy { enablePOIComponent = false; toggleMapComponents(option) { - if(this.showHistory){ + if (this.showHistory) { if (option == "route")//route,pointofinterest,geofencing { this.routeDetails1(this.useridd, !this.enableRouteComponent); @@ -2932,7 +2936,7 @@ export class LocationComponent implements OnInit, OnDestroy { } - }else{ + } else { if (option == "route")//route,pointofinterest,geofencing { this.routeDetails(this.useridd, !this.enableRouteComponent); @@ -3100,7 +3104,7 @@ export class LocationComponent implements OnInit, OnDestroy { //this.speed = 200 var iconselected = this.devicon var delay = 100; - + var carIcon = { // path: car, @@ -3229,7 +3233,7 @@ export class LocationComponent implements OnInit, OnDestroy { "tractor": tractorIcon, "bus": busIcon, "user": userIcon, - "ambulance":ambulance + "ambulance": ambulance } var that = this; @@ -3243,24 +3247,24 @@ export class LocationComponent implements OnInit, OnDestroy { // } // this.rangeDetector=false; var km_h = km_h || 50; - + if (!startPos.length) coords.push([startPos[0], startPos[1]]); that.goToPoint = function () { // console.log("Go to point function"); - if(that.rangeDetector === true){ - a= that.indexValue; - target = that.indexValue; + if (that.rangeDetector === true) { + a = that.indexValue; + target = that.indexValue; that.sliderValue = that.indexValue; } var lat = marker.position.lat(); var lng = marker.position.lng(); - that.getAddress(lat,lng); - - if(km_h === 0){ - km_h = 200 ; + that.getAddress(lat, lng); + + if (km_h === 0) { + km_h = 200; } var step = (km_h * 1000 * delay) / 3600000; // in meters var dest = new google.maps.LatLng( @@ -3277,7 +3281,7 @@ export class LocationComponent implements OnInit, OnDestroy { var distance = google.maps.geometry.spherical.computeDistanceBetween(dest, marker.position); // in meters var numStep = distance / step; - + var i = 0; var deltaLat = (coords[target][0] - lat) / numStep; var deltaLng = (coords[target][1] - lng) / numStep; @@ -3286,15 +3290,15 @@ export class LocationComponent implements OnInit, OnDestroy { // console.log("Move Marker Function"); // console.log('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz',a,target); // ye wala movemarker function h - outerThis.sliderValue = a; - outerThis.cummulative_Distance = coords[target][3] ; + outerThis.sliderValue = a; + outerThis.cummulative_Distance = coords[target][3]; lat += deltaLat; lng += deltaLng; i += step; // console.log('icons[iconselected].rotation',icons[iconselected].rotation); let markerDOM: any; var status = "RUNNING"; - + if (i < distance) { // let iconType = 'car'; // console.log('iconsiconsiconsiconsiconsicons',icons); @@ -3306,34 +3310,34 @@ export class LocationComponent implements OnInit, OnDestroy { icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = that.elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); // console.log('markerDOM',markerDOM); - + var head = google.maps.geometry.spherical.computeHeading(marker.getPosition(), new google.maps.LatLng(lat, lng)); - + // console.log('head',head); - + // if (head != 0) { - // icons[iconselected].rotation = head - - if (markerDOM) { - markerDOM.style.transform = 'rotate(' + head + 'deg)'; - } + // icons[iconselected].rotation = head + + if (markerDOM) { + markerDOM.style.transform = 'rotate(' + head + 'deg)'; + } // } marker.setIcon(icons[iconselected]); marker.setPosition(new google.maps.LatLng(lat, lng)); map.setCenter({ lat: lat, lng: lng }); - + that.start = setTimeout(that.moveMarker, delay); } else { var head = google.maps.geometry.spherical.computeHeading(marker.getPosition(), dest); - - + + // var iconType = 'car'; // console.log(iconType); - + // console.log(icons[iconType]); // console.log(icons[iconType]); // console.log(icons[iconType].url); @@ -3341,9 +3345,9 @@ export class LocationComponent implements OnInit, OnDestroy { icons[iconType].url = that.iconSelector(status, iconType, msg); markerDOM = that.elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); - if (markerDOM) { - markerDOM.style.transform = 'rotate(' + head + 'deg)'; - } + if (markerDOM) { + markerDOM.style.transform = 'rotate(' + head + 'deg)'; + } // } marker.setIcon(icons[iconselected]); marker.setPosition(dest); @@ -3356,71 +3360,71 @@ export class LocationComponent implements OnInit, OnDestroy { } } a++ - - + + that.rangeDetector = false; - console.log('iteration', a,coords.length) + console.log('iteration', a, coords.length) // console.log("outside moveMarker function"); if (a > coords.length) { // console.log("Cord.length if condition"); outerThis.speeed2 = 0; outerThis.isLastPosition = true; - + } - else { - outerThis.isLastPosition = false; + else { + outerThis.isLastPosition = false; // console.log("Cord.length else condition"); that.moveMarker(); km_h = outerThis.speed; } } var a = 0; - - + + // console.log("Gotopoint function"); that.goToPoint(); } -rangeDetector:boolean=false; -changeRange(){ - - clearTimeout(this.start); - this.rangeDetector = true; - var rangeVal = document.getElementById("slider1"); -// console.log(rangeVal); - - // var zoomTImeOut = setTimeout(()=>{ - // this.historyMap.setZoom(15); - // clearTimeout(zoomTImeOut); - // },5000) + rangeDetector: boolean = false; + changeRange() { - this.indexValue = rangeVal['value']; + clearTimeout(this.start); + this.rangeDetector = true; + var rangeVal = document.getElementById("slider1"); + // console.log(rangeVal); - if(this.tempMapHistory[0]['flag'] == 'stop'){ - this.marker4.setPosition({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); - this.historyMap.setCenter({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); - // clearTimeout(this.start); - // this.moveMarker(); - this.goToPoint(); - - } - if(this.tempMapHistory[0]['flag'] == 'start'){ - // this.speed = 0 ; - this.marker4.setPosition({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); - this.historyMap.setCenter({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); - this.tempMapHistory[0]['flag'] = 'stop'; - // clearTimeout(this.start); - this.goToPoint(); + // var zoomTImeOut = setTimeout(()=>{ + // this.historyMap.setZoom(15); + // clearTimeout(zoomTImeOut); + // },5000) - } + this.indexValue = rangeVal['value']; -} + if (this.tempMapHistory[0]['flag'] == 'stop') { + this.marker4.setPosition({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); + this.historyMap.setCenter({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); + // clearTimeout(this.start); + // this.moveMarker(); + this.goToPoint(); -zoomSet(){ - this.historyMap.setZoom(15); -} + } + if (this.tempMapHistory[0]['flag'] == 'start') { + // this.speed = 0 ; + this.marker4.setPosition({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); + this.historyMap.setCenter({ lat: this.latLngLine[this.indexValue].lat, lng: this.latLngLine[this.indexValue].lng }); + this.tempMapHistory[0]['flag'] = 'stop'; + // clearTimeout(this.start); + this.goToPoint(); + + } + + } + + zoomSet() { + this.historyMap.setZoom(15); + } @@ -3467,6 +3471,7 @@ zoomSet(){ this.ddid = dev.did this.contactService.getCurrentLocation(this.ddid, fromtime, totime).subscribe((data5) => { + this.latlongObjArr = data5; // console.log("currlocdata=>",data5) // console.log(this.latlongObjArr) @@ -3516,7 +3521,7 @@ zoomSet(){ google.maps.event.addListener(map, 'click', function (me) { - + setInterval(function () { // console.log("Interval Started") if (outerThis.latlongObjArr[outerThis.last_pointer].interpolated == null || outerThis.latlongObjArr[outerThis.last_pointer].interpolated == undefined) { @@ -3616,62 +3621,62 @@ zoomSet(){ } play(playindex) { // console.log('playindex',playindex); - + this.showStatus = true var icontype = this.dev_id.iconType; var tempObj = { "icontype": icontype } var tempDataCoordArr = this.tempMapHistory[playindex].dataArrayCoords; - + tempObj["tempDataCoordArr"] = tempDataCoordArr; - if (this.tempMapHistory[playindex]['flag'] == 'init') { + if (this.tempMapHistory[playindex]['flag'] == 'init') { this.speed = 100; this.animateMarker_history(this.marker4, tempDataCoordArr, 50, icontype); tempObj["marker"] = this.marker4; this.tempMapHistory[playindex]['flag'] = 'stop'; tempObj["flag"] = this.tempMapHistory[playindex]['flag']; - - } else if (this.tempMapHistory[playindex]['flag'] == 'start') { - - this.moveMarker(); - // clearTimeout(this.start); - this.tempMapHistory[playindex]['flag'] = 'stop'; - tempObj["flag"] = this.tempMapHistory[playindex]['flag']; - - } else - if (this.tempMapHistory[playindex]['flag'] == 'stop') { - this.speed = 0; - clearTimeout(this.start); - this.tempMapHistory[playindex]['flag'] = 'start'; - tempObj["flag"] = this.tempMapHistory[playindex]['flag']; - } - if (this.flag == 'reset') { - this.marker4.setPosition({ lat: this.latLngLine[0].lat, lng: this.latLngLine[0].lng }); - this.flag = 'init'; - } + } else if (this.tempMapHistory[playindex]['flag'] == 'start') { + + this.moveMarker(); + // clearTimeout(this.start); + this.tempMapHistory[playindex]['flag'] = 'stop'; + tempObj["flag"] = this.tempMapHistory[playindex]['flag']; + + } else + if (this.tempMapHistory[playindex]['flag'] == 'stop') { + this.speed = 0; + clearTimeout(this.start); + this.tempMapHistory[playindex]['flag'] = 'start'; + tempObj["flag"] = this.tempMapHistory[playindex]['flag']; + } + + if (this.flag == 'reset') { + this.marker4.setPosition({ lat: this.latLngLine[0].lat, lng: this.latLngLine[0].lng }); + this.flag = 'init'; + } } headingName = 'Live Tracking'; playingHistory: boolean = false; - parkingPOINTS=[] + parkingPOINTS = [] fromTIME - stop_locationss=[] + stop_locationss = [] counter maphistory(data) { this.showArea(); this.pdfFunction(this.deviceSelect[0]); this.getTravelPathReport(this.deviceSelect[0]) - if(this.digitalInput==1){ + if (this.digitalInput == 1) { this.workingHoursFunction1(this.deviceSelect[0]) - }else{ + } else { this.workingHoursFunction2(this.deviceSelect[0]) } - this.historyAdress =''; - this.sliderValue=0; + this.historyAdress = ''; + this.sliderValue = 0; this.showSocketData = false; this.Load = true; this.map2load = false; @@ -3696,10 +3701,10 @@ zoomSet(){ this.latLongArr3 = [] to1 = null; - + this.dev_id = this.deviceSelect[0]; // console.log("Trssss",this.deviceSelect[0]); - + var currtime = new Date(); var from1 = new Date(this.datefrom).toISOString(); var to1 = new Date(this.date2).toISOString(); @@ -3707,16 +3712,16 @@ zoomSet(){ var fromtime = new Date(from1).toISOString(); var totime = new Date(to1).toISOString(); - this.fromTIME=new Date(from1).toISOString(); + this.fromTIME = new Date(from1).toISOString(); // console.log(fromtime) var diff = moment(totime).diff(fromtime, 'days') // console.log('difference :' + diff) - - if ((fromtime > totime)||(diff>=31)) { + + if ((fromtime > totime) || (diff >= 31)) { this.Load = false; - let error = (fromtime > totime)?"Error: From Time Never Greater then To Time" : "History is unavailable for more than one month"; + let error = (fromtime > totime) ? "Error: From Time Never Greater then To Time" : "History is unavailable for more than one month"; // let message = "Error: From Time Never Greater then To Time"; let action this.snackBar.open(error, action, { @@ -3740,415 +3745,435 @@ zoomSet(){ // this.ddid = dev.did; // this.devicon = dev.iconType; // console.log(this.navId); - - if(this.navId === 'locationHistory'){ - this.ddid=this.dev_id.did - }else{ - this.ddid=this.dev_id.Device_ID + + if (this.navId === 'locationHistory') { + this.ddid = this.dev_id.did + } else { + this.ddid = this.dev_id.Device_ID } - + // this.ddid = (this.navId === 'locationHistory')? this.dev_id.did : this.dev_id.Device_ID; // console.log("DID",this.ddid,this.dev_id.did); - + this.devicon = this.dev_id.iconType; this.speedArr = []; var counter = 0 - var countTime = setInterval(()=>{ + var countTime = setInterval(() => { counter++ - - },1000) - if(data==1){ + }, 1000) - var ft = new Date(fromtime); - var tt = new Date(totime); - var dname = this.deviceSelect[0]; - - if (this.coloumnClicked === false) { - var tempData = { - fromTime: ft.toLocaleString(), - toTime: tt.toLocaleString(), - device_name: this.deviceName, - device_obj: this.deviceSelect[0], - lineThickness: this.thicknessVal, - idleColor: this.idleColor, - parkingColor: this.parkingColor, - dataColor: this.dataColor, - flag: 'init', + if (data == 1) { + + var ft = new Date(fromtime); + var tt = new Date(totime); + var dname = this.deviceSelect[0]; + + if (this.coloumnClicked === false) { + var tempData = { + fromTime: ft.toLocaleString(), + toTime: tt.toLocaleString(), + device_name: this.deviceName, + device_obj: this.deviceSelect[0], + lineThickness: this.thicknessVal, + idleColor: this.idleColor, + parkingColor: this.parkingColor, + dataColor: this.dataColor, + flag: 'init', + } + } + + this.showTable = true; + this.flag = 'init'; + initialize(); + + this.Load = false; + + + let cluster_arr = []; + + try { + + this.path = flightPath.getPath(); + } catch (error) { + console.log('flightPath.getPath()', error) + } + + + var cumulativeDistance = 0; + + for (let i = this.latlongObjArr.length - 1; i > 0; i--) { + + var d_name = (this.navId === 'locationHistory') ? this.dev_id.viewValue : this.dev_id.Device_Name; + this.speed = this.latlongObjArr[i].speed + "Km/hr"; + this.im = this.latlongObjArr[i].imei; + + this.speedArr.push(this.latlongObjArr[i].speed); + + var heading = this.latlongObjArr[i].heading; + // this.time = gmtDateTime.local().format('h:mm:ss A'); + this.datee = JSON.stringify(this.latlongObjArr[i].insertionTime); + // console.log(JSON.parse(this.datee)); + // var insTime = new Date(this.datee); + this.datee = moment(JSON.parse(this.datee)).format('MMMM Do YYYY, h:mm:ss a'); + + var harshAcc = this.latlongObjArr[i].harshAccel; + var harshBreak = this.latlongObjArr[i].harshBrake; + var harshCorner = this.latlongObjArr[i].harshCorner; + // console.log(harshAcc,harshBreak,harshCorner); + var fill_color = '#00F'; + var stroke_color = '#00A'; + var content = ''; + // + content = `

DEVICE NAME : ` + + d_name + `
IMEI : ` + + this.im + `
DEVICE DATE : ` + + this.datee + `
SPEED : ` + + this.speed + `
Address : ` + + this.contentAdd + `
+
` + var harsh = this.latlongObjArr[i].gforce ? (parseFloat(this.latlongObjArr[i].gforce) / 10) : 0; + if ((harshAcc != undefined) && (harshAcc == 'true')) { + fill_color = '#008000'; + stroke_color = '#008000'; + + if ((harsh != undefined) && (harsh != null)) { + var harshStat = outerThis.harshImpact(harsh); + content = '

Harsh Acceleration


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' + '
' } } - - this.showTable = true; - this.flag = 'init'; - initialize(); - - this.Load = false; - - - let cluster_arr = []; - console.log(flightPath.getPath()); + if ((harshBreak != undefined) && (harshBreak == 'true')) { + fill_color = '#FF0000'; + stroke_color = '#FF0000'; + if ((harsh != undefined) && (harsh != null)) { + var harshStat = outerThis.harshImpact(harsh); + content = '

Harsh Break


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' + '
' - this.path = flightPath.getPath(); - - var cumulativeDistance =0 ; - - for (let i = this.latlongObjArr.length - 1; i > 0; i--) { - - var d_name = (this.navId === 'locationHistory')? this.dev_id.viewValue:this.dev_id.Device_Name; - this.speed = this.latlongObjArr[i].speed + "Km/hr"; - this.im = this.latlongObjArr[i].imei; - - this.speedArr.push(this.latlongObjArr[i].speed); - - var heading = this.latlongObjArr[i].heading; - // this.time = gmtDateTime.local().format('h:mm:ss A'); - this.datee = JSON.stringify(this.latlongObjArr[i].insertionTime); - // console.log(JSON.parse(this.datee)); - // var insTime = new Date(this.datee); - this.datee = moment(JSON.parse(this.datee)).format('MMMM Do YYYY, h:mm:ss a'); - - var harshAcc = this.latlongObjArr[i].harshAccel; - var harshBreak = this.latlongObjArr[i].harshBrake; - var harshCorner = this.latlongObjArr[i].harshCorner; - // console.log(harshAcc,harshBreak,harshCorner); - var fill_color = '#00F'; - var stroke_color = '#00A'; - var content = ''; - // - content = `

DEVICE NAME : ` - + d_name + `
IMEI : ` - + this.im + `
DEVICE DATE : ` - + this.datee + `
SPEED : ` - + this.speed + `
Address : ` - + this.contentAdd + `
-
` - var harsh = this.latlongObjArr[i].gforce ? (parseFloat(this.latlongObjArr[i].gforce) / 10) : 0; - if ((harshAcc != undefined) && (harshAcc == 'true')) { - fill_color = '#008000'; - stroke_color = '#008000'; - - if ((harsh != undefined) && (harsh != null)) { - var harshStat = outerThis.harshImpact(harsh); - content = '

Harsh Acceleration


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' - '
' - } } - if ((harshBreak != undefined) && (harshBreak == 'true')) { - fill_color = '#FF0000'; - stroke_color = '#FF0000'; - if ((harsh != undefined) && (harsh != null)) { - var harshStat = outerThis.harshImpact(harsh); - content = '

Harsh Break


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' - '
' - - } + } + if ((harshCorner != undefined) && (harshCorner == 'true')) { + fill_color = '#c407b1'; + stroke_color = '#c407b1'; + if ((harsh != undefined) && (harsh != null)) { + var harshStat = outerThis.harshImpact(harsh); + content = '

Harsh Corner


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' + '
' } - if ((harshCorner != undefined) && (harshCorner == 'true')) { - fill_color = '#c407b1'; - stroke_color = '#c407b1'; - if ((harsh != undefined) && (harsh != null)) { - var harshStat = outerThis.harshImpact(harsh); - content = '

Harsh Corner


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' - '
' - } + } + + + + if (this.latlongObjArr[i].isPastData != true) { + if (i === 0) { + cumulativeDistance += 0; + } else { + cumulativeDistance += this.latlongObjArr[i].distanceFromPrevious ? parseFloat(this.latlongObjArr[i].distanceFromPrevious) : 0; } - - - - if(this.latlongObjArr[i].isPastData != true){ - if(i === 0){ - cumulativeDistance += 0 ; - }else{ - cumulativeDistance += this.latlongObjArr[i].distanceFromPrevious?parseFloat(this.latlongObjArr[i].distanceFromPrevious):0 ; - } - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2) ; - }else{ - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2) ; - } - - - var arr = []; - arr.push(this.latlongObjArr[i].lat); - arr.push(this.latlongObjArr[i].lng); - arr.push(this.latlongObjArr[i].speed); - arr.push(this.latlongObjArr[i].cummulative_distance); - arr.push(this.datee); - arr.push(this.latlongObjArr[i].external_Battery); - let cord = { - lat: this.latlongObjArr[i].lat, - lng: this.latlongObjArr[i].lng - } - this.dataArrayCoords.push(arr); - - - this.latLngLine.push(cord); + this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); + } else { + this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); + } + + + var arr = []; + arr.push(this.latlongObjArr[i].lat); + arr.push(this.latlongObjArr[i].lng); + arr.push(this.latlongObjArr[i].speed); + arr.push(this.latlongObjArr[i].cummulative_distance); + arr.push(this.datee); + arr.push(this.latlongObjArr[i].external_Battery); + let cord = { + lat: this.latlongObjArr[i].lat, + lng: this.latlongObjArr[i].lng + } + this.dataArrayCoords.push(arr); + + + this.latLngLine.push(cord); var contentString = '
' + - '
'+ + '
' + '

' + this.deviceName + '

' + '
' - var iconSrc = this.iconSelector("RUNNING","truck",{}); - // 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=S|00FF00|000000' - // this.iconSelector("RUNNING","car",{}); - - var iconDest = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=D|FF0000|000000'; - - // =====================================added============================== - - if (this.latlongObjArr[i].interpolated == null || this.latlongObjArr[i].interpolated == undefined || this.latlongObjArr[i].interpolated.length == 0) { - this.lat = this.latlongObjArr[i].lat; - this.lng = this.latlongObjArr[i].lng; + var iconSrc = this.iconSelector("RUNNING", "truck", {}); + // 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=S|00FF00|000000' + // this.iconSelector("RUNNING","car",{}); + + var iconDest = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=D|FF0000|000000'; + + // =====================================added============================== + + if (this.latlongObjArr[i].interpolated == null || this.latlongObjArr[i].interpolated == undefined || this.latlongObjArr[i].interpolated.length == 0) { + this.lat = this.latlongObjArr[i].lat; + this.lng = this.latlongObjArr[i].lng; + this.path.push(new google.maps.LatLng(this.lat, this.lng)); + + + if (this.dataColor === true) { + var markersPasts = new google.maps.Marker({ + position: new google.maps.LatLng(this.lat, this.lng), + icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, + map: map, + }) + + markersPasts['infowindow'] = new google.maps.InfoWindow({ content: content }); + + + google.maps.event.addListener(markersPasts, 'click', function () { + + var lattitude = markersPasts.position.lat(); + var longitude = markersPasts.position.lng(); + var latlng_1 = + { + "lat": lattitude, + "long": longitude + } + + outerThis.contactService.getAddressByApi(latlng_1).subscribe(res => { + + if (res.message == "Address not found in databse") { + var geocoder = new google.maps.Geocoder(); + var latlng = new google.maps.LatLng(lattitude, longitude); + + var request = { + latLng: latlng + }; + // console.log('latlongVal', request) + var innerThis = this; + this['infowindow'].open(map, innerThis); + geocoder.geocode(request, function (data, status) { + if (status == google.maps.GeocoderStatus.OK) { + if (data[0] != null) { + // innerThis.contentAdd = data[0].formatted_address; + var tempAdd = data[0].formatted_address; + var getAddressContent = document.getElementById('addressBinding'); + getAddressContent.innerHTML = 'Address :' + tempAdd; + + + } else { + // console.log("No address available") + var tempAdd_1 = "No address available"; + var getAddressContent = document.getElementById('addressBinding'); + getAddressContent.innerHTML = 'Address :' + tempAdd_1; + + + + } + } + else { + var tempAdd_2 = 'NA'; + var getAddressContent = document.getElementById('addressBinding'); + getAddressContent.innerHTML = 'Address :' + tempAdd_2; + // console.log('aaaaaaaaaaaaaa',getAddressContent); + + + } + + }) + + } else { + var innerThis_1 = this; + + this['infowindow'].open(map, innerThis_1); + var tempAdd = res.address; + // console.log('innerThis_1.contentAdd',tempAdd); + var chkTmout = setTimeout(function () { + var getAddressContent = document.getElementById('addressBinding'); + // console.log('getAddressContent',getAddressContent); + getAddressContent.innerHTML = 'Address :' + tempAdd; + clearTimeout(chkTmout); + }, 500) + + } + + }) + + + + }) + // cluster_arr.push(markersPast); + + } + + + + if (i == 1) { + markerCurrent = new google.maps.Marker({ + position: new google.maps.LatLng(this.lat, this.lng), + map: map, + icon: iconDest + }); + // outerThis.marker4 = markerCurrent; + map.setCenter(new google.maps.LatLng(this.lat, this.lng)) + flightPath.setMap(map); + zoomToObject(flightPath); + } + if (i == (this.latlongObjArr.length - 1)) { + markerSrc = new google.maps.Marker({ + position: new google.maps.LatLng(this.lat, this.lng), + map: map, + icon: iconSrc, + scaledSize: new google.maps.Size(20, 20), + }); + // markerSrc['infowindow'] = new google.maps.InfoWindow({ content: content }); + const infowindow = new google.maps.InfoWindow({ + content: contentString, + }); + infowindow.open(map, markerSrc); + markerSrc.addListener("click", () => { + infowindow.open(map, markerSrc); + }); + outerThis.marker4 = markerSrc; + } + + + } + else { + + for (let k = 0; k < this.latlongObjArr[i].interpolated.length; k++) { + if (this.latlongObjArr[i].interpolated[k].location.latitude == null || this.latlongObjArr[i].interpolated[k].location.longitude == null) { + this.lat = this.latlongObjArr[i].lat; + this.lng = this.latlongObjArr[i].lng; + } else { + this.lat = this.latlongObjArr[i].interpolated[k].location.latitude; + this.lng = this.latlongObjArr[i].interpolated[k].location.longitude; + } + this.path.push(new google.maps.LatLng(this.lat, this.lng)); - - - if (this.dataColor === true) { + + + if (this.dataColor) { var markersPasts = new google.maps.Marker({ position: new google.maps.LatLng(this.lat, this.lng), icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, map: map, }) - markersPasts['infowindow'] = new google.maps.InfoWindow({ content: content }); - - google.maps.event.addListener(markersPasts, 'click', function () { - - var lattitude = markersPasts.position.lat(); - var longitude = markersPasts.position.lng() ; - var latlng_1 = - { - "lat": lattitude, - "long": longitude - } - outerThis.contactService.getAddressByApi(latlng_1).subscribe(res=>{ - - if(res.message == "Address not found in databse"){ - var geocoder = new google.maps.Geocoder(); - var latlng = new google.maps.LatLng(lattitude, longitude); - - var request = { - latLng: latlng - }; - // console.log('latlongVal', request) - var innerThis = this ; - this['infowindow'].open(map, innerThis); - geocoder.geocode(request, function (data, status) { - if (status == google.maps.GeocoderStatus.OK) { - if (data[0] != null) { - // innerThis.contentAdd = data[0].formatted_address; - var tempAdd = data[0].formatted_address; - var getAddressContent = document.getElementById('addressBinding'); - getAddressContent.innerHTML = 'Address :' + tempAdd ; - - - } else { - // console.log("No address available") - var tempAdd_1 = "No address available"; - var getAddressContent = document.getElementById('addressBinding'); - getAddressContent.innerHTML = 'Address :' + tempAdd_1 ; - - - - } - } - else { - var tempAdd_2 = 'NA'; - var getAddressContent = document.getElementById('addressBinding'); - getAddressContent.innerHTML = 'Address :' + tempAdd_2 ; - // console.log('aaaaaaaaaaaaaa',getAddressContent); - - - } - - }) - - }else{ - var innerThis_1 = this ; - - this['infowindow'].open(map, innerThis_1); - var tempAdd = res.address ; - // console.log('innerThis_1.contentAdd',tempAdd); - var chkTmout = setTimeout(function(){ - var getAddressContent = document.getElementById('addressBinding'); - // console.log('getAddressContent',getAddressContent); - getAddressContent.innerHTML = 'Address :' + tempAdd ; - clearTimeout(chkTmout); - },500) - - } - - }) - - - - }) - // cluster_arr.push(markersPast); - - } - - - - if (i == 1) { - markerCurrent = new google.maps.Marker({ - position: new google.maps.LatLng(this.lat, this.lng), - map: map, - icon: iconDest + // console.log("inside info window function 1"); + this['infowindow'].open(map, this); }); - // outerThis.marker4 = markerCurrent; - map.setCenter(new google.maps.LatLng(this.lat, this.lng)) - flightPath.setMap(map); - zoomToObject(flightPath); - } - if (i == (this.latlongObjArr.length - 1)) { - markerSrc = new google.maps.Marker({ - position: new google.maps.LatLng(this.lat, this.lng), - map: map, - icon: iconSrc, - scaledSize: new google.maps.Size(20, 20), - }); - // markerSrc['infowindow'] = new google.maps.InfoWindow({ content: content }); - const infowindow = new google.maps.InfoWindow({ - content: contentString, - }); - infowindow.open(map, markerSrc); - markerSrc.addListener("click", () => { - infowindow.open(map, markerSrc); - }); - outerThis.marker4 = markerSrc; - } - - - } - else { - - for (let k = 0; k < this.latlongObjArr[i].interpolated.length; k++) { - if (this.latlongObjArr[i].interpolated[k].location.latitude == null || this.latlongObjArr[i].interpolated[k].location.longitude == null) { - this.lat = this.latlongObjArr[i].lat; - this.lng = this.latlongObjArr[i].lng; - } else { - this.lat = this.latlongObjArr[i].interpolated[k].location.latitude; - this.lng = this.latlongObjArr[i].interpolated[k].location.longitude; - } - - this.path.push(new google.maps.LatLng(this.lat, this.lng)); - - - if (this.dataColor) { - var markersPasts = new google.maps.Marker({ - position: new google.maps.LatLng(this.lat, this.lng), - icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, - map: map, - }) - markersPasts['infowindow'] = new google.maps.InfoWindow({ content: content }); - google.maps.event.addListener(markersPasts, 'click', function () { - // console.log("inside info window function 1"); - this['infowindow'].open(map, this); }); - - - } - } - if (i == 1) { - markerCurrent = new google.maps.Marker({ - position: new google.maps.LatLng(this.lat, this.lng), - map: map, - icon: iconDest - }); - - // outerThis.marker4 = markerCurrent; - map.setCenter(new google.maps.LatLng(this.lat, this.lng)) - flightPath.setMap(map); - zoomToObject(flightPath); - - } - - if (i == (this.latlongObjArr.length - 1)) { - markerSrc = new google.maps.Marker({ - position: new google.maps.LatLng(this.lat, this.lng), - map: map, - icon: iconSrc - }) - outerThis.marker4 = markerSrc; - } - } - } - - - - // console.log(this.coloumnClicked) ; - if (this.coloumnClicked === false) { - tempData['dataArrayCoords'] = this.dataArrayCoords; - - } - - // console.log('this.dataArrayCoords',this.dataArrayCoords); - if(this.dataArrayCoords.length<1){ - var fdd = new Date(this.datefrom); - var tdd= new Date(this.date2); - swal("No Data Found", "Vehicle has not moved from" +" "+ moment(fdd).format('LLL') + "to " + moment(tdd).format('LLL')).then((ans)=>{ - // console.log(ans); - - },err=>{ - // console.log(err); - }); - - } - - this.seekBarValue = this.dataArrayCoords.length; - - this.maxSpeedd = Math.max.apply(null, this.speedArr); - this.dis = true; - - this.contactService.getDistance(this.ddid, fromtime, totime,this.satelliteDisabled?this.satelite:undefined).subscribe((data3) => { - - this.data2 = data3; - - // initialize(); - // console.log(this.data2); - let a = this.data2["Distance"] ? this.data2["Distance"] : 0; - if (this.coloumnClicked === false) { - tempData['mileage'] = a; - this.tempMapHistory.push(tempData); - - } - - - - this.total_dis = a; - let b = this.data2["Average Speed"] ? this.data2["Average Speed"] : 0; - this.avg_speed = b; - - this.ideal_time = this.data2["Idle Time"] ? this.minToHoursConversion(this.data2["Idle Time"]) : 0; - if (parseFloat(this.ideal_time) < 0) { - this.ideal_time = 0; - } - - this.historyDataCondition = true; - - var playerSeekbar: any; - $( document ).ready(function() { - playerSeekbar = document.getElementById('slider1'); - console.log( "ready!", playerSeekbar['value']); - playerSeekbar.oninput = function () { - - zoomToObject(flightPath); - outerThis.changeRange(); - - } - }); - }) - + + } + } + if (i == 1) { + markerCurrent = new google.maps.Marker({ + position: new google.maps.LatLng(this.lat, this.lng), + map: map, + icon: iconDest + }); + + // outerThis.marker4 = markerCurrent; + map.setCenter(new google.maps.LatLng(this.lat, this.lng)) + flightPath.setMap(map); + zoomToObject(flightPath); + + } + + if (i == (this.latlongObjArr.length - 1)) { + markerSrc = new google.maps.Marker({ + position: new google.maps.LatLng(this.lat, this.lng), + map: map, + icon: iconSrc + }) + outerThis.marker4 = markerSrc; + } + } + } + + + + // console.log(this.coloumnClicked) ; + if (this.coloumnClicked === false) { + tempData['dataArrayCoords'] = this.dataArrayCoords; + + } + + // console.log('this.dataArrayCoords',this.dataArrayCoords); + if (this.dataArrayCoords.length < 1) { + var fdd = new Date(this.datefrom); + var tdd = new Date(this.date2); + swal("No Data Found", "Vehicle has not moved from" + " " + moment(fdd).format('LLL') + "to " + moment(tdd).format('LLL')).then((ans) => { + // console.log(ans); + + }, err => { + // console.log(err); + }); + + } + + this.seekBarValue = this.dataArrayCoords.length; + + this.maxSpeedd = Math.max.apply(null, this.speedArr); + this.dis = true; + + this.contactService.getDistance(this.ddid, fromtime, totime, this.satelliteDisabled ? this.satelite : undefined).subscribe((data3) => { + + this.data2 = data3; + + // initialize(); + // console.log(this.data2); + let a = this.data2["Distance"] ? this.data2["Distance"] : 0; + if (this.coloumnClicked === false) { + tempData['mileage'] = a; + this.tempMapHistory.push(tempData); + + } + + + + this.total_dis = a; + let b = this.data2["Average Speed"] ? this.data2["Average Speed"] : 0; + this.avg_speed = b; + + this.ideal_time = this.data2["Idle Time"] ? this.minToHoursConversion(this.data2["Idle Time"]) : 0; + if (parseFloat(this.ideal_time) < 0) { + this.ideal_time = 0; + } + + this.historyDataCondition = true; + + var playerSeekbar: any; + $(document).ready(function () { + playerSeekbar = document.getElementById('slider1'); + console.log("ready!", playerSeekbar['value']); + playerSeekbar.oninput = function () { + + zoomToObject(flightPath); + outerThis.changeRange(); + + } + }); + }) + + } - else{ - this.contactService.getCurrentLocation1(this.ddid, fromtime, totime,this.satelliteDisabled?this.satelite:undefined).subscribe((data3:any) => { - if(data3){ + else { + this.contactService.getCurrentLocation1(this.ddid, fromtime, totime, this.satelliteDisabled ? this.satelite : undefined).subscribe((data3: any) => { + if (data3) { clearInterval(countTime); } - + let latLongArray : any[] = []; + data3.forEach((deData)=>{ + latLongArray.push({ + "long":deData.lng, + "lat":deData.lat + }) + + }) + + outerThis.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + data3.forEach((deData,index)=>{ + outerThis.contactService.latLongAddress[deData.lng+'_'+deData.lat] = latLongAddress[index]; + }) + // console.log('countercountercountercountercountercountercounter',counter,data3); var ft = new Date(fromtime); var tt = new Date(totime); var dname = this.deviceSelect[0]; - + if (this.coloumnClicked === false) { var tempData = { fromTime: ft.toLocaleString(), @@ -4160,30 +4185,35 @@ zoomSet(){ parkingColor: this.parkingColor, dataColor: this.dataColor, flag: 'init', - + } } - + this.showTable = true; - this.latlongObjArr = data3; this.flag = 'init'; initialize(); this.Load = false; let cluster_arr = []; // console.log(flightPath.getPath()); + + try { - this.path = flightPath.getPath(); - var cumulativeDistance =0 ; - + this.path = flightPath.getPath(); + } catch (error) { + this.path = []; + console.log('flightPath.getPath()', error) + } + var cumulativeDistance = 0; + for (let i = this.latlongObjArr.length - 1; i > 0; i--) { console.log(this.latlongObjArr[i]); - var d_name = (this.navId === 'locationHistory')? this.dev_id.viewValue:this.dev_id.Device_Name; + var d_name = (this.navId === 'locationHistory') ? this.dev_id.viewValue : this.dev_id.Device_Name; this.speed = this.latlongObjArr[i].speed + "Km/hr"; this.im = this.latlongObjArr[i].imei; // console.log(this.latlongObjArr[i]); - var insertionTime=moment(this.latlongObjArr[i].insTime).format('MMMM Do YYYY, h:mm:ss a'); - var raw=this.latlongObjArr[i].raw; + var insertionTime = moment(this.latlongObjArr[i].insTime).format('MMMM Do YYYY, h:mm:ss a'); + var raw = this.latlongObjArr[i].raw; this.speedArr.push(this.latlongObjArr[i].speed); var heading = this.latlongObjArr[i].heading; @@ -4192,8 +4222,8 @@ zoomSet(){ // console.log(this.latlongObjArr[i],"lakskalskalkl"); // var insTime = new Date(this.datee); this.datee = moment(JSON.parse(this.datee)).format('MMMM Do YYYY, h:mm:ss a'); - var lastLat=this.latlongObjArr[i].lat - var lastlong=this.latlongObjArr[i].lng + var lastLat = this.latlongObjArr[i].lat + var lastlong = this.latlongObjArr[i].lng var harshAcc = this.latlongObjArr[i].harshAccel; var harshBreak = this.latlongObjArr[i].harshBrake; var harshCorner = this.latlongObjArr[i].harshCorner; @@ -4203,22 +4233,22 @@ zoomSet(){ var content = ''; // content=`

DEVICE NAME :$d_name` content = `

DEVICE NAME : ` - + d_name + `
IMEI : ` - + this.im + `
DEVICE DATE : ` - + this.datee + `
SPEED : `+ this.speed + - `
INSERTION TIME : `+ insertionTime + - `
RAW : ` + ' Get Raw Data '+ - `
Address : ` + + d_name + `
IMEI : ` + + this.im + `
DEVICE DATE : ` + + this.datee + `
SPEED : ` + this.speed + + `
INSERTION TIME : ` + insertionTime + + `
RAW : ` + ' Get Raw Data ' + + `
Address : ` + this.contentAdd + '

' - +'
' - // '' - // - + + '
' + // '' + // + var harsh = this.latlongObjArr[i].gforce ? (parseFloat(this.latlongObjArr[i].gforce) / 10) : 0; if ((harshAcc != undefined) && (harshAcc == 'true')) { fill_color = '#008000'; stroke_color = '#008000'; - + if ((harsh != undefined) && (harsh != null)) { var harshStat = outerThis.harshImpact(harsh); content = '

Harsh Acceleration


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' @@ -4232,7 +4262,7 @@ zoomSet(){ var harshStat = outerThis.harshImpact(harsh); content = '

Harsh Break


Impact : ' + harshStat + '
DEVICE NAME : ' + d_name + '
IMEI : ' + this.im + '
DEVICE DATE : ' + this.datee + '
SPEED : ' + this.speed + '
' '
' - + } } if ((harshCorner != undefined) && (harshCorner == 'true')) { @@ -4244,22 +4274,22 @@ zoomSet(){ '
' } } - - - - if(this.latlongObjArr[i].isPastData != true){ - if(i === 0){ - cumulativeDistance += 0 ; - }else{ - cumulativeDistance += this.latlongObjArr[i].distanceFromPrevious?parseFloat(this.latlongObjArr[i].distanceFromPrevious):0 ; - } - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2) ; - }else{ - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2) ; + + + + if (this.latlongObjArr[i].isPastData != true) { + if (i === 0) { + cumulativeDistance += 0; + } else { + cumulativeDistance += this.latlongObjArr[i].distanceFromPrevious ? parseFloat(this.latlongObjArr[i].distanceFromPrevious) : 0; + } + this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); + } else { + this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); } - - - var arr = []; + + + var arr = []; arr.push(this.latlongObjArr[i].lat); arr.push(this.latlongObjArr[i].lng); arr.push(this.latlongObjArr[i].speed); @@ -4271,17 +4301,17 @@ zoomSet(){ lng: this.latlongObjArr[i].lng } this.dataArrayCoords.push(arr); - - + + this.latLngLine.push(cord); - var contentString = '
' + - '
'+ - '

' + this.deviceName + '

' + - '
' - var iconSrc = this.iconSelector("RUNNING","truck",{}); + var contentString = '
' + + '
' + + '

' + this.deviceName + '

' + + '
' + var iconSrc = this.iconSelector("RUNNING", "truck", {}); // 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=S|00FF00|000000' // this.iconSelector("RUNNING","car",{}); - + var iconDest = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=D|FF0000|000000'; // iconSrc['infowindow'] = new google.maps.InfoWindow({ content: contentString }); // '/assets/images/liveTrackIcons/ocar.png'; @@ -4289,98 +4319,99 @@ zoomSet(){ // this.lat = this.latlongObjArr[i].lat; // this.lng = this.latlongObjArr[i].lng; // this.path.push(new google.maps.LatLng(this.lat, this.lng)); - + // =====================================added============================== - + if (this.latlongObjArr[i].interpolated == null || this.latlongObjArr[i].interpolated == undefined || this.latlongObjArr[i].interpolated.length == 0) { this.lat = this.latlongObjArr[i].lat; this.lng = this.latlongObjArr[i].lng; this.path.push(new google.maps.LatLng(this.lat, this.lng)); - - + + if (this.dataColor === true) { var markersPast = new google.maps.Marker({ position: new google.maps.LatLng(this.lat, this.lng), icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, map: map, }) - + markersPast['infowindow'] = new google.maps.InfoWindow({ content: content }); - + google.maps.event.addListener(markersPast, 'click', function () { - - + + var lattitude = markersPast.position.lat(); - var longitude = markersPast.position.lng() ; + var longitude = markersPast.position.lng(); var latlng_1 = { "lat": lattitude, - "long": longitude + "long": longitude } - outerThis.contactService.getAddressByApi(latlng_1).subscribe(res=>{ - - if(res.message == "Address not found in databse"){ - var geocoder = new google.maps.Geocoder(); - var latlng = new google.maps.LatLng(lattitude, longitude); - - var request = { - latLng: latlng - }; - // console.log('latlongVal', request) - var innerThis = this ; - this['infowindow'].open(map, innerThis); - geocoder.geocode(request, function (data, status) { - if (status == google.maps.GeocoderStatus.OK) { - if (data[0] != null) { - // innerThis.contentAdd = data[0].formatted_address; - var tempAdd = data[0].formatted_address; - var getAddressContent = document.getElementById('addressBinding'); - getAddressContent.innerHTML = 'Address :' + tempAdd ; - - - } else { - // console.log("No address available") - var tempAdd_1 = "No address available"; - var getAddressContent = document.getElementById('addressBinding'); - getAddressContent.innerHTML = 'Address :' + tempAdd_1 ; - - - - } - } - else { - var tempAdd_2 = 'NA'; - var getAddressContent = document.getElementById('addressBinding'); - getAddressContent.innerHTML = 'Address :' + tempAdd_2 ; - // console.log('aaaaaaaaaaaaaa',getAddressContent); - - - } - - }) - - }else{ - var innerThis_1 = this ; + let addressRes = outerThis.contactService.latLongAddress[longitude+'_'+lattitude]; - this['infowindow'].open(map, innerThis_1); - var tempAdd = res.address ; + + if (!(addressRes && addressRes.address)) { + var geocoder = new google.maps.Geocoder(); + var latlng = new google.maps.LatLng(lattitude, longitude); + + var request = { + latLng: latlng + }; + // console.log('latlongVal', request) + var innerThis = this; + this['infowindow'].open(map, innerThis); + geocoder.geocode(request, function (data, status) { + if (status == google.maps.GeocoderStatus.OK) { + if (data[0] != null) { + // innerThis.contentAdd = data[0].formatted_address; + var tempAdd = data[0].formatted_address; + var getAddressContent = document.getElementById('addressBinding'); + getAddressContent.innerHTML = 'Address :' + tempAdd; + + + } else { + // console.log("No address available") + var tempAdd_1 = "No address available"; + var getAddressContent = document.getElementById('addressBinding'); + getAddressContent.innerHTML = 'Address :' + tempAdd_1; + + + + } + } + else { + var tempAdd_2 = 'NA'; + var getAddressContent = document.getElementById('addressBinding'); + getAddressContent.innerHTML = 'Address :' + tempAdd_2; + // console.log('aaaaaaaaaaaaaa',getAddressContent); + + + } + + }) + + } else { + var innerThis_1 = this; + + this['infowindow'].open(map, innerThis_1); + var tempAdd = addressRes.address; // console.log('innerThis_1.contentAdd',tempAdd); - var chkTmout = setTimeout(function(){ + var chkTmout = setTimeout(function () { var getAddressContent = document.getElementById('addressBinding'); // console.log('getAddressContent',getAddressContent); - getAddressContent.innerHTML = 'Address :' + tempAdd ; + getAddressContent.innerHTML = 'Address :' + tempAdd; clearTimeout(chkTmout); - },500) - + }, 500) + } - - }) - }) - + + + }) + } - - - + + + if (i == 1) { markerCurrent = new google.maps.Marker({ position: new google.maps.LatLng(this.lat, this.lng), @@ -4400,24 +4431,24 @@ zoomSet(){ scaledSize: new google.maps.Size(20, 20), }); markerSrc['infowindow'] = new google.maps.InfoWindow({ content: content }); - const infowindow = new google.maps.InfoWindow({ - content: contentString, - }); - infowindow.open(map, markerSrc); - markerSrc.addListener("click", () => { + const infowindow = new google.maps.InfoWindow({ + content: contentString, + }); infowindow.open(map, markerSrc); + markerSrc.addListener("click", () => { + infowindow.open(map, markerSrc); }); outerThis.marker4 = markerSrc; } - - - + + + } else { - + for (let k = 0; k < this.latlongObjArr[i].interpolated.length; k++) { if (this.latlongObjArr[i].interpolated[k].location.latitude == null || this.latlongObjArr[i].interpolated[k].location.longitude == null) { this.lat = this.latlongObjArr[i].lat; @@ -4426,22 +4457,23 @@ zoomSet(){ this.lat = this.latlongObjArr[i].interpolated[k].location.latitude; this.lng = this.latlongObjArr[i].interpolated[k].location.longitude; } - + this.path.push(new google.maps.LatLng(this.lat, this.lng)); - - + + if (this.dataColor) { var markersPast = new google.maps.Marker({ position: new google.maps.LatLng(this.lat, this.lng), icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, map: map, }) - markersPast['infowindow'] = new google.maps.InfoWindow({ content: content }); - google.maps.event.addListener(markersPast, 'click', function () { + markersPast['infowindow'] = new google.maps.InfoWindow({ content: content }); + google.maps.event.addListener(markersPast, 'click', function () { // console.log("inside info window function 1"); - this['infowindow'].open(map, this); }); - - + this['infowindow'].open(map, this); + }); + + } } if (i == 1) { @@ -4450,14 +4482,14 @@ zoomSet(){ map: map, icon: iconDest }); - + // outerThis.marker4 = markerCurrent; map.setCenter(new google.maps.LatLng(this.lat, this.lng)) flightPath.setMap(map); zoomToObject(flightPath); - + } - + if (i == (this.latlongObjArr.length - 1)) { markerSrc = new google.maps.Marker({ position: new google.maps.LatLng(this.lat, this.lng), @@ -4468,87 +4500,88 @@ zoomSet(){ } } } - + if (this.coloumnClicked === false) { tempData['dataArrayCoords'] = this.dataArrayCoords; - + } - - if(this.dataArrayCoords.length<1){ - var fdd = new Date(this.datefrom); - var tdd= new Date(this.date2); - swal("No Data Found", "Vehicle has not moved from" +" "+ moment(fdd).format('LLL') + "to " + moment(tdd).format('LLL')).then((ans)=>{ - // console.log(ans); - - },err=>{ - // console.log(err); - }); - - } - + + if (this.dataArrayCoords.length < 1) { + var fdd = new Date(this.datefrom); + var tdd = new Date(this.date2); + swal("No Data Found", "Vehicle has not moved from" + " " + moment(fdd).format('LLL') + "to " + moment(tdd).format('LLL')).then((ans) => { + // console.log(ans); + + }, err => { + // console.log(err); + }); + + } + this.seekBarValue = this.dataArrayCoords.length; - + this.maxSpeedd = Math.max.apply(null, this.speedArr); this.dis = true; - - this.contactService.getDistance(this.ddid, fromtime, totime,this.satelliteDisabled?this.satelite:undefined).subscribe((data3) => { - + + this.contactService.getDistance(this.ddid, fromtime, totime, this.satelliteDisabled ? this.satelite : undefined).subscribe((data3) => { + this.data2 = data3; - + // initialize(); - console.log("__________________",this.data2,this.distanceVariation); + console.log("__________________", this.data2, this.distanceVariation); let a = Number(this.data2["Distance"] ? this.data2["Distance"] : 0); // if(this.distanceVariation){ // if(this.distanceVariation[0]=="+"){ // var milege=(a/100)*(Number(this.distanceVariation.substring(1))) - // console.log("MILEGE->",milege,'-',a); + // console.log("MILEGE->",milege,'-',a); // a=a+milege // }else{ // var milege=(a/100)*(Number(this.distanceVariation.substring(1))) - // console.log("MILEGE->",milege,'-',a); + // console.log("MILEGE->",milege,'-',a); // a=a-milege // } // } if (this.coloumnClicked === false) { tempData['mileage'] = a.toFixed(2); this.tempMapHistory.push(tempData); - + } - + this.total_dis = a; let b = this.data2["Average Speed"] ? this.data2["Average Speed"] : 0; this.avg_speed = b; - + this.ideal_time = this.data2["Idle Time"] ? this.minToHoursConversion(this.data2["Idle Time"]) : 0; if (parseFloat(this.ideal_time) < 0) { this.ideal_time = 0; } - + this.historyDataCondition = true; - + var playerSeekbar: any; - $( document ).ready(function() { - playerSeekbar = document.getElementById('slider1'); - console.log( "ready!", playerSeekbar['value']); - playerSeekbar.oninput = function () { - - zoomToObject(flightPath); - outerThis.changeRange(); - - } - }); + $(document).ready(function () { + playerSeekbar = document.getElementById('slider1'); + console.log("ready!", playerSeekbar['value']); + playerSeekbar.oninput = function () { + + zoomToObject(flightPath); + outerThis.changeRange(); + + } + }); }) + }) }); } - + let min_time = this.minIdleTime; - var deviceObjectid = (this.navId === 'locationHistory')?this.dev_id.id: this.dev_id._id; + var deviceObjectid = (this.navId === 'locationHistory') ? this.dev_id.id : this.dev_id._id; // console.log(deviceObjectid); if (this.idleColor === true) { @@ -4556,28 +4589,28 @@ zoomSet(){ } var stop_locations = []; if (this.parkingColor === true) { - // var from1 = new Date(this.datefrom).toISOString(); - // var to1 = new Date(this.date2).toISOString(); + // var from1 = new Date(this.datefrom).toISOString(); + // var to1 = new Date(this.date2).toISOString(); - // var fromtime = new Date(from1).toISOString(); - // var totime = new Date(to1).toISOString(); - // console.log('this.useriddthis.useridd',this.useridd,"IIIIIIIIIIIIIIIi",this.dev_id.id?this.dev_id.id: this.dev_id._id); - var userid=(this.dev_id.user._id != undefined)?this.dev_id.user._id:this.dev_id.user; - this.contactService.stoppage_points(deviceObjectid, fromtime, totime, userid) - // this.contactService.stoppage_report(fromtime,totime,userid,this.dev_id.id?this.dev_id.id: this.dev_id._id) + // var fromtime = new Date(from1).toISOString(); + // var totime = new Date(to1).toISOString(); + // console.log('this.useriddthis.useridd',this.useridd,"IIIIIIIIIIIIIIIi",this.dev_id.id?this.dev_id.id: this.dev_id._id); + var userid = (this.dev_id.user._id != undefined) ? this.dev_id.user._id : this.dev_id.user; + this.contactService.stoppage_points(deviceObjectid, fromtime, totime, userid) + // this.contactService.stoppage_report(fromtime,totime,userid,this.dev_id.id?this.dev_id.id: this.dev_id._id) .subscribe((res) => { // console.log("===========================>",res,this.parkingArr); // this.parkingArr=res let test = res; // let test = res; this.Load = false; - this.stoppageCount = (test.length != 0)?test.length : 0; + this.stoppageCount = (test.length != 0) ? test.length : 0; for (var i = 0; i < test.length; i++) { this.stoppage_container = []; this.stoppage_container.push(test[i].lat); this.stoppage_container.push(test[i].long); - + this.arrival = new Date(test[i].arrival_time); this.stoppage_container.push(this.arrival); this.departure = new Date(test[i].departure_time); @@ -4587,12 +4620,12 @@ zoomSet(){ } - // debugger; - console.log("initParking",stop_locations.length) + // debugger; + console.log("initParking", stop_locations.length) if (stop_locations.length > 0) { // for(var l=0;l{ - - isMapInit = true; - // ============================ - // var pinImage = new google.maps.MarkerImage("https://png.icons8.com/office/30/000000/parking.png"); - var pinImage = new google.maps.MarkerImage("../../assets/image/parkingPoint1.png"); - var infowindow = new google.maps.InfoWindow(); + var callTimeout = setTimeout(() => { - // var marker: any; - var k: any; - var l: number - + isMapInit = true; + // ============================ + // var pinImage = new google.maps.MarkerImage("https://png.icons8.com/office/30/000000/parking.png"); + var pinImage = new google.maps.MarkerImage("../../assets/image/parkingPoint1.png"); + var infowindow = new google.maps.InfoWindow(); - console.log('stoppagelocationArr',stop_locations.length); - var index=stop_locations.length - for (l = 0; l < stop_locations.length; l++) { - index--; - outerThis.latitude = stop_locations[l][0]; - outerThis.longitude = stop_locations[l][1]; - outerThis.arrivalTime = new Date(stop_locations[l][2]).toLocaleString(); - outerThis.departureTime = new Date(stop_locations[l][3]).toLocaleString(); - outerThis.addresslocation = stop_locations[l][4]; - - var fd = new Date(outerThis.arrivalTime).getTime(); - var td = new Date(outerThis.departureTime).getTime(); - var time_difference = td - fd; - var total_min = time_difference / 60000; - var hours = total_min / 60 - var rhours = Math.floor(hours); - var minutes = (hours - rhours) * 60; - var rminutes = Math.round(minutes); - outerThis.Durations = rhours + ':' + rminutes - let marker = new google.maps.Marker({ - position: new google.maps.LatLng(stop_locations[l][0], stop_locations[l][1]), - map: outerThis.historyMap, - // icon: pinImage, - label: {color: '#000', fontSize: '12px', fontWeight: '600', - text: index.toString()} + // var marker: any; + var k: any; + var l: number - }); - google.maps.event.addListener(marker, 'dragend', function () { + console.log('stoppagelocationArr', stop_locations.length); + var index = stop_locations.length + for (l = 0; l < stop_locations.length; l++) { + index--; + outerThis.latitude = stop_locations[l][0]; + outerThis.longitude = stop_locations[l][1]; + outerThis.arrivalTime = new Date(stop_locations[l][2]).toLocaleString(); + outerThis.departureTime = new Date(stop_locations[l][3]).toLocaleString(); + outerThis.addresslocation = stop_locations[l][4]; - this.geocodePosition(marker.getPosition()); - }); - outerThis.historyMap.setCenter(marker.getPosition()); - // console.log(outerThis.parkingPonit(fromtime,stop_locations,l),'erueruu') - // outerThis.counter=l - - // setTimeout(function(){ + var fd = new Date(outerThis.arrivalTime).getTime(); + var td = new Date(outerThis.departureTime).getTime(); + var time_difference = td - fd; + var total_min = time_difference / 60000; + var hours = total_min / 60 + var rhours = Math.floor(hours); + var minutes = (hours - rhours) * 60; + var rminutes = Math.round(minutes); + outerThis.Durations = rhours + ':' + rminutes + let marker = new google.maps.Marker({ + position: new google.maps.LatLng(stop_locations[l][0], stop_locations[l][1]), + map: outerThis.historyMap, + // icon: pinImage, + label: { + color: '#000', fontSize: '12px', fontWeight: '600', + text: index.toString() + } + + }); + + google.maps.event.addListener(marker, 'dragend', function () { + + this.geocodePosition(marker.getPosition()); + }); + outerThis.historyMap.setCenter(marker.getPosition()); + // console.log(outerThis.parkingPonit(fromtime,stop_locations,l),'erueruu') + // outerThis.counter=l + + // setTimeout(function(){ var content = '
Arrival Time-: ' - + outerThis.arrivalTime + '

Departure Time-: ' - + outerThis.departureTime + '

Time Duration-: ' - + outerThis.Durations + '

Latitude-: ' - + outerThis.latitude + '

Longitude-: ' - + outerThis.longitude + '

' + + outerThis.arrivalTime + '

Departure Time-: ' + + outerThis.departureTime + '

Time Duration-: ' + + outerThis.Durations + '

Latitude-: ' + + outerThis.latitude + '

Longitude-: ' + + outerThis.longitude + '

' // console.log("CONTENt",content)
Odo-:'+dataa+' // },2000) // var dataa // console.log(outerThis.fromTIME,outerThis.stop_locationss,outerThis.counter,"))))))))))))))))"); - + // outerThis.contactService.getDistance(outerThis.ddid, outerThis.fromTIME, (outerThis.stop_locationss[l][2]).toISOString(),outerThis.satelliteDisabled?outerThis.satelite:undefined).subscribe((data3:any) => { - // console.log("DADADADADADADAD--->",data3); + // console.log("DADADADADADADAD--->",data3); // dataa=data3.Distance?data3.Distance:'' // content=content+`
Odo-:`+ data3.Distance?data3.Distance:''+'
' // }) - google.maps.event.addListener(marker, 'click', (function (marker,content, infowindow) { - return function () { - // var dataa - // console.log(outerThis.fromTIME,outerThis.stop_locationss,outerThis.counter,"))))))))))))))))"); - - // outerThis.contactService.getDistance(outerThis.ddid, outerThis.fromTIME, (outerThis.stop_locationss[outerThis.counter][2]).toISOString(),outerThis.satelliteDisabled?outerThis.satelite:undefined).subscribe((data3:any) => { - // console.log("DADADADADADADAD--->",data3); - // dataa=data3.Distance?data3.Distance:'' - // // return data3 - // }) - // setTimeout(function(){ - // content=content+`
Odo-:`+ dataa+'
' - // console.log(content,"+++"); - geocodePosition(marker.getPosition(), function (result) { - infowindow.setContent(content); - infowindow.open(map, marker, content); - }); - // }, 2000); + google.maps.event.addListener(marker, 'click', (function (marker, content, infowindow) { + return function () { + // var dataa + // console.log(outerThis.fromTIME,outerThis.stop_locationss,outerThis.counter,"))))))))))))))))"); + + // outerThis.contactService.getDistance(outerThis.ddid, outerThis.fromTIME, (outerThis.stop_locationss[outerThis.counter][2]).toISOString(),outerThis.satelliteDisabled?outerThis.satelite:undefined).subscribe((data3:any) => { + // console.log("DADADADADADADAD--->",data3); + // dataa=data3.Distance?data3.Distance:'' + // // return data3 + // }) + // setTimeout(function(){ + // content=content+`
Odo-:`+ dataa+'
' + // console.log(content,"+++"); + geocodePosition(marker.getPosition(), function (result) { + infowindow.setContent(content); + infowindow.open(map, marker, content); + }); + // }, 2000); + + } + })(marker, content, infowindow)); + + } + clearTimeout(callTimeout); + }, ttVal) - } - })(marker, content, infowindow)); - - } - clearTimeout(callTimeout); - },ttVal) - } - function initialize() { + function initialize() { const myOptions = { - zoom:8, + zoom: 8, center: new google.maps.LatLng(18.602941, 73.777147), mapTypeId: google.maps.MapTypeId.ROADMAP }; - + map = new google.maps.Map(document.getElementById('map2'), myOptions); // console.log('mapmapmapmapmapmapmapmapmapmapmapmapmapmap',map); outerThis.historyMap = map; var trafficLayer = new google.maps.TrafficLayer(); - if(outerThis.isTraffic){ + if (outerThis.isTraffic) { trafficLayer.setMap(map); - }else{ + } else { trafficLayer.setMap(null); } - - + + isMapInit = true; var zoomBar: any; zoomBar = document.getElementById('myRange'); console.log(map.getZoom()); - + map.setZoom(map.getZoom()); - + zoomBar.value = map.getZoom(); - + zoomBar.oninput = function () { // console.log('zoomValue',map.getZoom()); map.setZoom(parseInt(this.value)); @@ -4763,7 +4798,7 @@ zoomSet(){ zoomBar.value = map.getZoom(); }); - + } @@ -4847,7 +4882,7 @@ zoomSet(){ var sourceIcon = "http://www.googlemapsmarkers.com/v1/S/" + "009933" + "/FFFFFF/000000/ ";//colorForPath var pinImage = new google.maps.MarkerImage(sourceIcon); - var marker = new google.maps.Marker({ + var marker = new google.maps.Marker({ position: mapData[0], map: map, icon: pinImage, @@ -4855,7 +4890,7 @@ zoomSet(){ }); allSourceDestinationMarkers.push(marker); // console.log(allSourceDestinationMarkers); - + var destinationIcon = "http://www.googlemapsmarkers.com/v1/D/" + "FF3300" + "/FFFFFF/000000/ ";//colorForPath var pinImage1 = new google.maps.MarkerImage(destinationIcon); @@ -4930,7 +4965,7 @@ zoomSet(){ "lng": pois[i].poi.location.coordinates[0] }); - var poiIcon="/assets/images/liveTrackIcons/building.jpg" + var poiIcon = "/assets/images/liveTrackIcons/building.jpg" // var poiIcon="https://img.icons8.com/ios-filled/50/000000/building-with-rooftop-terrace.png" // building.jpeg // var poiIcon = "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"; @@ -4945,23 +4980,23 @@ zoomSet(){ poiMarkers.push(marker); var infobox_numberPlate = new InfoBox({ - content: "
" + pois[i].poi.poiname + "
", - disableAutoPan: false, - maxWidth: 150, - alignBottom: true, - pixelOffset: new google.maps.Size(-25, -20), - zIndex: null, - boxStyle: { - opacity: 1, - zIndex: 999, - width: "auto", - padding: "2px" - }, - closeBoxURL: "", - infoBoxClearance: new google.maps.Size(1, 1) - }); + content: "
" + pois[i].poi.poiname + "
", + disableAutoPan: false, + maxWidth: 150, + alignBottom: true, + pixelOffset: new google.maps.Size(-25, -20), + zIndex: null, + boxStyle: { + opacity: 1, + zIndex: 999, + width: "auto", + padding: "2px" + }, + closeBoxURL: "", + infoBoxClearance: new google.maps.Size(1, 1) + }); - infobox_numberPlate.open(map, marker); + infobox_numberPlate.open(map, marker); } @@ -5009,30 +5044,30 @@ zoomSet(){ }); - function zoomToObject(obj){ - var bounds = new google.maps.LatLngBounds(); - var points = obj.getPath().getArray(); - for (var n = 0; n < points.length ; n++){ + function zoomToObject(obj) { + var bounds = new google.maps.LatLngBounds(); + var points = obj.getPath().getArray(); + for (var n = 0; n < points.length; n++) { bounds.extend(points[n]); + } + map.fitBounds(bounds); } - map.fitBounds(bounds); -} - this.parkingData(fromtime, totime,this.useridd,this.dev_id); + this.parkingData(fromtime, totime, this.useridd, this.dev_id); - this.notificationData(fromtime, totime,this.useridd,this.dev_id); + this.notificationData(fromtime, totime, this.useridd, this.dev_id); } - parkingPonit(fromtime,stop_locations,l){ + parkingPonit(fromtime, stop_locations, l) { // console.log(fromtime,stop_locations,l,"--------------"); - - var data - this.contactService.getDistance(this.ddid, fromtime, (stop_locations[l][2]).toISOString(),this.satelliteDisabled?this.satelite:undefined).subscribe((data3:any) => { - // console.log("DADADADADADADAD--->",data3.Distance); - data=data3 - return data3 - }) - } + + var data + this.contactService.getDistance(this.ddid, fromtime, (stop_locations[l][2]).toISOString(), this.satelliteDisabled ? this.satelite : undefined).subscribe((data3: any) => { + // console.log("DADADADADADADAD--->",data3.Distance); + data = data3 + return data3 + }) + } harshImpact(harshVal) { @@ -5148,28 +5183,28 @@ zoomSet(){ // if (this.devicess.devices[i].type_of_device == "Tracker") { - let a = { - did: this.devicess.devices[i].Device_ID, - dname: this.devicess.devices[i].Device_Name - } - this.device_imei.push(a); + let a = { + did: this.devicess.devices[i].Device_ID, + dname: this.devicess.devices[i].Device_Name } + this.device_imei.push(a); + } // } this.geoFenceaction(this.device_imei) }); } - minToHoursConversion(num){ - var hours = Math.floor(num / 3600); -num %= 3600; -var minutes = Math.floor(num / 60); -var seconds = num % 60; -// var hours = (num / 60); -// var rhours = Math.floor(hours); -// var minutes = (hours - rhours) * 60; -// var rminutes = Math.round(minutes); - return hours + " hrs " + minutes + " min "; + minToHoursConversion(num) { + var hours = Math.floor(num / 3600); + num %= 3600; + var minutes = Math.floor(num / 60); + var seconds = num % 60; + // var hours = (num / 60); + // var rhours = Math.floor(hours); + // var minutes = (hours - rhours) * 60; + // var rminutes = Math.round(minutes); + return hours + " hrs " + minutes + " min "; } //GeoFence Action @@ -5244,12 +5279,12 @@ var seconds = num % 60; if (type == "Tracker") { //this.router.navigateByUrl("location?_dname="+name+"_id="+id); this.share_id = device; - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("111111111133333"); this.livetrack(id) } - + } else { @@ -5262,18 +5297,18 @@ var seconds = num % 60; let mapLanguage = localStorage.getItem('appLang'); this.token_identifier = localStorage.getItem('referrer_token='); // console.log('mapLanguage',mapLanguage); - if((mapLanguage == null)||(mapLanguage == undefined)){ - mapLanguage = 'en'; + if ((mapLanguage == null) || (mapLanguage == undefined)) { + mapLanguage = 'en'; } - if(mapLanguage == 'sp'){ - mapLanguage = 'es'; + if (mapLanguage == 'sp') { + mapLanguage = 'es'; } - if(mapLanguage == 'fa'){ - mapLanguage = 'fas'; + if (mapLanguage == 'fa') { + mapLanguage = 'fas'; } - if(mapLanguage == 'fr'){ - mapLanguage = 'fr'; + if (mapLanguage == 'fr') { + mapLanguage = 'fr'; } @@ -5282,21 +5317,21 @@ var seconds = num % 60; // script.setAttribute("type", "text/javascript"); // script.setAttribute("src", "https://maps.google.com/maps/api/js?libraries=geometry,places,drawing&key=AIzaSyCNT3eO1wPQHUhY_cmQ9N_9BkLzJ_GB9j8&language=" + mapLanguage); // document.getElementsByTagName("head")[0].appendChild(script); - - + + let tblid; let status = false; var cuTime = new Date(); this.currentTime = moment(cuTime).format(); - + this.activatedRoute.queryParams.subscribe((params: Params) => { this.navId = params['pageid']; - - if(this.navId === 'locationHistory'){ + + if (this.navId === 'locationHistory') { this.tabIndexValue = "2"; this.showHistory = true; - this.tab_1 = true; + this.tab_1 = true; this.tab_2 = true; navigator.geolocation.getCurrentPosition(function (position) { var myOptions = { @@ -5308,7 +5343,7 @@ var seconds = num % 60; mapTypeId: google.maps.MapTypeId.ROADMAP }; var mapHistory = new google.maps.Map(document.getElementById("map2"), myOptions); - + var marker = new google.maps.Marker({ center: { lat: position.coords.latitude, @@ -5317,14 +5352,14 @@ var seconds = num % 60; map: mapHistory, title: "Your current location!", }); - + }) } // locationComponent }) - + } fs: any; @@ -5436,21 +5471,21 @@ var seconds = num % 60; if (!this.prev_map) { this.MapLoad = true; if (this.current_map == "True") { - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("111111111144444"); - this.livetrack(null) ; + this.livetrack(null); } - + this.prev_map = window.localStorage.mapLoad_ID; this.showButton = true; } else { // console.log(window.localStorage.mapLoad_ID); - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("111111115555555"); this.livetrack(window.localStorage.mapLoad_ID); } - + this.prev_map = window.localStorage.mapLoad_ID; this.showButton = true; } @@ -5461,22 +5496,22 @@ var seconds = num % 60; } else if (this.current_map == "True") { this.MapLoad = true; - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("11111111666666"); - this.livetrack(null); + this.livetrack(null); } - + this.prev_map = window.localStorage.mapLoad_ID; this.showButton = true; } else if (this.prev_map != this.current_map) { this.MapLoad = true; - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("1111111777777"); this.livetrack(window.localStorage.mapLoad_ID) } - + this.prev_map = window.localStorage.mapLoad_ID; this.showButton = true; } @@ -5494,25 +5529,25 @@ var seconds = num % 60; datefrom = new Date(); gaugeString: any = 'PERCENTAGE'; gaugeDataticks: any = '0,20,40,60,80,100'; - newFunction(){ - + newFunction() { + } - + ngOnInit() { this.injectData.setGPSConnection(); window["angularComponentRef"] = { component: this, zone: this._ngZone }; this.socket = this.injectData.getSocket_gps(); this.socket.on('connect', function (this) { }); - this.socket_Notify = this.injectData.getSocket_notifIO(); - this.socket_Notify.on('connect', function(this){ - console.log('notify connect ',this); + this.socket_Notify = this.injectData.getSocket_notifIO(); + this.socket_Notify.on('connect', function (this) { + console.log('notify connect ', this); }); - this.bsConfig = Object.assign({dateInputFormat: 'DD-MM-YYYY, h:mm:ss a'}, { containerClass: this.colorTheme }); + this.bsConfig = Object.assign({ dateInputFormat: 'DD-MM-YYYY, h:mm:ss a' }, { containerClass: this.colorTheme }); // console.log('this.bsConfig',this.bsConfig); - + this.to = new Date().toISOString(); var d = new Date(); let a = d.setHours(0, 0, 0, 0) @@ -5585,7 +5620,7 @@ var seconds = num % 60; this.gaugeString = 'LITRE'; // this.gaugeDataticks = '0,20,40,60,80,100'; // window.onload = function () { - // console.log("inside percentage"); + // console.log("inside percentage"); // var gaugeElement = document.getElementById('fuelgauge'); // // gaugeElement.setAttribute('data-units', 'LITRE'); // // gaugeElement.setAttribute('data-major-ticks', "0,80,160,240,320,400,480"); @@ -5594,7 +5629,7 @@ var seconds = num % 60; } - + if (this.superAdmin == true) { this.supadmin = this.useridd; @@ -5633,11 +5668,11 @@ var seconds = num % 60; // console.log("this.fin=>",this.fin); this.fin = this.getData.split("=")[1]; } - // console.log(this.fin); + // console.log(this.fin); }); - if(this.token_identifier != undefined){ + if (this.token_identifier != undefined) { this.fin = null } @@ -5682,24 +5717,24 @@ var seconds = num % 60; this.getDevicebyIdComingFromDashboard(); this.getGeofence_1(); // this.testMap() - this. getGrp() + this.getGrp() this.modelChanged .debounceTime(2000) // wait 300ms after the last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value .subscribe(myInput => { var searchObj = JSON.parse(myInput); - + this.myInput = searchObj.str; - (searchObj.identifier == 'devSearch') ? this.getDeviceBYfilter('','') : this.getGeofence_1() - + (searchObj.identifier == 'devSearch') ? this.getDeviceBYfilter('', '') : this.getGeofence_1() + }); - this.getUserDetails(); - $('addPOI').click(function() { - alert("GeeksForGeeks"); - }); - + this.getUserDetails(); + $('addPOI').click(function () { + alert("GeeksForGeeks"); + }); + } // className:any; @@ -5714,32 +5749,32 @@ var seconds = num % 60; } localStorage.removeItem('devDetail'); - if(this.status_cmdq!=undefined){ + if (this.status_cmdq != undefined) { clearInterval(this.status_cmdq) } - if(this.intervalTimeOut!=undefined){ + if (this.intervalTimeOut != undefined) { clearTimeout(this.intervalTimeOut); } - - + + window["angularComponentRef"] = null; - if( this.socket_Notify){ + if (this.socket_Notify) { this.socket_Notify.removeAllListeners() } this.injectData.removedGPSConnection(); } - GetRowPacketEvent(data) { - this.contactService.GetRowPacket(data).subscribe((res: any) => { - document.getElementById(data).innerHTML = ''; - document.getElementById('display_row' + data).innerHTML = res.raw ? res.raw : 'NA'; - + GetRowPacketEvent(data) { + this.contactService.GetRowPacket(data).subscribe((res: any) => { + document.getElementById(data).innerHTML = ''; + document.getElementById('display_row' + data).innerHTML = res.raw ? res.raw : 'NA'; - }) - } + + }) + } addpoi(lat) { // var lattitude = JSON.parse(lat); var latlng = JSON.stringify(lat).substring(1, lat.length - 1); @@ -5772,11 +5807,11 @@ var seconds = num % 60; DriverNumber ac; power; - todaysOdo=0; - fuelConsumption=0 + todaysOdo = 0; + fuelConsumption = 0 getAllDevice() { // this.Load = true; - + if (this.dev_by_dashboard != null) { this.disableSearch = true // console.log(this.disableSearch); @@ -5786,23 +5821,23 @@ var seconds = num % 60; this.contactService.alldevices1(this.useridd, this.emailid, this.supadmin, this.dealerid, search_1) .subscribe(res => { this.deviceObj = []; - + var Alldevices = { id: "all", viewValue: "ALL Devices", iconType: "", deviceId: "" } - if(res.devices.length==1){ - this.selectedDevice=res.devices[0]._id - this.parkingButtonShow=res.devices[0].theftAlert==null?'grey':res.devices[0].theftAlert==undefined?'grey':res.devices[0].theftAlert==true?'green':'red' - this.DriverName=res.devices[0].driver_name; + if (res.devices.length == 1) { + this.selectedDevice = res.devices[0]._id + this.parkingButtonShow = res.devices[0].theftAlert == null ? 'grey' : res.devices[0].theftAlert == undefined ? 'grey' : res.devices[0].theftAlert == true ? 'green' : 'red' + this.DriverName = res.devices[0].driver_name; // console.log("DRIVER NAME",this.DriverName,res.devices[0].ac); - this.ac=res.devices[0].ac?res.devices[0].ac:'NA' - this.power=res.devices[0].power?res.devices[0].power:'NA' - this.todaysOdo=res.devices[0].today_odo?res.devices[0].today_odo:0; - this.fuelConsumption=(res.devices[0].Mileage && res.devices[0].total_odo)?(res.devices[0].total_odo/res.devices[0].Mileage):0 - this.DriverNumber=res.devices[0].contact_number + this.ac = res.devices[0].ac ? res.devices[0].ac : 'NA' + this.power = res.devices[0].power ? res.devices[0].power : 'NA' + this.todaysOdo = res.devices[0].today_odo ? res.devices[0].today_odo : 0; + this.fuelConsumption = (res.devices[0].Mileage && res.devices[0].total_odo) ? (res.devices[0].total_odo / res.devices[0].Mileage) : 0 + this.DriverNumber = res.devices[0].contact_number } // console.log("device obj =>",res.devices); this.deviceObj.push(Alldevices); @@ -5817,11 +5852,11 @@ var seconds = num % 60; } this.final = res.devices; - + for (let i = 0; i < this.final.length; i++) { this.final[i]['checked'] = true; // this.deviceList = this.final; - + if (this.final[i].type_of_device == "Tracker") { let a = { value: this.final[i].Device_Name, @@ -5836,18 +5871,18 @@ var seconds = num % 60; } this.foods.push(a); - + } } - + // console.log('this.deviceList=>=>',this.deviceList); - let that= this; - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + let that = this; + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log(this.fin, this.fin); // this.deviceList.filter((dl,index)=>{ - // console.log(dl,index); + // console.log(dl,index); // if(dl.Device_ID === this.fin){ // that.deviceList[index]['checked'] = true; // } @@ -5855,7 +5890,7 @@ var seconds = num % 60; // console.log("1111111188888"); this.livetrack(this.fin); } - + for (let y = 0; y < this.foods.length; y++) { if (this.foods[y].did == this.fin) { this.new = this.foods[y]; @@ -5869,40 +5904,40 @@ var seconds = num % 60; // console.log(err); }) } - filterDevicesNew(dlr) { - if ((this.navId === 'locationHistory')) { - if (dlr) { - const filterdealerValue: any = dlr; - this.foods = []; - this.masterFoods.forEach(pp => { - let t = pp.viewValue.toLocaleLowerCase().indexOf(filterdealerValue.toLocaleLowerCase()); - if (t > -1) { - this.foods.push(pp) - } - }); - } else { - this.foods = [...this.masterFoods]; - } - - } - this.sortFoodDataByKey(); - } - sortFoodDataByKey() { - this.foods.sort((a, b) => { - let fa = a.viewValue.toLowerCase(), - fb = b.viewValue.toLowerCase(); + filterDevicesNew(dlr) { + if ((this.navId === 'locationHistory')) { + if (dlr) { + const filterdealerValue: any = dlr; + this.foods = []; + this.masterFoods.forEach(pp => { + let t = pp.viewValue.toLocaleLowerCase().indexOf(filterdealerValue.toLocaleLowerCase()); + if (t > -1) { + this.foods.push(pp) + } + }); + } else { + this.foods = [...this.masterFoods]; + } - if (fa < fb) { - return -1; - } - if (fa > fb) { - return 1; - } - return 0; - }) - } + } + this.sortFoodDataByKey(); + } + sortFoodDataByKey() { + this.foods.sort((a, b) => { + let fa = a.viewValue.toLowerCase(), + fb = b.viewValue.toLowerCase(); + + if (fa < fb) { + return -1; + } + if (fa > fb) { + return 1; + } + return 0; + }) + } filterDevices(dlr) { - + // console.log("=========>",dlr,this.foods); if (dlr.length == 0) { this.deviceSelect = []; @@ -5910,22 +5945,22 @@ var seconds = num % 60; if (dlr) { const filterdealerValue: any = dlr; this.deviceSelect = []; - if((this.navId === 'locationHistory')){ + if ((this.navId === 'locationHistory')) { this.deviceSelect = this.foods.filter(function (pp) { var t = pp.viewValue.toLocaleLowerCase().indexOf(filterdealerValue.toLocaleLowerCase()); return t > -1; }); - + // this.buindhistoryDevice = this.deviceSelect; // console.log("this.deviceSelectthis.deviceSelectthis.deviceSelect",this.deviceSelect); return this.deviceSelect; - }else{ + } else { this.deviceSelect = this.deviceList.filter(function (pp) { var t = pp.Device_ID.toLocaleLowerCase().indexOf(filterdealerValue.toLocaleLowerCase()); return t > -1; }); - + this.buindhistoryDevice = this.deviceSelect; // console.log("this.deviceSelectthis.deviceSelectthis.deviceSelect",this.deviceSelect); // localStorage.setItem('devDetail',JSON.stringify({vehicleId:this.deviceSelect[0].did, @@ -5933,15 +5968,15 @@ var seconds = num % 60; // vehicleType: this.deviceSelect[0].deviceType})) // this.imei=this.deviceSelect[0].did // console.log("IMEI===>",this.imei); - + return this.deviceSelect; } - + } } count: number = 0; iconSelector(status, iconType, msg) { - + // var tempSpeed = msg.speed; // var tempIgn = msg.ignition; @@ -5976,7 +6011,7 @@ var seconds = num % 60; } else if (iconType == 'tractor') { iconUrl = '/assets/images/liveTrackIcons/otractor.png'; return iconUrl; - } else if (iconType == 'jcb') { + } else if (iconType == 'jcb') { iconUrl = '/assets/images/liveTrackIcons/ourjcb.png'; return iconUrl; } @@ -5984,7 +6019,7 @@ var seconds = num % 60; iconUrl = '/assets/images/liveTrackIcons/ambulance_b.png'; return iconUrl; } - else { + else { iconUrl = '/assets/images/liveTrackIcons/user_b.png'; return iconUrl; } @@ -6005,13 +6040,13 @@ var seconds = num % 60; } else if (iconType == 'tractor') { iconUrl = '/assets/images/liveTrackIcons/stractor.png'; return iconUrl; - }else if (iconType == 'jcb') { + } else if (iconType == 'jcb') { iconUrl = '/assets/images/liveTrackIcons/stoppedjcb.png'; return iconUrl; - } else if (iconType == 'ambulance') { + } else if (iconType == 'ambulance') { iconUrl = '/assets/images/liveTrackIcons/ambulance_r.png'; return iconUrl; - }else { + } else { iconUrl = '/assets/images/liveTrackIcons/user_r.png'; return iconUrl; } @@ -6031,11 +6066,11 @@ var seconds = num % 60; } else if (iconType == 'tractor') { iconUrl = '/assets/images/liveTrackIcons/rtractor.png'; return iconUrl; - } else if(iconType == 'jcb'){ + } else if (iconType == 'jcb') { iconUrl = '/assets/images/liveTrackIcons/runningjcb.png'; return iconUrl; - } else if (iconType == 'ambulance') { + } else if (iconType == 'ambulance') { iconUrl = '/assets/images/liveTrackIcons/ambulance_g.png'; return iconUrl; } else { @@ -6058,18 +6093,18 @@ var seconds = num % 60; } else if (iconType == 'tractor') { iconUrl = '/assets/images/liveTrackIcons/itractor.png'; return iconUrl; - }else if(iconType == "jcb" ){ + } else if (iconType == "jcb") { iconUrl = '/assets/images/liveTrackIcons/idlingjcb.png'; - return iconUrl; + return iconUrl; } else if (iconType == 'ambulance') { iconUrl = '/assets/images/liveTrackIcons/ambulance_y.png'; return iconUrl; - } else { + } else { iconUrl = '/assets/images/liveTrackIcons/user_y.png'; return iconUrl; } - }else if (status == "NO DATA") { + } else if (status == "NO DATA") { if (iconType == 'bike') { iconUrl = '/assets/image/no_data.png'; return iconUrl; @@ -6085,7 +6120,7 @@ var seconds = num % 60; } else if (iconType == 'tractor') { iconUrl = '/assets/image/no_data.png'; return iconUrl; - } else if(iconType == 'jcb'){ + } else if (iconType == 'jcb') { iconUrl = '/assets/image/no_data.png'; return iconUrl; } else { @@ -6186,12 +6221,12 @@ var seconds = num % 60; var DeviceObj = JSON.parse(localStorage.getItem('devDetail')); if (DeviceObj != undefined) { // console.log('DeviceObj',DeviceObj); - this.contactService.getdevById(DeviceObj.vehicleId).subscribe((res:any) => { + this.contactService.getdevById(DeviceObj.vehicleId).subscribe((res: any) => { // console.log("lastTripStatus",res); // this.getLastTrip();\ var tempObj = JSON.parse(res['_body']); - this.distanceVariation=tempObj.distanceVariation?tempObj.distanceVariation:undefined - + this.distanceVariation = tempObj.distanceVariation ? tempObj.distanceVariation : undefined + this.IMEI = tempObj._id; @@ -6209,7 +6244,7 @@ var seconds = num % 60; getLastTrip(imei) { // console.log("IMEI==>",imei); - + this.contactService.getLastTripStatus('last_trip', 'Started', imei).subscribe(res => { // console.log("lastTripStatus", res); if (res.message != "No Trip Found") { @@ -6220,7 +6255,7 @@ var seconds = num % 60; this.playPause = true; } var outerThis = this; - this.deviceList.filter(function (colHilight, i) { + this.deviceList.filter(function (colHilight, i) { if (colHilight.Device_ID === imei) { outerThis.deviceList[i].playPause = outerThis.playPause; } @@ -6432,9 +6467,9 @@ var seconds = num % 60; function geocodePosition(pos, callback) { try { - + } catch (error) { - + } var geocoder = new google.maps.Geocoder(); geocoder.geocode({ @@ -6491,7 +6526,7 @@ var seconds = num % 60; // } - AllVeh: any = [{ 'status': 'Total', 'totalCount': '0' },{ 'status': 'Running', 'totalCount': '0' }, { 'status': 'Idle', 'totalCount': '0' }, { 'status': 'Stopped', 'totalCount': '0' }, { 'status': 'Inactive', 'totalCount': '0' }, { 'status': 'No data', 'totalCount': '0' }] + AllVeh: any = [{ 'status': 'Total', 'totalCount': '0' }, { 'status': 'Running', 'totalCount': '0' }, { 'status': 'Idle', 'totalCount': '0' }, { 'status': 'Stopped', 'totalCount': '0' }, { 'status': 'Inactive', 'totalCount': '0' }, { 'status': 'No data', 'totalCount': '0' }] deviceData = [ { @@ -6617,54 +6652,54 @@ var seconds = num % 60; - ]; + ]; myInput: any; - updateLiveTracking(device,ev) { - this.showAddress=true + updateLiveTracking(device, ev) { + this.showAddress = true var that = this; // this.openRightMenu() - if(device){ - // console.log(device); - this.selectedDevice=device._id - this.parkingButtonShow=device.theftAlert==null?'grey':device.theftAlert==undefined?'grey':device.theftAlert==true?'green':'red' - this.DriverName=device.driver_name; - // console.log("DRIVER NAME",this.DriverName,device.ac); - this.ac=device.ac?device.ac:'NA' - this.DriverNumber=device.contact_number + if (device) { + // console.log(device); + this.selectedDevice = device._id + this.parkingButtonShow = device.theftAlert == null ? 'grey' : device.theftAlert == undefined ? 'grey' : device.theftAlert == true ? 'green' : 'red' + this.DriverName = device.driver_name; + // console.log("DRIVER NAME",this.DriverName,device.ac); + this.ac = device.ac ? device.ac : 'NA' + this.DriverNumber = device.contact_number - } - - console.log('this.markerArray________________________--',this.socketData); + } + + console.log('this.markerArray________________________--', this.socketData); this.showSocketData = true; - if(this.socketData) - this.socketData.date=new Date() + if (this.socketData) + this.socketData.date = new Date() this.flightPathArr = []; // localStorage.setItem('devDetail',device) this.temptrackingDev = device.Device_ID; - var td= this.filterDevices(device.Device_ID); - this.tempDevInfo =td[0]; - this.deviceList.filter((dl,index)=>{ - if(dl.Device_ID == device.Device_ID){ - var ilock =that.deviceList[index].ignitionLock; - if((ilock === '1')&&(ev === 'lockchange')){ - + var td = this.filterDevices(device.Device_ID); + this.tempDevInfo = td[0]; + this.deviceList.filter((dl, index) => { + if (dl.Device_ID == device.Device_ID) { + var ilock = that.deviceList[index].ignitionLock; + if ((ilock === '1') && (ev === 'lockchange')) { + that.deviceList[index].ignitionLock = '0'; } - if((ilock === '0')&&(ev === 'lockchange')){ - + if ((ilock === '0') && (ev === 'lockchange')) { + that.deviceList[index].ignitionLock = '1'; } that.deviceList[index].checked = true; - - }else{ + + } else { that.deviceList[index].checked = false; } - + }) - - - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + + + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("1111111199999"); this.livetrack(device.Device_ID); } @@ -6757,7 +6792,7 @@ var seconds = num % 60; this.AllVeh[4].totalCount = this.OutOfReach; this.AllVeh[5].totalCount = this.no_data; // console.log("DAtatatatat---",this.AllVeh); - + }); } @@ -6766,17 +6801,17 @@ var seconds = num % 60; limit: number = 100; firstcall: boolean = false; lastcall: boolean = true; - devReady:boolean=true; - groups=[] - getDeviceBYfilter(i,iden) { - console.log(i,iden); + devReady: boolean = true; + groups = [] + getDeviceBYfilter(i, iden) { + console.log(i, iden); this.currStatus = i; - if (this.currStatus =='Total'){ + if (this.currStatus == 'Total') { this.ngOnInit(); } - else{ + else { if (i == 6) { this.skip = 0; } @@ -6883,10 +6918,10 @@ var seconds = num % 60; this.buindhistoryDevice = []; var DeviceObj = JSON.parse(localStorage.getItem('devDetail')); if (DeviceObj != undefined) { - this.contactService.getdevById(DeviceObj.vehicleId).subscribe((res:any) => { + this.contactService.getdevById(DeviceObj.vehicleId).subscribe((res: any) => { var tempObj = JSON.parse(res['_body']); - this.distanceVariation=tempObj.distanceVariation?tempObj.distanceVariation:undefined - tempObj['checked']=true + this.distanceVariation = tempObj.distanceVariation ? tempObj.distanceVariation : undefined + tempObj['checked'] = true // console.log('tempObjtempObjtempObjtempObj', tempObj); this.temptrackingDev = tempObj.Device_ID; this.buindhistoryDevice.push(tempObj); @@ -6896,7 +6931,7 @@ var seconds = num % 60; // console.log(err); }) } else { - this.getDeviceBYfilter('',''); + this.getDeviceBYfilter('', ''); } } @@ -6904,18 +6939,18 @@ var seconds = num % 60; next() { this.lastcall = false; this.skip += 1; - this.getDeviceBYfilter(this.currStatus,'tclick'); + this.getDeviceBYfilter(this.currStatus, 'tclick'); } refresh() { this.getGraphFunction(); - this.getDeviceBYfilter(this.currStatus,''); + this.getDeviceBYfilter(this.currStatus, ''); } pre() { if (this.skip > 0) { this.skip -= 1; - this.getDeviceBYfilter(this.currStatus,'tclick'); + this.getDeviceBYfilter(this.currStatus, 'tclick'); this.lastcall = false; } else { this.lastcall = true; @@ -6965,11 +7000,11 @@ var seconds = num % 60; if (ev == 0) { this.headingName = 'Live Tracking'; this.showSocketData = true; - if((this.navId === undefined)||(this.navId != 'locationHistory')){ + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { // console.log("1111111111-11-"); this.livetrack(this.temptrackingDev); } - + // this.refresh_map(); } if (ev == 1) { @@ -7093,9 +7128,9 @@ var seconds = num % 60; var yt = moment().subtract(1, 'days'); var ptt = new Date(yt).setHours(0, 0, 0); this.datefrom = new Date(ptt); - var ttt = new Date(yt).setHours(23,59,59); + var ttt = new Date(yt).setHours(23, 59, 59); this.date2 = new Date(ttt); - + // console.log('this.datefrom', this.datefrom); } if (dateid == 'week') { @@ -7135,7 +7170,7 @@ var seconds = num % 60; engineCutStatus = ''; engineCut(device) { this.engineCutStatus = device.ignitionLock; - + var identifyType = typeof (device.user); var userId; if (identifyType == 'string') { @@ -7149,7 +7184,7 @@ var seconds = num % 60; this.contactService.checkForPassword(pload).subscribe(res => { // console.log('resres', res); var engCutPass = res.engine_cut_psd; - if ((engCutPass == undefined)||(this.superAdmin ===true)||(this.custtype === true)) { + if ((engCutPass == undefined) || (this.superAdmin === true) || (this.custtype === true)) { this.immobilizeDevice(device, this.engineCutStatus); } else { let dialogRef = this.dialog.open(ImmobilizeComponent, { @@ -7198,63 +7233,63 @@ var seconds = num % 60; } - callLiveTracking= 0; + callLiveTracking = 0; triggerCmd(cmdObj, deviceCommand) { // console.log("inside triggerCmd function"); - var that = this; - this.callLiveTracking= 0; - // var iurl = '../../assets/image/idle_bus.png'; + var that = this; + this.callLiveTracking = 0; + // var iurl = '../../assets/image/idle_bus.png'; // this.Load = true; - that.errIcon =false; - that.immobilizeCount = 45; + that.errIcon = false; + that.immobilizeCount = 45; that.immobilizeChk = true; - var timer = setInterval(()=>{ + var timer = setInterval(() => { // console.log("that.immobilizeCount--",that.immobilizeCount--); that.immobilizeCount-- // console.log('timer Value',that.immobilizeCount--); - if( that.immobilizeCount=== 0){ + if (that.immobilizeCount === 0) { clearInterval(timer); } - },1000) + }, 1000) this.contactService.addCommandQueue(cmdObj).subscribe(res => { // this.Load = false; // console.log(res); var cmdQId = res._id; // console.log('cmdQId', cmdQId); - this.intervalTimeOut = setTimeout(function(){ + this.intervalTimeOut = setTimeout(function () { let message = "Please Try After Sometime"; // let action // that.snackBar.open(message, action, { // duration: 4000, - - // }); - that.errIcon =true; - that.showErr = true; - that.ImmErrMsg = message ; - that.shoError = setTimeout(()=>{ - that.immobilizeChk = false; - that.showErr = false; - clearTimeout(that.shoError) - },5000) - clearInterval(that.status_cmdq); - clearTimeout(that.intervalTimeOut); - clearInterval(timer); - },45000) + // }); + that.errIcon = true; + that.showErr = true; + that.ImmErrMsg = message; + that.shoError = setTimeout(() => { + that.immobilizeChk = false; + that.showErr = false; + clearTimeout(that.shoError) + }, 5000) + clearInterval(that.status_cmdq); + clearTimeout(that.intervalTimeOut); + + clearInterval(timer); + }, 45000) that.status_cmdq = setInterval(function () { that.contactService.getEngineCutStatus(cmdQId) - .subscribe(res => { - that.locked = false; - that.unlocked = false; + .subscribe(res => { + that.locked = false; + that.unlocked = false; if (res.status == "SUCCESS") { that.Load = false; var cc = '' - if(deviceCommand === 'ON'){ + if (deviceCommand === 'ON') { cc = 'UNLOCKED'; that.unlocked = true; } - if(deviceCommand === 'OFF'){ + if (deviceCommand === 'OFF') { cc = 'LOCKED'; that.locked = true; } @@ -7263,41 +7298,41 @@ var seconds = num % 60; // that.snackBar.open(message, action, { // duration: 4000, // }); - that.showErr = true; - that.ImmErrMsg = message ; - that.shoError = setTimeout(()=>{ - that.immobilizeChk = false; - that.showErr = false; - clearTimeout(that.shoError); - },5000) + that.showErr = true; + that.ImmErrMsg = message; + that.shoError = setTimeout(() => { + that.immobilizeChk = false; + that.showErr = false; + clearTimeout(that.shoError); + }, 5000) // console.log("Console after Getting success",that.callLiveTracking); - - if(that.callLiveTracking === 0){ - that.callLiveTracking = 1; - + + if (that.callLiveTracking === 0) { + that.callLiveTracking = 1; + that.deviceCQ(cmdObj.imei); - that.updateLiveTracking(cmdObj.imei,'lockchange'); + that.updateLiveTracking(cmdObj.imei, 'lockchange'); // that.refresh(); - + } - + clearInterval(timer); clearTimeout(that.intervalTimeOut) clearInterval(that.status_cmdq); // that.immobilizeChk = false; // that.Load = false - + } }, err => { - that.errIcon =true; + that.errIcon = true; let message = "Please Try After Sometime"; - that.showErr = true; - that.ImmErrMsg = message ; - that.shoError = setTimeout(()=>{ - that.immobilizeChk = false; - that.showErr = false; - clearTimeout(that.shoError) - },5000) + that.showErr = true; + that.ImmErrMsg = message; + that.shoError = setTimeout(() => { + that.immobilizeChk = false; + that.showErr = false; + clearTimeout(that.shoError) + }, 5000) let action; that.immobilizeChk = false; clearInterval(timer); @@ -7380,7 +7415,7 @@ var seconds = num % 60; }); var str = (this.currStatus == undefined) ? '' : this.currStatus; this.getGraphFunction(); - this.getDeviceBYfilter(str,''); + this.getDeviceBYfilter(str, ''); }, err => { this.Load = false; @@ -7393,9 +7428,9 @@ var seconds = num % 60; }) } - enableMapTrail(){ - this.enabletrail = !this.enabletrail; - if(this.enabletrail == false){ + enableMapTrail() { + this.enabletrail = !this.enabletrail; + if (this.enabletrail == false) { this.flightPathArr = []; // this.flightPath_live = new google.maps.Polyline({ // path: this.flightPathArr, @@ -7404,86 +7439,86 @@ var seconds = num % 60; // strokeColor: "#0000FF", // strokeWeight: 6 // }); - + this.flightPath_live.setMap(null); - }else{ + } else { var a = [] this.draw_flight_trail(a); } - - - + + + } - flightPath_live:any - elm=0 - draw_flight_trail(flightPathArr){ - var tempTimeInterval ; + flightPath_live: any + elm = 0 + draw_flight_trail(flightPathArr) { + var tempTimeInterval; var that = this; - var time=6000; - // if(that.elm>0){ - // time = 30000 - // } - // that.elm++; - if(flightPathArr.length != 0){ + var time = 6000; + // if(that.elm>0){ + // time = 30000 + // } + // that.elm++; + if (flightPathArr.length != 0) { console.log("ARRAY", flightPathArr); - - if(that.elm){ + + if (that.elm) { flightPathArr.splice(0, 0, that.elm) flightPathArr.join() } console.log("ARRAY", flightPathArr); that.elm = flightPathArr[flightPathArr.length - 1]; - flightPathArr.splice(flightPathArr.length - 1,1); + flightPathArr.splice(flightPathArr.length - 1, 1); console.log("ARRAY2", flightPathArr); clearTimeout(tempTimeInterval); - tempTimeInterval = setTimeout(function(){ - that.flightPath_live = new google.maps.Polyline({ - path: flightPathArr, - geodesic: true, - strokeColor: "#0000FF", - strokeOpacity: 1.0, - strokeWeight: 6 - }); - // console.log(mapData); - that.flightPath_live.setMap(that.mapNew); - },time) - + tempTimeInterval = setTimeout(function () { + that.flightPath_live = new google.maps.Polyline({ + path: flightPathArr, + geodesic: true, + strokeColor: "#0000FF", + strokeOpacity: 1.0, + strokeWeight: 6 + }); + // console.log(mapData); + that.flightPath_live.setMap(that.mapNew); + }, time) + } - + } - saveAddress(lat,lng,address){ + saveAddress(lat, lng, address) { var addressObj = { - "lat":lat, - "long":lng, - "address":address - } - this.contactService.saveAdd(addressObj).subscribe(res=>{ + "lat": lat, + "long": lng, + "address": address + } + this.contactService.saveAdd(addressObj).subscribe(res => { // console.log(res); - },err=>{ + }, err => { // console.log("couldn't save address"); }) } - convertDate(utcDate){ - var convertedDate:any; - if(utcDate != undefined){ + convertDate(utcDate) { + var convertedDate: any; + if (utcDate != undefined) { convertedDate = new Date(utcDate).toLocaleString(); - }else{ + } else { convertedDate = ''; } - - return convertedDate ; + + return convertedDate; } - devIcon : any; + devIcon: any; iconCheck(status, iconType) { - + var devStatus = status.split(" "); if ((iconType == 'car') && (devStatus[0] == "OUT")) { @@ -7498,7 +7533,7 @@ var seconds = num % 60; } else if ((iconType == 'car') && (devStatus[0] == "IDLING")) { this.devIcon = "../../assets/image/idle_car.png"; return this.devIcon; - } else if ((iconType == 'car') && (devStatus[0] == "NO")) { + } else if ((iconType == 'car') && (devStatus[0] == "NO")) { this.devIcon = "../../assets/image/no_data.png"; return this.devIcon; } else if ((iconType == 'bike') && (devStatus[0] == "OUT")) { @@ -7514,7 +7549,7 @@ var seconds = num % 60; this.devIcon = "../../assets/image/idle_bike.png"; return this.devIcon; // } - } else if ((iconType == 'bike') && (devStatus[0] == "NO")) { + } else if ((iconType == 'bike') && (devStatus[0] == "NO")) { this.devIcon = "../../assets/image/no_data.png"; return this.devIcon; } else if ((iconType == 'bus') && (devStatus[0] == "OUT")) { @@ -7565,40 +7600,40 @@ var seconds = num % 60; return this.devIcon; } else if ((iconType == 'ambulance') && (devStatus[0] == "OUT")) { - + this.devIcon = "../../assets/images/liveTrackIcons/ambulance_b.png"; return this.devIcon; } else if ((iconType == 'ambulance') && (devStatus[0] == "RUNNING")) { - + this.devIcon = "../../assets/images/liveTrackIcons/ambulance_g.png"; - return this.devIcon; - } else if ((iconType == 'ambulance') && (devStatus[0] == "STOPPED")) { + return this.devIcon; + } else if ((iconType == 'ambulance') && (devStatus[0] == "STOPPED")) { this.devIcon = "../../assets/images/liveTrackIcons/ambulance_r.png"; return this.devIcon; - } else if ((iconType == 'ambulance') && (devStatus[0] == "IDLING")) { + } else if ((iconType == 'ambulance') && (devStatus[0] == "IDLING")) { this.devIcon = "../../assets/images/liveTrackIcons/ambulance_y.png"; - return this.devIcon; - } + return this.devIcon; + } else if ((iconType == 'tractor') && (devStatus[0] == "NO")) { this.devIcon = "../../assets/image/no_data.png"; return this.devIcon; } - else if((!iconType)&&(devStatus[0] == "OUT")){ + else if ((!iconType) && (devStatus[0] == "OUT")) { this.devIcon = "../../assets/image/outOfReach_car.png"; return this.devIcon; - } else if((!iconType)&&(devStatus[0] == "RUNNING")){ + } else if ((!iconType) && (devStatus[0] == "RUNNING")) { this.devIcon = "../../assets/image/running_car.png"; return this.devIcon; - }else if((!iconType)&&(devStatus[0] == "STOPPED")){ + } else if ((!iconType) && (devStatus[0] == "STOPPED")) { this.devIcon = "../../assets/image/stopped_car.png"; return this.devIcon; - }else if((!iconType)&&(devStatus[0] == "IDLING")){ + } else if ((!iconType) && (devStatus[0] == "IDLING")) { this.devIcon = "../../assets/image/idle_car.png"; return this.devIcon; - }else if ((!iconType) && (devStatus[0] == "NO")) { + } else if ((!iconType) && (devStatus[0] == "NO")) { this.devIcon = "../../assets/image/no_data.png"; return this.devIcon; - }else if ((iconType == 'user') && (devStatus[0] == "OUT")) { + } else if ((iconType == 'user') && (devStatus[0] == "OUT")) { this.devIcon = "../../assets/image/user_b.png"; return this.devIcon; } else if ((iconType == 'user') && (devStatus[0] == "RUNNING")) { @@ -7610,8 +7645,8 @@ var seconds = num % 60; } else if ((iconType == 'user') && (devStatus[0] == "IDLING")) { this.devIcon = "../../assets/image/user_y.png"; return this.devIcon; - - }else if ((iconType == 'user') && (devStatus[0] == "NO")) { + + } else if ((iconType == 'user') && (devStatus[0] == "NO")) { this.devIcon = "../../assets/image/no_data.png"; return this.devIcon; } @@ -7627,27 +7662,27 @@ var seconds = num % 60; } else if ((iconType == 'jcb') && (devStatus[0] == "IDLING")) { this.devIcon = "../../assets/image/jcb_yellow.png"; return this.devIcon; - + } else if ((iconType == 'jcb') && (devStatus[0] == "NO")) { this.devIcon = "../../assets/image/no_data.png"; return this.devIcon; - }else{ + } else { this.devIcon = "../../assets/image/noIcon.png"; return this.devIcon } } - locationShare(device){ + locationShare(device) { let dialogRef = this.dialog.open(ShareLocComponent, { - width:'500px', + width: '500px', data: { deviceObject: device } }); dialogRef.afterClosed().subscribe(result => { if (result == "succ") { - this.data_descip = "Location Shared" ; + this.data_descip = "Location Shared"; // this.immobilizeDevice(device, this.engineCutStatus); } function launch_toast() { @@ -7661,187 +7696,188 @@ var seconds = num % 60; } - getAddress(lat,lng){ - + getAddress(lat, lng) { + var latlng_1 = { "lat": lat, - "long": lng + "long": lng } - this.contactService.getAddressByApi(latlng_1).subscribe(res=>{ - if(res.address != undefined){ - this.historyAdress = res.address ; - } - }) + + this.contactService.getAddressByApi(latlng_1).subscribe(res => { + if (res.address != undefined) { + this.historyAdress = res.address; + } + }) } -getSystemLogs(imeiObj){ - var tDate = new Date(); - tDate.setSeconds(0); - tDate.setMilliseconds(0); - var fDate = new Date().setHours(0,0,0,0); - var payLoad = { - "draw": 5, - "columns": [ - { - "data": "_id" - }, - { - "data": "imei" - }, - { - "data": "date" - }, - { - "data": "latDecimal" - }, - { - "data": "longDecimal" - }, - { - "data": "insertionTime" - }, - { - "data": "syncedAt" - }, - { - "data": "integrationResponse" - }, - { - "data": "speed" - }, - { - "data": "ac" - }, - { - "data": "currentFuel" - }, - { - "data": "raw" - }, - { - "data": "ignition" - }, - { - "data": "power" - }, - { - "data": "fuelVoltage" - }, - { - "data": "rawio" - }, - { - "data": "external_Battery" - }, - { - "data": "powerCutAlarm" - }, - { - "data": "satellites" - } - ], - "order": [ - { - "column": 4, - "dir": "asc" - } - ], - "start": 0, - "length": 100, - "search": { - "value": "", - "regex": false - }, - "op": {}, - "select": [], - "find": { - "imei": imeiObj.Device_ID, - "insertionTime": { - "$gte": { - "_eval": "date", - "value": new Date(fDate).toISOString() + getSystemLogs(imeiObj) { + var tDate = new Date(); + tDate.setSeconds(0); + tDate.setMilliseconds(0); + var fDate = new Date().setHours(0, 0, 0, 0); + var payLoad = { + "draw": 5, + "columns": [ + { + "data": "_id" }, - "$lte": { - "_eval": "date", - "value": tDate.toISOString() + { + "data": "imei" + }, + { + "data": "date" + }, + { + "data": "latDecimal" + }, + { + "data": "longDecimal" + }, + { + "data": "insertionTime" + }, + { + "data": "syncedAt" + }, + { + "data": "integrationResponse" + }, + { + "data": "speed" + }, + { + "data": "ac" + }, + { + "data": "currentFuel" + }, + { + "data": "raw" + }, + { + "data": "ignition" + }, + { + "data": "power" + }, + { + "data": "fuelVoltage" + }, + { + "data": "rawio" + }, + { + "data": "external_Battery" + }, + { + "data": "powerCutAlarm" + }, + { + "data": "satellites" + } + ], + "order": [ + { + "column": 4, + "dir": "asc" + } + ], + "start": 0, + "length": 100, + "search": { + "value": "", + "regex": false + }, + "op": {}, + "select": [], + "find": { + "imei": imeiObj.Device_ID, + "insertionTime": { + "$gte": { + "_eval": "date", + "value": new Date(fDate).toISOString() + }, + "$lte": { + "_eval": "date", + "value": tDate.toISOString() + } } } } - } - var suburl = '/gps/datatable'; - - this.contactService.post(suburl, payLoad).subscribe(resp => { + var suburl = '/gps/datatable'; + + this.contactService.post(suburl, payLoad).subscribe(resp => { // console.log(resp); var tempLog = resp; - this.gpsDataArr=[]; + this.gpsDataArr = []; this.gpsDataArr = resp['data']; - for(var i=0;i { - - }); + }, err => { -} -dcqData= []; -deviceCQ(imeiObj){ - var imei = imeiObj.Device_ID?imeiObj.Device_ID:imeiObj ; - this.dcqData =[]; - this.contactService.deviceCmdQueue(imei).subscribe(resp => { - var tempLog = resp; - this.dcqData = resp; - }, err => { - this.dcqData =[]; - }); + }); -} - - -historySeekbaar(){ - -} - - public Selectedspeed = 1; -changeSpeed(t){ - // console.log(t); - this.speed = t * 100; - this.Selectedspeed = t; - -} - - -nearByValue:number= 1000 ; -changeRangeNearby(){ - var rangeVal1 = document.getElementById("nearbySlider"); - this.nearByValue = rangeVal1['value'] ; -} - - -getNearByVehicles(devData){ - // console.log(devData); - var payLoad = { - uid : this.useridd, - distance : this.nearByValue, - coord: {lat : devData.latDecimal,long:devData.longDecimal} } - this.contactService.getNearByVehicles(payLoad).subscribe(res=>{ - // console.log(res); - this.deviceList=[]; - this.deviceList = res; - if(this.deviceList.length != 0){ - if (this.deviceList.length === 0) { - this.lastcall = false; - this.firstcall = true - } - this.foods=[]; - for (var k = 0; k < this.deviceList.length; k++) { - this.deviceList[k]['playPause'] = true; - this.deviceList[k]['checked'] = true; + dcqData = []; + deviceCQ(imeiObj) { + var imei = imeiObj.Device_ID ? imeiObj.Device_ID : imeiObj; + this.dcqData = []; + this.contactService.deviceCmdQueue(imei).subscribe(resp => { + var tempLog = resp; + this.dcqData = resp; + }, err => { + this.dcqData = []; + }); + + } + + + historySeekbaar() { + + } + + public Selectedspeed = 1; + changeSpeed(t) { + // console.log(t); + this.speed = t * 100; + this.Selectedspeed = t; + + } + + + nearByValue: number = 1000; + changeRangeNearby() { + var rangeVal1 = document.getElementById("nearbySlider"); + this.nearByValue = rangeVal1['value']; + } + + + getNearByVehicles(devData) { + // console.log(devData); + var payLoad = { + uid: this.useridd, + distance: this.nearByValue, + coord: { lat: devData.latDecimal, long: devData.longDecimal } + } + this.contactService.getNearByVehicles(payLoad).subscribe(res => { + // console.log(res); + this.deviceList = []; + this.deviceList = res; + if (this.deviceList.length != 0) { + if (this.deviceList.length === 0) { + this.lastcall = false; + this.firstcall = true + } + this.foods = []; + for (var k = 0; k < this.deviceList.length; k++) { + this.deviceList[k]['playPause'] = true; + this.deviceList[k]['checked'] = true; if (this.deviceList[k].type_of_device == "Tracker") { let a = { value: this.deviceList[k].Device_Name, @@ -7852,224 +7888,224 @@ getNearByVehicles(devData){ email: this.deviceList[k].Email_ID, deviceType: this.deviceList[k].type_of_device, iconType: this.deviceList[k].iconType, - // checked:true + // checked:true } this.foods.push(a); - if(k === (this.deviceList.length -1)){ + if (k === (this.deviceList.length - 1)) { // console.log("1111111121212"); this.livetrack(null); } - - } + + } + } + this.masterFoods = JSON.parse(JSON.stringify(this.foods)); + this.sortFoodDataByKey(); + // console.log('this.deviceList',this.deviceList); + } else { + this.data_descip = "No Nearby Devices Found !!!"; + launch_toast(); + } - this.masterFoods = JSON.parse(JSON.stringify(this.foods)); - this.sortFoodDataByKey(); - // console.log('this.deviceList',this.deviceList); - }else{ - this.data_descip = "No Nearby Devices Found !!!"; - launch_toast(); - } + function launch_toast() { + // console.log(divid); + var x = document.getElementById("toast") + // console.log(x); + x.className = "show"; + setTimeout(function () { x.className = x.className.replace("show", ""); }, 1500); + } + }) + } - 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); - } - }) -} + directionShow(deviceObj) { + var lat = deviceObj.last_location.lat; + var long = deviceObj.last_location.long; - directionShow(deviceObj) { - var lat = deviceObj.last_location.lat; - var long = deviceObj.last_location.long; - - var url ="https://www.google.com/maps/dir/?api=1&destination="+lat+","+long+"&travelmode=driving"; - window.open(url, '_blank'); - } + var url = "https://www.google.com/maps/dir/?api=1&destination=" + lat + "," + long + "&travelmode=driving"; + window.open(url, '_blank'); + } - getStringifyio(rawio){ - console.log('askdjsahdiasjdasdlkasdjasdlkadjajldadadaa',rawio); - return JSON.stringify(rawio); + getStringifyio(rawio) { + console.log('askdjsahdiasjdasdlkasdjasdlkadjajldadadaa', rawio); + return JSON.stringify(rawio); - } + } - viewStreet(){ - console.log("Street View"); + viewStreet() { + console.log("Street View"); - } + } - triggerDeviceCmd(dev){ - console.log('device Object',dev); + triggerDeviceCmd(dev) { + console.log('device Object', dev); // CmdUIComponent - let dialogRef = this.dialog.open(CommandWindowComponent, { - width:'500px', + let dialogRef = this.dialog.open(CommandWindowComponent, { + width: '500px', data: { deviceObject: dev } }); dialogRef.afterClosed().subscribe(result => { if (result == "succ") { - this.data_descip = "Command Successfully Triggered" ; - launch_toast() - + this.data_descip = "Command Successfully Triggered"; + launch_toast() + } - if(result == "openOther"){ + if (result == "openOther") { let dialogRef_1 = this.dialog.open(CmdUIComponent, { - width:'500px', + width: '500px', data: { deviceObject: dev } }); dialogRef_1.afterClosed().subscribe(result => { - if(result === 'cancel'){ + if (result === 'cancel') { // console.log('Working Fine'); } - if(result === 'succ'){ + if (result === 'succ') { this.data_descip = 'Command Triggered Successfully'; launch_toast(); - + } }) } - function launch_toast() { + function launch_toast() { var x = document.getElementById("toast"); x.className = "show"; setTimeout(function () { x.className = x.className.replace("show", ""); }, 1500); } }); - } - parkingArr = []; + } + parkingArr = []; + + parkingData(fTime, tTime, uid, dev) { - parkingData(fTime, tTime,uid,dev){ - // console.log('fTime, tTime,uid,dev',fTime, tTime,uid,dev); var fd = new Date(fTime); - var td= new Date(tTime); - var userid=(dev.user._id != undefined)?dev.user._id:dev.user; - var device_imei=dev._id; - - this.contactService.stoppage_report(fd.toISOString(),td.toISOString(),userid,device_imei).subscribe(res=>{ - this.parkingArr =[] ; - this.parkingArr =res ; - + var td = new Date(tTime); + var userid = (dev.user._id != undefined) ? dev.user._id : dev.user; + var device_imei = dev._id; + + this.contactService.stoppage_report(fd.toISOString(), td.toISOString(), userid, device_imei).subscribe(res => { + this.parkingArr = []; + this.parkingArr = res; + // console.log('response=>',res); - },err=>{ - this.parkingArr =[] ; + }, err => { + this.parkingArr = []; }) } - notifArray=[]; - bulkVar:any; - notificationData(fTime, tTime,uid,dev){ + notifArray = []; + bulkVar: any; + notificationData(fTime, tTime, uid, dev) { // console.log('fTime, tTime,uid,dev',fTime, tTime,uid,dev); // console.log('Inside notification'); var fd = new Date(fTime); - var td= new Date(tTime); - var userid=(dev.user._id != undefined)?dev.user._id:dev.user; + var td = new Date(tTime); + var userid = (dev.user._id != undefined) ? dev.user._id : dev.user; // var userid:any; // console.log(dev); - var device_imei= dev.Device_ID; - - var skip = 1; - var limit = 200; - // console.log('what is skip here',skip); - - this.contactService.filteredNotifications(fd,td,this.bulkVar,device_imei,userid,skip,limit) - .subscribe(res=>{ - // console.log('res=>',res); - this.notifArray = []; - this.notifArray = res; - // console.log('this.notifArray',this.notifArray); + var device_imei = dev.Device_ID; - },err=>{ - this.notifArray = []; - }) + var skip = 1; + var limit = 200; + // console.log('what is skip here',skip); + + this.contactService.filteredNotifications(fd, td, this.bulkVar, device_imei, userid, skip, limit) + .subscribe(res => { + // console.log('res=>',res); + this.notifArray = []; + this.notifArray = res; + // console.log('this.notifArray',this.notifArray); + + }, err => { + this.notifArray = []; + }) } - getDuration(atime,dtime){ - let arrival_time = new Date(atime).toLocaleString(); + getDuration(atime, dtime) { + let arrival_time = new Date(atime).toLocaleString(); let departure_time = new Date(dtime).toLocaleString(); - var fd = new Date(arrival_time ).getTime(); + var fd = new Date(arrival_time).getTime(); var td = new Date(departure_time).getTime(); - var time_difference = td-fd; - var total_min = time_difference/60000; - var hours = total_min/60 + var time_difference = td - fd; + var total_min = time_difference / 60000; + var hours = total_min / 60 var rhours = Math.floor(hours); var minutes = (hours - rhours) * 60; - var rminutes = Math.round(minutes); - let Durations = rhours +" "+'hrs'+ " "+ rminutes + 'min'; + var rminutes = Math.round(minutes); + let Durations = rhours + " " + 'hrs' + " " + rminutes + 'min'; return Durations; } - getAlink(lat,lng){ + getAlink(lat, lng) { // lat +","+lng + // https://maps.google.com/?q= - var addressLink = "https://maps.google.com/?q=" +lat +',' +lng; - return addressLink; + var addressLink = "https://maps.google.com/?q=" + lat + ',' + lng; + return addressLink; } - liveEventsData:any=[]; - nType:any; - getRecentNotification(colObj){ - var fd= new Date(); - fd.setHours(0,0,0,0); - var fromD = new Date(fd); - var td = new Date(); - // var user = colObj.user; - var user=(colObj.user._id != undefined)?colObj.user._id:colObj.user; - var did= colObj.Device_ID + liveEventsData: any = []; + nType: any; + getRecentNotification(colObj) { + var fd = new Date(); + fd.setHours(0, 0, 0, 0); + var fromD = new Date(fd); + var td = new Date(); + // var user = colObj.user; + var user = (colObj.user._id != undefined) ? colObj.user._id : colObj.user; + var did = colObj.Device_ID // console.log('Inside get Notification Function',this.deviceSelect); - var skip=1; + var skip = 1; var limit = 200; // console.log('what is skip here',skip); - this.contactService.filteredNotifications(fromD,td,this.nType,did,user,skip,limit).subscribe(res=>{ + this.contactService.filteredNotifications(fromD, td, this.nType, did, user, skip, limit).subscribe(res => { // console.log('Inside get Notification Function',did); - this.liveEventsData=[]; - this.liveEventsData = res; - this.socket_Notify.on(this.useridd, this.accListener()); - },err=>{ - this.liveEventsData =[]; + this.liveEventsData = []; + this.liveEventsData = res; + this.socket_Notify.on(this.useridd, this.accListener()); + }, err => { + this.liveEventsData = []; }) } - accListener(){ + accListener() { // console.log('this is accListner'); var outerThis = this; - return function(msg){ - // console.log('message=>',msg); - // console.log('message=>',msg.device , this.deviceSelect); - if (this.deviceSelect){ + return function (msg) { + // console.log('message=>',msg); + // console.log('message=>',msg.device , this.deviceSelect); + if (this.deviceSelect) { - if(msg.device == this.deviceSelect[0].Device_ID){ + if (msg.device == this.deviceSelect[0].Device_ID) { // this.liveEventsData.push(msg); this.liveEventsData.splice(0, 0, msg); } } - // console.log('accListner=>',this.liveEventsData) - + // console.log('accListner=>',this.liveEventsData) + } } - addVehicle(){ - var that= this; + addVehicle() { + var that = this; let dialogRef = this.dialog.open(AddDeviceComponent, { width: '800px', }); @@ -8081,53 +8117,53 @@ getNearByVehicles(devData){ } }); } - checkBoxValue1(event){ + checkBoxValue1(event) { // console.log(event); - this.satelliteDisabled=event.checked + this.satelliteDisabled = event.checked } - checkBoxValue(ev,i){ + checkBoxValue(ev, i) { // console.log('event=>',ev); // console.log('index=>',i); // console.log('this.markerArray[i]',this.markerArray[i]); - var indexSwitch = (this.markerArray[i]===undefined)?0:i; + var indexSwitch = (this.markerArray[i] === undefined) ? 0 : i; // console.log(indexSwitch); // console.log(this.markerArray[indexSwitch].lat, this.markerArray[indexSwitch].lng); // console.log('this.markerArray',this.markerArray); - if(ev.checked === false){ + if (ev.checked === false) { this.markerArray[indexSwitch].marker.setMap(null); // this.markerArray[i] ={}; } - if(ev.checked === true){ + if (ev.checked === true) { this.markerArray[indexSwitch].marker.setMap(null); var m = new google.maps.Marker({ position: new google.maps.LatLng(this.markerArray[indexSwitch].lat, this.markerArray[indexSwitch].lng), map: this.mapNew, - icon: this.markerArray[indexSwitch].icon, + icon: this.markerArray[indexSwitch].icon, }); this.markerArray[indexSwitch].marker = m; this.mapNew.setCenter({ lat: this.markerArray[indexSwitch].lat, lng: this.markerArray[indexSwitch].lng }); - if(this.markerArray[indexSwitch].number_plate) - this.markerArray[indexSwitch].number_plate.open(this.mapNew, this.markerArray[indexSwitch].marker); + if (this.markerArray[indexSwitch].number_plate) + this.markerArray[indexSwitch].number_plate.open(this.mapNew, this.markerArray[indexSwitch].marker); var that = this; - this.markerArray[indexSwitch].marker.addListener('click',function(){ + this.markerArray[indexSwitch].marker.addListener('click', function () { // console.log('inside test function'); - + that.markerArray[i].infowindow.open(that.mapNew, that.markerArray[i].marker); - + }); // this.markerArray[indexSwitch].marker.addListener(this.markerArray[i].infowindow, 'click', function () { - // console.log('inside info click'); + // console.log('inside info click'); // that.markerArray[i].infowindow.open(that.mapNew, that.markerArray[i].marker); // }); } - - var that= this; - this.deviceList.filter((dl,index)=>{ + + var that = this; + this.deviceList.filter((dl, index) => { // console.log(dl,index); - if(dl.Device_ID == this.markerArray[indexSwitch].imei){ + if (dl.Device_ID == this.markerArray[indexSwitch].imei) { that.deviceList[index].checked = ev.checked } @@ -8136,106 +8172,106 @@ getNearByVehicles(devData){ } - selectGroup(event,item){ - var index=[] + selectGroup(event, item) { + var index = [] // console.log(item); - if(event.checked){ - this.deviceList.filter(x => x.vehicleGroup==undefined || x.vehicleGroup.name !== item.name).forEach(x => this.deviceList[this.deviceList.indexOf(x)].checked=false); - this.deviceList.filter(x =>{ - if(x.vehicleGroup){ - if(x.vehicleGroup.name === item.name){ - // console.log(x) - var ev={checked:true} - this.checkBoxValue(ev,this.deviceList.indexOf(x)); + if (event.checked) { + this.deviceList.filter(x => x.vehicleGroup == undefined || x.vehicleGroup.name !== item.name).forEach(x => this.deviceList[this.deviceList.indexOf(x)].checked = false); + this.deviceList.filter(x => { + if (x.vehicleGroup) { + if (x.vehicleGroup.name === item.name) { + // console.log(x) + var ev = { checked: true } + this.checkBoxValue(ev, this.deviceList.indexOf(x)); + } + } else { + var ev = { checked: false } + this.checkBoxValue(ev, this.deviceList.indexOf(x)); } - }else{ - var ev={checked:false} - this.checkBoxValue(ev,this.deviceList.indexOf(x)); - } - }) - }else{ - this.deviceList.forEach(x => { - x.checked=true; - var ev={checked:true} - this.checkBoxValue(ev,this.deviceList.indexOf(x)); - - }); - } - + }) + } else { + this.deviceList.forEach(x => { + x.checked = true; + var ev = { checked: true } + this.checkBoxValue(ev, this.deviceList.indexOf(x)); + + }); + } + // for(var i=0;i - // console.log(x) - // ); + + // }).forEach(x => + // console.log(x) + // ); } - getUserDetails(){ + getUserDetails() { // console.log("USERID--",this.useridd); - - this.contactService.getUserObj(this.useridd).subscribe((res:any)=>{ + + this.contactService.getUserObj(this.useridd).subscribe((res: any) => { // console.log("RESPONSE",res); - if(res.label_setting!==undefined){ - this.showLabels=res.label_setting - this.digitalInput=res.digital_input + if (res.label_setting !== undefined) { + this.showLabels = res.label_setting + this.digitalInput = res.digital_input } - if(res.user_settings){ - if(res.user_settings.sateliteValue) - this.satelite=res.user_settings.sateliteValue + if (res.user_settings) { + if (res.user_settings.sateliteValue) + this.satelite = res.user_settings.sateliteValue } - - + + }) } - + // @HostListener('click', ['$event']) // onClick(event) { // if (event.target.id === 'deletePoint'){ - // console.log(event.target.value); + // console.log(event.target.value); // this.latlongObjArr.splice(event.target.value,1); // this.maphistory(1) // } - + // } // CLICK(data){ - // console.log(data); - + // console.log(data); + // } // ------------new Method for calculate area------------------ - cordinates=[]; - showArea(){ + cordinates = []; + showArea() { // console.log(this.datefrom,this.date2,this.foods); - var imei=JSON.parse(localStorage.getItem('devDetail'))?JSON.parse(localStorage.getItem('devDetail')):this.temptrackingDev + var imei = JSON.parse(localStorage.getItem('devDetail')) ? JSON.parse(localStorage.getItem('devDetail')) : this.temptrackingDev // console.log(imei,"====>",imei,this.temptrackingDev); - if(!imei){ - imei=this.deviceSelect[0].did - }else{ - if(imei.vehicleId){ - imei=imei.vehicleId - }else{ - imei=imei + if (!imei) { + imei = this.deviceSelect[0].did + } else { + if (imei.vehicleId) { + imei = imei.vehicleId + } else { + imei = imei } } - - var data={ - f:new Date(this.datefrom).toISOString(), - t:new Date(this.date2).toISOString(), - imei:imei + + var data = { + f: new Date(this.datefrom).toISOString(), + t: new Date(this.date2).toISOString(), + imei: imei } // console.log( // data // ); - - this.contactService.calculateArea(data).subscribe((res:any)=>{ + + this.contactService.calculateArea(data).subscribe((res: any) => { // console.log("AREA RESPONSE",res); - if(res.area) - this.area=(res.area/1000000)*247; + if (res.area) + this.area = (res.area / 1000000) * 247; // let a = res.pts; @@ -8247,337 +8283,337 @@ getNearByVehicles(devData){ // this.cordinates.push(b); // } - // console.log(this.cordinates); + // console.log(this.cordinates); // // this.draw1(this.cordinates,'') - - + + }) } - -// draw1(zzz,yyy){ -// var map; -// var infoWindow; - // console.log(typeof zzz) -// var GeoFencCoords = zzz -// var GeoName = yyy - // console.log(zzz[0].lat) -// initMap(GeoFencCoords); -// function initMap(GeoFencCoords) { -// map = new google.maps.Map(document.getElementById('map2'), { -// zoom: 17, -// center: {lat: GeoFencCoords[0].lat, lng: GeoFencCoords[0].lng}, -// mapTypeId: 'terrain' -// }); - -// var bermudaTriangle = new google.maps.Polygon({ -// paths: GeoFencCoords, -// strokeColor: '#FF0000', -// strokeOpacity: 0.8, -// strokeWeight: 3, -// fillColor: '#FF0000', -// fillOpacity: 0.35 -// }); -// bermudaTriangle.setMap(map); + // draw1(zzz,yyy){ + // var map; + // var infoWindow; + // console.log(typeof zzz) + // var GeoFencCoords = zzz + // var GeoName = yyy + // console.log(zzz[0].lat) + // initMap(GeoFencCoords); + // function initMap(GeoFencCoords) { + // map = new google.maps.Map(document.getElementById('map2'), { + // zoom: 17, + // center: {lat: GeoFencCoords[0].lat, lng: GeoFencCoords[0].lng}, + // mapTypeId: 'terrain' + // }); -// // Add a listener for the click event. -// bermudaTriangle.addListener('click', showArrays); -// infoWindow = new google.maps.InfoWindow; -// } + // var bermudaTriangle = new google.maps.Polygon({ + // paths: GeoFencCoords, + // strokeColor: '#FF0000', + // strokeOpacity: 0.8, + // strokeWeight: 3, + // fillColor: '#FF0000', + // fillOpacity: 0.35 + // }); + // bermudaTriangle.setMap(map); -// /** @this {google.maps.Polygon} */ -// function showArrays(event) { -// // Since this polygon has only one path, we can call getPath() to return the -// // MVCArray of LatLngs. -// var vertices = this.getPath(); + // // Add a listener for the click event. + // bermudaTriangle.addListener('click', showArrays); -// var contentString = 'Geo Fence
' + -// 'Name: ' + GeoName; + // infoWindow = new google.maps.InfoWindow; + // } -// // Iterate over the vertices. -// /* for (var i =0; i < vertices.getLength(); i++) { -// var xy = vertices.getAt(i); -// contentString += '
' + 'Coordinate ' + i + ':
' + xy.lat() + ',' + -// xy.lng(); -// } -// */ -// // Replace the info window's content and position. -// infoWindow.setContent(contentString); -// infoWindow.setPosition(event.latLng); + // /** @this {google.maps.Polygon} */ + // function showArrays(event) { + // // Since this polygon has only one path, we can call getPath() to return the + // // MVCArray of LatLngs. + // var vertices = this.getPath(); -// infoWindow.open(map); -// } -// } + // var contentString = 'Geo Fence
' + + // 'Name: ' + GeoName; -change(device){ - // console.log(device); - this.deviceSelect[0]=device; - // console.log(this.deviceSelect); - -} -startAddress:any; -deviceNameForPDF -startTime -endTime -endAddress:any -pdfFunction(data){ - // console.log("IN PDF FUNCTION",data) - // this.startAddress=this.getAddressForPDF(data.today_start_location?data.today_start_location.lat:0,data.today_start_location?data.today_start_location.long:0,'start'); - // this.endAddress=this.getAddressForPDF(data.last_location?data.last_location.lat:0,data.last_location?data.last_location.long:0,'end') -} -getAddressForPDF(lat,lng,type){ - - var outerThis=this - - let geocoder = new google.maps.Geocoder(); - - let request = { - latLng: new google.maps.LatLng(lat,lng) - }; - geocoder.geocode(request, function (data, status) { - if (status == google.maps.GeocoderStatus.OK) { - if (data[0] != null) { - // var liveAdd = ; - // console.log(data[0].formatted_address); - if(type=="start"){ - outerThis.startAddress=data[0].formatted_address - }else{ - outerThis.endAddress=data[0].formatted_address - } - return data[0].formatted_address; - } - } - else { - // console.log(liveAdd); - return 'N/A'; - - - } - - }) -} + // // Iterate over the vertices. + // /* for (var i =0; i < vertices.getLength(); i++) { + // var xy = vertices.getAt(i); + // contentString += '
' + 'Coordinate ' + i + ':
' + xy.lat() + ',' + + // xy.lng(); + // } + // */ + // // Replace the info window's content and position. + // infoWindow.setContent(contentString); + // infoWindow.setPosition(event.latLng); + + // infoWindow.open(map); + // } + // } + + change(device) { + // console.log(device); + this.deviceSelect[0] = device; + // console.log(this.deviceSelect); + + } + startAddress: any; + deviceNameForPDF + startTime + endTime + endAddress: any + pdfFunction(data) { + // console.log("IN PDF FUNCTION",data) + // this.startAddress=this.getAddressForPDF(data.today_start_location?data.today_start_location.lat:0,data.today_start_location?data.today_start_location.long:0,'start'); + // this.endAddress=this.getAddressForPDF(data.last_location?data.last_location.lat:0,data.last_location?data.last_location.long:0,'end') + } + getAddressForPDF(lat, lng, type) { + + var outerThis = this + + let geocoder = new google.maps.Geocoder(); + + let request = { + latLng: new google.maps.LatLng(lat, lng) + }; + geocoder.geocode(request, function (data, status) { + if (status == google.maps.GeocoderStatus.OK) { + if (data[0] != null) { + // var liveAdd = ; + // console.log(data[0].formatted_address); + if (type == "start") { + outerThis.startAddress = data[0].formatted_address + } else { + outerThis.endAddress = data[0].formatted_address + } + return data[0].formatted_address; + } + } + else { + // console.log(liveAdd); + return 'N/A'; + + + } + + }) + } -image - pdf() { - var image="" - if(this.deviceList[0].supAdmin.imageDoc.length != 0){ - var str = this.deviceList[0].supAdmin.imageDoc[0] - var splitStr = str.split('/'); - var concatStr =''; - for(var i=1 ; i< splitStr.length ; i++){ - if(i > 0){ - var tt = splitStr[i]; - concatStr += '/'+tt ; - } - } - image='https://www.oneqlik.in' + concatStr + image + pdf() { + var image = "" + if (this.deviceList[0].supAdmin.imageDoc.length != 0) { + var str = this.deviceList[0].supAdmin.imageDoc[0] + var splitStr = str.split('/'); + var concatStr = ''; + for (var i = 1; i < splitStr.length; i++) { + if (i > 0) { + var tt = splitStr[i]; + concatStr += '/' + tt; + } + } + image = 'https://www.oneqlik.in' + concatStr // console.log("IMAGE==>",image); - + // this.contactService.imageUrlToBase64('https://www.oneqlik.in' + concatStr).subscribe(res=>{ - // console.log("Image=>",(res).toString()); + // console.log("Image=>",(res).toString()); // // this.image=res // }) - // this.getBase64ImageFromUrl('https://www.oneqlik.in' + concatStr).then(result => this.image= result) - } - this.deviceNameForPDF=this.tempMapHistory[0].device_name - this.startTime=this.tempMapHistory[0].fromTime - this.endTime=this.tempMapHistory[0].toTime; - var name=this.deviceNameForPDF+" track from "+this.startTime+" to "+this.endTime+'.pdf' - var outerThis=this; - this.startAddress = this.finalArr[0] ?this.finalArr[0].address : ''; - this.endAddress = this.finalArr[0] ?this.finalArr[this.finalArr.length-1].address :'' + // this.getBase64ImageFromUrl('https://www.oneqlik.in' + concatStr).then(result => this.image= result) + } + this.deviceNameForPDF = this.tempMapHistory[0].device_name + this.startTime = this.tempMapHistory[0].fromTime + this.endTime = this.tempMapHistory[0].toTime; + var name = this.deviceNameForPDF + " track from " + this.startTime + " to " + this.endTime + '.pdf' + var outerThis = this; + this.startAddress = this.finalArr[0] ? this.finalArr[0].address : ''; + this.endAddress = this.finalArr[0] ? this.finalArr[this.finalArr.length - 1].address : '' // console.log(this.startAddress,this.endAddress); - -// console.log(this.tempMapHistory,this.startAddress,this.endAddress, this.image); + + // console.log(this.tempMapHistory,this.startAddress,this.endAddress, this.image); - var element = $('#map2'); - var pdfOptions = { - orientation: "landscape", // One of "portrait" or "landscape" (or shortcuts "p" (Default), "l") - unit: "mm", //Measurement unit to be used when coordinates are specified. One of "pt" (points), "mm" (Default), "cm", "in" - format: "legal" //One of 'a3', 'a4' (Default),'a5' ,'letter' ,'legal' - }; + var element = $('#map2'); + var pdfOptions = { + orientation: "landscape", // One of "portrait" or "landscape" (or shortcuts "p" (Default), "l") + unit: "mm", //Measurement unit to be used when coordinates are specified. One of "pt" (points), "mm" (Default), "cm", "in" + format: "legal" //One of 'a3', 'a4' (Default),'a5' ,'letter' ,'legal' + }; - var doc = new jsPDF(pdfOptions); - this.contactService.setFontInPdf(doc); - var pageWidth = doc.internal.pageSize.width-20; - var width = pageWidth; + var doc = new jsPDF(pdfOptions); + this.contactService.setFontInPdf(doc); + var pageWidth = doc.internal.pageSize.width - 20; + var width = pageWidth; - html2canvas(element, { - useCORS: true, // MUST - onrendered: function(canvas) { - var imgWidth = element.width(); - var imgHeight = element.height(); + html2canvas(element, { + useCORS: true, // MUST + onrendered: function (canvas) { + var imgWidth = element.width(); + var imgHeight = element.height(); - var height = (pageWidth * imgHeight)/ imgWidth - var imgData = canvas.toDataURL('image/png'); - doc.addImage(imgData, 'PNG', 5, 30 , width, height); - outerThis.toDataURL(image, function (dataUrl) { - if(image) - doc.addImage(dataUrl, 'JPEG', 2, 2, 27, 27); - let finalY = doc.previousAutoTable.finalY; - var header = function(data) { - doc.setFontSize(15); - doc.setTextColor(40); - doc.setFontStyle('normal'); - // console.log(dataUrl); - - // doc.addImage(dataUrl, 'JPEG', data.settings.margin.left, 20, 30, 30); - // doc.text("Testing Report", data.settings.margin.left, 50); - }; - doc.autoTable({html:"#headerTable",margin:{bottom:140,left:30,right:8,top:2},theme:'plain'}); - - // var options = { - // beforePageContent: header, - // // margin: { - // // top: 300 - // // }, - // // // startY:doc.lastAutoTable+ 300 - // // startY: 300 - // // startY: doc.autoTableEndPosY() + 300 - // }; - doc.autoTable({ - head: outerThis.headRows(), - // margin: { top: 80 }, - startY: doc.autoTable.previous.finalY + 200, - body: outerThis.bodyRows(outerThis.finalArr.length, outerThis.finalArr), - // beforePageContent: header, - }); - doc.save(name); - // // doc.addImage(dataUrl, 'JPG', 330, 4, 20, 20); - // // doc.addImage({ - // // imageData : dataUrl, - // // angle : 20, - // // x : 330, - // // y : 1, - // // w : 20, - // // h : 20 - // // }) - // console.log("URLLLL",dataUrl); - // // this.image=dataUrl - // }) - }); - - } + var height = (pageWidth * imgHeight) / imgWidth + var imgData = canvas.toDataURL('image/png'); + doc.addImage(imgData, 'PNG', 5, 30, width, height); + outerThis.toDataURL(image, function (dataUrl) { + if (image) + doc.addImage(dataUrl, 'JPEG', 2, 2, 27, 27); + let finalY = doc.previousAutoTable.finalY; + var header = function (data) { + doc.setFontSize(15); + doc.setTextColor(40); + doc.setFontStyle('normal'); + // console.log(dataUrl); + + // doc.addImage(dataUrl, 'JPEG', data.settings.margin.left, 20, 30, 30); + // doc.text("Testing Report", data.settings.margin.left, 50); + }; + doc.autoTable({ html: "#headerTable", margin: { bottom: 140, left: 30, right: 8, top: 2 }, theme: 'plain' }); + + // var options = { + // beforePageContent: header, + // // margin: { + // // top: 300 + // // }, + // // // startY:doc.lastAutoTable+ 300 + // // startY: 300 + // // startY: doc.autoTableEndPosY() + 300 + // }; + doc.autoTable({ + head: outerThis.headRows(), + // margin: { top: 80 }, + startY: doc.autoTable.previous.finalY + 200, + body: outerThis.bodyRows(outerThis.finalArr.length, outerThis.finalArr), + // beforePageContent: header, + }); + doc.save(name); + // // doc.addImage(dataUrl, 'JPG', 330, 4, 20, 20); + // // doc.addImage({ + // // imageData : dataUrl, + // // angle : 20, + // // x : 330, + // // y : 1, + // // w : 20, + // // h : 20 + // // }) + // console.log("URLLLL",dataUrl); + // // this.image=dataUrl + // }) }); + } + }); - } - 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(); - } - - selectedGroup(event){ - // console.log(event,this.toppings); - this.getDeviceBYfilter('','') } - getGrp(){ - this.contactService.getGroup(this.useridd).subscribe( - res => { - // console.log(res); - this.groups = res["group_details"]; - // console.log(this.grpName); - }) -} + toDataURL(url, callback) { + // console.log(url); -selectAllVehicles(ev){ + 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(); + } + + selectedGroup(event) { + // console.log(event,this.toppings); + this.getDeviceBYfilter('', '') + } + + getGrp() { + this.contactService.getGroup(this.useridd).subscribe( + res => { + // console.log(res); + this.groups = res["group_details"]; + // console.log(this.grpName); + }) + } + + selectAllVehicles(ev) { // console.log(ev); - if(ev.checked){ - this.deviceObj = []; - var Alldevices = { - id: "all", - viewValue: "ALL Devices", - iconType: "", - deviceId: "" - } - if(this.deviceList.length==1){ - this.selectedDevice=this.deviceList[0]._id - this.parkingButtonShow=this.deviceList[0].theftAlert==null?'grey':this.deviceList[0].theftAlert==undefined?'grey':this.deviceList[0].theftAlert==true?'green':'red' - this.DriverName=this.deviceList[0].driver_name; - // console.log("DRIVER NAME",this.DriverName,this.deviceList[0].ac); - this.ac=this.deviceList[0].ac?this.deviceList[0].ac:'NA' - this.DriverNumber=this.deviceList[0].contact_number - } - // console.log("device obj =>",this.deviceList); - this.deviceObj.push(Alldevices); - for (var i = 0; i < this.deviceList.length; i++) { - Alldevices = { - id: this.deviceList[i]._id, - viewValue: this.deviceList[i].Device_Name ? this.deviceList[i].Device_Name : "", - iconType: this.deviceList[i].iconType, - deviceId: this.deviceList[i].Device_ID - } - this.deviceObj.push(Alldevices) - } - - this.final = this.deviceList; - this.foods = []; - this.masterFoods = []; - for (let i = 0; i < this.final.length; i++) { - this.final[i]['checked'] = true; - // this.deviceList = this.final; - - if (this.final[i].type_of_device == "Tracker") { - let a = { - value: this.final[i].Device_Name, - viewValue: this.final[i].Device_Name, - did: this.final[i].Device_ID, - id: this.final[i]._id, - user: this.final[i].user, - email: this.final[i].Email_ID, - deviceType: this.final[i].type_of_device, - iconType: this.final[i].iconType - - } - - this.foods.push(a); - - } - - } - - let that= this; - if((this.navId === undefined)||(this.navId != 'locationHistory')){ - this.livetrack(this.fin); - } - - for (let y = 0; y < this.foods.length; y++) { - if (this.foods[y].did == this.fin) { - this.new = this.foods[y]; - } + if (ev.checked) { + this.deviceObj = []; + var Alldevices = { + id: "all", + viewValue: "ALL Devices", + iconType: "", + deviceId: "" + } + if (this.deviceList.length == 1) { + this.selectedDevice = this.deviceList[0]._id + this.parkingButtonShow = this.deviceList[0].theftAlert == null ? 'grey' : this.deviceList[0].theftAlert == undefined ? 'grey' : this.deviceList[0].theftAlert == true ? 'green' : 'red' + this.DriverName = this.deviceList[0].driver_name; + // console.log("DRIVER NAME",this.DriverName,this.deviceList[0].ac); + this.ac = this.deviceList[0].ac ? this.deviceList[0].ac : 'NA' + this.DriverNumber = this.deviceList[0].contact_number + } + // console.log("device obj =>",this.deviceList); + this.deviceObj.push(Alldevices); + for (var i = 0; i < this.deviceList.length; i++) { + Alldevices = { + id: this.deviceList[i]._id, + viewValue: this.deviceList[i].Device_Name ? this.deviceList[i].Device_Name : "", + iconType: this.deviceList[i].iconType, + deviceId: this.deviceList[i].Device_ID + } + this.deviceObj.push(Alldevices) + } + + this.final = this.deviceList; + this.foods = []; + this.masterFoods = []; + for (let i = 0; i < this.final.length; i++) { + this.final[i]['checked'] = true; + // this.deviceList = this.final; + + if (this.final[i].type_of_device == "Tracker") { + let a = { + value: this.final[i].Device_Name, + viewValue: this.final[i].Device_Name, + did: this.final[i].Device_ID, + id: this.final[i]._id, + user: this.final[i].user, + email: this.final[i].Email_ID, + deviceType: this.final[i].type_of_device, + iconType: this.final[i].iconType + } + + this.foods.push(a); + + } + + } + + let that = this; + if ((this.navId === undefined) || (this.navId != 'locationHistory')) { + this.livetrack(this.fin); + } + + for (let y = 0; y < this.foods.length; y++) { + if (this.foods[y].did == this.fin) { + this.new = this.foods[y]; + } + } this.masterFoods = JSON.parse(JSON.stringify(this.foods)); this.sortFoodDataByKey(); - }else{ + } else { + - this.deviceList.forEach(element => { - element.checked=false; + element.checked = false; }); const myOptions = { - zoom:2, + zoom: 2, center: new google.maps.LatLng(18.602941, 73.777147), mapTypeId: google.maps.MapTypeId.ROADMAP }; - + var map = new google.maps.Map(document.getElementById('map'), myOptions); // console.log('mapmapmapmapmapmapmapmapmapmapmapmapmapmap',map); var trafficLayer = new google.maps.TrafficLayer(); @@ -8591,9 +8627,9 @@ selectAllVehicles(ev){ zoomBar = document.getElementById('myRange'); map.setZoom(map.getZoom()); - + zoomBar.value = map.getZoom(); - + zoomBar.oninput = function () { // console.log('zoomValue',map.getZoom()); map.setZoom(parseInt(this.value)); @@ -8604,114 +8640,133 @@ selectAllVehicles(ev){ if (zoomBar.value) zoomBar.value = map.getZoom(); }); - + } - -} -reportArr -finalArr=[] -reportArr1 -pathReport=[] -getTravelPathReport(device){ - var payload ={ - "to":new Date(this.date2).toISOString(), - "from" : new Date(this.datefrom).toISOString(), - "device": device.Device_ID ? device.Device_ID : device.did, - "interval" :10 + + } + reportArr + finalArr = [] + reportArr1 + pathReport = [] + getTravelPathReport(device) { + var payload = { + "to": new Date(this.date2).toISOString(), + "from": new Date(this.datefrom).toISOString(), + "device": device.Device_ID ? device.Device_ID : device.did, + "interval": 10 + } + + this.contactService.getTravel_path_report(payload).subscribe((resp: any) => { + + + this.reportArr = []; + if (resp && resp.length) { + this.reportArr = resp.filter(function (el) { + return el != null; + }); + } + + + let last = { speed: '' }; + let result = []; + + for (let i = 0; i < this.reportArr.length; i++) { + var cum_distance = parseFloat(this.reportArr[i].odo) - parseFloat(this.reportArr[0].odo); + this.reportArr[i].cum_distance = Math.abs(parseFloat(cum_distance.toFixed(2))) + + // let char = this.reportArr[i]; + // if(char.speed !== last.speed){ + // result.push(char); + // last = char; + // } + } + // console.log("RESSSS==>",this.reportArr); + this.reportArr1 = this.reportArr + let latLongArray :any[] = []; + this.reportArr1.forEach((deData)=>{ + latLongArray.push({ + "long":deData.longDecimal ? deData.longDecimal : 0, + "lat":deData.latDecimal ? deData.latDecimal : 0 + }) + + }) + + this.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + this.reportArr1.forEach((deData,index)=>{ + let latLng = { + lat: deData.latDecimal ? deData.latDecimal : 0, + long: deData.longDecimal ? deData.longDecimal : 0 } + this.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[index]; + }) - this.contactService.getTravel_path_report(payload).subscribe((resp:any)=>{ - - - this.reportArr = []; - if (resp && resp.length) { - this.reportArr= resp.filter(function (el) { - return el != null; + + + if (this.reportArr1.length != 0) { + var j = 0; + // console.log(this.reportArr1); + for (let i = 0; i < resp.length; i++) { + if (resp[i] != null) { + resp[i].Device_name = device.Device_Name; + this.pathReport.push(resp[i]); + } else { + } + } + + this.finalArr = []; + var that = this + // console.log(this.finalArr); + for (var i = 0; i < this.reportArr1.length; i++) { + this.clocation_1(this.reportArr1[i], function (err, succ) { + if (err) { + // console.log(err); + j++; + } else { + // console.log(succ); + succ['index'] = j + that.finalArr.push(succ); + // if(j==0){ + // that.startAddress=succ.address + // } + // console.log(that.finalArr,j); + j++; + if (j === that.reportArr1.length) { + // that.endAddress=succ.address + that.Load = false; + that.finalArr.sort(function (a: any, b: any) { + + return new Date(a.date).valueOf() - new Date(b.date).valueOf(); }); + // callback({ data: this.finalArr }); + } } - - - let last = {speed:''}; -let result = []; + }) -for(let i = 0; i < this.reportArr.length; i++){ - var cum_distance = parseFloat(this.reportArr[i].odo)-parseFloat(this.reportArr[0].odo); - this.reportArr[i].cum_distance=Math.abs(parseFloat(cum_distance.toFixed(2))) - // let char = this.reportArr[i]; - // if(char.speed !== last.speed){ - // result.push(char); - // last = char; - // } -} -// console.log("RESSSS==>",this.reportArr); -this.reportArr1=this.reportArr - - - if (this.reportArr1.length != 0) { - var j = 0; - // console.log(this.reportArr1); - for(let i = 0; i 0) ? false : true; - this.finalArr = []; - var that=this - // console.log(this.finalArr); - for (var i = 0; i < this.reportArr1.length; i++) { - this.clocation_1(this.reportArr1[i], function (err, succ) { - if (err) { - // console.log(err); - j++; - } else { - // console.log(succ); - succ['index']=j - that.finalArr.push(succ); - // if(j==0){ - // that.startAddress=succ.address - // } - // console.log(that.finalArr,j); - j++; - if (j === that.reportArr1.length) { - // that.endAddress=succ.address - that.Load = false; - that.finalArr.sort(function(a:any,b:any){ - - return new Date(a.date).valueOf() - new Date(b.date).valueOf(); - }); - // callback({ data: this.finalArr }); - } - } - }) - - - } - if(this.pathReport.length==0){ - this.Load = false; - } - } else { - this.Load = false; - this.firstcall=true; - this.lastcall=(this.skip>0)?false:true; - - - } - }, err => { - this.Load= false; - - // console.log("error",err) ; - }); -} + } + }) + }, err => { + this.Load = false; - clocation_1(latlngObj, cb) { - if(latlngObj==null){ - cb(null, latlngObj); - } + // console.log("error",err) ; + }); + + } + + clocation_1(latlngObj, cb) { + if (latlngObj == null) { + cb(null, latlngObj); + } var outerThis = this; var la = ''; @@ -8719,25 +8774,17 @@ this.reportArr1=this.reportArr lat: "0", long: "0" }; - - latLng = { - lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, - long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 - } - - - // if () { - // latLng = { - // lat: 0, - // long: 0 - // } - // } + latLng = { + lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, + long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 + } + outerThis.contactService.getAddressByApi(latLng).subscribe(res => { if (res.message == "Address not found in databse") { var adata = { - iden : 'noaddress', - latlng : latLng + iden: 'noaddress', + latlng: latLng } latlngObj['address'] = adata; // cb(null,latlngObj); @@ -8745,20 +8792,20 @@ this.reportArr1=this.reportArr lat: "0", long: "0" }; - - latLng_1 = { - lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, - long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 - } - + latLng_1 = { + lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, + long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 + } + + outerThis.contactService.getAddressByApi(latLng_1).subscribe(res => { if (res.message == "Address not found in databse") { var bdata = { - iden : 'noaddress', - latlng : latLng_1 + iden: 'noaddress', + latlng: latLng_1 } - + latlngObj['address'] = bdata; cb(null, latlngObj); @@ -8776,22 +8823,22 @@ this.reportArr1=this.reportArr lat: "0", long: "0" }; - - latLng_1 = { - lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, - long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 - } + + latLng_1 = { + lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, + long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 + } + + + - - - outerThis.contactService.getAddressByApi(latLng_1).subscribe(res => { if (res.message == "Address not found in databse") { var cdata = { - iden : 'noaddress', - latlng : latLng_1 + iden: 'noaddress', + latlng: latLng_1 } - + latlngObj['address'] = cdata; cb(null, latlngObj); @@ -8809,24 +8856,24 @@ this.reportArr1=this.reportArr } - headRows() { + headRows() { return [ - // displayedColumns=['vehicleName','IMEI','totalDistance','fuel','ignOn','ignOff','idleTime','outOfReach','noGps','trips','maxSpeed','startLocation','endLocation','details']; + // displayedColumns=['vehicleName','IMEI','totalDistance','fuel','ignOn','ignOff','idleTime','outOfReach','noGps','trips','maxSpeed','startLocation','endLocation','details']; { - deviceName:'device Name', - imei:'IMEI', - date:'Date', - odo:'ODO', - distanceFromPrevious:'Distance', - speed:'Speed', - avgSpeed:'AVG Speed', - externalBattery:'Ext Battery', - temperature:'Temperature', - cumDistance:'Cum Distance', - location:'Location', - address:'Address', + deviceName: 'device Name', + imei: 'IMEI', + date: 'Date', + odo: 'ODO', + distanceFromPrevious: 'Distance', + speed: 'Speed', + avgSpeed: 'AVG Speed', + externalBattery: 'Ext Battery', + temperature: 'Temperature', + cumDistance: 'Cum Distance', + location: 'Location', + address: 'Address', } ]; } @@ -8834,87 +8881,87 @@ this.reportArr1=this.reportArr bodyRows(rowCount, pdfBody) { rowCount = rowCount || 10; let body = []; - - + + for (var j = 0; j < rowCount; j++) { - var str = (pdfBody[j] && pdfBody[j].latDecimal ? pdfBody[j].latDecimal : 0) + ' , ' + (pdfBody[j] &&pdfBody[j].longDecimal?pdfBody[j].longDecimal:0) + var str = (pdfBody[j] && pdfBody[j].latDecimal ? pdfBody[j].latDecimal : 0) + ' , ' + (pdfBody[j] && pdfBody[j].longDecimal ? pdfBody[j].longDecimal : 0) body.push({ - deviceName:pdfBody[j].Device_name, - imei:pdfBody[j].imei, - date:moment(pdfBody[j].date).format('lll'), - odo:pdfBody[j].odo?(pdfBody[j].odo).toFixed(2):0, - distanceFromPrevious:this.get_distance(pdfBody[j],pdfBody[j].index), - speed:pdfBody[j].speed, - avgSpeed:this.getavgSpeed(pdfBody[j],pdfBody[j].index), - externalBattery:pdfBody[j].external_Battery?pdfBody[j].external_Battery:'0', - temperature:pdfBody[j].temp?(parseFloat(pdfBody[j].temp)/10).toFixed(2):'0', - cumDistance:this.getcummulative_distance(pdfBody[j],pdfBody[j].index), - location:str, - address:pdfBody[j].address, + deviceName: pdfBody[j].Device_name, + imei: pdfBody[j].imei, + date: moment(pdfBody[j].date).format('lll'), + odo: pdfBody[j].odo ? (pdfBody[j].odo).toFixed(2) : 0, + distanceFromPrevious: this.get_distance(pdfBody[j], pdfBody[j].index), + speed: pdfBody[j].speed, + avgSpeed: this.getavgSpeed(pdfBody[j], pdfBody[j].index), + externalBattery: pdfBody[j].external_Battery ? pdfBody[j].external_Battery : '0', + temperature: pdfBody[j].temp ? (parseFloat(pdfBody[j].temp) / 10).toFixed(2) : '0', + cumDistance: this.getcummulative_distance(pdfBody[j], pdfBody[j].index), + location: str, + address: pdfBody[j].address, }); } return body; } -getcummulative_distance(gps_report,index){ - - if(index == 0){ - return 0.00; - }else{ - var cum_distance = parseFloat(this.reportArr1[index].odo)-parseFloat(this.reportArr1[0].odo); - return Math.abs(parseFloat(cum_distance.toFixed(2))) ; - } - -} + getcummulative_distance(gps_report, index) { -getavgSpeed(gps_report,index_1){ - if(index_1 == 0){ - return 0.00; - }else{ - var cum_distance = parseFloat(this.reportArr1[index_1].odo)-parseFloat(this.reportArr1[index_1-1].odo); - return Math.abs(parseFloat((cum_distance/0.166).toFixed(2))); - } -} - -get_distance(gps_report,index_1){ - if(index_1 == 0){ - return 0.00; - }else{ - var cum_distance = parseFloat(this.reportArr1[index_1].odo)-parseFloat(this.reportArr1[index_1-1].odo); - return Math.abs(parseFloat(cum_distance.toFixed(2))); - } - -} - -changeParking(){ - var theftAlert=this.parkingButtonShow=='grey'?true:this.parkingButtonShow=='green'?false:true - this.contactService.post('/devices/deviceupdate',{_id:this.selectedDevice,theftAlert:theftAlert}).subscribe(res=>{ - if(theftAlert){ - this.parkingButtonShow='green' - }else{ - this.parkingButtonShow='red' + if (index == 0) { + return 0.00; + } else { + var cum_distance = parseFloat(this.reportArr1[index].odo) - parseFloat(this.reportArr1[0].odo); + return Math.abs(parseFloat(cum_distance.toFixed(2))); } - }) -} + } - openRightMenu() { - document.getElementById("rightMenu").style.display = "block"; - document.getElementById('buttons').style.marginRight='325px' -} + getavgSpeed(gps_report, index_1) { + if (index_1 == 0) { + return 0.00; + } else { + var cum_distance = parseFloat(this.reportArr1[index_1].odo) - parseFloat(this.reportArr1[index_1 - 1].odo); + return Math.abs(parseFloat((cum_distance / 0.166).toFixed(2))); + } + } - closeRightMenu() { - document.getElementById("rightMenu").style.display = "none"; - document.getElementById('buttons').style.marginRight='-7px' -} + get_distance(gps_report, index_1) { + if (index_1 == 0) { + return 0.00; + } else { + var cum_distance = parseFloat(this.reportArr1[index_1].odo) - parseFloat(this.reportArr1[index_1 - 1].odo); + return Math.abs(parseFloat(cum_distance.toFixed(2))); + } -saveRoutePath(){ - let dialogRef = this.dialog.open(ShoRoutePlanComponent, { + } + + changeParking() { + var theftAlert = this.parkingButtonShow == 'grey' ? true : this.parkingButtonShow == 'green' ? false : true + this.contactService.post('/devices/deviceupdate', { _id: this.selectedDevice, theftAlert: theftAlert }).subscribe(res => { + if (theftAlert) { + this.parkingButtonShow = 'green' + } else { + this.parkingButtonShow = 'red' + } + }) + + } + + openRightMenu() { + document.getElementById("rightMenu").style.display = "block"; + document.getElementById('buttons').style.marginRight = '325px' + } + + closeRightMenu() { + document.getElementById("rightMenu").style.display = "none"; + document.getElementById('buttons').style.marginRight = '-7px' + } + + saveRoutePath() { + let dialogRef = this.dialog.open(ShoRoutePlanComponent, { width: '650px', height: '700px', - data: {data:this.latlongObjArr,device:this.tempMapHistory[0]} + data: { data: this.latlongObjArr, device: this.tempMapHistory[0] } }); dialogRef.afterClosed().subscribe(result => { @@ -8922,33 +8969,33 @@ saveRoutePath(){ // console.log(result); }) -} + } -workingHours=0 -workingHoursFunction1(device){ - // console.log(this.tempMapHistory[0]); - var date1=new Date(this.datefrom).toISOString(); - var date2=new Date(this.date2).toISOString(); - this.contactService.get('/notifs/ignitionReportForMobile?from_date='+date1+'&to_date='+date2+'&_u='+this.useridd+'&device='+device.Device_ID).subscribe((res:any)=>{ - // console.log(res); - if(res.length>0){ - this.workingHours=res[0].workingHours!="" && res[0].workingHours?res[0].workingHours:0 + workingHours = 0 + workingHoursFunction1(device) { + // console.log(this.tempMapHistory[0]); + var date1 = new Date(this.datefrom).toISOString(); + var date2 = new Date(this.date2).toISOString(); + this.contactService.get('/notifs/ignitionReportForMobile?from_date=' + date1 + '&to_date=' + date2 + '&_u=' + this.useridd + '&device=' + device.Device_ID).subscribe((res: any) => { + // console.log(res); + if (res.length > 0) { + this.workingHours = res[0].workingHours != "" && res[0].workingHours ? res[0].workingHours : 0 - } - - },err=>{ - // console.log(err); - }) -} + } -workingHoursFunction2(device){ -// console.log(this.tempMapHistory[0]); - this.contactService.get('/notifs/acReportForMobile?from_date='+this.datefrom+'&to_date='+this.date2+'&_u='+this.useridd+'&device='+device.Device_ID).subscribe((res:any)=>{ - // console.log(res); - this.workingHours=res.workingHours!="" && res.workingHours?res.workingHours:0 - },err=>{ - // console.log(err); - }) -} + }, err => { + // console.log(err); + }) + } + + workingHoursFunction2(device) { + // console.log(this.tempMapHistory[0]); + this.contactService.get('/notifs/acReportForMobile?from_date=' + this.datefrom + '&to_date=' + this.date2 + '&_u=' + this.useridd + '&device=' + device.Device_ID).subscribe((res: any) => { + // console.log(res); + this.workingHours = res.workingHours != "" && res.workingHours ? res.workingHours : 0 + }, err => { + // console.log(err); + }) + } } diff --git a/src/app/report/report component/current-position/current-position.component.ts b/src/app/report/report component/current-position/current-position.component.ts index 6994d7b..0cf7948 100644 --- a/src/app/report/report component/current-position/current-position.component.ts +++ b/src/app/report/report component/current-position/current-position.component.ts @@ -325,82 +325,115 @@ export class CurrentPositionReportComponent implements OnInit { if (that.reportArr.length != 0) { var j = 0; that.finalArr = []; - for (var i = 0; i < that.reportArr.length; i++) { - if (that.reportArr[i]) { - if (that.reportArr[i].status_updated_at == undefined) { - let dev_status_1 = that.reportArr[i].status ? that.reportArr[i].status : "Not available"; - that.reportArr[i].status = dev_status_1; - // console.log("Not Available !!!"); - } else { - // this.arrival_time = new Date(that.reportArr[i].status_updated_at) - let dev_status = that.reportArr[i] ? that.reportArr[i].status : "NA"; - var curr_time: any = new Date(); - this.arrival_time = new Date(that.reportArr[i].status_updated_at); - var fd: any = new Date(this.arrival_time); - // console.log('curr_time',curr_time,this.arrival_time); - var diffInMilliSeconds = Math.abs(curr_time - fd) / 1000; + let latLongArray :any[] = []; + that.reportArr.forEach((deData)=>{ - // calculate days - const days = Math.floor(diffInMilliSeconds / 86400); - diffInMilliSeconds -= days * 86400; - // console.log('calculated days', days); - - // calculate hours - const hours = Math.floor(diffInMilliSeconds / 3600) % 24; - diffInMilliSeconds -= hours * 3600; - // console.log('calculated hours', hours); - - // calculate minutes - const minutes = Math.floor(diffInMilliSeconds / 60) % 60; - diffInMilliSeconds -= minutes * 60; - // console.log('minutes', minutes); - - let difference = ''; - if (days > 0) { - difference += (days === 1) ? `${days} day, ` : `${days} days, `; - } - - difference += (hours === 0 || hours === 1) ? `${hours} hour, ` : `${hours} hours, `; - - difference += (minutes === 0 || hours === 1) ? `${minutes} minutes` : `${minutes} minutes`; - - // new conversion logic - this.Durations = difference; - if (dev_status == undefined) { - - this.status_toShow = "NA"; - - } else { - this.status_toShow = dev_status + " " + "Since" + " " + this.Durations; - } - - that.reportArr[i].status = this.status_toShow; - } - - that.clocation_1(that.reportArr[i], function (err, succ) { - if (err) { - console.log(err); - j++; - } else { - console.log(succ); - that.finalArr.push(succ); - console.log(that.finalArr); - j++; - if (j === that.reportArr.length) { - that.Load = false; - callback({ data: that.finalArr }); - } - } - }) - } else { - that.Load = false; - callback({ data: [] }); + let latLng = { + lat: "0", + long: "0" + }; + + latLng = { + long: deData.last_loc && deData.last_loc.coordinates && deData.last_loc.coordinates.length && deData.last_loc.coordinates[0] ? deData.last_loc.coordinates[0] : 0, + lat: deData.last_loc && deData.last_loc.coordinates && deData.last_loc.coordinates.length && deData.last_loc.coordinates[1] ? deData.last_loc.coordinates[1]: 0 } + latLongArray.push(latLng) + + }) + + that.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + + for (var i = 0; i < that.reportArr.length; i++) { + + if (that.reportArr[i]) { + let latLng = { + lat: "0", + long: "0" + }; + latLng = { + long: that.reportArr[i].last_loc && that.reportArr[i].last_loc.coordinates && that.reportArr[i].last_loc.coordinates.length && that.reportArr[i].last_loc.coordinates[0] ? that.reportArr[i].last_loc.coordinates[0] : 0, + lat: that.reportArr[i].last_loc && that.reportArr[i].last_loc.coordinates && that.reportArr[i].last_loc.coordinates.length && that.reportArr[i].last_loc.coordinates[1] ? that.reportArr[i].last_loc.coordinates[1]: 0 + } + that.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[i]; + if (that.reportArr[i].status_updated_at == undefined) { + let dev_status_1 = that.reportArr[i].status ? that.reportArr[i].status : "Not available"; + that.reportArr[i].status = dev_status_1; + // console.log("Not Available !!!"); + } else { + // this.arrival_time = new Date(that.reportArr[i].status_updated_at) + let dev_status = that.reportArr[i] ? that.reportArr[i].status : "NA"; + var curr_time: any = new Date(); + this.arrival_time = new Date(that.reportArr[i].status_updated_at); + var fd: any = new Date(this.arrival_time); + // console.log('curr_time',curr_time,this.arrival_time); + var diffInMilliSeconds = Math.abs(curr_time - fd) / 1000; + + // calculate days + const days = Math.floor(diffInMilliSeconds / 86400); + diffInMilliSeconds -= days * 86400; + // console.log('calculated days', days); + + // calculate hours + const hours = Math.floor(diffInMilliSeconds / 3600) % 24; + diffInMilliSeconds -= hours * 3600; + // console.log('calculated hours', hours); + + // calculate minutes + const minutes = Math.floor(diffInMilliSeconds / 60) % 60; + diffInMilliSeconds -= minutes * 60; + // console.log('minutes', minutes); + + let difference = ''; + if (days > 0) { + difference += (days === 1) ? `${days} day, ` : `${days} days, `; + } + + difference += (hours === 0 || hours === 1) ? `${hours} hour, ` : `${hours} hours, `; + + difference += (minutes === 0 || hours === 1) ? `${minutes} minutes` : `${minutes} minutes`; + + // new conversion logic + this.Durations = difference; + if (dev_status == undefined) { + + this.status_toShow = "NA"; + + } else { + this.status_toShow = dev_status + " " + "Since" + " " + this.Durations; + } + + that.reportArr[i].status = this.status_toShow; + } + + that.clocation_1(that.reportArr[i], function (err, succ) { + if (err) { + console.log(err); + j++; + } else { + console.log(succ); + that.finalArr.push(succ); + console.log(that.finalArr); + j++; + if (j === that.reportArr.length) { + that.Load = false; + callback({ data: that.finalArr }); + } + } + }) + } else { + that.Load = false; + callback({ data: [] }); + } + + + + } - } + }) + } else { that.Load = false; that.firstcall = true; diff --git a/src/app/report/report component/day-wise-report/day-wise-report.component.ts b/src/app/report/report component/day-wise-report/day-wise-report.component.ts index abf87b3..c49e19e 100644 --- a/src/app/report/report component/day-wise-report/day-wise-report.component.ts +++ b/src/app/report/report component/day-wise-report/day-wise-report.component.ts @@ -210,74 +210,93 @@ export class DayWiseReportComponent implements OnInit { that.reportArr = []; that.reportArr= resp ; if (that.reportArr.length != 0) { - console.log(that.reportArr); + var j = 0; that.finalArr = []; - for (var i = 0; i < that.reportArr.length; i++) { - // if(that.reportArr[i].distanceVariation){ - // console.log("IN"); - - // if(that.reportArr[i].distanceVariation[0]=="+"){ - // that.reportArr[i]['Distance(Kms)']=that.reportArr[i]['Distance(Kms)']+(that.reportArr[i]['Distance(Kms)']/100)*Number(that.reportArr[i].distanceVariation.substring(1)) - // console.log("IN",(that.reportArr[i]['Distance(Kms)']/100)*Number(that.reportArr[i].distanceVariation.substring(1))); - // }else{ - - // that.reportArr[i]['Distance(Kms)']=that.reportArr[i]['Distance(Kms)']-(that.reportArr[i]['Distance(Kms)']/100)*Number(that.reportArr[i].distanceVariation.substring(1)) - // console.log("IN-",that.reportArr[i]['Distance(Kms)']); - // } - // } - - console.log(that.reportArr[i]['Idle Time'],that.reportArr[i]['Moving Time'],that.reportArr[i]['Stoppage Time'],that.reportArr[i]['Idle Time']); + let latLongArray :any[] = []; + that.reportArr.forEach((deData)=>{ + let latLng = { + lat: deData.start_location ? deData.start_location.lat ? deData.start_location.lat : 0:0, + long: deData.start_location ? deData.start_location.long ? deData.start_location.long : 0:0 + } + latLongArray.push(latLng) + let end_latLng = { + lat: deData.end_location ? deData.end_location.lat ? deData.end_location.lat : 0:0, + long: deData.end_location ? deData.end_location.long ? deData.end_location.long : 0:0 + } + latLongArray.push(end_latLng) + }) - if((that.reportArr[i]['Idle Time']+that.reportArr[i]['Stoppage Time']+that.reportArr[i]['Moving Time'])<24){ - that.reportArr[i].outOfReach=(24-(that.reportArr[i]['Idle Time']+that.reportArr[i]['Stoppage Time']+that.reportArr[i]['Moving Time'])).toFixed(2) - }else{ - that.reportArr[i].outOfReach=0.0 + that.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + let indexCounter = 0; + for (var i = 0; i < that.reportArr.length; i++) { + let latLng = { + lat: that.reportArr[i].start_location ? that.reportArr[i].start_location.lat ? that.reportArr[i].start_location.lat : 0:0, + long: that.reportArr[i].start_location ? that.reportArr[i].start_location.long ? that.reportArr[i].start_location.long : 0:0 + } + that.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[indexCounter]; + indexCounter++; + let end_latLng = { + lat: that.reportArr[i].end_location ? that.reportArr[i].end_location.lat ? that.reportArr[i].end_location.lat : 0:0, + long: that.reportArr[i].end_location ? that.reportArr[i].end_location.long ? that.reportArr[i].end_location.long : 0:0 + } + that.contactService.latLongAddress[end_latLng.long+'_'+end_latLng.lat] = latLongAddress[indexCounter]; + console.log('indexCounter++',indexCounter,i) + indexCounter++; - } - - that.clocation_1(that.reportArr[i], function (err, succ) { - if (err) { - console.log(err); - j++; - } else { - if(!(that.finalArr.includes(succ))){ - console.log(that.finalArr.includes(succ)); - for(var k=0;k{ + let latLng = { + lat: deData.start_location ? deData.start_location.lat ? deData.start_location.lat : 0:0, + long: deData.start_location ? deData.start_location.long ? deData.start_location.long : 0:0 + } + latLongArray.push(latLng) + let end_latLng = { + lat: deData.end_location ? deData.end_location.lat ? deData.end_location.lat : 0:0, + long: deData.end_location ? deData.end_location.long ? deData.end_location.long : 0:0 + } + latLongArray.push(end_latLng) + }) + + that.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + let indexCounter = 0; + that.reportArr.forEach((deData,index)=>{ + let latLng = { + lat: deData.start_location ? deData.start_location.lat ? deData.start_location.lat : 0:0, + long: deData.start_location ? deData.start_location.long ? deData.start_location.long : 0:0 } + that.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[indexCounter]; + indexCounter++; + let end_latLng = { + lat: deData.end_location ? deData.end_location.lat ? deData.end_location.lat : 0:0, + long: deData.end_location ? deData.end_location.long ? deData.end_location.long : 0:0 + } + that.contactService.latLongAddress[end_latLng.long+'_'+end_latLng.lat] = latLongAddress[indexCounter]; + indexCounter++; + if(deData) { + + + that.clocation_1(deData, function (err, succ) { + if (err) { + console.log(err); + j++; + } else { + console.log(succ); + that.finalArr.push(succ); + console.log(that.finalArr); + j++; + if (j === that.reportArr.length) { + that.Load = false; + callback({ data: that.finalArr }); + } + } + }) + } else { + that.Load = false; + callback({ data: [] }); + + } }) - }else{ - that.Load = false; - callback({ data: [] }); - } + }) - - } + } else { that.Load = false; that.firstcall = true; diff --git a/src/app/report/report component/summary-report/summary-report.component.ts b/src/app/report/report component/summary-report/summary-report.component.ts index 81bebcb..91fc598 100644 --- a/src/app/report/report component/summary-report/summary-report.component.ts +++ b/src/app/report/report component/summary-report/summary-report.component.ts @@ -443,35 +443,98 @@ testTable() { if (that.summary.length != 0) { var j = 0; that.finalArr = []; - for (var i = 0; i < that.summary.length; i++) { - - that.clocation_1(that.summary[i], function (err, succ) { - if (err) { - console.log(err); - j++; - } else { - that.finalArr.push(succ); - console.log(that.finalArr); - j++; - if (j === that.summary.length) { - that.Load = false; - var x = []; - that.finalArr.sort(function(a,b){ - // Turn your strings into dates, and then subtract them - // to get a value that is either negative, positive, or zero. - var aDate:any = new Date(a.Date); - var bDate:any = new Date(b.Date); - return bDate - aDate; - }); - - - callback({ data: that.finalArr }); - } + + let latLongArray :any[] = []; + that.summary.forEach((deData)=>{ + let latLng = {lat:0, + long:0}; + let end_latLng = {lat:0, + long:0}; + if (deData.start_location) { + latLng = { + lat: deData.start_location.lat ? deData.start_location.lat : 0, + long: deData.start_location.long ? deData.start_location.long : 0 } - }) - + } + if (deData.today_start_location) { + latLng = { + lat: deData.today_start_location.lat ? deData.today_start_location.lat : 0, + long: deData.today_start_location.long ? deData.today_start_location.long : 0 + } + } else { + deData.today_start_location = deData.start_location; + } + latLongArray.push(latLng) + if (deData.last_location) { + end_latLng = { + lat: deData.last_location.lat ? deData.last_location.lat : 0, + long: deData.last_location.long ? deData.last_location.long : 0 + } + } + if (deData.end_location) { + end_latLng = { + lat: deData.end_location.lat ? deData.end_location.lat : 0, + long: deData.end_location.long ? deData.end_location.long : 0 + } + } else { + deData.end_location = deData.last_location; + } + latLongArray.push(end_latLng) + }) - } + that.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + let indexCounter = 0; + that.summary.forEach((deData,index)=>{ + let latLng = { + lat: deData.today_start_location ? deData.today_start_location.lat ? deData.today_start_location.lat : 0:0, + long: deData.today_start_location ? deData.today_start_location.long ? deData.today_start_location.long : 0:0 + } + that.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[indexCounter]; + indexCounter++; + let end_latLng = { + lat: deData.end_location ? deData.end_location.lat ? deData.end_location.lat : 0:0, + long: deData.end_location ? deData.end_location.long ? deData.end_location.long : 0:0 + } + that.contactService.latLongAddress[end_latLng.long+'_'+end_latLng.lat] = latLongAddress[indexCounter]; + indexCounter++; + if(deData) { + + //location code + that.clocation_1(deData, function (err, succ) { + if (err) { + console.log(err); + j++; + } else { + that.finalArr.push(succ); + console.log(that.finalArr); + j++; + if (j === that.summary.length) { + that.Load = false; + var x = []; + that.finalArr.sort(function(a,b){ + // Turn your strings into dates, and then subtract them + // to get a value that is either negative, positive, or zero. + var aDate:any = new Date(a.Date); + var bDate:any = new Date(b.Date); + return bDate - aDate; + }); + + + callback({ data: that.finalArr }); + } + } + }) + + } else { + that.Load = false; + callback({ data: [] }); + + } + }) + + }) + + } else { that.Load = false; callback({ data: [] }); From 140263abd8f922516483bc4c787534a9effbf790 Mon Sep 17 00:00:00 2001 From: Alex beart Date: Fri, 13 Jan 2023 19:33:16 +0530 Subject: [PATCH 02/10] Change KYC PDF format for nippon --- .../download-certificate.component.html | 748 ++++++++++-------- .../download-certificate.component.scss | 30 + .../download-certificate.component.ts | 79 +- src/index.html | 3 +- 4 files changed, 514 insertions(+), 346 deletions(-) diff --git a/src/app/dashboard/download-certificate/download-certificate.component.html b/src/app/dashboard/download-certificate/download-certificate.component.html index 33f664e..5018d9b 100644 --- a/src/app/dashboard/download-certificate/download-certificate.component.html +++ b/src/app/dashboard/download-certificate/download-certificate.component.html @@ -1,344 +1,420 @@ - - - - - - - - +
+
+
-
-
-
-
- - - RTO COPY - -
- -
-
+ + + + + +
+
+
+
+
+ + + + - - - - - - - - - - - - - +

+ 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 +

+ + + +
+ To
+ Regional Transport Authority
+ Kolkata
+ West Bengal Only
+
+
+
+ FITMENT CERTIFICATE +
+
-
- -
- TAC Reg.No    
- CoP No.    
- CoP Validity upto  
- Fitment Date   
- Fitment Renewal Date  
-
- : CK8077
- : CC0GR8739
- : 30 September 2023
- : {{ kycApprovalDate ? (kycApprovalDate | date: "dd/MM/yyyy") : "" - }}
- : {{ esim_validity ? esim_validity : "" }}
-
-
- AIS 140 COMPLIANCE VLT INSTALLATION CERTIFICATE -
-
- Fitment Certificate No.
- Chassis No.
- Engine No.
- Vehicle OEM
- Vehicle Model
- Vehicle Reg/temp
- Voltage
- Panic Button Model
- Panic Button fitted
- Dealer Name/fitted by
- Device Model No.
- GNSS Module
- Vahan ID
- Device IMEI
- GSM Module
- ICCID
- Primary SIM
- Primary SIM Valid till
- Secondary SIM
- Secondary SIM Valid till
-
- : {{ fitmentCertificateNo ? fitmentCertificateNo : "" }}
- : {{ ChassisNo ? ChassisNo : "" }}
- : {{ engineNo ? engineNo : "" }}
- : {{ manufacturingCompany ? manufacturingCompany : "" }}
- : {{ model ? model : "" }}
- : {{ devName ? devName : "" }}
- : 12V & 24V
- : NSS-1821
- : {{ numberOfSOS ? numberOfSOS : "" }}
- : {{ dealerName ? dealerName : "" }}
- : {{ devicetype ? devicetype : "" }}
- : {{ gnnsModule ? gnnsModule : 0 }}
- : {{ vahanID ? vahanID : "" }}
- : {{ deviceID ? deviceID : "" }}
- : {{ gsmModule ? gsmModule : "Telit GE910" }}
- : {{ ICCICD ? ICCICD : "" }}
- : {{ simNum ? simNum : "" }}
- : {{ esim_validity ? (esim_validity) : "" - }}
- : {{ simNum1 ? simNum1 : "" }}
- : {{ esim_validity ? (esim_validity) : "" - }}
-
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VEHICLE DETAILS
VEHICLE REG.NO{{ devName ? devName : "" }}
VEHICLE REG.DATE{{data.deviceInfo && data.deviceInfo.vehicleRegDate?data.deviceInfo.vehicleRegDate:''}}
ENGINE NO{{ engineNo ? engineNo : "" }}
CHASSIS NO{{ ChassisNo ? ChassisNo : "" }}
VEHICLE MAKE{{data && data.deviceInfo && data.deviceInfo.manufacturingCompany ? data.deviceInfo.manufacturingCompany :'-'}}
VEHICLE MODEL{{ model ? model : "" }}
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FITMENT DETAILS
FITMENT DATE{{ kycApprovalDate ? (kycApprovalDate | date : "dd/MM/yyyy") : "" + }}
FITMENT RENEWAL DATE{{ esim_validity ? esim_validity : "" }}
FITMENT CERT.NO{{ fitmentCertificateNo ? fitmentCertificateNo : "" }}
INVOICE NO.{{data.deviceInfo && data.deviceInfo.invoiceNumber?data.deviceInfo.invoiceNumber:''}}
INVOCE DATE{{data.deviceInfo && data.deviceInfo.invoiceDate?data.deviceInfo.invoiceDate:''}}
RTO CODE{{data.deviceInfo && data.deviceInfo.rto?data.deviceInfo.rto:''}}
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PRODUCT DETAILS
VTS SR.NO/UINO{{ ICCICD ? ICCICD : "" }}
VTS MODEL TRACK{{ devicetype ? devicetype : "" }}
Test Report NO.-
TAC NO.CK8077
COP NO.CC0GR8739
COP Validity upto30 September 2023
+
+
+ + + + + + + + - - + + + + + + + + + + + + + + + + + + + + +
SERVICE/ESIM DETAILS
+
IMEI NO.{{ deviceID ? deviceID : "" }}
ICCID NO/SIM NO{{ ICCICD ? ICCICD : "" }}
Sim Card Service Provider{{data.deviceInfo && data.deviceInfo.sim_provider? data.deviceInfo.sim_provider : ''}}
No. Of Panic Button{{ numberOfSOS ? numberOfSOS : "" }}
Sim No.{{ simNum ? simNum : "" }}
+
+
+ + + + + + + + + + + + + + + +
+ + + + + +
Device ImageReg.Certificate ImageVehicle Front Image
+ - - - - - - - - +
+
PRODUCT SATISFACTION REPORT
+
+

This is to acknowledge confirm that we have got our vehicle bearing registration no {{vahanID}} VTS Device manufactured by NIPPON AUDIOTRONIX bearing Sr.No + {{engineNo}} We have checked the performance ot the vehicle after fitment of the said VTS device the unit is sealed and functioning as per normslaid out in AIS 140.We + have satisfied with the performance of the unit in all respects.We undertake not to reseany dispute or any legal claims against NIPPON AUDIOTRONIX in the event that the + above mentioned seals atfound broken/tampered.

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Dealer Name: + + {{ data.deviceInfo && data.deviceInfo.Dealer && data.deviceInfo.Dealer.first_name ? data.deviceInfo.Dealer.first_name : "" }} + {{ data.deviceInfo && data.deviceInfo.Dealer && data.deviceInfo.Dealer.last_name ? data.deviceInfo.Dealer.last_name : "" }} + + Dealer Contact no: + + + + Dealer Addresse: + + {{ data.deviceInfo && data.deviceInfo.Dealer && data.deviceInfo.Dealer.address ? data.deviceInfo.Dealer.address : "" }} +
+ Customer Name: + + {{ user.first_name ? user.first_name : "" }} + {{ user.last_name ? user.last_name : "" }} + + Customer Contact no: + + {{ user.phone ? user.phone : "" }} + + Customer Addresse: + + {{ user.address ? user.address : "" }} +
+ Device Installed By + + + + Dealer Sign: + + .............................. + + RTA/MVI/STA: + + ............................... +
+ - - - - -

- 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 -

- - - - Authorised - - - Undertaking - - - -

- 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) -

- - - - - Customer Name : {{ user.first_name ? user.first_name : "" }} - {{ user.last_name ? user.last_name : "" }}
- Contact/Login ID : {{ user.phone ? user.phone : "" }} - - - Customer Address: {{ user.address ? user.address : "" }}
- Customer Sign : - - - - +
+
+
- - + + + +
+ + + TAC Reg.No    
+ CoP No.    
+ CoP Validity upto  
+ Fitment Date   
+ Fitment Renewal Date  
+ + + : CK8077
+ : CC0GR8739
+ : 30 September 2023
+ :
+ :
+ + + + +
+ AIS 140 COMPLIANCE VLT INSTALLATION CERTIFICATE +
+ + + + + Fitment Certificate No.
+ Chassis No.
+ + Vehicle OEM
+ Vehicle Model
+ Vehicle Reg/temp
+ Voltage
+ Panic Button Model
+ Panic Button fitted
+ Dealer Name/fitted by
+ Device Model No.
+ GNSS Module
+ Vahan ID
+ Device IMEI
+ GSM Module
+ ICCID
+ Primary SIM
+ Primary SIM Valid till
+ Secondary SIM
+ Secondary SIM Valid till
+ + + : {{ fitmentCertificateNo ? fitmentCertificateNo : "" }}
+ :
+ :
+ : {{ manufacturingCompany ? manufacturingCompany : "" }}
+ : {{ model ? model : "" }}
+ : {{ devName ? devName : "" }}
+ : 12V & 24V
+ : NSS-1821
+ : panic button
+ : {{ dealerName ? dealerName : "" }}
+ : {{ devicetype ? devicetype : "" }}
+ : {{ gnnsModule ? gnnsModule : 0 }}
+ : {{ vahanID ? vahanID : "" }}
+ : {{ deviceID ? deviceID : "" }}
+ : {{ gsmModule ? gsmModule : "Telit GE910" }}
+ : {{ ICCICD ? ICCICD : "" }}
+ : {{ simNum ? simNum : "" }}
+ : {{ esim_validity ? esim_validity : "" }}
+ : {{ simNum1 ? simNum1 : "" }}
+ : {{ esim_validity ? esim_validity : "" }}
+ + + + + + + + + + + + + Authorised + + + Undertaking + + + +

+ 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) +

+ + + + + Customer Name :
+ Contact/Login ID : + + + Customer Address:
+ Customer Sign : + + + +
diff --git a/src/app/dashboard/download-certificate/download-certificate.component.scss b/src/app/dashboard/download-certificate/download-certificate.component.scss index 5b2f821..10ad477 100644 --- a/src/app/dashboard/download-certificate/download-certificate.component.scss +++ b/src/app/dashboard/download-certificate/download-certificate.component.scss @@ -2,3 +2,33 @@ width: 3000px !important; height: 3000px !important; } +.t-mp-heading { + font-size: 16px;font-weight: 700; + text-align: center; +} +.table.table-bordered tr td:first-child{ + font-weight: 700; +} +.fitment-heading{ + font-size: 12px; + border: 3px solid; + padding: 5px; + display: inline; + font-weight: 700; + width: fit-content; + margin-top: -12px; +} +.to-head { + font-size: 14px; + font-weight: 600; +} +#testPdf .table td, #testPdf .table th { + padding: 0.25rem;} + + .table.table-borderless td{ + border:none; + font-size: 10px; +} +.fix-width-20 td{ + width: 16%; +} diff --git a/src/app/dashboard/download-certificate/download-certificate.component.ts b/src/app/dashboard/download-certificate/download-certificate.component.ts index c87882d..7d49369 100644 --- a/src/app/dashboard/download-certificate/download-certificate.component.ts +++ b/src/app/dashboard/download-certificate/download-certificate.component.ts @@ -1,7 +1,10 @@ import { Component, Inject, OnInit } from '@angular/core'; import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material'; declare var jsPDF: any; +declare var pdfMake: any; declare var html2canvas: any; + +declare var html2pdf: any; import * as moment from 'moment'; import { ContactService } from '../../contact.service'; declare var $: any; @@ -375,7 +378,7 @@ export class DownloadCertificateComponent implements OnInit { // img.onload = function(){ console.log("-1"); doc.setPage(1); - doc.addImage(that.img, 'png', 15, 9, 50, 40) + doc.addImage(that.img, 'png', 75, 9, 50, 40) // }; // doc.text("Customer Copy", 110, 12); @@ -386,13 +389,14 @@ export class DownloadCertificateComponent implements OnInit { tableWidth: 'auto', - // styles : { - // cellWidth : 10, - // overflow: "linebreak" - // }, + styles : { + cellWidth : 35, + overflow: "linebreak" + }, willDrawCell: data => { + console.log('manojpatidar',data); if (data.row.index === 0) { - data.row.height = 30; + data.row.height = 40; doc.setFontStyle('bold'); data.row.cells[0].styles.halign = 'center'; data.row.cells[0].styles.fontSize = 25; @@ -403,15 +407,16 @@ export class DownloadCertificateComponent implements OnInit { // } // doc.addImage(this.supAdmin.imageDoc,'JPEG', 140, 9,40,40); - doc.setPage(1); - 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 = 50 + doc.cellPadding = 50; + doc.setPage(1); + doc.addImage(this.imgURL, 'JPEG', 150, 45, 50, 40); } if (data.row.index === 3) { @@ -550,5 +555,61 @@ export class DownloadCertificateComponent implements OnInit { xhr.responseType = 'blob'; xhr.send(); } + public convetToPDF() +{ +var data = document.getElementById('testPdf'); + +var opt = { + margin: [0, 0.2, 0.2, 0.2], + filename: this.devName +'.pdf', + image: { type: 'jpeg', quality: 0.98 }, + html2canvas: { scale: 4 , useCORS: true}, + jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' } +}; + +// New Promise-based usage: +html2pdf().set(opt).from(data).save(); + + + +// html2canvas(data, { +// useCORS: true, +// scale: 2, +// scrollY: -window.scrollY, +// height:'3000px', +// onrendered: (canvas) =>{ +// var data = canvas.toDataURL(); + +// let img = new Image(); +// img.src = this.org.imageDoc ? this.org.imageDoc : ''; +// img.crossOrigin = "anonymous"; +// //canvas.addImage(img, 'png', 75, 9, 50, 40) + +// var docDefinition = { +// content: [{ +// image: data, +// width: 500 +// }] +// }; +// pdfMake.createPdf(docDefinition).download("JSON.pdf"); + + +// } +// }); + +// html2canvas(data).then(canvas => { +// // Few necessary setting options +// var imgWidth = 208; +// var pageHeight = 295; +// var imgHeight = canvas.height * imgWidth / canvas.width; +// var heightLeft = imgHeight; + +// const contentDataURL = canvas.toDataURL('image/png') +// let pdf = new jsPDF('p', 'mm', 'a4'); // A4 size page of PDF +// var position = 0; +// pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight) +// pdf.save('new-file.pdf'); // Generated PDF +// }); +} } \ No newline at end of file diff --git a/src/index.html b/src/index.html index 3536612..eded6a3 100644 --- a/src/index.html +++ b/src/index.html @@ -257,7 +257,8 @@ - + + From 6387df705009a77011deee3c9b92b23bf3276df1 Mon Sep 17 00:00:00 2001 From: Alex beart Date: Fri, 13 Jan 2023 19:35:37 +0530 Subject: [PATCH 03/10] Get all USER api parameter change --- src/app/contact.service.ts | 25 ++++++++++++++----- .../device-edit/device-edit.component.ts | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/app/contact.service.ts b/src/app/contact.service.ts index 5f658a9..cce1e22 100644 --- a/src/app/contact.service.ts +++ b/src/app/contact.service.ts @@ -394,8 +394,13 @@ getFuelDetail(ustate){ } // http://localhost:3000/trackRoute/routepath/getRoutePathWithPoi?id=5b449ae5755a5527be41f7cc&user=59cbbdbe508f164aa2fef3d8 -getContactsbyDealer(uid){ - return this.http.get(this.dev_url + '/users/getAllUsers?dealer='+uid) +getContactsbyDealer(uid,isProjection =false){ + let apiUrl = this.dev_url + '/users/getAllUsers?dealer='+uid ; + if(isProjection) { + apiUrl = apiUrl + '&projection=user_id,first_name,last_name'; + } + + return this.http.get(apiUrl) .map(res => res.json()); } getDistance(ddid,fromtime,totime,satelite){ @@ -1659,11 +1664,19 @@ getAddressByApi(latlng){ } -getAddressByApiBulk(latlng){ - - return this.http.post(this.dev_url +'/googleAddress/getGoogleAddressBulk',latlng) - .map(res => res.json()); +getAddressByApiBulkOld(latlng){ + let PromiseArray = [], size = 1000; + while (latlng.length > 0) + //PromiseArray.push(this.getAddressInChunk(latlng.splice(0, size))); + Promise.all(PromiseArray).then((values) => { + console.log(values); + }); + +} +getAddressByApiBulk(latlng) { + return this.http.post(this.dev_url +'/googleAddress/getGoogleAddressBulk',latlng) + .map(res => res.json()); } resetPass(pld) { diff --git a/src/app/dashboard/device-edit/device-edit.component.ts b/src/app/dashboard/device-edit/device-edit.component.ts index 6e0f451..d7da1e4 100644 --- a/src/app/dashboard/device-edit/device-edit.component.ts +++ b/src/app/dashboard/device-edit/device-edit.component.ts @@ -725,7 +725,7 @@ showFieldsDealer:boolean=false; passDealer = this.useridd; } console.log(passDealer); - this.contactService.getContactsbyDealer(passDealer) + this.contactService.getContactsbyDealer(passDealer,true) .subscribe(res=>{ console.log("Alluserobject",res); this.costumers = res; From 5dc54bfdb1ae6d79efa17f313525e5d7ec32580e Mon Sep 17 00:00:00 2001 From: Alex beart Date: Fri, 13 Jan 2023 19:36:19 +0530 Subject: [PATCH 04/10] Formatting and some UI issue in reports section --- .../device-doc/device-doc.component.html | 44 ++++++++++++++----- .../device-doc/device-doc.component.ts | 15 ++++++- .../day-wise-report.component.ts | 2 +- .../details/details.component.ts | 8 ++-- .../disatance-report.component.ts | 6 +-- 5 files changed, 56 insertions(+), 19 deletions(-) diff --git a/src/app/kyc-approval/device-doc/device-doc.component.html b/src/app/kyc-approval/device-doc/device-doc.component.html index 3ef24f1..ff5ebf8 100644 --- a/src/app/kyc-approval/device-doc/device-doc.component.html +++ b/src/app/kyc-approval/device-doc/device-doc.component.html @@ -14,7 +14,7 @@ - + @@ -25,7 +25,7 @@ - - + + + + + + + + @@ -142,10 +154,22 @@ - + + + + + + + + diff --git a/src/app/kyc-approval/device-doc/device-doc.component.ts b/src/app/kyc-approval/device-doc/device-doc.component.ts index 92a98ba..e35a08f 100644 --- a/src/app/kyc-approval/device-doc/device-doc.component.ts +++ b/src/app/kyc-approval/device-doc/device-doc.component.ts @@ -415,7 +415,9 @@ submit1(status){ base64Image downloadImage(imageUrl,name) { - + if(!this.hasPdfFile(imageUrl)) { + + this.getBase64ImageFromURL(imageUrl).subscribe(base64data => { this.base64Image = "data:image/jpg;base64," + base64data; // save image to disk @@ -427,6 +429,17 @@ downloadImage(imageUrl,name) { link.setAttribute("download", name); link.click(); }); + }else { + var link = document.createElement("a"); + + document.body.appendChild(link); // for Firefox + + link.setAttribute("href", imageUrl); + link.setAttribute("download", name); + + link.setAttribute("target", '_blank'); + link.click(); + } } getBase64ImageFromURL(url: string) { diff --git a/src/app/report/report component/day-wise-report/day-wise-report.component.ts b/src/app/report/report component/day-wise-report/day-wise-report.component.ts index c49e19e..eb0ceba 100644 --- a/src/app/report/report component/day-wise-report/day-wise-report.component.ts +++ b/src/app/report/report component/day-wise-report/day-wise-report.component.ts @@ -823,7 +823,7 @@ var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth(); VRN:pdfBody[j].VRN, 'Distance(Kms)':(pdfBody[j]['Distance(Kms)']).toFixed(2), 'Moving Time':this.conversion(pdfBody[j]['Moving Time']), - 'Stoppage Time':this.conversion(pdfBody[j]['Moving Time']), + 'Stoppage Time':this.conversion(pdfBody[j]['Stoppage Time']), "Idle Time":this.conversion(pdfBody[j]['Idle Time']), fuelConsumed: this.fuleConvert((pdfBody[j]['Distance(Kms)']).toFixed(2), pdfBody[j]['Mileage']), startAddress:pdfBody[j].startAddress, diff --git a/src/app/report/report component/disatance-report/details/details.component.ts b/src/app/report/report component/disatance-report/details/details.component.ts index 5f9cb84..d488bea 100644 --- a/src/app/report/report component/disatance-report/details/details.component.ts +++ b/src/app/report/report component/disatance-report/details/details.component.ts @@ -701,9 +701,9 @@ export class DetailComponent implements OnInit { // --------------------New Method for excel export------------------- exportExcels() { - // for (var i = 0; i < this.reportArr.length; i++) { - // this.reportArr[i].deviceName = this.reportArr[i].device.Device_Name; - // } + for (var i = 0; i < this.reportArr.length; i++) { + this.reportArr[i].DateInFormat = moment(this.reportArr[i].Date).format('DD/MM/YYYY') + } this.downloadFile(this.reportArr); } @@ -711,7 +711,7 @@ export class DetailComponent implements OnInit { downloadFile(data, filename = 'Distance Report Details') { console.log(data); - let arrHeader = ["VRN", "Date", "startAddress", "endAddress", "Distance(Kms)"]; + let arrHeader = ["VRN", "DateInFormat", "startAddress", "endAddress", "Distance(Kms)"]; let csvData = this.ConvertToCSV(data, arrHeader); let blob = new Blob(['\ufeff' + csvData], { type: 'text/csv;charset=utf-8;' }); let dwldLink = document.createElement("a"); diff --git a/src/app/report/report component/disatance-report/disatance-report.component.ts b/src/app/report/report component/disatance-report/disatance-report.component.ts index a9b5aba..1b76eba 100644 --- a/src/app/report/report component/disatance-report/disatance-report.component.ts +++ b/src/app/report/report component/disatance-report/disatance-report.component.ts @@ -416,14 +416,14 @@ export class DisatanceReportComponent implements OnInit { "data": "from_date", "render": function (data, type, row) { // let date=new Date(that.Fromdate).getDate()+"/"+new Date(that.Fromdate).getMonth()+"/"+new Date(that.Fromdate).getFullYear() - return that.FROMDATE; + return moment(that.FROMDATE).format('DD/MM/YYYY'); } }, { "data": "to_date", "render": function (data, type, row) { // let date=new Date(that.todate).getDate()+"/"+new Date(that.todate).getMonth()+"/"+new Date(that.todate).getFullYear() - return that.TODATE; + return moment(that.TODATE).format('DD/MM/YYYY'); } }, { @@ -962,7 +962,7 @@ export class DisatanceReportComponent implements OnInit { for (var j = 0; j < rowCount; j++) { body.push({ - device: pdfBody[j].device.Device_Name, + device: pdfBody[j].device && pdfBody[j].device.Device_Name ?pdfBody[j].device.Device_Name :pdfBody[j].VRN, fromDate: this.FROMDATE, toDate: this.TODATE, startAddress: pdfBody[j].startAddress, From 55d79d12944dac92cb53d6cf3fe79b61b556b699 Mon Sep 17 00:00:00 2001 From: Alex beart Date: Sat, 4 Mar 2023 16:39:03 +0530 Subject: [PATCH 05/10] New index report and some UI issue --- src/app/all-menus/all-menus.component.html | 1 + src/app/all-menus/all-menus.component.ts | 5 + src/app/app.module.ts | 3 + src/app/app.router.ts | 2 + .../add-new-device.component.html | 3 + .../add-new-device.component.ts | 13 +- src/app/dashboard/dashboard.component.html | 1 - src/app/dashboard/dashboard.component.ts | 8 +- .../download-certificate.component.html | 66 +-- .../download-certificate.component.scss | 11 + .../download-certificate.component.ts | 15 +- .../index-report.component.html | 44 ++ .../index-report.component.scss | 86 +++ .../index-report.component.spec.ts | 24 + .../indexingReport/index-report.component.ts | 520 ++++++++++++++++++ .../device-doc/device-doc.component.html | 94 +++- .../device-doc/device-doc.component.ts | 10 +- .../new-travel-path-report.component.ts | 137 ++--- .../report-filter.component.html | 4 +- .../report-filter/report-filter.component.ts | 1 + src/index.html | 2 +- 21 files changed, 908 insertions(+), 142 deletions(-) create mode 100644 src/app/indexingReport/index-report.component.html create mode 100644 src/app/indexingReport/index-report.component.scss create mode 100644 src/app/indexingReport/index-report.component.spec.ts create mode 100644 src/app/indexingReport/index-report.component.ts diff --git a/src/app/all-menus/all-menus.component.html b/src/app/all-menus/all-menus.component.html index 5f4bcaf..fd3f8aa 100644 --- a/src/app/all-menus/all-menus.component.html +++ b/src/app/all-menus/all-menus.component.html @@ -116,6 +116,7 @@ (click)="modelMaster('admin')">{{'Model Master' | translate}} --> {{'Subadmin' | translate}} {{'System Logs' | translate}} + {{'Index Report' | translate}} diff --git a/src/app/all-menus/all-menus.component.ts b/src/app/all-menus/all-menus.component.ts index e722db8..9b678dc 100644 --- a/src/app/all-menus/all-menus.component.ts +++ b/src/app/all-menus/all-menus.component.ts @@ -571,6 +571,11 @@ gpsMaster(id){ this.menuFlag = this.contactService.menuReturnSet(id); this.router.navigateByUrl("gpsMaster"); +} +indexReport(id){ + this.menuFlag = this.contactService.menuReturnSet(id); + this.router.navigateByUrl("indexingReport"); + } technician(id){ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index cadb172..70504a0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -280,6 +280,7 @@ import { NewEditDeviceComponent } from './dashboard/new-edit-device/new-edit-dev import { DownloadCertificateComponent } from './dashboard/download-certificate/download-certificate.component'; import { DeviceSettingComponent } from './device-setting/device-setting.component'; import { UserSettingComponent } from './user-setting/user-setting.component'; +import { IndexingReportComponent } from './indexingReport/index-report.component'; // import { DisatanceReportComponent } from './report/disatance-report/disatance-report.component'; // import { MainComponent } from './report/main/main.component'; // import { AcReportsComponent } from './report/ac-report/ac-report.component'; @@ -419,6 +420,7 @@ export function createTranslateLoader(http: Http) { UserMasterComponent, DeviceComponent, GpsMasterComponent, + IndexingReportComponent, CmdPacketMasterComponent, EditDeviceMasterComponent, GpsEditMasterComponent, @@ -541,6 +543,7 @@ export function createTranslateLoader(http: Http) { DownloadCertificateComponent, DeviceSettingComponent, UserSettingComponent, + IndexingReportComponent, // LiveTrackingComponent, // MainComponent, // DisatanceReportComponent, diff --git a/src/app/app.router.ts b/src/app/app.router.ts index 23aa86c..4fade70 100644 --- a/src/app/app.router.ts +++ b/src/app/app.router.ts @@ -210,6 +210,7 @@ import { NewEditDeviceComponent } from './dashboard/new-edit-device/new-edit-dev import { DeviceSettingComponent } from './device-setting/device-setting.component'; import { UserSettingComponent } from './user-setting/user-setting.component'; import { CurrentPositionReportComponent } from './report/report component/current-position/current-position.component'; +import { IndexingReportComponent } from './indexingReport/index-report.component'; // import { DeviceFuelReportComponent } from './device-report/device-fuel-report/device-fuel-report.component'; // import { DeviceSOSreportComponent } from './device-report/device-sosreport/device-sosreport.component'; // import { TripByDeviceComponent } from './device-report/trip-by-device/trip-by-device.component'; @@ -357,6 +358,7 @@ export const router: Routes =[ {path: 'userLogs',component:UserMasterComponent}, {path: 'deviceMaster',component:DeviceComponent}, {path: 'gpsMaster',component:GpsMasterComponent}, + {path: 'indexingReport',component:IndexingReportComponent}, {path: 'cmdMaster',component:CmdPacketMasterComponent}, {path : 'deviceEntry', component : DeviceEntryComponent}, {path : 'Inventorylist', component : InventoryListComponent}, diff --git a/src/app/dashboard/add-new-device/add-new-device.component.html b/src/app/dashboard/add-new-device/add-new-device.component.html index 07f8865..5fdeb81 100644 --- a/src/app/dashboard/add-new-device/add-new-device.component.html +++ b/src/app/dashboard/add-new-device/add-new-device.component.html @@ -438,9 +438,11 @@
-
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 588eeb4..35d6f9c 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -1694,7 +1694,13 @@ testTable() { "data":null, "defaultContent": "", "render":function(data,type,row){ - return '' + if(row.kycStatus && row.kycStatus=="Approved") { + return '' + } + else { + + return '' + } } } , { diff --git a/src/app/dashboard/download-certificate/download-certificate.component.html b/src/app/dashboard/download-certificate/download-certificate.component.html index 5018d9b..e89eb1a 100644 --- a/src/app/dashboard/download-certificate/download-certificate.component.html +++ b/src/app/dashboard/download-certificate/download-certificate.component.html @@ -20,12 +20,12 @@
- + @@ -127,16 +127,13 @@ - + - + - - - - + @@ -190,24 +187,27 @@
ImageImage Doc Number Name
+ @@ -128,10 +128,22 @@
State RTO Certificate - - + + + + + + Not Available + + {{state_certifcate_date |date:"medium"}}
Vahan Certificate - - + + + + + + Not Available + + {{vaahan_certifcate_date |date:"medium"}} To
Regional Transport Authority
- Kolkata
- West Bengal Only
+ {{data.deviceInfo && data.deviceInfo.transportOfficeCity?data.deviceInfo.transportOfficeCity:''}}
+ {{data.deviceInfo && data.deviceInfo.transportOfficeState?data.deviceInfo.transportOfficeState:''}} Only
-
+
FITMENT CERTIFICATE
@@ -56,7 +56,7 @@
VEHICLE REG.NO{{ devName ? devName : "" }}
VEHICLE REG.DATE
VTS SR.NO/UINO{{ ICCICD ? ICCICD : "" }}{{ vahanID ? vahanID : "" }}
VTS MODEL TRACKVTS MODEL {{ devicetype ? devicetype : "" }}
Test Report NO.-
TAC NO. CK8077
- - - + + - - - - + - + + + - - + + + + + Not Available + + + + @@ -127,18 +157,18 @@ - + - - + @@ -147,24 +177,33 @@ + + + + + + - - - + @@ -173,9 +212,18 @@ - + + + + + +
+
+ +
PRODUCT SATISFACTION REPORT
-

This is to acknowledge confirm that we have got our vehicle bearing registration no {{vahanID}} VTS Device manufactured by NIPPON AUDIOTRONIX bearing Sr.No - {{engineNo}} We have checked the performance ot the vehicle after fitment of the said VTS device the unit is sealed and functioning as per normslaid out in AIS 140.We +

This is to acknowledge confirm that we have got our vehicle bearing chassis no {{ChassisNo}} VTS Device manufactured by NIPPON AUDIOTRONIX bearing Sr.No + {{vahanID}} We have checked the performance ot the vehicle after fitment of the said VTS device the unit is sealed and functioning as per normslaid out in AIS 140.We have satisfied with the performance of the unit in all respects.We undertake not to reseany dispute or any legal claims against NIPPON AUDIOTRONIX in the event that the above mentioned seals atfound broken/tampered.

-
- + +
+ +
- + - - - - @@ -273,8 +277,7 @@ - @@ -289,18 +292,17 @@ Dealer Sign: -
+
+ +
Dealer Name: + {{ data.deviceInfo && data.deviceInfo.Dealer && data.deviceInfo.Dealer.first_name ? data.deviceInfo.Dealer.first_name : "" }} {{ data.deviceInfo && data.deviceInfo.Dealer && data.deviceInfo.Dealer.last_name ? data.deviceInfo.Dealer.last_name : "" }} + Dealer Contact no: + Dealer Addresse: - + {{ data.deviceInfo && data.deviceInfo.Dealer && data.deviceInfo.Dealer.address ? data.deviceInfo.Dealer.address : "" }}
Customer Addresse: - + {{ user.address ? user.address : "" }}
- .............................. - - RTA/MVI/STA: + .............. + RTA/MVI/STA: + ...............................
- +
diff --git a/src/app/dashboard/download-certificate/download-certificate.component.scss b/src/app/dashboard/download-certificate/download-certificate.component.scss index 10ad477..01cd97a 100644 --- a/src/app/dashboard/download-certificate/download-certificate.component.scss +++ b/src/app/dashboard/download-certificate/download-certificate.component.scss @@ -2,6 +2,17 @@ width: 3000px !important; height: 3000px !important; } +#testPdf .table{ + margin-bottom: 0.25rem; +} +#stamp-section{ + background: url('/assets/images/liveTrackIcons/Stamp.png'); + background-repeat: no-repeat; + height: 110px; + position: absolute; + top: 5px; + width: 110px; +} .t-mp-heading { font-size: 16px;font-weight: 700; text-align: center; diff --git a/src/app/dashboard/download-certificate/download-certificate.component.ts b/src/app/dashboard/download-certificate/download-certificate.component.ts index 7d49369..ad20314 100644 --- a/src/app/dashboard/download-certificate/download-certificate.component.ts +++ b/src/app/dashboard/download-certificate/download-certificate.component.ts @@ -138,6 +138,7 @@ export class DownloadCertificateComponent implements OnInit { 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; @@ -165,10 +166,16 @@ export class DownloadCertificateComponent implements OnInit { this.gsmModule = 'Quectel M66' } + let replaceURL = 'http://nipponsecura.in' + let currentWebURl = window.location.hostname; + if(currentWebURl.includes('www.oneqlik.in')) { + replaceURL = 'https://www.oneqlik.in' + } for (var i = 0; i < this.deviceImage.length; i++) { console.log("DEVUCE IMAGE=>", this.deviceImage[i]); - - this.deviceImage[i] = this.deviceImage[i] && this.deviceImage[i] != "" ? 'http://nipponsecura.in' + this.deviceImage[i].substring(6) : '' + if(this.deviceImage[i] && !this.deviceImage[i].includes(replaceURL)) { + this.deviceImage[i] = this.deviceImage[i] && this.deviceImage[i] != "" ? replaceURL + this.deviceImage[i].substring(6) : '' + } } @@ -310,6 +317,9 @@ export class DownloadCertificateComponent implements OnInit { + } + removeItemForm() { + this.deviceImage.splice(this.deviceImage.length -1,1); } closePopup() { this.dialogRef.close(1); @@ -394,7 +404,6 @@ export class DownloadCertificateComponent implements OnInit { overflow: "linebreak" }, willDrawCell: data => { - console.log('manojpatidar',data); if (data.row.index === 0) { data.row.height = 40; doc.setFontStyle('bold'); diff --git a/src/app/indexingReport/index-report.component.html b/src/app/indexingReport/index-report.component.html new file mode 100644 index 0000000..8f6f7c6 --- /dev/null +++ b/src/app/indexingReport/index-report.component.html @@ -0,0 +1,44 @@ + +
+
+
{{data_descip}}
+
+
+
+

{{'Index Report' | translate}}

+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
Loading…
+
+ + + + + + + + + + + + +
{{col | translate}}
{{item[col]}}
+
+
+
+
+
+
diff --git a/src/app/indexingReport/index-report.component.scss b/src/app/indexingReport/index-report.component.scss new file mode 100644 index 0000000..c80b458 --- /dev/null +++ b/src/app/indexingReport/index-report.component.scss @@ -0,0 +1,86 @@ +.topDiv { + padding-top: 59px; + background: whitesmoke; + height: 100vh; +} + +.rowStyle { + // margin: 5px; + // background: white; + height: 84vh; + // box-shadow: 3px 1px 5px 0px #b2b0ae; +} + +#deviceTable input { + border-radius: 5px; +} + +::-webkit-scrollbar { + width: 10px; +} + +/* Track */ +::-webkit-scrollbar-track { + background: rgb(153, 153, 153); +} + +/* Handle */ +::-webkit-scrollbar-thumb { + // background: rgb(74, 118, 184); + background: #868e96; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background: #555; +} +#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; +} + +#toast { + visibility: hidden; + max-width: 350px; + 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; +} diff --git a/src/app/indexingReport/index-report.component.spec.ts b/src/app/indexingReport/index-report.component.spec.ts new file mode 100644 index 0000000..7bba407 --- /dev/null +++ b/src/app/indexingReport/index-report.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { IndexingReportComponent } from './index-report.component'; + +describe('IndexingReportComponent', () => { + let component: IndexingReportComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ IndexingReportComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(IndexingReportComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/indexingReport/index-report.component.ts b/src/app/indexingReport/index-report.component.ts new file mode 100644 index 0000000..9a4022e --- /dev/null +++ b/src/app/indexingReport/index-report.component.ts @@ -0,0 +1,520 @@ +import { Component, OnInit } from '@angular/core'; +import { ContactService } from './../contact.service'; + +declare var $: any, DataTable: any; +import * as moment from 'moment'; + +import { MdDialog } from '@angular/material'; +import { FlashMessagesService } from 'angular2-flash-messages'; + + +@Component({ + selector: 'app-index-report', + templateUrl: './index-report.component.html', + styleUrls: ['./index-report.component.scss'] +}) +export class IndexingReportComponent implements OnInit { + Fromdate=new Date(); + todate=new Date(); + reportData : any = []; + tabelObj: any; + emailid: any; + useridd: any; + option: any; + supadm: any; + deviceObjwithName: any=[]; + deviceSelect1: any=[]; + + identifier:String='gps_master'; + Load: boolean; + super_admin : any; + isDealer: any; + dlrID: any; + constructor(public contactService: ContactService,public dialog: MdDialog,private _flashMessagesService: FlashMessagesService) { + this.Fromdate.setHours(0, 0, 0); + 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.supadm = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin; + this.isDealer = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isDealer; + if(this.isDealer == true){ + this.dlrID = JSON.parse(window.atob(window.localStorage.token.split(".")[1]))._id + } + + } + + ngOnInit() { + // this.getAllDevice(); + // this.testTable(); + } + + callfunction(): void { + this.tabelObj.draw(); + } + + displayCol = [] + testTable() { + +this.displayCol = []; + + //console.log("initId=>",id); + console.log('Inside testTable'); + const that = this; + let obj ={ "imei":"", + "from":"", + "to":""}; + if (that.deviceArr.length !=0) { + // console.log(that.deviceSelect[0].id); + obj.imei =that.deviceArr[0]; + } + + + if (that.Fromdate) { + console.log('that.Fromdate',that.Fromdate.toISOString()); + + obj.from = new Date(that.Fromdate).toISOString() + + }; + if (that.todate) { + that.todate.setSeconds(0); + that.todate.setMilliseconds(0); + obj.to = new Date(that.todate).toISOString() + + } + + + + // if(this.supadm){ + // dataTablesParameters.find.supAdmin = that.useridd; + // } + + var suburl = ""; + suburl += "/gps/indexingAIS140"; + // console.log(suburl); + // console.log(dataTablesParameters); + // console.log(suburl) +// if(id != 0) + console.log('calling api'); + // { "imei":"862818043677154", + // "from":"2023-02-26 00:00:00.000Z", + // "to":"2023-02-27 20:00:00.000Z"} + that.contactService.post(suburl,obj ).subscribe(resp => { + // console.log('resp',resp); + that.reportData = resp ? resp : []; + if(that.reportData.length) { + + for (var key in that.reportData[0]) { + this.displayCol.push(key) + } + } + }, err => { + // console.log(err); + // console.log(err.status); + that.reportData = []; + + }); + + // $(document).ready(function () { + // that.tabelObj = $('#gpsTable').DataTable({ + // "serverSide": true, + // "processing": true, + // "searching": false, + // "scrollX": true, + // "scrollY": "480px", + // "scrollCollapse": true, + // "responsive" :true, + // lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], + // ajax: (dataTablesParameters: any, callback) => { + // console.log('inside ajax call'); + // dataTablesParameters.op = {}; + // dataTablesParameters.select = []; + // dataTablesParameters.find = {}; + + + // // console.log(dataTablesParameters); + // // console.log("callback", callback); + + // // dataTablesParameters.find = { + // // _id: that.useridd + // // }; + // dataTablesParameters.columns = [ + // {data : "_id"}, + // { data: "imei" }, + // { data: "date" }, + // { data: "latDecimal" }, + // { data: "longDecimal" }, + // { data: "insertionTime" }, + // {data : 'syncedAt'}, + // {data : 'integrationResponse'}, + // { data: "speed" }, + // {data:"ac"}, + // {data : "currentFuel"}, + // {data : "raw"}, + // { data: "ignition" }, + // { data: "power" }, + // {data : "fuelVoltage"}, + // { data: "external_Battery" }, + // { data: "powerCutAlarm" }, + // { data: "satellites" }, + // {data:'GPS positioned'}, + // {data:'isFluctuation'}, + // {data:'isPastData'}, + // ] + + + // // dataTablesParameters.find.supAdmin = that.useridd; + + + // if (that.deviceArr.length !=0) { + // // console.log(that.deviceSelect[0].id); + // dataTablesParameters.find.imei =that.deviceArr[0]; + // } + + + // if (that.Fromdate) { + // console.log('that.Fromdate',that.Fromdate.toISOString()); + // dataTablesParameters.find['insertionTime'] = dataTablesParameters.find['insertionTime'] ? dataTablesParameters.find['insertionTime'] : {}; + // dataTablesParameters.find['insertionTime']['$gte'] = { + // _eval: 'date', + // value: new Date(that.Fromdate).toISOString() + // } + // }; + // // } + // if (that.todate) { + // that.todate.setSeconds(0); + // that.todate.setMilliseconds(0); + // console.log('that.todate',that.todate.toISOString()) + + // dataTablesParameters.find['insertionTime'] = dataTablesParameters.find['insertionTime'] ? dataTablesParameters.find['insertionTime'] : {}; + // dataTablesParameters.find['insertionTime']['$lte'] = { + // _eval: 'date', + // value: new Date(that.todate).toISOString() + // }; + // } + + + + // // if(this.supadm){ + // // dataTablesParameters.find.supAdmin = that.useridd; + // // } + + // var suburl = ""; + // suburl += "/gps/indexingAIS140"; + // // console.log(suburl); + // // console.log(dataTablesParameters); + // // console.log(suburl) + // // if(id != 0) + // console.log('calling api'); + // that.contactService.post(suburl, { "imei":"862818043677154", + // "from":"2023-02-26 00:00:00.000Z", + // "to":"2023-02-27 20:00:00.000Z"}).subscribe(resp => { + // // console.log('resp',resp); + // that.reportData = resp ? resp : []; + // callback(resp); + // }, err => { + // // console.log(err); + // // console.log(err.status); + // that.reportData = []; + // callback({data:[]}) + // }); + + + // }, + // "rowCallback": function(row: Node, data: any | Object, index: number){ + // $('#delete', row).bind('click', () => { + // // console.log("delete Method",data); + // var gpsId = data._id; + // that.contactService.deletegpsdata(gpsId) + // .subscribe(res=>{ + // // console.log(res); + // that._flashMessagesService.show("Data Deleted", { cssClass: 'alert-warning', timeout: 2000 }); + // that.callfunction(); + // },err=>{ + // that._flashMessagesService.show("Internal server error", { cssClass: 'alert-warning', timeout: 2000 }); + // // console.log(err); + // }) + // }); + // }, + + // "columns": [ + // { + // "data": "imei", + // "render": function (data, type, row) { + // return data ? data : ""; + // } + // }, + // { + // "data": "latDecimal", + // "render": function (data, type, row) { + // return data ? data : ""; + // } + // }, + // { + // "data": "longDecimal", + // "render": function (data, type, row) { + // return data ? data : ""; + // } + // }, + // { + // "data": "speed", + // "render": function (data, type, row) { + // return data ? data : ""; + // } + // }, + // { + // "data": "date", + // "render": function (data, type, row) { + + // var device_time = new Date(data); + // return data ? (moment(device_time).format('dddd,ll,LTS')) : ""; + // } + // }, + // { + // "data": "insertionTime", + // "render": function (data, type, row) { + // var created_time = new Date(data); + // return data ? (moment(created_time).format('dddd,ll,LTS')) : ""; + // } + // }, + // { + // "data": "syncedAt", + // "render": function (data, type, row) { + // var insertion_time = new Date(data); + // return data ? (moment(insertion_time).format('dddd,ll,LTS')) : ""; + // } + // }, + // { + // "data": "integrationResponse", + // "render": function (data, type, row) { + // if(data) + // // alert(data); + // console.log(typeof(data)); + // if(typeof(data) === 'object'){ + // data = JSON.stringify(data); + + // } + // return data ? data: ""; + // } + // }, + // { + // "data": "ignition", + // "render": function (data, type, row) { + // return data ? data : ""; + // } + // }, + // { + // "data": "power", + // "render": function (data, type, row) { + // return data ? data : "" + // } + // }, + // { + // "data": "GPS positioned", + // "render": function (data, type, row) { + // return data ? data : "" + // } + // }, + // { + // "data": "isFluctuation", + // "render": function (data, type, row) { + // return data ? data : "" + // } + // }, + // { + // "data": "isPastData", + // "render": function (data, type, row) { + // return data ? data : "" + // } + // }, + // { + // "data": "external_Battery", + // "render": function (data, type, row) { + // return data ? data : "" + // } + // }, + // { + // "data": "fuelVoltage", + // "render": function (data, type, row) { + // return data ? (data/1000).toFixed(2) : "" + // } + // }, + // { + // "data": "currentFuel", + // "render": function (data, type, row) { + // return data ? data : "" + // } + // }, + // { + // "data": "raw", + // "render": function (data, type, row) { + // return data ? data : "" ; + // } + // }, + // { + // "data": "ac", + // "render": function (data, type, row) { + // return data ? data : "" + // } + // }, + // { + // "data": "powerCutAlarm", + // "render": function (data, type, row) { + // return data ? data : ""; + // } + // }, + // { + // "data": "satellites", + // "render": function (data, type, row) { + // return data ? data : ""; + // } + // }, + // { + // "data":null,"render":function(data,type,row){ + // return '' + // }} + // ], + // "columnDefs": [ + + // { width: '20px', targets: ['15'] } + // ] + // }); + // }); + + } + + deviceObj=[]; + + + +deviceSelect:any=[]; +deviceName:any; +deviceName1:any; + + deviceArr=[]; + data_descip:any; + + getReport(event){ + this.deviceArr=[]; + console.log("inside function",event); + if(event == 'getExcel'){ + this.exportExcel(); + }else{ + var deviceId: any; + var tpdata = event ; + var that = this; + var fd = new Date(tpdata.fromDate); + var td = new Date(tpdata.toDate); + var Fromdate = fd.toISOString(); + var todate = td.toISOString(); + + var diff = moment(todate).diff(Fromdate, 'days') + // console.log(diff,"999999999"); + + if(diff>=31){ + console.log('difference :' + diff) + this.data_descip = 'Report is unavailable for more than a month'; + launch_toast(); + + }else{ + if(event.deviceId.length==0){ + deviceId=[]; + }else{ + deviceId= event.deviceId; + } + this.deviceArr = deviceId; + this.Fromdate = fd; + this.todate = td; + this.testTable(); + } + } + + function launch_toast() { + // console.log(divid); + var x = document.getElementById("toast") + //console.log(x); + x.className = "show"; + setTimeout(function () { x.className = x.className.replace("show", ""); }, 4500); + } + +} + + + tab:any; + exportExcel() { + this.downloadFile(this.reportData) + } + downloadFile(data) { + let arrHeader = this.displayCol; + let csvData = this.ConvertToCSV(data, arrHeader); + let blob = new Blob(['\ufeff' + csvData], { type: 'text/csv;charset=utf-8;' }); + let dwldLink = document.createElement("a"); + let url = URL.createObjectURL(blob); + let isSafariBrowser = navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1; + if (isSafariBrowser) { //if Safari open in new window to save file with random filename. + dwldLink.setAttribute("target", "_blank"); + } + dwldLink.setAttribute("href", url); + dwldLink.setAttribute("download", "systemLogs.csv"); + dwldLink.style.visibility = "hidden"; + document.body.appendChild(dwldLink); + dwldLink.click(); + document.body.removeChild(dwldLink); + this.Load = false; + } + convertToDate(element, key) { + if (element[key]) { + var device_time = new Date(element[key]); + return device_time ? (moment(device_time).format('dddd,ll,LTS')) : ""; + } else { + return element[key] + } + } + ConvertToCSV(objArray, headerList) { + let array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray; + array = JSON.parse(JSON.stringify(array)); + + // console.log(array,"<===");Distance 126.94 + // Running 2:1 + // Idle 1:56 + // Stop + + let str = 'Customer List \r\n'; + let row = 'S.No,'; + // name,emial,phone,id,password and status no of vehicles + let newHeaders = this.displayCol; + for (let index in newHeaders) { + row += newHeaders[index] + ','; + } + row = row.slice(0, -1); + str += row + '\r\n'; + for (let i = 0; i < array.length; i++) { + + + let line = (i + 1) + ''; + if (i < array.length) { } + for (let index in headerList) { + let head = headerList[index]; + line += ',' + this.strRep(array[i][head]); + } + str += line + '\r\n'; + + } + return str; + } + strRep(data) { + if (typeof data == "string") { + let newData = data.replace(/,/g, " "); + return newData; + } + else if (typeof data == "undefined") { + return "-"; + } + else if (typeof data == "number") { + return data.toString(); + } + else { + return data; + } + } + + +} diff --git a/src/app/kyc-approval/device-doc/device-doc.component.html b/src/app/kyc-approval/device-doc/device-doc.component.html index ff5ebf8..1e54bfd 100644 --- a/src/app/kyc-approval/device-doc/device-doc.component.html +++ b/src/app/kyc-approval/device-doc/device-doc.component.html @@ -21,12 +21,12 @@
+ @@ -92,21 +92,51 @@
State RTO Certificate - + + + + + + Not Available + + + + {{state_certifcate_date |date:"medium"}}
Vahan Certificate - + + + + + - {{vaahan_certifcate_date |date:"medium"}}
State RTO CertificateState RTO Certificate + - + - + Not Available {{state_certifcate_date |date:"medium"}} + + + + + + - -
Vahan Certificate + - + - + Not Available {{vaahan_certifcate_date |date:"medium"}} - - + + + + + +
diff --git a/src/app/kyc-approval/device-doc/device-doc.component.ts b/src/app/kyc-approval/device-doc/device-doc.component.ts index e35a08f..6977ca0 100644 --- a/src/app/kyc-approval/device-doc/device-doc.component.ts +++ b/src/app/kyc-approval/device-doc/device-doc.component.ts @@ -137,12 +137,11 @@ AddDocumentsField(addedRow:any){ console.log(this.imageuploadObject); // console.log("ImageuploadObject=>",this.imageuploadObject); } -selectedFile: File; +selectedFile: any = {}; statePic; vahanPic onFileChanged(event1,type) { - this.selectedFile = event1.target.files[0]; - console.log(this.selectedFile,type); + this.selectedFile[type] = event1.target.files[0]; var fileToUpload = event1.target.files.item(0); @@ -172,15 +171,14 @@ onUpload(imgIndex) { console.log(imgIndex); console.log(this.imageuploadObject); const fd = new FormData(); - console.log("selected file name =>",this.selectedFile.name); - if(this.selectedFile.name == " "){ + if( !(this.selectedFile[imgIndex] && this.selectedFile[imgIndex].name)){ swal( 'Upload Error', 'Please select document type before upload !!!', 'error' ) }else{ - fd.append('photo',this.selectedFile,this.selectedFile.name) + fd.append('photo',this.selectedFile[imgIndex],this.selectedFile[imgIndex].name) console.log("imgURL=>",fd) ; this.Load = true; this.contactService.imageupload(fd) diff --git a/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts b/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts index 1c63a61..b3c4f92 100644 --- a/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts +++ b/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts @@ -432,21 +432,22 @@ export class NewTravelPathReportComponent implements OnInit { return (sa); } clocation_1(latlngObj, cb) { - if (latlngObj == null) { - cb(null, latlngObj); - } - var outerThis = this; - var la = ''; + // if (latlngObj == null) { + // cb(null, latlngObj); + // } + cb(null, latlngObj); + // var outerThis = this; + // var la = ''; - let latLng = { - lat: "0", - long: "0" - }; + // let latLng = { + // lat: "0", + // long: "0" + // }; - latLng = { - lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, - long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 - } + // latLng = { + // lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, + // long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 + // } // if () { @@ -456,79 +457,79 @@ export class NewTravelPathReportComponent implements OnInit { // } // } - outerThis.contactService.getAddressByApi(latLng).subscribe(res => { - if (res.message == "Address not found in databse") { - var adata = { - iden: 'noaddress', - latlng: latLng - } - latlngObj['address'] = adata; - // cb(null,latlngObj); - var latLng_1 = { - lat: "0", - long: "0" - }; + // outerThis.contactService.getAddressByApi(latLng).subscribe(res => { + // if (res.message == "Address not found in databse") { + // var adata = { + // iden: 'noaddress', + // latlng: latLng + // } + // latlngObj['address'] = adata; + // // cb(null,latlngObj); + // var latLng_1 = { + // lat: "0", + // long: "0" + // }; - latLng_1 = { - lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, - long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 - } + // latLng_1 = { + // lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, + // long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 + // } - outerThis.contactService.getAddressByApi(latLng_1).subscribe(res => { - if (res.message == "Address not found in databse") { - var bdata = { - iden: 'noaddress', - latlng: latLng_1 - } + // outerThis.contactService.getAddressByApi(latLng_1).subscribe(res => { + // if (res.message == "Address not found in databse") { + // var bdata = { + // iden: 'noaddress', + // latlng: latLng_1 + // } - latlngObj['address'] = bdata; - cb(null, latlngObj); + // latlngObj['address'] = bdata; + // cb(null, latlngObj); - } else { - latlngObj['address'] = res.address; - cb(null, latlngObj); - } + // } else { + // latlngObj['address'] = res.address; + // cb(null, latlngObj); + // } - }) + // }) - } else { - latlngObj['address'] = res.address; - var latLng_1 = { - lat: "0", - long: "0" - }; + // } else { + // latlngObj['address'] = res.address; + // var latLng_1 = { + // lat: "0", + // long: "0" + // }; - latLng_1 = { - lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, - long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 - } + // latLng_1 = { + // lat: latlngObj.latDecimal ? latlngObj.latDecimal : 0, + // long: latlngObj.longDecimal ? latlngObj.longDecimal : 0 + // } - outerThis.contactService.getAddressByApi(latLng_1).subscribe(res => { - if (res.message == "Address not found in databse") { - var cdata = { - iden: 'noaddress', - latlng: latLng_1 - } + // outerThis.contactService.getAddressByApi(latLng_1).subscribe(res => { + // if (res.message == "Address not found in databse") { + // var cdata = { + // iden: 'noaddress', + // latlng: latLng_1 + // } - latlngObj['address'] = cdata; - cb(null, latlngObj); + // latlngObj['address'] = cdata; + // cb(null, latlngObj); - } else { - latlngObj['address'] = res.address; - cb(null, latlngObj); - } + // } else { + // latlngObj['address'] = res.address; + // cb(null, latlngObj); + // } - }) + // }) - // cb(null,latlngObj); - } - }) + // // cb(null,latlngObj); + // } + // }) } diff --git a/src/app/report/report-filter/report-filter.component.html b/src/app/report/report-filter/report-filter.component.html index 869f645..0178641 100644 --- a/src/app/report/report-filter/report-filter.component.html +++ b/src/app/report/report-filter/report-filter.component.html @@ -1086,7 +1086,7 @@

{{ "Search By" | translate }} :

-
+
-
+
{{ "Vahicle Name" | translate }}
diff --git a/src/app/report/report-filter/report-filter.component.ts b/src/app/report/report-filter/report-filter.component.ts index b82db88..04053fb 100644 --- a/src/app/report/report-filter/report-filter.component.ts +++ b/src/app/report/report-filter/report-filter.component.ts @@ -134,6 +134,7 @@ export class ReportFilterComponent implements OnInit { // {name : "User Trip Report",Rstatus : true,Astatus:false,value:"user_trip_report"}, // {name : "Alert Report",Rstatus : true,Astatus:false,value:"alert_report"} , ]; + @Input() hideIEMI= false; reportPrefrecne:any componentArray=['AC_report','daily_report','ss','dayWiseReport','distance_report','Driver_performance','geofence_report', 'idle_report','ignition_report','loadunloadTrip','notification_master','over_speed','poi_report','route_violation_report','speed_variation','summary_report','stoppage_report','device_sos_report', diff --git a/src/index.html b/src/index.html index eded6a3..2a07fd6 100644 --- a/src/index.html +++ b/src/index.html @@ -287,7 +287,7 @@ - + From 69894ac1322fab4b28446a4cdbbb2a94506c84d3 Mon Sep 17 00:00:00 2001 From: Pranav Samvith Date: Sun, 5 Mar 2023 11:44:38 +0000 Subject: [PATCH 06/10] removed needless files --- dataprocessing.js | 3112 ---------- dms.js | 225 - gpsFunctions.js | 127 - src/app/login/login.controller.js | 0 src/assets/image/contact.controller (1).js | 6198 -------------------- 5 files changed, 9662 deletions(-) delete mode 100644 dataprocessing.js delete mode 100644 dms.js delete mode 100644 gpsFunctions.js delete mode 100644 src/app/login/login.controller.js delete mode 100644 src/assets/image/contact.controller (1).js diff --git a/dataprocessing.js b/dataprocessing.js deleted file mode 100644 index 9a9a035..0000000 --- a/dataprocessing.js +++ /dev/null @@ -1,3112 +0,0 @@ - -var mongoose = require('mongoose'); -const FLUCTUATION_THRESHOLD = 50 / 1000; -const ObjectID = require('mongodb').ObjectID; -var Notifs = require('./app_api/models/notifications'); -var MongoClient = require('mongodb').MongoClient -var f = require('./gpsFunctions'); -var crc = require('crc'); -var pushNotifs = require('./notify') -var Device = require('./app_api/models/device'); -var cmdPackets = require('./app_api/models/cmdPackets') -var GeoFence = require('./app_api/models/geofence') -var Route = require('./app_api/models/trackRoute'); -var RouteMap = require('./app_api/models/routeDeviceMap') -var Groups = require('./app_api/models/group'); -var GPS = require('./app_api/models/gps') -//var gpsio = gpsIo -var moment = require('moment-timezone'); -var Mailer = require('./app_api/controllers/mailer'); -var OutgoingIntegrations = require('./outgoingIntegrations'); -var GeofenceReports = require('./app_api/models/geofenceReports'); -var GPS_x03 = require('./GPS_x03'); -//var geoFenceio = geoFenceIo -var TCPUTIL = require('./tcpUtil'); -var Utilities = require('./app_api/controllers/utilities.controller'); -var request = require('request'); -var KafkaService = require('./kafka-producer'); -var url = 'mongodb://'+Utilities.getConfig().dbUserName+':'+Utilities.getConfig().dbPassUrlEncoded+'@'+Utilities.getConfig().dbDomain+':'+Utilities.getConfig().dbPort+'/IOT?authSource='+Utilities.getConfig().dbAuthSource; -var dbOption = { - //user : Utilities.getConfig().dbUserName, - //pass : Utilities.getConfig().dbPass -}; - - -function parseYantraData(raw) { - console.log('yantra') - try { - var rawWOHeadFoot = raw.substring(1); - rawWOHeadFoot = rawWOHeadFoot.substring(0, rawWOHeadFoot.length - 1); - var rawArray = rawWOHeadFoot.split(','); - var latDecimal = rawArray[5] == 'N' ? - parseFloat(rawArray[4].substring(0, 2)) + parseFloat((rawArray[4].substring(2, 9) / 60)) : - (parseFloat(rawArray[4].substring(0, 2)) + parseFloat((rawArray[4].substring(2, 9) / 60))) * -1; - var longDecimal = rawArray[7] == 'E' ? - parseFloat(rawArray[6].substring(0, 3)) + parseFloat((rawArray[6].substring(3, 10) / 60)) : - (parseFloat(rawArray[6].substring(0, 3)) + parseFloat((rawArray[6].substring(3, 10) / 60))) * -1; - /* var ac=rawArray[12].substring(4,6); - var ac1 = (parseInt(ac, 16).toString(2)); - while (ac1.length < 8) { - ac1 = '0' + ac1; - } - ac1 = ac1.substr(5, 1); - var power = rawArray[12].substring(2, 4); - - var power1 = parseInt(power, 16).toString(2); - while (power1.length < 8) { - power1 = '0' + power1; - } - power1 = power1.substr(4, 1); */ - return { - "imei": rawArray[0], - "command": '$', - "date": rawArray[2] ? new Date(parseInt('20' + - rawArray[2].substring(4, 6)), - parseInt(rawArray[2].substring(2, 4) - 1), - parseInt(rawArray[2].substring(0, 2)), - parseInt(rawArray[3].substring(0, 2)), - parseInt(rawArray[3].substring(2, 4)), - parseInt(rawArray[3].substring(4, 6)) - ) : null, - "dateString": rawArray[2], - "latDirection": rawArray[5], - "longDirection" : rawArray[7], - "latDegrees": rawArray[4] + rawArray[5], - "longDegrees": rawArray[6] + rawArray[7], - "latDecimal": latDecimal, - "longDecimal": longDecimal, - "insertionTime": new Date(), - "raw": raw, - "valid": rawArray[1], - "speed": (parseFloat(rawArray[8])).toFixed(2), - "odo" : parseFloat(rawArray[9]), - "timeString": rawArray[3], - "heading": rawArray[10], - "satellites": rawArray[11], - "gsmSignal": rawArray[12], - "DIN1": rawArray[14], - "DIN2" : rawArray[15], - "ignition": rawArray[13], - "boxStatus" : rawArray[17], - "GPS positioned": rawArray[16], - "batteryStatus" : rawArray[18], - "geoJSON": { - "type": "Point", - "coordinates": [ longDecimal, latDecimal ] - } - } -} catch (err) { - console.error("exception handled"); - console.error(err); -} -} - -function parseRawGpsVTX(raw) -{ - var rawArray = raw.split('&'); - var latDecimal = rawArray[3].split(',')[3].charAt(rawArray[3].split(',')[3].length-1) == 'N' ?parseFloat(rawArray[3].split(',')[3].substring(0,2)) + parseFloat((rawArray[3].split(',')[3].substring(2, 9) / 60)):(parseFloat(rawArray[3].split(',')[3].substring(0,2)) + parseFloat((rawArray[3].split(',')[3].substring(2, 9) / 60)))* -1; - var longDecimal = rawArray[3].split(',')[4].charAt(rawArray[3].split(',')[4].length-1) == 'E' ?parseFloat(rawArray[3].split(',')[4].substring(0,3)) + parseFloat((rawArray[3].split(',')[4].substring(3, 10) / 60)):(parseFloat(rawArray[3].split(',')[4].substring(0,3)) + parseFloat((rawArray[3].split(',')[4].substring(3, 10) / 60))) * -1; - - return { - "imei": rawArray[0].split(',')[1], - "command": 'VTX', - "date": new Date(parseInt('20' + - rawArray[3].split(',')[7].substring(4,6)), - parseInt(rawArray[3].split(',')[7].substring(2,4) - 1), - parseInt(rawArray[3].split(',')[7].substring(0,2)), - parseInt(rawArray[3].split(',')[1].substring(0,2)), - parseInt(rawArray[3].split(',')[1].substring(2,4)), - parseInt(rawArray[3].split(',')[1].substring(4,6)) - ), - "dateString": rawArray[3].split(',')[7], - "latDegrees": rawArray[3].split(',')[3], - "longDegrees":rawArray[3].split(',')[4], - "latDecimal": latDecimal, - "longDecimal": longDecimal, - "insertionTime": new Date(), - "raw": raw, - "valid": rawArray[3].split(',')[2], - "speed": rawArray[3].split(',')[5], - "timeString": rawArray[3].split(',')[1], - "heading": rawArray[3].split(',')[6], - "GPS positioned":((rawArray[6]=='A')?1:0), - "ignition":rawArray[3].split(',')[10]=='1'?'0':'1', - "geoJSON": { - "type": "Point", - "coordinates": [longDecimal,latDecimal] - } -} -} - -function parseRawGpsTs(raw,type) -{ - var raw1=raw.substring(0, raw.length - 2); - var rawArray = raw.split(','); - if(type=='first') - { - - } - else if(type=='rest') - { - - return { - "imei": rawArray[1], - "command": 'TS', - "date": new Date(parseInt('20' + - rawArray[5].substring(0,2)), - parseInt(rawArray[5].substring(2,4) - 1), - parseInt(rawArray[5].substring(4,6)), - parseInt(rawArray[5].substring(6,8)), - parseInt(rawArray[5].substring(8,10)), - parseInt(rawArray[5].substring(10,12)) - ), - "dateString": rawArray[5].substring(0,6), - "latDecimal": Number(rawArray[3]), - "longDecimal": Number(rawArray[4]), - "insertionTime": new Date(), - "raw": raw, - "valid": rawArray[6], - "speed": rawArray[8], - "timeString": rawArray[5].substring(6,12), - "heading": rawArray[10], - "GPS positioned":((rawArray[6]=='A')?1:0), - "ignition":rawArray[27], - "gsmSignal":rawArray[7], - "power":rawArray[23]=='0'?'1':'0', - "satellites":rawArray[11], - "batteryStatus":rawArray[48], - "gpsTracking":((rawArray[6]=='A')?'1':'0'), - "geoJSON": { - "type": "Point", - "coordinates": [rawArray[4],rawArray[3]] - } - } - -} -} - -function parseRawGpsGB(raw,gpsModel) -{ - if(gpsModel == 'GB') - { - try { - - var rawArray = raw.split(','); - var latstring=rawArray[4].split(':')[1]; - var lat=(parseFloat(latstring.substring(0,2))+parseFloat(latstring.substring(2,9)/60)); - - var longstring=rawArray[5].split(':')[1]; - var long=(parseFloat(longstring.substring(0,3))+parseFloat(longstring.substring(3,10)/60)); - - return { - "imei": rawArray[0].split(':')[1], - "command": 'GB', - "date": rawArray[11] ? new Date(parseInt('20' + - rawArray[7].split(':')[1].substring(4,6)), - parseInt(rawArray[7].split(':')[1].substring(2,4) - 1), - parseInt(rawArray[7].split(':')[1].substring(0,2)), - - parseInt(rawArray[3].split(':')[1].substring(0,2)), - parseInt(rawArray[3].split(':')[1].substring(2,4)), - parseInt(rawArray[3].split(':')[1].substring(4,6)) - ) : null, - "dateString": rawArray[7].split(':')[1], - "latDegrees": rawArray[4].split(':')[1], - "longDegrees": rawArray[5].split(':')[1], - "latDecimal": lat, - "longDecimal": long, - "insertionTime": new Date(), - "raw": raw, - "valid": rawArray[10].split(':')[1].charAt(7), - "speed": (parseFloat(rawArray[6].split(':')[1]).toFixed(2)), - "timeString": rawArray[3].split(':')[1], - "heading": rawArray[12].split(':')[1].substring(0, rawArray[12].split(':')[1].length - 2), - "GPS positioned":((rawArray[10].split(':')[1].charAt(7)=='A')?1:0), - "ignition": rawArray[9].split(':')[1].charAt(0), - "ac": rawArray[9].split(':')[1].charAt(3), - "sos" : rawArray[9].split(':')[1].charAt(1) == "1" ? true : false, - "debug" : rawArray[9].split(':')[1].charAt(4), - "batteryStatus": rawArray[1].split(':')[1], - "power":rawArray[9].split(':')[1].charAt(5), - "gpsTracking":((rawArray[10].split(':')[1].charAt(7)=='A')?'1':'0'), - "geoJSON": { - "type": "Point", - "coordinates": [long, lat] - } - } - } catch (err) { - console.error("exception handled"); - console.error(err); - } -} -} -function parseRawGpsL(raw) -{ - - try { - - var rawArray = raw.split(','); - var lat=(parseFloat(rawArray[4].substring(0,2))+parseFloat(rawArray[4].substring(2,9)/60)); - var long=(parseFloat(rawArray[6].substring(0,3))+parseFloat(rawArray[6].substring(3,10)/60)); - - return { - "imei": rawArray[0].substring(11), - "command": 'L100', - "date": new Date (Number(rawArray[2])).toISOString().replace('T',' '), - "dateString": new Date(parseInt('20' + - str.split(',')[10].substring(4,6)), - parseInt(str.split(',')[10].substring(2,4) - 1), - parseInt(str.split(',')[10].substring(0,2))), - "latDegrees": rawArray[4]+rawArray[5], - "longDegrees": rawArray[6]+rawArray[7], - "latDecimal": lat, - "longDecimal": long, - "insertionTime": new Date(), - "raw": raw, - "valid": rawArray[3], - "speed": (parseFloat(Number(rawArray[8])*1.85).toFixed(2)), - "timeString": Number(rawArray[2]), - "heading": rawArray[9], - "ignition":rawArray[14].charAt(1), - "geoJSON": { - "type": "Point", - "coordinates": [long, lat] - } - } - } catch (err) { - console.error("exception handled"); - console.error(err); - } - -} - -function parseT8803_data(raw, parsedHead) { - data = Buffer.from(data).toString('hex'); - var date = new Date( - parseInt(data.substr(88, 2), 16) + 2000, - parseInt(data.substr(90, 2), 16) - 1, - parseInt(data.substr(92, 2), 16), - parseInt(data.substr(94, 2), 16), - parseInt(data.substr(96, 2), 16), - parseInt(data.substr(98, 2), 16) - ) - - var course_status = parseInt(data.substr(128, 4), 16).toString(2); - var latitude = Buffer(str.substr(116, 8), 'hex').readFloatBE(0); - var longitude = Buffer(str.substr(108, 8), 'hex').readFloatBE(0); - var speedHex = str.substr(124, 4); - var speed = [speedHex.slice(0, 3), '.', speedHex.slice(3)].join(''); - var gpsPositionedData = parseInt(str.substr(48, 2), 16).toString(2); - var gpsPositioned = gpsPositionedData.charAt(0) == '0' ? '1' : '0'; - var digitalIOData = parseInt(str.substr(62, 4), 16).toString(2); - var ignition = digitalIOData.charAt(1) == '1' ? 1 : 0; - - return { - "imei": parseInt(str.substr(14,16)), - "command": parsedHead.protocal_id, - "date": date, - "dateString": str.substr(88, 6), - "latDecimal": latitude, - "longDecimal": longitude, - "insertionTime": new Date(), - "raw": raw.toString('hex'), - "speed": speed, - "timeString": str.substr(94, 6), - "heading": course_status, - "geoJSON": { - "type": "Point", - "coordinates": [longitude, latitude ] - }, - //'MCC': parseInt(str.substr(36, 4), 16), - //'MNC': parseInt(str.substr(40, 2), 16), - //'LAC': parseInt(str.substr(42, 4), 16), - //'CellT ID': parseInt(str.substr(46, 6), 16), - //'lbs': str.substr(36, 16), - //'real-time gps': course_status.substr(0, 1), - 'GPS positioned': course_status.substr(1, 1), - 'ignition' : ignition - //'satellites': parseInt(str.substr(13, 1), 16) - } -} -function authorizeT8803(device_id, socket) { - socket.imei = parseInt(device_id) - var loginResponse = '232301000F0001' + device_id; - socket.write(new Buffer(loginResponse, 'hex')); -} - -function respond_T8803_heartbeat(device_id, socket) { - socket.imei = parseInt(device_id) - var heartbeatResponse = '232303000F0001' + device_id; - socket.write(new Buffer(heartbeatResponse, 'hex')); -} -function parseT8803_head(raw, socket) { - data = Buffer.from(data).toString('hex') - var parts = { - 'start': data.substr(0, 4) - }; - - if (parts['start'] == '2323') { - parts['length'] = parseInt(data.substr(6, 4), 16); - //parts['finish'] = data.substr(6 + parts['length'] * 2, 4); - parts['protocal_id'] = data.substr(4, 2); - if (parts['protocal_id'] == '01') { - parts['device_id'] = data.substr(14, 16); - parts.cmd = 'login_request'; - parts.action = 'login_request'; - } else if (parts['protocal_id'] == '02') { - parts['device_id'] = socket.imei || data.substr(14, 16); - parts['data'] = data.substr(30); - parts.cmd = 'ping'; - parts.action = 'ping'; - } else if (parts['protocal_id'] == '03') { - parts['device_id'] = socket.imei || data.substr(14, 16); - parts['data'] = data.substr(30); - parts.cmd = 'heartbeat'; - parts.action = 'heartbeat'; - } else if (parts['protocal_id'] == '04') { - parts['device_id'] = socket.imei || ''; - parts['data'] = data.substr(8, parts['length'] * 2); - parts.cmd = 'alert'; - parts.action = 'alert'; - } else { - parts['device_id'] = socket.imei || ''; - parts.cmd = 'noop'; - parts.action = 'noop'; - } - } - else { - parts['device_id'] = ''; - parts.cmd = 'noop'; - parts.action = 'noop'; - } - return parts; -} - -function parseGM06_Head(data, socket) { - data = Buffer.from(data).toString('hex') - var parts = { - 'start': data.substr(0, 4) - }; - - if (parts['start'] == '6767') { - parts['protocal_id'] = data.substr(4, 2); - parts['length'] = parseInt(data.substr(6, 4), 16); - //parts['finish'] = data.substr(6 + parts['length'] * 2, 4); - if (parts['protocal_id'] == '01') { - parts['device_id'] = data.substr(15, 15); - parts.cmd = 'login_request'; - parts.action = 'login_request'; - } else if (parts['protocal_id'] == '02') { - parts['device_id'] = socket.imei || ''; - parts['data'] = data.substr(14, parts['length'] * 2); - parts.cmd = 'ping'; - parts.action = 'ping'; - } else if (parts['protocal_id'] == '03') { - parts['device_id'] = socket.imei || ''; - parts.cmd = 'heartbeat'; - parts['data'] = data/* .substr(8, 10) */; - parts.action = 'heartbeat'; - } else { - parts['device_id'] = socket.imei || ''; - parts.cmd = 'noop'; - parts.action = 'noop'; - } - } - else { - parts['device_id'] = ''; - parts.cmd = 'noop'; - parts.action = 'noop'; - } - return parts; -}; - -function authorizeGM06(socket, request, raw) { - socket.imei = socket.imei || parseInt(request.device_id); - console.log('6767010002' + Buffer.from(raw, 'hex').toString('hex').substr(10, 4)); - socket.write('6767010002' + Buffer.from(raw, 'hex').toString('hex').substr(10,4), 'hex'); -}; - -function get_GM06_ping_data(msg_parts, raw, socket) { - var str = msg_parts.data; - var date = new Date( - parseInt(str.substr(0, 8), 16) * 1000 - ) - - var latitude = dex_to_degrees(str.substr(8, 8), 0); - var longitude = dex_to_degrees(str.substr(16, 8), 0); - var gps = parseInt(str.substr(48, 1), 2).toString(); - gps = gps.charAt(gps.length-1) - - - - - - - return { - "imei": socket.imei.toString(), - "command": msg_parts.protocal_id, - "date": date, - "dateString": str.substr(0, 6), - "latDecimal": latitude, - "longDecimal": longitude, - "insertionTime": new Date(), - "raw": raw.toString('hex'), - "speed": parseInt(str.substr(24, 2), 16).toString(), - "timeString": str.substr(6, 6), - "heading": parseInt(str.substr(26, 4), 16).toString(), - "geoJSON": { - "type": "Point", - "coordinates": [longitude, latitude ] - }, - 'GPS positioned': gps - } -}; - -function receive_GM06_heartbeat(raw, socket) { - socket.write('6767030002' + Buffer.from(raw, 'hex').toString('hex').substr(10,4), 'hex'); -}; - - -function parseVT1000(raw) -{ - var gsm1=str.substring(str.length-20); - var gsmval=gsm1.substring(6,8); - var latstring=raw.substring(31,38)/1000; - var lat=(parseFloat(latstring.toString().substring(0,2))+parseFloat(latstring.toString().substring(2,7)/60)); - - var longstring=raw.substring(38,46)/1000; - var long=(parseFloat(longstring.toString().substring(0,2))+parseFloat(longstring.toString().substring(2,7)/60)); - - var locationStatusBits = parseInt(raw.substr(54, 2), 16).toString(2); - while(locationStatusBits.length < 8) { - locationStatusBits = "0" + locationStatusBits; - } - var alarmPacket = raw.substr(62, 8); - var alarm1Packet = alarmPacket.substr(0, 2); - var alarm1PacketBits = parseInt(alarm1Packet, 16).toString(2); - while(alarm1PacketBits.length < 8) { - alarm1PacketBits = "0" + alarm1PacketBits; - } - var io=raw.substring(62,70).charAt(7); - return { - "imei": raw.substring(10,18), - "command": raw.substring(4,6), - "date": new Date(parseInt('20' + - raw.substring(18, 20)), - parseInt(raw.substring(20, 22) - 1), - parseInt(raw.substring(22, 24)), - parseInt(raw.substring(24, 26)), - parseInt(raw.substring(26, 28)), - parseInt(raw.substring(28, 30)) - ), - "dateString": raw.substring(18, 24), - //"latDecimal": raw.substring(31,38)/100000, - // "longDecimal": raw.substring(38,46)/100000, - "latDecimal": lat, - "longDecimal": long, - "insertionTime": new Date(), - "raw": raw, - "speed": raw.substring(46,50), - "timeString": raw.substring(24,30), - "heading": raw.substring(50, 54), - "GPS positioned": locationStatusBits.charAt(0), - "alarm1PacketBits": alarm1PacketBits, - "locationStatusBits" : locationStatusBits, - "ignition": alarm1PacketBits.charAt(0) == '1' ? '0' : '1', - "power" : alarm1PacketBits.charAt(4) == '1' ? '0' : '1', - "gsmSignal":gsmval, - "geoJSON": { - "type": "Point", - "coordinates": [ long, lat ] - } -} -} - -function fmb_login(hexString, socket) { - - - //disable nagle's algorithm which prevents packets from being sent immediately - //socket.setNoDelay(true); - var imei_scramble = hexString.substr(4); - var imei = ''; - for (var i = 0; i < imei_scramble.length; i++){ - if (i % 2 != 0) { - imei += imei_scramble.charAt(i); - } - } - socket.imei = imei; - socket.write(new Buffer('01', 'hex'), function (z) { - //console.log('fmb accepted') - }); -} - -function parseFmbData(hexString, socket) { - - var allData = []; - - var imei = socket.imei; - var command = hexString.substr(16, 2); - var number_of_data = parseInt(hexString.substr(18, 2), 16) - var startIndex = 20; - for (var q = 1; q <= number_of_data; q++){ - var data = {} - data.startIndex = startIndex; - data.command = command; - data.number_of_data = number_of_data; - data.imei = socket.imei; - data.date = new Date(parseInt(hexString.substr(startIndex + 0, 16), 16)); - data.priority = hexString.substr(startIndex + 16, 2); - var longDecimal = parseInt(hexString.substr(startIndex + 18, 8), 16) / 10000000; - var latDecimal = parseInt(hexString.substr(startIndex + 26, 8), 16) / 10000000; - data.raw = hexString; - data.latDecimal = latDecimal; - data.longDecimal = longDecimal; - data.geoJSON = { - "type": "Point", - "coordinates": [longDecimal, latDecimal] - }; - data.insertionTime = new Date(); - data.altitude = hexString.substr(startIndex + 34, 4) - data.heading = hexString.substr(startIndex + 38, 4); - data.satellites = hexString.substr(startIndex + 42, 2); - data.speed = parseInt(hexString.substr(startIndex + 44, 4), 16).toString(); - data.eventId = parseInt(hexString.substr(startIndex + 48, 2),16); - data.numOfIO = parseInt(hexString.substr(startIndex + 50, 2), 16); - - - //1 byte IO - var num1ByteIO = parseInt(hexString.substr(startIndex + 52, 2), 16); - data.num1ByteIO = num1ByteIO - var _1ByteIO = hexString.substr(startIndex + 54, (num1ByteIO + (num1ByteIO * 1)) * 2); - data._1ByteIO = _1ByteIO - - for (var i = 0; i <= num1ByteIO; i++){ - var IoElement = _1ByteIO.substr(i * 4, 2); - var IoValue = _1ByteIO.substr((i * 4) + 2, 2); - - //digital in - if (parseInt(IoElement, 16) == 1) { - data.ignition = parseInt(IoValue, 16).toString(); - } - //GNSS status - if (parseInt(IoElement, 16) == 69) { - data['GPS positioned'] = parseInt(IoValue, 16).toString(); - } - } - - - - //2 byte IO - var num2ByteIOIndex = startIndex + 54 + ((num1ByteIO + (num1ByteIO * 1)) * 2); - data.num2ByteIOIndex = num2ByteIOIndex; - var num2ByteIO = parseInt(hexString.substr(num2ByteIOIndex, 2), 16); - data.num2ByteIO = num2ByteIO; - - var _2ByteIO = hexString.substr(num2ByteIOIndex + 2, (num2ByteIO * 6)); - data._2ByteIO = _2ByteIO; - - for (var i = 0; i <= num2ByteIO; i++){ - var IoElement = _2ByteIO.substr(i * 6, 2); - var IoValue = _2ByteIO.substr((i * 6) + 2, 4); - - //analog in - if (parseInt(IoElement, 16) == 9) { - data.fuelVoltage = parseInt(IoValue, 16); - } - //ext voltage - if (parseInt(IoElement, 16) == 66) { - data.power = parseInt(IoValue, 16) == 0 ? '0' : '1'; - } - - } - - //4 byte IO - var num4ByteIOIndex = num2ByteIOIndex + ((num2ByteIO * 6/* + (num2ByteIO * 1) */) + 2); - data.num4ByteIOIndex = num4ByteIOIndex; - var num4ByteIO = parseInt(hexString.substr(num4ByteIOIndex, 2), 16); - data.num4ByteIO = num4ByteIO; - - var _4ByteIO = hexString.substr(num4ByteIOIndex + 2, (num4ByteIO * 10)); - startIndex = num4ByteIOIndex + 2 + 2 + (num4ByteIO * 10); - data._4ByteIO = _4ByteIO; - - for (var i = 0; i <= num4ByteIO; i++){ - var IoElement = _4ByteIO.substr(i * 10, 2); - var IoValue = _4ByteIO.substr((i * 10) + 2, 8); - - //analog in - if (parseInt(IoElement, 16) == 16) { - data.odo = parseInt(IoValue, 16) / 1000; - } - - - } - allData.push(data); - } - - var latest = allData[0]; - - if (allData.length > 1) { - Device.findOne({ Device_ID: latest.imei }, function (err, device) { - if(err){ - console.error(err); - } - else if(device) { - allData.shift(); - for (var z = 0; z < allData.length; z++){ - allData[z].group = device.vehicleGroup; - allData[z].vehicle = device.vehicle; - } - GPS.insertMany(allData, { ordered: false }, function (err, docs) { - }) - } - }) - } - - return latest; -} -function numHex(s) -{ - var a = s.toString(16); - if( (a.length % 2) > 0 ){ a = "0" + a; } - return a; -} -function sendFmbAck(socket, number_of_data) { - number_of_data_encoded = parseInt(number_of_data).toString(16); - while (number_of_data_encoded.length < 8) { - number_of_data_encoded = '0' + number_of_data_encoded; - } - var packet = new Buffer(number_of_data_encoded, 'hex'); - socket.write(packet); -} - - - -function crc16(buf) { - - var crcTable = - [ - 0X0000, 0X1189, 0X2312, 0X329B, 0X4624, 0X57AD, 0X6536, 0X74BF, 0X8C48, 0X9DC1, 0XAF5A, - 0XBED3, 0XCA6C, 0XDBE5, 0XE97E, 0XF8F7, 0X1081, 0X0108, 0X3393, 0X221A, 0X56A5, 0X472C, - 0X75B7, 0X643E, 0X9CC9, 0X8D40, 0XBFDB, 0XAE52, 0XDAED, 0XCB64, 0XF9FF, 0XE876, 0X2102, - 0X308B, 0X0210, 0X1399, 0X6726, 0X76AF, 0X4434, 0X55BD, 0XAD4A, 0XBCC3, 0X8E58, 0X9FD1, - 0XEB6E, 0XFAE7, 0XC87C, 0XD9F5, 0X3183, 0X200A, 0X1291, 0X0318, 0X77A7, 0X662E, 0X54B5, - 0X453C, 0XBDCB, 0XAC42, 0X9ED9, 0X8F50, 0XFBEF, 0XEA66, 0XD8FD, 0XC974, 0X4204, 0X538D, - 0X6116, 0X709F, 0X0420, 0X15A9, 0X2732, 0X36BB, 0XCE4C, 0XDFC5, 0XED5E, 0XFCD7, 0X8868, - 0X99E1, 0XAB7A, 0XBAF3, 0X5285, 0X430C, 0X7197, 0X601E, 0X14A1, 0X0528, 0X37B3, 0X263A, - 0XDECD, 0XCF44, 0XFDDF, 0XEC56, 0X98E9, 0X8960, 0XBBFB, 0XAA72, 0X6306, 0X728F, 0X4014, - 0X519D, 0X2522, 0X34AB, 0X0630, 0X17B9, 0XEF4E, 0XFEC7, 0XCC5C, 0XDDD5, 0XA96A, 0XB8E3, - 0X8A78, 0X9BF1, 0X7387, 0X620E, 0X5095, 0X411C, 0X35A3, 0X242A, 0X16B1, 0X0738, 0XFFCF, - 0XEE46, 0XDCDD, 0XCD54, 0XB9EB, 0XA862, 0X9AF9, 0X8B70, 0X8408, 0X9581, 0XA71A, 0XB693, - 0XC22C, 0XD3A5, 0XE13E, 0XF0B7, 0X0840, 0X19C9, 0X2B52, 0X3ADB, 0X4E64, 0X5FED, 0X6D76, - 0X7CFF, 0X9489, 0X8500, 0XB79B, 0XA612, 0XD2AD, 0XC324, 0XF1BF, 0XE036, 0X18C1, 0X0948, - 0X3BD3, 0X2A5A, 0X5EE5, 0X4F6C, 0X7DF7, 0X6C7E, 0XA50A, 0XB483, 0X8618, 0X9791, 0XE32E, - 0XF2A7, 0XC03C, 0XD1B5, 0X2942, 0X38CB, 0X0A50, 0X1BD9, 0X6F66, 0X7EEF, 0X4C74, 0X5DFD, - 0XB58B, 0XA402, 0X9699, 0X8710, 0XF3AF, 0XE226, 0XD0BD, 0XC134, 0X39C3, 0X284A, 0X1AD1, - 0X0B58, 0X7FE7, 0X6E6E, 0X5CF5, 0X4D7C, 0XC60C, 0XD785, 0XE51E, 0XF497, 0X8028, 0X91A1, - 0XA33A, 0XB2B3, 0X4A44, 0X5BCD, 0X6956, 0X78DF, 0X0C60, 0X1DE9, 0X2F72, 0X3EFB, 0XD68D, - 0XC704, 0XF59F, 0XE416, 0X90A9, 0X8120, 0XB3BB, 0XA232, 0X5AC5, 0X4B4C, 0X79D7, 0X685E, - 0X1CE1, 0X0D68, 0X3FF3, 0X2E7A, 0XE70E, 0XF687, 0XC41C, 0XD595, 0XA12A, 0XB0A3, 0X8238, - 0X93B1, 0X6B46, 0X7ACF, 0X4854, 0X59DD, 0X2D62, 0X3CEB, 0X0E70, 0X1FF9, 0XF78F, 0XE606, - 0XD49D, 0XC514, 0XB1AB, 0XA022, 0X92B9, 0X8330, 0X7BC7, 0X6A4E, 0X58D5, 0X495C, 0X3DE3, - 0X2C6A, 0X1EF1, 0X0F78 - ]; - - - crcX = parseInt("FFFF", 16); - cr1 = parseInt("FF", 16); - cr2 = parseInt("FFFF", 16); - i = 0; - - while (i < buf.length) { - str = buf.substring(i, i + 2); - str_hex = parseInt(str, 16); - - j = (crcX ^ str_hex) & cr1; - crcX = (crcX >> 8) ^ crcTable[j]; - - i = i + 2; - } - - crcX = crcX ^ 0xffff; - - return crcX.toString(16); -} - -function receive_heartbeat(raw, socket) { - var data = Buffer.from(raw, 'hex').toString('hex') - if (!socket.__count) { - socket.__count = 1; - } - //socket.imei = parseInt(request.device_id) - var length = '05'; - var protocal_id = '01'; - var serial = Buffer.from(raw).toString('hex').substr(18, 4) - var str = length + protocal_id + serial; - socket.__count++; - var crcResult = crc16(str); - var buff = new Buffer('7878' + str + crcResult + '0d0a', 'hex'); - socket.write(buff); -}; - -function dex_to_degrees(dex, l) { - return (parseInt(dex, 16) / 1800000) -}; - -function parseG500OBD_lat_long(l) { -} - -function parseG500OBD_data(data) { - data = Buffer.from(data).toString('hex') - if (data.substr(14, 4) == '2084') { - var date = new Date( - - parseInt(data.substr(32, 2)) + 2000, - parseInt(data.substr(30, 2)) - 1, - parseInt(data.substr(28, 2)), - parseInt(data.substr(34, 2)), - parseInt(data.substr(36, 2)), - parseInt(data.substr(38, 2)) - ) - var latDecimal = parseInt(data.substr(40, 2)) + (parseFloat(data.substr(42, 2) + '.' + data.substr(44, 4)) / 60) - var longDecimal = parseInt(data.substr(48, 2)) + (parseFloat(data.substr(50, 2) + '.' + data.substr(52, 4)) / 60) - return { - "imei": data.substr(2, 12), - "command": data.substr(14, 4), - "date": date, - "dateString": data.substr(28, 6), - "latDecimal": latDecimal, - "longDecimal": longDecimal, - "insertionTime": new Date(), - "raw": data, - "speed": parseInt(data.substr(58, 2), 16).toString(), - "timeString": data.substr(34, 6), - "heading": (parseInt(data.substr(60, 2), 16) * 2).toString(), - "geoJSON": { - "type": "Point", - "coordinates": [ longDecimal, latDecimal ] - } - } - } - else { - return {} - } -} - -function hex2ASCII(hexx) { - var hex = hexx.toString(); - var str = ''; - for (var i = 0; (i < hex.length && hex.substr(i, 2) !== '00'); i += 2) - str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); - return str; -} - -function parse_GT06_stringInfo(parsedHead) { - var contentLength = parseInt(parsedHead.data.substr(0, 2), 16); - var serverKeyLength = 4; - var stringInfo = hex2ASCII(parsedHead.data.substr(2 + (4 * 2), contentLength * 2)); - return stringInfo; -} - -function get_GT06_alarm_data(msg_parts, raw, socket) { - var str = msg_parts.data; - var sos = 0; - var date = new Date( - parseInt(str.substr(0, 2), 16) + 2000, - parseInt(str.substr(2, 2), 16) - 1, - parseInt(str.substr(4, 2), 16), - parseInt(str.substr(6, 2), 16), - parseInt(str.substr(8, 2), 16), - parseInt(str.substr(10, 2), 16) - ) - - var course_status = parseInt(str.substr(32, 4), 16).toString(2); - var longDir = course_status.substr(2, 1) == '0' ? 'E' : 'W'; - var latDir = course_status.substr(3, 1) == '0' ? 'S' : 'N'; - //var latitude = latDir == 'N' ? dex_to_degrees(str.substr(14, 8), 0) : dex_to_degrees(str.substr(14, 8), 0)*-1; - //var longitude = longDir == 'E' ? dex_to_degrees(str.substr(22, 8), 1) : dex_to_degrees(str.substr(22, 8), 1)*-1; - var latitude = latDir == 'N' ? dex_to_degrees(str.substr(14, 8), 0) : dex_to_degrees(str.substr(14, 8), 0); - var longitude = longDir == 'E' ? dex_to_degrees(str.substr(22, 8), 1) : dex_to_degrees(str.substr(22, 8), 1); - - - var terminalInfoContentByte = parseInt(str.substr(54, 2), 16).toString(2); - while (terminalInfoContentByte.length < 8) { - terminalInfoContentByte = '0' + terminalInfoContentByte - } - //parse alarms - var sosAlarm = 0; - var powerCutAlarm = 0; - var shockAlarm = 0; - var alarmBits = terminalInfoContentByte.substr(2, 3); - if (alarmBits == '000') { - sosAlarm = 0; - powerCutAlarm = 0; - shockAlarm = 0; - } - if (alarmBits == '001') { - sosAlarm = 0; - powerCutAlarm = 0; - shockAlarm = 1; - } - if (alarmBits == '010') { - sosAlarm = 0; - powerCutAlarm = 1; - shockAlarm = 0; - } - if (alarmBits == '100') { - sosAlarm = 1; - sos = 1; - powerCutAlarm = 0; - shockAlarm = 0; - } - - - - return { - "imei": socket.imei.toString(), - "command": msg_parts.protocal_id, - "date": date, - "dateString": str.substr(0, 6), - "latDecimal": latitude, - "longDecimal": longitude, - "insertionTime": new Date(), - "raw": raw.toString('hex'), - "speed": parseInt(str.substr(30, 2), 16).toString(), - "timeString": str.substr(6, 6), - "heading": parseInt(course_status.substr(4, 10), 2).toString(), - "geoJSON": { - "type": "Point", - "coordinates": [longitude, latitude ] - }, - 'MCC': parseInt(str.substr(36, 4), 16), - 'MNC': parseInt(str.substr(40, 2), 16), - 'LAC': parseInt(str.substr(42, 4), 16), - 'CellT ID': parseInt(str.substr(46, 6), 16), - 'lbs': str.substr(36, 16), - 'real-time gps': course_status.substr(0, 1), - 'GPS positioned': course_status.substr(1, 1), - 'satellites': parseInt(str.substr(13, 1), 16), - "powerCutAlarm": powerCutAlarm, - "sosAlarm": sosAlarm, - "shockAlarm": shockAlarm, - "terminalInfoContentByte": terminalInfoContentByte, - "sos" : sos == 1 ? true : false - } -}; -function get_GT06_ping_data(msg_parts, raw, socket) { - var str = msg_parts.data; - var date = new Date( - parseInt(str.substr(0, 2), 16) + 2000, - parseInt(str.substr(2, 2), 16) - 1, - parseInt(str.substr(4, 2), 16), - parseInt(str.substr(6, 2), 16), - parseInt(str.substr(8, 2), 16), - parseInt(str.substr(10, 2), 16) - ) - - var course_status = parseInt(str.substr(32, 4), 16).toString(2); - var longDir = course_status.substr(2, 1) == '0' ? 'E' : 'W'; - var latDir = course_status.substr(3, 1) == '0' ? 'S' : 'N'; - //var latitude = latDir == 'N' ? dex_to_degrees(str.substr(14, 8), 0) : dex_to_degrees(str.substr(14, 8), 0)*-1; - //var longitude = longDir == 'E' ? dex_to_degrees(str.substr(22, 8), 1) : dex_to_degrees(str.substr(22, 8), 1)*-1; - var latitude = latDir == 'N' ? dex_to_degrees(str.substr(14, 8), 0) : dex_to_degrees(str.substr(14, 8), 0); - var longitude = longDir == 'E' ? dex_to_degrees(str.substr(22, 8), 1) : dex_to_degrees(str.substr(22, 8), 1); - - - var terminalInfoContentByte = parseInt(str.substr(52, 2), 16).toString(2); - while (terminalInfoContentByte.length < 8) { - terminalInfoContentByte = '0' + terminalInfoContentByte - } - //parse alarms - var sosAlarm = 0; - var powerCutAlarm = 0; - var shockAlarm = 0; - var alarmBits = terminalInfoContentByte.substr(2, 3); - if (alarmBits == '000') { - sosAlarm = 0; - powerCutAlarm = 0; - shockAlarm = 0; - } - if (alarmBits == '001') { - sosAlarm = 0; - powerCutAlarm = 0; - shockAlarm = 1; - } - if (alarmBits == '010') { - sosAlarm = 0; - powerCutAlarm = 1; - shockAlarm = 0; - } - if (alarmBits == '100') { - sosAlarm = 1; - powerCutAlarm = 0; - shockAlarm = 0; - } - - - - return { - "imei": socket.imei.toString(), - "command": msg_parts.protocal_id, - "date": date, - "dateString": str.substr(0, 6), - "latDecimal": latitude, - "longDecimal": longitude, - "insertionTime": new Date(), - "raw": raw.toString('hex'), - "speed": parseInt(str.substr(30, 2), 16).toString(), - "timeString": str.substr(6, 6), - "heading": parseInt(course_status.substr(4, 10), 2).toString(), - "geoJSON": { - "type": "Point", - "coordinates": [longitude, latitude ] - }, - 'MCC': parseInt(str.substr(36, 4), 16), - 'MNC': parseInt(str.substr(40, 2), 16), - 'LAC': parseInt(str.substr(42, 4), 16), - 'CellT ID': parseInt(str.substr(46, 6), 16), - 'lbs': str.substr(36, 16), - 'real-time gps': course_status.substr(0, 1), - 'GPS positioned': course_status.substr(1, 1), - 'satellites': parseInt(str.substr(13, 1), 16), - "powerCutAlarm": powerCutAlarm, - "sosAlarm": sosAlarm, - "shockAlarm": shockAlarm, - "terminalInfoContentByte" : terminalInfoContentByte - } -}; - - - -function gt06_ping_response(socket) { - socket.__count++; - //socket.write(new Buffer('787805010001d9dc0d0a', 'hex')) -} -function authorizeGT06(socket, request, raw) { - - if (!socket.__count) { - socket.__count = 1; - } - socket.imei = socket.imei || parseInt(request.device_id) - var length = '05'; - var protocal_id = '01'; - var serial = Buffer.from(raw).toString('hex').substr(24, 4) - var str = length + protocal_id + serial; - socket.__count++; - var crcResult = crc16(str); - var buff = new Buffer('7878' + str + crcResult + '0D0A', 'hex'); - socket.write(buff); -}; - - -function parseGT06_Head(data, socket) { - data = Buffer.from(data).toString('hex') - var parts = { - 'start': data.substr(0, 4) - }; - - if (parts['start'] == '7878' || parts['start'] == '7979') { - parts['length'] = parseInt(data.substr(4, 2), 16); - parts['finish'] = data.substr(6 + parts['length'] * 2, 4); - parts['protocal_id'] = data.substr(6, 2); - if (parts['protocal_id'] == '01') { - parts['device_id'] = data.substr(8, 16); - parts.cmd = 'login_request'; - parts.action = 'login_request'; - } else if (parts['protocal_id'] == '12' || parts['protocal_id'] == '19') { - parts['device_id'] = socket.imei || ''; - parts['data'] = data.substr(8, parts['length'] * 2); - parts.cmd = 'ping'; - parts.action = 'ping'; - } else if (parts['protocal_id'] == '22') { - parts['device_id'] = socket.imei || ''; - parts['data'] = data.substr(8, parts['length'] * 2); - parts.cmd = 'ping'; - parts.action = 'ping'; - } else if (parts['protocal_id'] == '13' || parts['protocal_id'] == '23') { - parts['device_id'] = socket.imei || ''; - parts.cmd = 'heartbeat'; - parts['data'] = data.substr(8, 10); - parts.action = 'heartbeat'; - } else if (parts['protocal_id'] == '16' || parts['protocal_id'] == '18') { - parts['device_id'] = socket.imei || ''; - parts['data'] = data.substr(8, parts['length'] * 2); - parts.cmd = 'alert'; - parts.action = 'alert'; - } else if (parts['protocal_id'] == '15') { - parts['device_id'] = socket.imei || ''; - parts['data'] = data.substr(8, parts['length'] * 2); - parts.cmd = 'stringInfo'; - parts.action = 'stringInfo'; - } else { - parts['device_id'] = socket.imei || ''; - parts.cmd = 'noop'; - parts.action = 'noop'; - } - } - else if (parts['start'].indexOf('28') == 0) { - parts['device_id'] = data.substr(2, 12); - parts.cmd = data.substr(14, 4); - if (parts.cmd == '2084') { - parts.action = 'ping'; - } - else if (parts.cmd == '1088') { - parts.action = 'heartbeat' - } - else - parts.action = 'noop' - } - else { - parts['device_id'] = ''; - parts.cmd = 'noop'; - parts.action = 'noop'; - } - return parts; -}; - - -function isHex(h) { - var re = /[0-9A-Fa-f]{6}/g; - re.lastIndex = 0; - if (re.test(h)) { - - return true; - } else { - return false; - } - - -} - - - - -function change_G900WKMD(socket, device_id) { - //device_id = '865205032299264' - var hh = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours().toString() - var mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes().toString() - var ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds().toString() - - socket.write('*HQ,' + device_id + ',WKMD,' + hh + mm + ss + ',0#') - socket.write('*HQ,' + device_id + ',S26,' + hh + mm + ss + ',W#') - -} -/** move to another file */ -function parseRawGps(raw, gpsModel) { - if (gpsModel == 'TK') { - - var latDecimal = raw.substring(33, 34) == 'N' ? - parseFloat(raw.substring(24, 26)) + parseFloat((raw.substring(26, 33) / 60)) : - (parseFloat(raw.substring(24, 26)) + parseFloat((raw.substring(26, 33) / 60))) * -1; - var longDecimal = raw.substring(44, 45) == 'E' ? - parseFloat(raw.substring(34, 37)) + parseFloat((raw.substring(37, 44) / 60)) : - (parseFloat(raw.substring(34, 37)) + parseFloat((raw.substring(37, 44) / 60))) * -1; - - var io=raw.substr(63,1)?parseInt(raw.substr(63,1)):null; - var ac=raw.substr(64,1)?parseInt(raw.substr(64,1)):null; - var fuel=((parseInt(raw.substr(67,1), 16)*16*16)+(parseInt(raw.substr(68,1), 16)*16)+(parseInt(raw.substr(69,1), 16)))*10; - var ac1=('0000' + parseInt(ac, 16).toString(2)).slice(-4).charAt(3); - var sos=('0000' + parseInt(ac, 16).toString(2)).slice(-4).charAt(2); - - return { - "imei": raw.substring(1, 13), - "command": raw.substring(13, 17), - "date": new Date(parseInt('20' + - raw.substring(17, 19)), - parseInt(raw.substring(19, 21) - 1), - parseInt(raw.substring(21, 23)), - parseInt(raw.substring(50, 52)), - parseInt(raw.substring(52, 54)), - parseInt(raw.substring(54, 56)) - ), - "dateString": raw.substring(17, 23), - "latDegrees": raw.substring(24, 34), - "longDegrees": raw.substring(34, 45), - "latDecimal": latDecimal, - "longDecimal": longDecimal, - "insertionTime": new Date(), - "raw": raw, - "valid": raw.substring(23, 24), - "speed": raw.substring(45, 50), - "timeString": raw.substring(50, 56), - "heading": raw.substring(56, 62), - "power": raw.substr(62,1)=='0'?'1':'0', - "mileage": raw.substring(71, 80), - "ignition": io, - "ac":ac1, - "sos":sos, - "fuelVoltage":fuel, - "GPS positioned":((raw.substring(23, 24)=='A')?1:0), - "geoJSON": { - "type": "Point", - "coordinates": [ longDecimal, latDecimal ] - } - } -} -if (gpsModel == 'G') { - try { - var rawArray = raw.split(',') - var latDecimal = rawArray[6] == 'N' ? - parseFloat(rawArray[5].substring(0, 2)) + parseFloat((rawArray[5].substring(2, 9) / 60)) : - (parseFloat(rawArray[5].substring(0, 2)) + parseFloat((rawArray[5].substring(2, 9) / 60))) * -1; - var longDecimal = rawArray[8] == 'E' ? - parseFloat(rawArray[7].substring(0, 3)) + parseFloat((rawArray[7].substring(3, 10) / 60)) : - (parseFloat(rawArray[7].substring(0, 3)) + parseFloat((rawArray[7].substring(3, 10) / 60))) * -1; - var ac=rawArray[12].substring(4,6); - var ac1 = (parseInt(ac, 16).toString(2)); - while (ac1.length < 8) { - ac1 = '0' + ac1; - } - ac1 = ac1.substr(5, 1); - var power = rawArray[12].substring(2, 4); - - var power1 = parseInt(power, 16).toString(2); - while (power1.length < 8) { - power1 = '0' + power1; - } - power1 = power1.substr(4, 1); - return { - "imei": rawArray[1], - "command": rawArray[2], - "date": rawArray[11] ? new Date(parseInt('20' + - rawArray[11].substring(4, 6)), - parseInt(rawArray[11].substring(2, 4) - 1), - parseInt(rawArray[11].substring(0, 2)), - parseInt(rawArray[3].substring(0, 2)), - parseInt(rawArray[3].substring(2, 4)), - parseInt(rawArray[3].substring(4, 6)) - ) : null, - "dateString": rawArray[11], - "latDegrees": rawArray[5] + rawArray[6], - "longDegrees": rawArray[7] + rawArray[8], - "latDecimal": latDecimal, - "longDecimal": longDecimal, - "insertionTime": new Date(), - "raw": raw, - "valid": rawArray[4], - "speed": (parseFloat(rawArray[9]) * 1.60934).toFixed(2), - "timeString": rawArray[3], - "heading": rawArray[10], - "power": power1/* =='0'?'1':'0' */, - "mileage": rawArray[12], - "ignition":ac1/* =='0'?'1':'0' */, - "GPS positioned":((rawArray[4]=='A')?1:0), - "geoJSON": { - "type": "Point", - "coordinates": [ longDecimal, latDecimal ] - } - } -} catch (err) { - console.error("exception handled"); - console.error(err); -} -} -} - -function parseMobileTrackerData(raw) { - return { - imei: raw.imei.toString(), - command: "mPing", - latDecimal: parseFloat(raw.curLat), - longDecimal: parseFloat(raw.curLong), - date: new Date(raw.curDateTime), - batteryStatus: raw.batteryStatus, - raw : JSON.stringify(raw), - deviceModel: raw.deviceModel, - deviceUUID: raw.deviceUUID, - platform: raw.platform, - platformVersion: raw.platformVersion, - deviceManufacturer: raw.deviceManufacturer, - deviceSerialNo: raw.deviceSerialNo, - isVirtual: raw.isVertual, - insertionTime: new Date(), - sos: raw.SOS, - speed: raw.speed, - mode: raw.mode, - accuracy: raw.accuracy, - geoJSON: { - "type": "Point", - "coordinates": [parseFloat(raw.curLong),parseFloat(raw.curLat)] - } - - } -} - -function parseAIS140Head(packet, socket) { - packet = packet.toString('utf8'); - var msgParts = packet.split(','); - var header = {} - if (msgParts.length == 10) { - header.cmd = 'login_request'; - header.packet = packet; - header.action = 'login_request'; - header['device_id'] = msgParts[3]; - socket.imei = msgParts[3]; - } - if (msgParts.length == 13) { - header.cmd = 'heartbeat'; - header.packet = packet; - header.action = 'heartbeat'; - header['device_id'] = msgParts[3]; - socket.imei = msgParts[3]; - } - if (msgParts.length == 17) { - header.cmd = 'alertPacket'; - header.packet = packet; - header.action = 'alertPacket'; - header['device_id'] = msgParts[3]; - socket.imei = msgParts[3]; - } - if (msgParts.length >= 52) { - header.cmd = 'ping'; - header.packet = packet; - header.action = 'ping'; - header['device_id'] = msgParts[6]; - socket.imei = msgParts[6]; - } - return header; -} - -function parseAIS140Ping(raw) { - raw = raw.toString('utf8'); - raw = "$Header" + raw.split('$Header')[raw.split('$Header').length -1] - var msgParts = raw.split(','); - var date = new Date( - parseInt(msgParts[9].substr(4, 4)), - parseInt(msgParts[9].substr(2, 2)) - 1, - parseInt(msgParts[9].substr(0, 2)), - parseInt(msgParts[10].substr(0, 2)), - parseInt(msgParts[10].substr(2, 2)), - parseInt(msgParts[10].substr(4, 2)), - ); - return { - firmwareVersion: msgParts[2], - command: msgParts[3], - msgID: msgParts[4], - packetStatus: msgParts[5], - isPastData: msgParts[5] == 'L' ? false : true, - imei: msgParts[6], - vehicleRegistration: msgParts[7], - "GPS positioned": msgParts[8], - dateString: msgParts[9], - timeString: msgParts[10], - date: date, - latDecimal: msgParts[11] * (msgParts[12] == 'N'? 1 : -1), - longDecimal: msgParts[13] * (msgParts[14] == 'E' ? 1 : -1), - speed: msgParts[15], - heading: msgParts[16], - satellites: msgParts[17], - altitude: msgParts[18], - ignition: msgParts[22], - power: msgParts[23], - gsmSignal: msgParts[28], - insertionTime : new Date(), - raw: raw, - sos: msgParts[4] == '10' ? true : null, - geoJSON : { - "type" : "Point", - "coordinates" : [ - msgParts[13] * (msgParts[14] == 'E' ? 1 : -1), - msgParts[11] * (msgParts[12] == 'N'? 1 : -1) - ] - } - } -} - -function parseAIS140Packets(packets, socket) { - var pings = []; - var alertPackets = []; - var logins = []; - var hbts = []; - var latestPing; - for (var i = 0; i < packets.length; i++){ - var parsedHead = parseAIS140Head(packets[i], socket); - console.log(parsedHead); - if (parsedHead.cmd == 'ping') { - pings.push(parseAIS140Ping(packets[i])); - } - if (parsedHead.cmd == 'login_request') { - logins.push(packets[i]); - } - if (parsedHead.cmd == 'heartbeat') { - hbts.push(packets[i]); - } - if (parsedHead.cmd == 'alertPacket') { - alertPackets.push(packets[i]); - } - } - - - if (pings.length > 0) { - for (var i = 0; i < pings.length; i++){ - pings[i].processed = false; - if (pings[i].msgID == '10') { - pings[0].sos == true; - } - } - if (alertPackets.length) { - - } - latestPing = pings.splice(0, 1); - GPS.insertMany(pings, function (err, insertedAISPings) { - if(err){ - console.log(err); - - } - else { - //console.log('insertedAISPings', insertedAISPings); - } - }) - } - //console.log('latestPing', latestPing); - if (latestPing) { - latestPing[0].processed = null; - return latestPing[0]; - } - else { - return null; - } -} - - -module.exports.intermediate = function (data) { - // console.log(data.data); - module.exports.process(data, KafkaService); -} - - -module.exports.process = function (data, KafkaService) { - try { - - var raw = data.data - - var socket = data.socket - var parsedData = {} - - - - /** - * mTracker proto - * - */ - - if (!(Buffer.isBuffer(raw))) { - //console.log('mobile tracker : ', raw); - //socket.setTimeout(5000); - if (!raw.imei) return; - parsedData = parseMobileTrackerData(raw); - //console.log(raw); - } - else if (raw.toString('utf8').indexOf('$Header') == 0) { - //console.log('ais140 : ', raw); - var packets = raw.toString('utf8').split('\r\n'); - packets.pop(); - //console.log("AIS PACKETS :: ", packets); - parsedData = parseAIS140Packets(packets, socket); - socket.setTimeout(0); - //var parsedHead = parseAIS140Head(raw, socket); - //console.log(parsedHead); - if (parsedData) { - //parsedData = parseAIS140ping(raw); - //console.log(parsedData); - } else { - return; - } - - } - else if(/* raw.toString("utf8").split('=')[1] */ raw.toString('utf8').indexOf('ApiString') == 0){ - //GB101 - //console.log('gb101 : ', raw); - if (true) { - var raw1 = raw.toString("utf8").split('=')[1]; - socket.write('+##Received OK'); - parsedData = parseRawGpsGB(raw1, 'GB'); - } - } - else if (Buffer.from(raw, 'hex').toString('hex').indexOf('00') == 0) { - //fmb protocol - //console.log('fmb : ', raw); - var hexString = Buffer.from(raw, 'hex').toString('hex'); - if (hexString.indexOf('00000000') == 0) { - parsedData = parseFmbData(hexString, socket); - sendFmbAck(socket, parsedData.number_of_data); - - } - else if(hexString.indexOf('00') == 0){ - - fmb_login(hexString, socket); - //return; - } - } - else if (raw.toString('utf8').indexOf("imei:") != -1) { - //console.log('COBAN GPS103/GPS303 : ', raw); - /** - * COBAN GPS103/GPS303 PROTOCOL - */ - var gps_x03 = new GPS_x03(raw.toString('utf8'), socket); - - if (gps_x03.command == 'login') { - gps_x03.doLogin(); - } - if (gps_x03.command == 'tracker') { - parsedData = gps_x03.getPingData(); - } - - } - else if (raw.toString('utf8').indexOf('(') == 0 && (raw.toString('utf8').lastIndexOf(')') == (raw.toString('utf8').length - 1)) && raw.toString('utf8').indexOf(' ') != 1) { - //tk protocol - - var data = raw.toString('utf8'); - var cmd_start = data.indexOf("B"); - if(data.substr(cmd_start,4)=='BP05') - { - socket.write('('+data.substring(1,cmd_start) + 'AP05)'); - return; - } - parsedData = parseRawGps(raw.toString('utf8'), 'TK'); - //console.log('TK : ', raw, parsedData.imei); - } - else if(raw.toString("utf8").indexOf('$$CLIENT_1')==0) - { - //console.log('$$CLIENT_1 : ', raw); - - if(raw.toString("utf8").indexOf('Ignition') != -1) - { - parsedData = parseRawGpsTs(raw.toString('utf8'), 'first'); - } - else - { - parsedData = parseRawGpsTs(raw.toString('utf8'), 'rest'); - } - } - else if(raw.toString("utf8").indexOf('Sender')==0) - { - //console.log('Sender : ', raw); - parsedData = parseRawGpsVTX(raw.toString("utf8")); - socket.write('Ok'); - } - //'yantra' protocol - else if (raw.toString('utf8').split(',').length >= 3 && raw.toString('utf8').startsWith('$') && raw.toString('utf8').endsWith('#')) { - - //console.log('Yantra : ', raw); - if (raw.toString('utf8').startsWith('$3')) { - //alert packet - //parsedData = parseYantraAlert(raw.toString('utf8')); - } - else { - //data packet - parsedData = parseYantraData(raw.toString('utf8')); - console.log(parsedData); - socket.destroy(); - } - } - else if (raw.toString('utf8').split(',').length >= 3 ) { - - //console.log('g900 : ', raw); - - //g900 protocol - if (raw.toString('utf8').split(',').length == 3) { - /** - * implement authorizeG900 - */ - cmdPacket = Buffer.from(raw).toString('hex') - - cmdPackets.create({ cmd: cmdPacket, device_id: cmdPacket.split(',')[1], time: new Date() }, function (err, inserted) { - if (err) { - console.error(err) - return; - } - else { - - } - }); - - //change_G900WKMD(socket, raw.toString('utf8').split(',')[1]) - return; - } - /* var hh = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours().toString() - var mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes().toString() - var ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds().toString() */ - - if (raw.toString('utf8').split(',').length >= 12) { - - parsedData = parseRawGps(raw.toString('utf8'), 'G'); - } - - } - - else if (Buffer.from(raw, 'hex').toString('hex').indexOf('2323') == 0) { - //t8803 protocol - //console.log('t8803 : ', raw); - var parsedHead = parseT8803_head(raw, socket); - if (parsedHead.cmd == 'login_request') { - authorizeT8803(parsedHead.device_id, socket); - return; - } - if (parsedHead.cmd == 'ping') { - - parsedData = parseT8803_data(raw); - return; - } - if (parsedHead.cmd == 'heartbeat') { - respond_T8803_heartbeat(parsedHead.device_id, socket); - return; - } - } - else if (Buffer.from(raw, 'hex').toString('hex').indexOf('2929') == 0) { - //VT1000 protocol - //console.log('VT1000 : ', raw); - if(Buffer.from(raw, 'hex').toString('hex').indexOf('B1')==4) - { - socket.write('21'); - } - if(Buffer.from(raw, 'hex').toString('hex').indexOf('80')==4) - { - - parsedData = parseVT1000(Buffer.from(raw, 'hex').toString('hex')); - } - - } - - else if (Buffer.from(raw, 'hex').toString('hex').indexOf('20') == 0) { - //L100 protocol - - //console.log('L100 : ', raw); - parsedData = parseRawGpsL(Buffer.from(raw, 'hex').toString('hex')); - - - } - else if (raw.toString('hex').indexOf('24') == 0) { - //console.log('24 : ', raw); - raw = raw.toString('hex'); - var head = raw.substr(0, 2); - var imei = raw.substr(2, 10); - var date = new Date( - parseInt('20' + raw.substr(22, 2)), - parseInt(raw.substr(20, 2) - 1), - parseInt(raw.substr(18, 2)), - parseInt(raw.substr(12, 2)), - parseInt(raw.substr(14, 2)), - parseInt(raw.substr(16, 2)) - ); - var latitude = parseInt(raw.substr(24, 2)) + (parseFloat(raw.substr(26,6)) / 600000); - var longitude = parseInt(raw.substr(34, 3)) + (parseFloat(raw.substr(37,6)) / 600000);//parseInt(raw.substr(34, 9)) / 1000000;//dex_to_degrees(raw.substr(34, 9), 0) // - var speed = parseInt(raw.substr(44, 3)).toString(); - var heading = parseInt(raw.substr(47, 3)).toString(); - - parsedData = { - imei: imei, - date: date, - latDecimal: latitude, - longDecimal: longitude, - latString: raw.substr(24, 8), - longString: raw.substr(34, 9), - raw: raw, - speed: speed, - heading: heading, - insertionTime: new Date(), - geoJSON: { - "type": "Point", - "coordinates": [longitude, latitude] - } - } - console.log(parsedData); - } - else if (Buffer.from(raw, 'hex').toString('hex').indexOf('6767') == 0) { - //gm-06 protocol - //console.log('gm-06 : ', raw); - var parsedHead = parseGM06_Head(raw, socket); - if (parsedHead.cmd == 'login_request') { - console.log(Buffer.from(raw, 'hex').toString('hex')) - authorizeGM06(socket, parsedHead, raw); - parsedHead.insertionTime = new Date(); - - } - else if (parsedHead.cmd == 'ping') { - parsedData = get_GM06_ping_data(parsedHead, raw, socket); - - } - else if (parsedHead.cmd == 'heartbeat') { - receive_GM06_heartbeat(raw, socket) - parsedHead.insertionTime = new Date(); - - - /** - * parse HEARTBEAT DATA - */ - var parsed_HBT = JSON.parse(JSON.stringify(parsedHead)) - parsed_HBT.device_id = parsed_HBT.device_id.toString(); - parsed_HBT.insertionTime = new Date(); - var batteryStatus = parseInt(parsedHead.data.substr(1, 1)).toString(); - var gsmSignal = parseInt(parsedHead.data.substr(2, 1)); - var terminalInfo = parseInt(parsedHead.data.substr(2, 2), 16).toString(2); - while (terminalInfo.length < 8) { - terminalInfo = '0' + terminalInfo - } - parsed_HBT.ignitionLock = terminalInfo.substr(2, 1) == '0' ? '1' : '0'; - parsed_HBT.gpsTracking = terminalInfo.substr(7, 1); - parsed_HBT.alarm = terminalInfo.substr(2, 3); - parsed_HBT.power = terminalInfo.substr(0, 1); - parsed_HBT.activated = terminalInfo.substr(7, 1); - parsed_HBT.ACC = terminalInfo.substr(6, 1); - parsed_HBT.batteryStatus = batteryStatus; - parsed_HBT.gsmSignal = gsmSignal; - if (parsed_HBT.ACC == "") { - parsed_HBT.ACC = "0"; - } - - cmdPackets.create(parsed_HBT, function (err, cmdPkt) { - if (err) { - console.error(err) - return; - } - else { - TCPUTIL.setACCNotif(parsed_HBT.device_id, parsed_HBT.ACC, KafkaService) - - - - - Device.findOne({ "Device_ID": parsed_HBT.device_id }).populate('user').exec(function (err, dev) { - if (err) { - console.error(err); - - } - else if (dev) { - - /** - * update last cmdPacket with the vehicle mapped against device - */ - cmdPackets.update({ _id: cmdPkt._id }, { $set: { vehicle: dev.vehicle } }).exec(); - //---------------------------------------------------------------------------------- - var previousPower = dev.power; - var user = dev.user; - dev['last_ACC'] = parsed_HBT.ACC; - dev['last_ACC_on'] = new Date(); - dev['batteryStatus'] = batteryStatus; - dev['gsmSignal'] = parsed_HBT.gsmSignal; - dev['ignitionLock'] = parsed_HBT.ignitionLock; - dev['gpsTracking'] = parsed_HBT.gpsTracking; - dev['alarm'] = parsed_HBT.alarm; - dev['power'] = parsed_HBT.power; - dev['activated'] = parsed_HBT.activated; - //dev['user'] = dev.user._id; - - dev.save(function (err) { - if (err) { - console.error(err); - } - else { - KafkaService.sendRecord({ namespace: "gpsio", room: parsed_HBT.device_id.toString(), channel: parsed_HBT.device_id.toString() + 'acc', data: [parsed_HBT.ACC, parsed_HBT.device_id.toString(), new Date(), dev] }) - /* gpsio.to(parsed_HBT.device_id.toString()).emit(parsed_HBT.device_id.toString() + 'acc', parsed_HBT.ACC, parsed_HBT.device_id.toString(), new Date(), dev) - */ TCPUTIL.setDeviceStatus(dev, null); - if ((parsed_HBT.power == "0" || parsed_HBT.power == "1") && previousPower != parsed_HBT.power) { - //setPowerNotification - TCPUTIL.setPowerNotif(dev, parsed_HBT.power, KafkaService, user); - } - } - }) - - } - }) - } - }); - - } - else if (parsedHead.cmd == 'alarm') { - } - - - - } - else { - // console.log('gt-06 : ', raw); - //gt-06 protocol - var parsedHead = parseGT06_Head(raw, socket); - var hasCombinedHBT = false; - var indexOfHBT = raw.toString('hex').indexOf('78780a13'); - if (indexOfHBT != -1 && indexOfHBT != 0) { - /** - * parse HEARTBEAT DATA - */ - //console.log('combined HBT detected for ', parsedHead.device_id) - var hbtBuf = Buffer.from(raw.toString('hex').substr(indexOfHBT), 'hex'); - //console.log(hbtBuf); - var parsed_HBT = parseGT06_Head(hbtBuf, socket); - parsed_HBT.device_id = parsed_HBT.device_id.toString(); - parsed_HBT.insertionTime = new Date(); - var batteryStatus = parseInt(parsed_HBT.data.substr(1, 1)).toString(); - var gsmSignal = parseInt(parsed_HBT.data.substr(2, 1)); - var terminalInfo = parseInt(parsed_HBT.data.substr(0, 2), 16).toString(2); - while (terminalInfo.length < 8) { - terminalInfo = '0' + terminalInfo - } - parsed_HBT.ignitionLock = terminalInfo.substr(0, 1); - parsed_HBT.gpsTracking = terminalInfo.substr(1, 1); - parsed_HBT.alarm = terminalInfo.substr(2, 3); - parsed_HBT.power = terminalInfo.substr(5, 1); - parsed_HBT.activated = terminalInfo.substr(7, 1); - parsed_HBT.ACC = terminalInfo.substr(6, 1); - parsed_HBT.batteryStatus = batteryStatus; - parsed_HBT.gsmSignal = gsmSignal; - if (parsed_HBT.ACC == "") { - parsed_HBT.ACC = "0"; - } - - TCPUTIL.processServerCommandQueue(parsed_HBT.device_id, socket); - cmdPackets.create(parsed_HBT, function (err, cmdPkt) { - if (err) { - console.error(err) - return; - } - else { - //console.log('hbt created on dev', cmdPkt._id) - TCPUTIL.setACCNotif(parsed_HBT.device_id, parsed_HBT.ACC, KafkaService) - - - - - Device.findOne({ "Device_ID": parsed_HBT.device_id }).populate('user').exec(function (err, dev) { - if (err) { - console.error(err); - - } - else if (dev) { - - /** - * update last cmdPacket with the vehicle mapped against device - */ - cmdPackets.update({ _id: cmdPkt._id }, { $set: { vehicle: dev.vehicle } }).exec(); - //---------------------------------------------------------------------------------- - var previousPower = dev.power; - var user = dev.user; - dev['last_ACC'] = parsed_HBT.ACC; - dev['last_ACC_on'] = new Date(); - dev['batteryStatus'] = batteryStatus; - dev['gsmSignal'] = parsed_HBT.gsmSignal; - dev['ignitionLock'] = parsed_HBT.ignitionLock; - dev['gpsTracking'] = parsed_HBT.gpsTracking; - dev['alarm'] = parsed_HBT.alarm; - dev['power'] = parsed_HBT.power; - dev['activated'] = parsed_HBT.activated; - dev['status'] = parsed_HBT.ACC == 1 ? 'IDLING' : 'STOPPED' - //dev['user'] = dev.user._id; - - dev.save(function (err) { - - if (err) { - console.error(err); - } - else { - KafkaService.sendRecord({ namespace: "gpsio", room: parsed_HBT.device_id.toString(), channel: parsed_HBT.device_id.toString() + 'acc', data: [parsed_HBT.ACC, parsed_HBT.device_id.toString(), new Date(), dev] }) - /* gpsio.to(parsed_HBT.device_id.toString()).emit(parsed_HBT.device_id.toString() + 'acc', parsed_HBT.ACC, parsed_HBT.device_id.toString(), new Date(), dev) - */ TCPUTIL.setDeviceStatus(dev, null); - if ((parsed_HBT.power == "0" || parsed_HBT.power == "1") && previousPower != parsed_HBT.power) { - //setPowerNotification - TCPUTIL.setPowerNotif(dev, parsed_HBT.power, KafkaService, user); - } - } - }) - - } - }) - } - }); - - } - if (parsedHead.device_id == '') { - socket.destroy(); - return; - } - if (parsedHead.start == '7878') { - if (parsedHead.device_id == '860016021075051') { - console.log(parsedHead); - } - if (parsedHead.cmd == 'login_request') { - authorizeGT06(socket, parsedHead, raw); - parsedHead.insertionTime = new Date(); - - } - else if (parsedHead.cmd == 'ping') { - - gt06_ping_response(socket) - parsedData = get_GT06_ping_data(parsedHead, raw, socket); - - if (parsedData.latDecimal == 0) { - console.info('gt06 0,0 from : ' + socket.imei) - } - } - else if (parsedHead.cmd == 'heartbeat') { - receive_heartbeat(raw, socket) - parsedHead.insertionTime = new Date(); - - - /** - * parse HEARTBEAT DATA - */ - var parsed_HBT = JSON.parse(JSON.stringify(parsedHead)) - parsed_HBT.device_id = parsed_HBT.device_id.toString(); - parsed_HBT.insertionTime = new Date(); - var batteryStatus = parseInt(parsedHead.data.substr(1, 1)).toString(); - var gsmSignal = parseInt(parsedHead.data.substr(2, 1)); - var terminalInfo = parseInt(parsedHead.data.substr(0, 2), 16).toString(2); - while (terminalInfo.length < 8) { - terminalInfo = '0' + terminalInfo - } - parsed_HBT.ignitionLock = terminalInfo.substr(0, 1); - parsed_HBT.gpsTracking = terminalInfo.substr(1, 1); - parsed_HBT.alarm = terminalInfo.substr(2, 3); - parsed_HBT.power = terminalInfo.substr(5, 1); - parsed_HBT.activated = terminalInfo.substr(7, 1); - parsed_HBT.ACC = terminalInfo.substr(6, 1); - parsed_HBT.batteryStatus = batteryStatus; - parsed_HBT.gsmSignal = gsmSignal; - if (parsed_HBT.ACC == "") { - parsed_HBT.ACC = "0"; - } - - TCPUTIL.processServerCommandQueue(parsed_HBT.device_id, socket); - cmdPackets.create(parsed_HBT, function (err, cmdPkt) { - if (err) { - console.error(err) - return; - } - else { - TCPUTIL.setACCNotif(parsed_HBT.device_id, parsed_HBT.ACC, KafkaService) - - - - - Device.findOne({ "Device_ID": parsed_HBT.device_id }).populate('user').exec(function (err, dev) { - if (err) { - console.error(err); - - } - else if (dev) { - - /** - * update last cmdPacket with the vehicle mapped against device - */ - cmdPackets.update({ _id: cmdPkt._id }, { $set: { vehicle: dev.vehicle } }).exec(); - //---------------------------------------------------------------------------------- - var previousPower = dev.power; - var user = dev.user; - dev['last_ACC'] = parsed_HBT.ACC; - dev['last_ACC_on'] = new Date(); - dev['batteryStatus'] = batteryStatus; - dev['gsmSignal'] = parsed_HBT.gsmSignal; - dev['ignitionLock'] = parsed_HBT.ignitionLock; - dev['gpsTracking'] = parsed_HBT.gpsTracking; - dev['alarm'] = parsed_HBT.alarm; - dev['power'] = parsed_HBT.power; - dev['activated'] = parsed_HBT.activated; - dev['status'] = parsed_HBT.ACC == 1 ? 'IDLING' : 'STOPPED' - //dev['user'] = dev.user._id; - - dev.save(function (err) { - if (err) { - console.error(err); - } - else { - KafkaService.sendRecord({ namespace: "gpsio", room: parsed_HBT.device_id.toString(), channel: parsed_HBT.device_id.toString() + 'acc', data: [parsed_HBT.ACC, parsed_HBT.device_id.toString(), new Date(), dev] }) - /* gpsio.to(parsed_HBT.device_id.toString()).emit(parsed_HBT.device_id.toString() + 'acc', parsed_HBT.ACC, parsed_HBT.device_id.toString(), new Date(), dev) - */ TCPUTIL.setDeviceStatus(dev, null); - if ((parsed_HBT.power == "0" || parsed_HBT.power == "1") && previousPower != parsed_HBT.power) { - //setPowerNotification - TCPUTIL.setPowerNotif(dev, parsed_HBT.power, KafkaService, user); - } - } - }) - - } - }) - } - }); - - } - else if (parsedHead.cmd == 'alert') { - parsedData = get_GT06_alarm_data(parsedHead, raw, socket); - } - else if (parsedHead.cmd == 'stringInfo') { - console.log(parsedHead); - console.log(socket.imei, socket.serverCommand) - var parsedStringInfo = parse_GT06_stringInfo(parsedHead); - TCPUTIL.setDCQResponse(parsedStringInfo, socket.imei); - return; - } - - - } - - else if (parsedHead.start.indexOf('28') != -1 || parsedHead.start.indexOf('24') != -1) { - console.log(parsedHead) - parsedData = parseG500OBD_data(raw) - } - else { - console.info("UNKNOWN PROTOCOL DETECTED") - } - } - if (parsedData && parsedData.command == 'BP00') { - socket.write(parsedData.imei + 'AP01HSO') - - } - - /** - * identify if server commands are queued to be sent for this imei - */ - if(parsedData){ - TCPUTIL.processServerCommandQueue(parsedData.imei, socket); - } - - - if (parsedData && parsedData.imei && (parsedData.command == 'BR00' || - parsedData.command == 'V1' || - parsedData.command == '12' || - parsedData.command == '22' || - parsedData.command == '19' || - parsedData.command == '2084' || - parsedData.command == '08' || - parsedData.command == 'GB' || - parsedData.command == 'L100' || - parsedData.command == '80' || - parsedData.command == 'TS' || - parsedData.command == 'VTX' || - parsedData.command == 'mPing' || - parsedData.command == 'tracker' || - parsedData.command == '$' || - parsedData.command == '$3' || - parsedData.command == '02' || - parsedData.command == '16' || - !parsedData.command || - parsedData.command == 'NR' || - parsedData.command == 'EA' || - parsedData.command == 'TA' || - parsedData.command == 'HP' || - parsedData.command == 'IN' || - parsedData.command == 'IF' || - parsedData.command == 'BD' || - parsedData.command == 'BR' || - parsedData.command == 'BL' - )) { - - - - - GPS - .aggregate([ - { $match: { "imei": parsedData.imei , isPastData: {$ne : true} } }, // - { $sort: { "insertionTime": -1 } }, - { $limit: 1 }, - { - $lookup: - { - from: "devInfo", - localField: "imei", - foreignField: "Device_ID", - as: "lookedUpDevice" - } - }, - { $unwind: "$lookedUpDevice" }, - { - $lookup: - { - from: "client_master", - localField: "lookedUpDevice.user", - foreignField: "_id", - as: "lookedUpUser" - } - }, - { - $lookup: - { - from: "trackroutes", - localField: "lookedUpDevice.currentRoute", - foreignField: "_id", - as: "lookedUpCurrentRoute" - } - }, - { - $unwind: { - path: "$lookedUpCurrentRoute", - preserveNullAndEmptyArrays: true - } - }, - { - $lookup: - { - from: "routeDeviceMap", - localField: "lookedUpDevice.currentTrip", - foreignField: "_id", - as: "lookedUpCurrentTrip" - } - }, - { - $unwind: { - path: "$lookedUpCurrentTrip", - preserveNullAndEmptyArrays: true - } - }, - { - $lookup: - { - from: "vehicletypes", - localField: "lookedUpDevice.vehicleType", - foreignField: "_id", - as: "lookedUpVehicleType" - } - }, - { - $unwind: { - path: "$lookedUpVehicleType", - preserveNullAndEmptyArrays: true - } - } - ]).allowDiskUse(true) - .exec(function (err, x) { - if (err) { - console.error(err); - return; - } - var dataForRoadAPI = ''; - if (true) { - - var displacement = 0; - if (x.length > 0) { - displacement = TCPUTIL.getDistanceFromLatLonInKm( - x[0].latDecimal, - x[0].longDecimal, - parsedData.latDecimal, - parsedData.longDecimal - ) - } - if ((parsedData.latDecimal == 0 || parsedData.longDecimal == 0) && x[0]) { - TCPUTIL.setDeviceStatus(x[0].lookedUpDevice, 'nofix'); - } - - if (/*x[0] && displacement > 0.40 && (new Date() - new Date(x[0].insertionTime) < 15000) && parsedData.imei != '868728030654476' && parsedData.imei != '2020202020'*/ false) { - //do nothing - console.log("Too much displacement in short time for " + parsedData.imei); - } - else if (/*new Date(parsedData.insertionTime) - new Date(parsedData.date) > (5 * 60 * 1000) && (parsedData.command == 'BR00' || parsedData.command == '22') && parsedData.imei != '123456789012345' && parsedData.command != "08"*/ false) { - //do nothing - console.log("Insertion time - date > 5 mins " + parsedData.imei); - } - - else if (x[0] && new Date() - new Date(parsedData.date) < (-1 * 365 * 24 * 60 * 60 * 1000) && parsedData.imei != '123456789012345' && parsedData.command != "08") { - //do nothing - console.log("Device from future " + parsedData.imei); - } - else { - if (x[0] && x[0].lookedUpDevice.last_device_time && new Date(parsedData.date) - new Date(x[0].lookedUpDevice.last_device_time) < 1 && parsedData.imei != '123456789012345') { - //do nothing - if(parsedData.isPastData == null) parsedData.isPastData = true; - - if (x[0] && new Date(parsedData.date) - new Date(x[0].date) < 1 && parsedData.imei != '123456789012345') { - //console.log("Chronology not maintained by device " + parsedData.imei); - } - } - if ( x[0] && - displacement < FLUCTUATION_THRESHOLD && parsedData.command != 'mPing' && - ((parsedData.speed == 0 && x.length > 0 && x[0].speed == 0) || (x[0].lookedUpDevice && x[0].lookedUpDevice.ignitionSource != 'MOVEMENT' && x[0].lookedUpDevice.last_ACC == 0 && parsedData.speed <10 && x.length > 0 && x[0].speed < 10)) - ) { - //recalculate displacement on interpolated fields - - parsedData.isFluctuation = true; - /** - * if displacement from last location < FLUCTUATION_THRESHOLD - * and speed == 0 - * then update the last ping data with current time - */ - //("MITIGATING FLUCTUATION") - - - } - if(parsedData.command == 'mPing'){ - if(parsedData.accuracy > 27){ - parsedData.isFluctuation = true; - } - } - - if (parsedData.insertionTime != 'Invalid Date' - && parsedData.latDecimal != 0 - && parsedData.longDecimal != 0 - && typeof parsedData.latDecimal == "number" - && typeof parsedData.longDecimal == "number" - && parsedData.speed != "NaN" - && !isNaN(parseFloat(parsedData.latDecimal)) - && !isNaN(parseFloat(parsedData.longDecimal))) { - - - if (x[0]) { - parsedData.vehicle = ObjectID(x[0].lookedUpDevice.vehicle); - //get distance on interpolated points, if interpolation was returned by google api - var interpolatedDistance = 0; - var previousLat; - var previousLong; - if (x[0].interpolated && x[0].interpolated.length > 0) { - previousLat = x[0].interpolated[x[0].interpolated.length - 1].location.latitude - previousLong = x[0].interpolated[x[0].interpolated.length - 1].location.longitude - } - else { - previousLat = x[0].latDecimal - previousLong = x[0].longDecimal - } - - - if (parsedData.interpolated && parsedData.interpolated.length > 1) { - - interpolatedDistance += TCPUTIL.getDistanceFromLatLonInKm( - previousLat, - previousLong, - parsedData.interpolated[0].location.latitude, - parsedData.interpolated[0].location.longitude - ) - - for (var m = 0; m < parsedData.interpolated.length - 1; m++) { - interpolatedDistance += TCPUTIL.getDistanceFromLatLonInKm( - parsedData.interpolated[m].location.latitude, - parsedData.interpolated[m].location.longitude, - parsedData.interpolated[m + 1].location.latitude, - parsedData.interpolated[m + 1].location.longitude - ) - } - } - else { - interpolatedDistance = TCPUTIL.getDistanceFromLatLonInKm( - previousLat, - previousLong, - parsedData.latDecimal, - parsedData.longDecimal - ) - } - /* parsedData.distanceFromPrevious = interpolatedDistance; - parsedData.odo = x[0].lookedUpDevice.total_odo + parsedData.distanceFromPrevious; */ - if (parsedData.odo != null) { - parsedData.distanceFromPrevious = parsedData.odo - (x[0].lookedUpDevice.total_odo || 0); - interpolatedDistance = parsedData.distanceFromPrevious; - } - else { - parsedData.distanceFromPrevious = interpolatedDistance; - parsedData.odo = x[0].lookedUpDevice.total_odo + parsedData.distanceFromPrevious; - } - } - - - if (parsedData.fuelVoltage && x[0] && parsedData.ignition == '1') { - - if (!(x[0].lookedUpDevice.last_ACC == 1 && (new Date() - new Date(x[0].lookedUpDevice.last_ACC_on) > 3 * 60 * 1000))) { - parsedData.currentFuel = x[0].lookedUpDevice.currentFuel; - } - - else if (x[0].lookedUpDevice.vehicleType !== null) { - if (x[0].lookedUpVehicleType) { - var currentFuel = TCPUTIL.getCurrentFuel(x[0].lookedUpVehicleType, parsedData.fuelVoltage); - if (currentFuel[1] > x[0].lookedUpVehicleType.tank_size) { - parsedData.currentFuel = x[0].lookedUpVehicleType.tank_size - } - else if (currentFuel[1] < 0) { - parsedData.currentFuel = 0; - } - else { - parsedData.currentFuel = currentFuel[1]; - } - } - - - } - } - else if (parsedData.fuelVoltage && x[0] && parsedData.ignition == '0') { - parsedData.currentFuel = x[0].lookedUpDevice.currentFuel; - } - - //if speed is less than 1, ignore - if (parseFloat(parsedData.speed) < 1) { - parsedData.speed = "0"; - } - - parsedData.speed = parsedData.speed ? parsedData.speed.toString().split('.')[0] : null; - if (x[0] && x[0].lookedUpDevice) { - parsedData.group = x[0].lookedUpDevice.vehicleGroup; - parsedData.vehicle = ObjectID(x[0].lookedUpDevice.vehicle); - } - MongoClient.connect(url, dbOption, function (err, db) { - if (err) { - console.error(err) - return; - } - db.collection('gpstracker').insertOne(parsedData, function (err, inserted) { - if (err) { - console.error(err) - console.error('Could not saved gps ping to db') - db.close() - } - else { - - db.close() - if (x[0]) { - if (parsedData.isPastData == true) { - if (parsedData.sos == true) { - TCPUTIL.setSOSNotif(x[0], parsedData, KafkaService); - } - return; - } - if (parsedData.isFluctuation && parsedData.command == 'mPing') { - return; - } - KafkaService.sendRecord({ namespace: "gpsio", room: parsedData.imei, channel: parsedData.imei, data: [parsedData, 'ping', x[0].lookedUpDevice] }) - //gpsio.to(parsedData.imei).emit(parsedData.imei, parsedData, 'ping', x[0].lookedUpDevice); - TCPUTIL.setMaxSpeed(parsedData, x[0].lookedUpDevice, x[0].lookedUpUser[0], new Date()); - //TCPUTIL.routeTracking(x[0].lookedUpDevice.Device_ID, parsedData.longDecimal, parsedData.latDecimal, null, x[0], KafkaService); - //poi tracking - - TCPUTIL.poiTracking(x[0], null, parsedData.longDecimal, parsedData.latDecimal, KafkaService); - - var start = null; - var end = null; - if (parsedData.sos == true) { - TCPUTIL.setSOSNotif(x[0], parsedData, KafkaService); - } - if (parsedData.ignition != null && parsedData.ignition !== undefined) { - if (parsedData.command == 'BR00') { //tk103 - var data = parsedData.raw; - start = "28"; - end = "29"; - var cmd_start = data.indexOf("B"); - var dataval = data.substring(cmd_start + 4, data.length - 1); - } - if (parsedData.command == 'V1') { //tk103 - var data = parsedData.raw; - start = "*HQ"; - end = "#"; - - var dataval = data; - } - - if (parsedData.command == '08') { //fmbXXX - var data = parsedData.raw; - start = "00000000"; - var cmd_start = data.indexOf("00000000"); - var dataval = data.substring(cmd_start + 4, data.length - 1); - } - if (parsedData.command == 'GB') { //fmbXXX - var data = parsedData.raw; - start = "{"; - end = "}" - //var cmd_start = data.indexOf("00000000"); - //var dataval=data.substring(cmd_start+4,data.length-1); - var dataval = ''; - } - if (parsedData.command == 'L100') { //fmbXXX - var data = parsedData.raw; - start = "20"; - end = "02"; - var startcmd = data.indexOf('$GPRMC'); - var dataval = data.substring(startcmd); - //var dataval=data.substring(cmd_start+4,data.length-1); - - } - - if (parsedData.command == '80') { //fmbXXX - var data = parsedData.raw; - start = "2929"; - end = "0d"; - - var dataval = data.substring(10, 90); - - } - - if (parsedData.command == 'TS') { //fmbXXX - var data = parsedData.raw; - start = "$$"; - end = "0a"; - - var dataval = data.substring(0, data.length - 2) - - } - if (parsedData.command == 'VTX') { - var data = parsedData.raw; - start = "Sender"; - end = "PKTEND"; - - var dataval = data.substring(7, data.length - 7); - - } - if (parsedData.command == 'tracker') { - var data = parsedData.raw; - start = "imei:"; - end = ";"; - - var dataval = data; - - } - if (parsedData.command == 'NR' || parsedData.command == 'IF' || parsedData.command == 'EA') { - var data = parsedData.raw; - start = "$Header"; - end = "*"; - - var dataval = data; - - } - TCPUTIL.insertIgnition(parsedData, start, end, dataval, KafkaService); - } - // at line 804, write method to be called from TCPUTIL// - if (parsedData.fuelVoltage && parsedData.currentFuel != null) { - TCPUTIL.checkFuelFill(x[0], parsedData, x[0].lookedUpVehicleType.tank_size, KafkaService) - } - // - if (parsedData.sos == true) { - TCPUTIL.sosAlert(x[0].lookedUpDevice, x[0].lookedUpUser[0], parsedData); - } - var today_odo = 0 - var distFromLastStop = 0 - if (parsedData.isFluctuation) { - interpolatedDistance = 0 - today_odo = (x[0].lookedUpDevice.today_odo || 0) - distFromLastStop = (x[0].lookedUpDevice.distFromLastStop || 0) - } - else { - today_odo = interpolatedDistance + (x[0].lookedUpDevice.today_odo || 0) - distFromLastStop = interpolatedDistance + (x[0].lookedUpDevice.distFromLastStop || 0) - } - - var incObj = { "total_odo": interpolatedDistance }; - var today_start_location = !x[0].lookedUpDevice.today_start_location ? { lat: parsedData.latDecimal, long: parsedData.longDecimal } : x[0].lookedUpDevice.today_start_location; - //increment today_running / today_stopped - if (x[0].lookedUpDevice.last_ACC == 1) { - var today_running = new Date().getTime() - new Date(x[0].insertionTime).getTime(); - incObj['today_running'] = today_running; - - } - else { - var today_stopped = new Date().getTime() - new Date(x[0].insertionTime).getTime(); - incObj['today_stopped'] = today_stopped; - - } - var parsedSpeed = parseInt(parsedData.speed); - if (parsedData.ignition == 1 || (typeof parsedData.ignition === 'undefined' && x[0].lookedUpDevice.last_ACC == '1')) { - if (0 <= parsedSpeed && parsedSpeed < 20) { - incObj['speedChart.0-20'] = 1 - } - else if (20 <= parsedSpeed && parsedSpeed < 40) { - incObj['speedChart.20-40'] = 1 - } - else if (40 <= parsedSpeed && parsedSpeed < 60) { - incObj['speedChart.40-60'] = 1 - } - else if (60 <= parsedSpeed && parsedSpeed < 80) { - incObj['speedChart.60-80'] = 1 - } - else if (80 <= parsedSpeed && parsedSpeed < 100) { - incObj['speedChart.80-100'] = 1 - } - else if (100 <= parsedSpeed) { - incObj['speedChart.>100'] = 1 - } - } - Device.update( - { "Device_ID": parsedData.imei }, - { - $set: { - "last_loc.type": "Point", - "last_loc.coordinates": [parsedData.longDecimal, parsedData.latDecimal], - "sec_last_location.lat": x[0].lookedUpDevice.last_location ? x[0].lookedUpDevice.last_location.lat : null, - "sec_last_location.long": x[0].lookedUpDevice.last_location ? x[0].lookedUpDevice.last_location.long : null, - "sec_last_speed": x[0].lookedUpDevice.last_speed, - "last_location.lat": parsedData.latDecimal, - "last_location.long": parsedData.longDecimal, - "last_ping_on": new Date(), - "last_device_time" : new Date(parsedData.date), - "last_speed": parsedData.speed, - "currentFuel": parsedData.currentFuel != null ? parsedData.currentFuel : null, - "currentFuelVoltage": parsedData.fuelVoltage ? parsedData.fuelVoltage : null, - "satellites": parsedData.satellites ? parsedData.satellites : null, - "gpsTracking": parsedData['GPS positioned'] ? parsedData['GPS positioned'] : "0", - "today_odo": today_odo, - "heading": parsedData.heading, - "distFromLastStop": distFromLastStop, - "power": (parsedData.power == "1" || parsedData.power == "0") ? parsedData.power : x[0].lookedUpDevice.power, - "ac": parsedData.ac, - "today_start_location" : today_start_location - }, - - $inc: incObj - - }, - function (err, numAffected) { - if (err) { - console.error(err); - } - if (!err) { - - Device.find({ "Device_ID": parsedData.imei }).populate('user').exec(function (err, devices) { - if (err) { - console.error(err); - - } - else { - if (devices[0].integrationId) { - OutgoingIntegrations.deliver(devices[0], inserted.ops[0]); - } - KafkaService.sendRecord({ namespace: 'gpsio', room: devices[0].Device_ID, channel: devices[0].Device_ID.toString() + 'acc', data: [devices[0].last_ACC, devices[0].Device_ID.toString(), new Date(), devices[0]] }) - //gpsio.to(devices[0].Device_ID).emit(devices[0].Device_ID.toString() + 'acc', devices[0].last_ACC, devices[0].Device_ID.toString(), new Date(), devices[0]) - - if ((parsedData.power == "0" || parsedData.power == "1") && x[0].lookedUpDevice.power != parsedData.power) { - - TCPUTIL.setPowerNotif(x[0].lookedUpDevice, parsedData.power, KafkaService, devices[0].user); - } - } - }) - TCPUTIL.setDeviceStatus(x[0].lookedUpDevice, null); - if (x[0].lookedUpCurrentTrip) { - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $inc: { "distanceTravelled": interpolatedDistance } }).exec(); - } - } - - }); - - } - else { - var status = 'OUT OF REACH'; - if (parsedData.ignition != null) { - if(parsedData.ignition == 1){ - if (parsedData.speed > 1) { - status = 'RUNNING' - } else { - status = 'IDLING' - } - } - if (parsedData.ignition == 0) { - status = 'STOPPED' - } - } - else{ - status = 'STOPPED' - } - Device.update( - { "Device_ID": parsedData.imei }, - { - $set: { - "last_loc.type": "Point", - "last_loc.coordinates": [parsedData.longDecimal, parsedData.latDecimal], - //"sec_last_location.lat": x[0].lookedUpDevice.last_location ? x[0].lookedUpDevice.last_location.lat : null, - //"sec_last_location.long": x[0].lookedUpDevice.last_location ? x[0].lookedUpDevice.last_location.long : null, - //"sec_last_speed": x[0].lookedUpDevice.last_speed, - "last_location.lat": parsedData.latDecimal, - "last_location.long": parsedData.longDecimal, - "last_ping_on": new Date(), - "last_device_time" : new Date(parsedData.date), - "last_speed": parsedData.speed, - "status": status, - "status_updated_at" : new Date(), - //"currentFuel": parsedData.currentFuel != null ? parsedData.currentFuel : null, - //"currentFuelVoltage": parsedData.fuelVoltage ? parsedData.fuelVoltage : null, - "satellites": parsedData.satellites ? parsedData.satellites : null, - "gpsTracking": parsedData['GPS positioned'] ? parsedData['GPS positioned'] : "0", - //"today_odo": today_odo, - "heading": parsedData.heading, - //"distFromLastStop": distFromLastStop, - "power": parsedData.power, - "ac": parsedData.ac - } - - } - ).exec(); - } - - } - }) - }); - } - else { - if ((parsedData.latDecimal == 0 || parsedData.longDecimal == 0) && x[0]) { - TCPUTIL.setDeviceStatus(x[0].lookedUpDevice, 'nofix'); - Device.update( - { "Device_ID": parsedData.imei }, - { - $set: { - "last_loc.type": "Point", - "last_loc.coordinates": [0, 0], - "sec_last_location.lat": x[0].lookedUpDevice.last_location ? x[0].lookedUpDevice.last_location.lat : null, - "sec_last_location.long": x[0].lookedUpDevice.last_location ? x[0].lookedUpDevice.last_location.long : null, - "sec_last_speed": x[0].lookedUpDevice.last_speed, - "last_location.lat": 0, - "last_location.long": 0, - "last_ping_on": new Date(), - "last_device_time" : new Date(parsedData.date), - "last_speed": parsedData.speed, - "currentFuel": parsedData.currentFuel ? parsedData.currentFuel : null, - "currentFuelVoltage": parsedData.fuelVoltage ? parsedData.fuelVoltage : null, - "satellites": parsedData.satellites ? parsedData.satellites : null, - } - }).exec(); - console.log("0,0 from : " + parsedData.imei); - } - - - } - - //}) - - /** SPEED LIMIT ALERTS */ - if (x[0] && parsedData.latDecimal != 0 && typeof parsedData.latDecimal == "number" - && typeof parsedData.longDecimal == "number" && !isNaN(parseFloat(parsedData.latDecimal)) - && !isNaN(parseFloat(parsedData.longDecimal))) { - if (parseFloat(parsedData.speed) >= x[0].lookedUpDevice.SpeedLimit && x[0].lookedUpDevice.SpeedAlert) { - - if (x[0].lookedUpDevice.overspeeding == true) { - return; - } - - TCPUTIL.sbTracking(null, x[0], 'os', parsedData.latDecimal, parsedData.longDecimal, null, null, parsedData.speed, KafkaService); - Notifs.create({ - "device": x[0].lookedUpDevice.Device_ID, - "vehicle": x[0].lookedUpDevice.vehicle, - "dealer": x[0].lookedUpDevice.created_by, - "user": x[0].lookedUpUser[0]._id, - "type": "overspeed", - "priority" : 3, - "group" : x[0].lookedUpDevice.vehicleGroup, - "trip" : x[0].lookedUpDevice.currentTrip, - "overSpeed" : parseFloat(parsedData.speed), - "lat" : parsedData.latDecimal, - "long" : parsedData.longDecimal, - "vehicleName" : x[0].lookedUpDevice.Device_Name, - "item": { "_type": "Speed Alert", "sentence": x[0].lookedUpDevice.Device_Name + " exceeded the speed limit of " + x[0].lookedUpDevice.SpeedLimit + ". Travelling at " + parseInt(parsedData.speed) + " kmph."} - }, function (err, result) { - if (err) { - console.error(err) - } - else { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { overspeeding: true }, $inc: {today_overspeeds : 1} }).exec(); - pushNotifs.notify(x[0].lookedUpUser[0], result); - KafkaService.sendRecord({ namespace: 'notifIO', room: null, channel : x[0].lookedUpUser[0]._id, data : [result]}) - //notifIO.emit(x[0].lookedUpUser[0]._id, result) - Utilities.setAddress(result.lat,result.long,result._id,"address","notifications"); - } - }) - } - else if (parseFloat(parsedData.speed) < x[0].lookedUpDevice.SpeedLimit) { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { overspeeding: false } }).exec(); - } - } - - /**GEO FENCE ALERTS */ - if (x[0] && parsedData.latDecimal != 0 && typeof parsedData.latDecimal == "number" - && typeof parsedData.longDecimal == "number" && !isNaN(parseFloat(parsedData.latDecimal)) - && !isNaN(parseFloat(parsedData.longDecimal))) { - - GeoFence.find( - { - geofence: { - $geoIntersects: { - $geometry: parsedData.geoJSON - } - }, - uid: {$in : [x[0].lookedUpDevice.user, x[0].lookedUpDevice.created_by]}, - status: true - } - ).exec(function (err, geoWithins) { - if (err) { - console.error(err); - return; - } - if (geoWithins.length > 0) { - - - - - /**if a location is found to be inside, determine if the previous location was inside or outside */ - var geoWithin = geoWithins[0]; - - //update geofence model [field : devicesWithin] - GeoFence.update( - { _id: geoWithin._id }, - { $addToSet: { devicesWithin: x[0].lookedUpDevice._id } }, - function (err, inserted) { - if (err) { - console.error(err); - } - } - ) - - GeoFence - .find( - { - _id: geoWithin._id, - geofence: { - $geoIntersects: { - $geometry: x[0].geoJSON - } - //uid : x[0].lookedUpDevice.user, - //status: true - } - }) - .exec(function (err, previousGeo) { - - if (err) { - console.error(err) - return - } - if (previousGeo.length > 0) { - /** both ultimate and penultimate locations are inside. nothing's changed. */ - } - else { - var tripId = null; - if (x[0].lookedUpCurrentTrip) { - tripId = x[0].lookedUpCurrentTrip._id; - } - //check if this geoFence is assigned as loading site for vehicle's current trip - if (x[0].lookedUpCurrentTrip && x[0].lookedUpCurrentTrip.startSite.toString() == geoWithin._id.toString()) { - tripId = x[0].lookedUpCurrentTrip._id; - //vehicle entering start site - if (x[0].lookedUpCurrentTrip.tripType == 2) { - //two way trip - if (x[0].lookedUpCurrentTrip.endSiteExitAt && x[0].lookedUpCurrentTrip.startSiteExitAt) { - // - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "UNASSIGNED", currentTrip : null, tripPTA : null, tripETA : null, loadingDeparture : null, unloadingDeparture : null } }).exec() - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "COMPLETED", startSiteReEnterAt: new Date(), tripPTA : null, tripETA : null } }).exec() - TCPUTIL.sbTracking(null,x[0],'tripEnd', parsedData.latDecimal, parsedData.longDecimal,null,null,null,KafkaService) - TCPUTIL.setTravelDelay('reverseTransitComplete', x[0].lookedUpCurrentTrip, new Date(), x[0].lookedUpDevice); - if (x[0].lookedUpUser[0].tripGeneration == 'scheduled') { - // createScheduledTrip - /* TCPUTIL.setScheduledTrip(x[0].lookedUpDevice); */ - } - else if (x[0].lookedUpUser[0].tripGeneration == 'auto') { - //change the vehicle's group to geo fence group if it is not the same - - //cancel current trip and create a new trip with the information available - var d = new Date(); - var newId = mongoose.Types.ObjectId(); - tripId = newId; - var newRouteMap = { - "_id" : newId, - "device" : x[0].lookedUpDevice._id, - "user" : x[0].lookedUpUser[0]._id, - "device_name": x[0].lookedUpDevice.Device_Name, - "group" : x[0].lookedUpDevice.vehicleGroup, - "driver" : x[0].lookedUpCurrentTrip ? x[0].lookedUpCurrentTrip.driver : null, - "startSite" : geoWithin._id, - "createdOn": d, - "startSiteEnterAt" : d, - "status" : "LOADING", - "poi" : [], - "tripType" : 2, - "radius" : 500, - "generated" : "auto" - } - RouteMap.create(newRouteMap, function (err, newTrip) { - if (err) { - console.error(err); - return; - } - else { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "LOADING", vehicleGroup: geoWithin.vehicleGroup, currentTrip: newTrip._id, tripPTA : null, tripETA : null, loadingDeparture : null, unloadingDeparture : null } }).exec(); - if (x[0].lookedUpCurrentTrip) { - //RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "COMPLETED", startSiteReEnterAt: new Date(), tripPTA : null, tripETA : null } }).exec() - //TCPUTIL.sbTracking(null,x[0],'tripEnd', parsedData.latDecimal, parsedData.longDecimal,null,null,null,sbNotifIO) - } - Groups.update({ _id: geoWithin.vehicleGroup }, { $addToSet: { devices: x[0].lookedUpDevice._id } }).exec() - Groups.update({ _id: x[0].lookedUpDevice.vehicleGroup }, { $pull: { devices: x[0].lookedUpDevice._id } }).exec(); - } - }) - } - - - } - else { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "LOADING" } }).exec() - RouteMap.update({_id : x[0].lookedUpCurrentTrip._id}, {$set : {status : "LOADING", startSiteEnterAt : new Date()}}).exec() - } - } - if (x[0].lookedUpCurrentTrip.tripType == 1) { - //one way trip; set status to LOADING - if (!x[0].lookedUpCurrentTrip.startSiteEnterAt){ - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "LOADING" } }).exec() - RouteMap.update({_id : x[0].lookedUpCurrentTrip._id}, {$set : {status : "LOADING", startSiteEnterAt : new Date()}}).exec() - } - else if (geoWithin.type == 'Loading' && x[0].lookedUpUser[0].tripGeneration == 'auto') { - //change the vehicle's group to geo fence group if it is not the same - - //cancel current trip and create a new trip with the information available - var d = new Date(); - var newId = mongoose.Types.ObjectId(); - tripId = newId; - var newRouteMap = { - "_id" : newId, - "device" : x[0].lookedUpDevice._id, - "user" : x[0].lookedUpUser[0]._id, - "device_name" : x[0].lookedUpDevice.Device_Name, - "driver" : x[0].lookedUpCurrentTrip ? x[0].lookedUpCurrentTrip.driver : null, - "startSite": geoWithin._id, - "group" : x[0].lookedUpDevice.vehicleGroup, - "createdOn": d, - "startSiteEnterAt" : d, - "status" : "LOADING", - "poi" : [], - "tripType" : 2, - "radius" : 500, - "generated" : "auto" - } - RouteMap.create(newRouteMap, function (err, newTrip) { - if (err) { - console.error(err); - return; - } - else { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "LOADING", vehicleGroup: geoWithin.vehicleGroup, currentTrip: newTrip._id, tripPTA : null, tripETA : null, loadingDeparture : null, unloadingDeparture : null } }).exec(); - if (x[0].lookedUpCurrentTrip) { - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "COMPLETED", cancelledAt: new Date(), tripPTA: null, tripETA: null }, $push: { deviations: {"type": "newLoading","time" : new Date()}} }).exec() - } - Groups.update({ _id: geoWithin.vehicleGroup }, { $addToSet: { devices: x[0].lookedUpDevice._id } }).exec() - Groups.update({ _id: x[0].lookedUpDevice.vehicleGroup }, { $pull: { devices: x[0].lookedUpDevice._id } }).exec(); - } - }) - } - - } - if (x[0].lookedUpCurrentTrip.tripType == 0 && !x[0].lookedUpCurrentTrip.startSiteEnterAt) { - //round trip; set status to LOADING - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "LOADING" } }).exec() - RouteMap.update({_id : x[0].lookedUpCurrentTrip._id}, {$set : {status : "LOADING", startSiteEnterAt : new Date()}}).exec() - } - } - else if (geoWithin.type == 'Loading' && x[0].lookedUpUser[0].tripGeneration == 'auto') { - //change the vehicle's group to geo fence group if it is not the same - - //cancel current trip and create a new trip with the information available - var d = new Date(); - var newId = mongoose.Types.ObjectId(); - tripId = newId; - var newRouteMap = { - "_id" : newId, - "device" : x[0].lookedUpDevice._id, - "user" : x[0].lookedUpUser[0]._id, - "device_name" : x[0].lookedUpDevice.Device_Name, - "driver" : x[0].lookedUpCurrentTrip ? x[0].lookedUpCurrentTrip.driver : null, - "startSite": geoWithin._id, - "group" : x[0].lookedUpDevice.vehicleGroup, - "createdOn": d, - "startSiteEnterAt" : d, - "status" : "LOADING", - "poi" : [], - "tripType" : 2, - "radius" : 500, - "generated" : "auto" - } - RouteMap.create(newRouteMap, function (err, newTrip) { - if (err) { - console.error(err); - return; - } - else { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "LOADING", vehicleGroup: geoWithin.vehicleGroup, currentTrip: newTrip._id, tripPTA : null, tripETA : null, loadingDeparture : null, unloadingDeparture : null } }).exec(); - if (x[0].lookedUpCurrentTrip) { - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "COMPLETED", cancelledAt: new Date(), tripPTA : null, tripETA : null }, $push: { deviations: {"type": "newLoading","time" : new Date()}} }).exec() - } - Groups.update({ _id: geoWithin.vehicleGroup }, { $addToSet: { devices: x[0].lookedUpDevice._id } }).exec() - Groups.update({ _id: x[0].lookedUpDevice.vehicleGroup }, { $pull: { devices: x[0].lookedUpDevice._id } }).exec(); - } - }) - } - //check if this geoFence is assigned as unloading site for vehicle's current trip - if (x[0].lookedUpCurrentTrip && x[0].lookedUpCurrentTrip.endSite && x[0].lookedUpCurrentTrip.endSite.toString() == geoWithin._id.toString()) { - tripId = x[0].lookedUpCurrentTrip._id; - //vehicle entering end site - if (x[0].lookedUpCurrentTrip.tripType == 2) { - //two way trip - if (!x[0].lookedUpCurrentTrip.endSiteEnterAt) { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "UNLOADING", tripPTA : null, tripETA : null } }).exec() - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "UNLOADING", endSiteEnterAt: new Date(), tripPTA: null, tripETA: null } }).exec() - TCPUTIL.setTravelDelay('transitComplete', x[0].lookedUpCurrentTrip, new Date(), x[0].lookedUpDevice); - } - } - if (x[0].lookedUpCurrentTrip.tripType == 1) { - //one way trip; set status to LOADING - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "UNLOADING", tripPTA : null, tripETA : null } }).exec() - RouteMap.update({_id : x[0].lookedUpCurrentTrip._id}, {$set : {status : "UNLOADING", endSiteEnterAt : new Date(), tripPTA : null, tripETA : null}}).exec() - TCPUTIL.setTravelDelay('transitComplete', x[0].lookedUpCurrentTrip, new Date(), x[0].lookedUpDevice); - } - if (x[0].lookedUpCurrentTrip.tripType == 0 && x[0].lookedUpCurrentTrip.startSiteExitAt) { - //one way trip; set status to COMPLETED - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "UNASSIGNED", currentTrip : null, tripPTA : null, tripETA : null, loadingDeparture : null, unloadingDeparture : null } }).exec() - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "COMPLETED", endSiteEnterAt: new Date(), tripPTA : null, tripETA : null } }).exec() - TCPUTIL.sbTracking(null,x[0],'tripEnd', parsedData.latDecimal, parsedData.longDecimal,null,null,null,KafkaService) - - if (x[0].lookedUpUser[0].tripGeneration == 'scheduled') { - // createScheduledTrip - /* TCPUTIL.setScheduledTrip(x[0].lookedUpDevice); */ - } - } - } - else if (x[0].lookedUpCurrentTrip && geoWithin.type == 'Unloading') { - if (geoWithin.vehicleGroup.toString() == x[0].lookedUpDevice.vehicleGroup.toString()) { - tripId = x[0].lookedUpCurrentTrip._id; - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "UNLOADING", tripPTA : null, tripETA : null } }).exec() - RouteMap.update({_id : x[0].lookedUpCurrentTrip._id}, {$set : {status : "UNLOADING", endSite: geoWithin._id, endSiteEnterAt : new Date(), tripPTA : null, tripETA : null}}).exec() - TCPUTIL.setTravelDelay('transitComplete', x[0].lookedUpCurrentTrip, new Date(), x[0].lookedUpDevice); - } - } - - /**socket emit event for this 'imei' ENTERING geoFence 'geoWithin.name' */ - if (geoWithin.entering == true) { - Notifs.create({ - "device": x[0].lookedUpDevice.Device_ID, - "dealer": x[0].lookedUpDevice.created_by, - "vehicle" : x[0].lookedUpDevice.vehicle, - "user": x[0].lookedUpUser[0]._id, - "type": "Geo-Fence", - "org":x[0].lookedUpDevice.org, - "priority" : 1, - "group" : x[0].lookedUpDevice.vehicleGroup, - "direction": "In", - "trip" : tripId, - "geoid" : geoWithin._id, - "lat" : parsedData.latDecimal, - "long" : parsedData.longDecimal, - "vehicleName" : x[0].lookedUpDevice.Device_Name, - "item": { "_type": "Geo-Fence Alert", "sentence": x[0].lookedUpDevice.Device_Name + " entered " + geoWithin.geoname } - }, function (err, result) { - if (err) { - console.error(err) - } - else { - GeofenceReports.create({ - vehicle: x[0].lookedUpDevice.vehicle, - device: x[0].lookedUpDevice._id, - geofence: geoWithin._id, - group : x[0].lookedUpDevice.vehicleGroup, - org:x[0].lookedUpDevice.org, - user: x[0].lookedUpUser[0]._id, - arrivalTime: new Date() - }, function (err, report) { - if (err) { - console.error(err); - return; - } - //Utilities.setAddress(report.lat, report.long,report._id, "address", "geofenceReports") - }) - pushNotifs.notify(x[0].lookedUpUser[0], result); - KafkaService.sendRecord({ namespace: 'notifIO', room: null, channel: x[0].lookedUpUser[0]._id, data: [result] }); - //notifIO.emit(x[0].lookedUpUser[0]._id, result) - Utilities.setAddress(result.lat,result.long,result._id,"address","notifications"); - } - }) - } - } - }) - - } - - else { - /**if a location is not found inside any geoFence, determine if the previous location was inside or outside ANY of the geoFences for that device */ - - - //update geofence model [field : devicesWithin] - GeoFence.update( - {}, - { $pull: { devicesWithin: x[0].lookedUpDevice._id } }, - {multi : true}, - function (err, inserted) { - if(err){ - console.error(err); - } - } - ) - - GeoFence - .find( - { - geofence: { - $geoIntersects: { - $geometry: x[0].geoJSON - } - }, - uid: {$in : [x[0].lookedUpDevice.user, x[0].lookedUpDevice.created_by]}, - status: true - }) - .populate('vehicleGroup') - .exec(function (err, previousGeos) { - if (err) { - console.error(err) - return - } - if (previousGeos.length > 0) { - - var tripId = null; - if (x[0].lookedUpCurrentTrip) { - tripId = x[0].lookedUpCurrentTrip._id; - } - //check if this geoFence is assigned as loading site for vehicle's current trip - if (x[0].lookedUpCurrentTrip && x[0].lookedUpCurrentTrip.startSite.toString() == previousGeos[0]._id.toString()) { - var now = new Date(); - - //vehicle exiting start site - if (x[0].lookedUpCurrentTrip.tripType == 2) { - //two way trip - - - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "TRANSIT", loadingDeparture : now } }).exec() - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "TRANSIT", startSiteExitAt: now } }).exec() - TCPUTIL.sbTracking(null, x[0], 'tripStart', parsedData.latDecimal, parsedData.longDecimal, null, null, null, KafkaService); - } - if (x[0].lookedUpCurrentTrip.tripType == 1) { - //one way trip; set status to LOADING - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "TRANSIT", loadingDeparture : now } }).exec() - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "TRANSIT", startSiteExitAt: now } }).exec() - TCPUTIL.sbTracking(null, x[0], 'tripStart', parsedData.latDecimal, parsedData.longDecimal, null, null, null, KafkaService); - } - if (x[0].lookedUpCurrentTrip.tripType == 0) { - //round trip; set status to Transit - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "TRANSIT", loadingDeparture : now } }).exec() - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "TRANSIT", startSiteExitAt: now } }).exec() - TCPUTIL.sbTracking(null, x[0], 'tripStart', parsedData.latDecimal, parsedData.longDecimal, null, null, null, KafkaService); - } - if (x[0].lookedUpCurrentTrip.startSiteEnterAt) { - TCPUTIL.setTimeAtSite(x[0].lookedUpCurrentTrip.startSiteEnterAt, now , x[0].lookedUpCurrentTrip._id, 'Loading'); - } - } - //check if this geoFence is assigned as unloading site for vehicle's current trip - if (x[0].lookedUpCurrentTrip && x[0].lookedUpCurrentTrip.endSite && x[0].lookedUpCurrentTrip.endSite.toString() == previousGeos[0]._id.toString()) { - var now = new Date(); - - //vehicle exiting end site - if (x[0].lookedUpCurrentTrip.tripType == 2) { - //two way trip - if (!x[0].lookedUpCurrentTrip.endSiteExitAt) { - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "TRANSIT-Return", unloadingDeparture : now } }).exec() - RouteMap.update({_id : x[0].lookedUpCurrentTrip._id}, {$set : {status : "TRANSIT-Return", lastPOIIndex : null, endSiteExitAt : now}}).exec() - } - } - if (x[0].lookedUpCurrentTrip.tripType == 1 && x[0].lookedUpCurrentTrip.status != "COMPLETED") { - //one way trip; set status to LOADING - Device.update({ _id: x[0].lookedUpDevice._id }, { $set: { currentTripStatus: "UNASSIGNED", currentTrip : null, tripPTA : null, tripETA : null, loadingDeparture : null, unloadingDeparture : null } }).exec() - RouteMap.update({ _id: x[0].lookedUpCurrentTrip._id }, { $set: { status: "COMPLETED", endSiteExitAt: now, tripPTA : null, tripETA : null } }).exec() - TCPUTIL.sbTracking(null, x[0], 'tripEnd', parsedData.latDecimal, parsedData.longDecimal, null, null, null, KafkaService); - - if (x[0].lookedUpUser[0].tripGeneration == 'scheduled') { - // createScheduledTrip - /* TCPUTIL.setScheduledTrip(x[0].lookedUpDevice); */ - } - } - - if (x[0].lookedUpCurrentTrip.endSiteEnterAt) { - TCPUTIL.setTimeAtSite(x[0].lookedUpCurrentTrip.endSiteEnterAt, now, x[0].lookedUpCurrentTrip._id, 'Unloading'); - } - } - - - /** socket emit event for this 'imei' EXITING all geoFences 'previousGeos[i].name'. */ - - - for (var i = 0; i < 1; i++) { - - if (previousGeos[i].exiting == true) { - var prevGeo = previousGeos[0]; - Notifs.create({ - "device": x[0].lookedUpDevice.Device_ID, - "vehicle": x[0].lookedUpDevice.vehicle, - "dealer": x[0].lookedUpDevice.created_by, - "user": x[0].lookedUpUser[0]._id, - "group" : x[0].lookedUpDevice.vehicleGroup, - "type": "Geo-Fence", - "priority" : 1, - "direction": "Out", - "trip" : tripId, - "geoid" : previousGeos[0]._id, - "lat" : parsedData.latDecimal, - "long" : parsedData.longDecimal, - "vehicleName" : x[0].lookedUpDevice.Device_Name, - "item": { "_type": "Geo-Fence Alert", "sentence": x[0].lookedUpDevice.Device_Name + " exited " + previousGeos[0].geoname } - }, function (err, result) { - if (err) { - console.error(err) - } - else { - GeofenceReports.findOneAndUpdate( - { - device: x[0].lookedUpDevice._id, - geofence: previousGeos[0]._id, - departureTime: { $exists: false }, - vehicle: x[0].lookedUpDevice.vehicle, - user : x[0].lookedUpUser[0]._id - }, - { - $set: - { group : x[0].lookedUpDevice.vehicleGroup, departureTime: new Date(), vehicle: x[0].lookedUpDevice.vehicle, device: x[0].lookedUpDevice._id, geofence: previousGeos[0]._id, user : x[0].lookedUpUser[0]._id } - }, - { - sort: { "_id": -1 }, new: true, upsert: true - }, - function (err, latest) { - if (err) { - console.error(err); - return; - } - }) - pushNotifs.notify(x[0].lookedUpUser[0], result); - KafkaService.sendRecord({namespace : 'notifIO', room : null, channel : x[0].lookedUpUser[0]._id, data : [result]}) - //notifIO.emit(x[0].lookedUpUser[0]._id, result) - Utilities.setAddress(result.lat, result.long, result._id, "address", "notifications"); - if (prevGeo.vehicleGroup) { - var emails = prevGeo.vehicleGroup.contact_email; - if (emails.length < 1) { - return; - } - Notifs.findOne({ - "device": x[0].lookedUpDevice.Device_ID, - "type": "Geo-Fence", - "direction": "In", - "timestamp": { $lt: result.timestamp }, - "geoid" : prevGeo._id - }, {}, { sort: { 'timestamp' : -1 } }, function (err, lastInNotif) { - if (err) { - console.error(err); - return; - } - if (lastInNotif) { - - if (!x[0].lookedUpUser[0]) { - return; - } - var mailOptions = { - from: Utilities.getConfig().mailUser, // sender address - to: emails, // list of receivers - //cc: emails.length > 1 ? emails.shift() : null, - subject: Utilities.getConfig().orgName+"- GeoFence Activity", // Subject line moment(m.report_lastdate.overspeed).tz(m.timezone).format("YYYY-MM-DDTHH:mm"); - html:'
Geo-Fence Vehicle In Time Out Time
'+prevGeo.geoname+' '+x[0].lookedUpDevice.Device_Name+' '+moment(lastInNotif.timestamp).tz(x[0].lookedUpUser[0].timezone).format("YYYY-MM-DD HH:mm")+' '+moment(result.timestamp).tz(x[0].lookedUpUser[0].timezone).format("YYYY-MM-DD HH:mm")+'
' - } - if(emails.length > 0){ - Mailer.sendMail(mailOptions); - } - } - }) - } - } - }) - - - - } - } - } - else { - /**both ultimate and penultimate locations are inside. nothing's changed. */ - } - }) - - } - }) - } - } - } - - }); - - - - } - - - } catch (error) { - console.error(error); - } - } \ No newline at end of file diff --git a/dms.js b/dms.js deleted file mode 100644 index ee53898..0000000 --- a/dms.js +++ /dev/null @@ -1,225 +0,0 @@ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Geodesy representation conversion functions (c) Chris Veness 2002-2017 */ -/* MIT Licence */ -/* www.movable-type.co.uk/scripts/latlong.html */ -/* www.movable-type.co.uk/scripts/geodesy/docs/module-dms.html */ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -'use strict'; -/* eslint no-irregular-whitespace: [2, { skipComments: true }] */ - - -/** - * Latitude/longitude points may be represented as decimal degrees, or subdivided into sexagesimal - * minutes and seconds. - * - * @module dms - */ - - -/** - * Functions for parsing and representing degrees / minutes / seconds. - * @class Dms - */ -var Dms = {}; - -// note Unicode Degree = U+00B0. Prime = U+2032, Double prime = U+2033 - - -/** - * Parses string representing degrees/minutes/seconds into numeric degrees. - * - * This is very flexible on formats, allowing signed decimal degrees, or deg-min-sec optionally - * suffixed by compass direction (NSEW). A variety of separators are accepted (eg 3° 37′ 09″W). - * Seconds and minutes may be omitted. - * - * @param {string|number} dmsStr - Degrees or deg/min/sec in variety of formats. - * @returns {number} Degrees as decimal number. - * - * @example - * var lat = Dms.parseDMS('51° 28′ 40.12″ N'); - * var lon = Dms.parseDMS('000° 00′ 05.31″ W'); - * var p1 = new LatLon(lat, lon); // 51.4778°N, 000.0015°W - */ -Dms.parseDMS = function(dmsStr) { - // check for signed decimal degrees without NSEW, if so return it directly - if (typeof dmsStr == 'number' && isFinite(dmsStr)) return Number(dmsStr); - - // strip off any sign or compass dir'n & split out separate d/m/s - var dms = String(dmsStr).trim().replace(/^-/, '').replace(/[NSEW]$/i, '').split(/[^0-9.,]+/); - if (dms[dms.length-1]=='') dms.splice(dms.length-1); // from trailing symbol - - if (dms == '') return NaN; - - // and convert to decimal degrees... - var deg; - switch (dms.length) { - case 3: // interpret 3-part result as d/m/s - deg = dms[0]/1 + dms[1]/60 + dms[2]/3600; - break; - case 2: // interpret 2-part result as d/m - deg = dms[0]/1 + dms[1]/60; - break; - case 1: // just d (possibly decimal) or non-separated dddmmss - deg = dms[0]; - // check for fixed-width unseparated format eg 0033709W - //if (/[NS]/i.test(dmsStr)) deg = '0' + deg; // - normalise N/S to 3-digit degrees - //if (/[0-9]{7}/.test(deg)) deg = deg.slice(0,3)/1 + deg.slice(3,5)/60 + deg.slice(5)/3600; - break; - default: - return NaN; - } - if (/^-|[WS]$/i.test(dmsStr.trim())) deg = -deg; // take '-', west and south as -ve - - return Number(deg); -}; - - -/** - * Separator character to be used to separate degrees, minutes, seconds, and cardinal directions. - * - * Set to '\u202f' (narrow no-break space) for improved formatting. - * - * @example - * var p = new LatLon(51.2, 0.33); // 51°12′00.0″N, 000°19′48.0″E - * Dms.separator = '\u202f'; // narrow no-break space - * var pʹ = new LatLon(51.2, 0.33); // 51° 12′ 00.0″ N, 000° 19′ 48.0″ E - */ -Dms.separator = ''; - - -/** - * Converts decimal degrees to deg/min/sec format - * - degree, prime, double-prime symbols are added, but sign is discarded, though no compass - * direction is added. - * - * @private - * @param {number} deg - Degrees to be formatted as specified. - * @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec. - * @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d. - * @returns {string} Degrees formatted as deg/min/secs according to specified format. - */ -Dms.toDMS = function(deg, format, dp) { - if (isNaN(deg)) return null; // give up here if we can't make a number from deg - - // default values - if (format === undefined) format = 'dms'; - if (dp === undefined) { - switch (format) { - case 'd': case 'deg': dp = 4; break; - case 'dm': case 'deg+min': dp = 2; break; - case 'dms': case 'deg+min+sec': dp = 0; break; - default: format = 'dms'; dp = 0; // be forgiving on invalid format - } - } - - deg = Math.abs(deg); // (unsigned result ready for appending compass dir'n) - - var dms, d, m, s; - switch (format) { - default: // invalid format spec! - case 'd': case 'deg': - d = deg.toFixed(dp); // round/right-pad degrees - if (d<100) d = '0' + d; // left-pad with leading zeros (note may include decimals) - if (d<10) d = '0' + d; - dms = d + '°'; - break; - case 'dm': case 'deg+min': - d = Math.floor(deg); // get component deg - m = ((deg*60) % 60).toFixed(dp); // get component min & round/right-pad - if (m == 60) { m = 0; d++; } // check for rounding up - d = ('000'+d).slice(-3); // left-pad with leading zeros - if (m<10) m = '0' + m; // left-pad with leading zeros (note may include decimals) - dms = d + '°'+Dms.separator + m + '′'; - break; - case 'dms': case 'deg+min+sec': - d = Math.floor(deg); // get component deg - m = Math.floor((deg*3600)/60) % 60; // get component min - s = (deg*3600 % 60).toFixed(dp); // get component sec & round/right-pad - if (s == 60) { s = (0).toFixed(dp); m++; } // check for rounding up - if (m == 60) { m = 0; d++; } // check for rounding up - d = ('000'+d).slice(-3); // left-pad with leading zeros - m = ('00'+m).slice(-2); // left-pad with leading zeros - if (s<10) s = '0' + s; // left-pad with leading zeros (note may include decimals) - dms = d + '°'+Dms.separator + m + '′'+Dms.separator + s + '″'; - break; - } - - return dms; -}; - - -/** - * Converts numeric degrees to deg/min/sec latitude (2-digit degrees, suffixed with N/S). - * - * @param {number} deg - Degrees to be formatted as specified. - * @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec. - * @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d. - * @returns {string} Degrees formatted as deg/min/secs according to specified format. - */ -Dms.toLat = function(deg, format, dp) { - var lat = Dms.toDMS(deg, format, dp); - return lat===null ? '–' : lat.slice(1)+Dms.separator + (deg<0 ? 'S' : 'N'); // knock off initial '0' for lat! -}; - - -/** - * Convert numeric degrees to deg/min/sec longitude (3-digit degrees, suffixed with E/W) - * - * @param {number} deg - Degrees to be formatted as specified. - * @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec. - * @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d. - * @returns {string} Degrees formatted as deg/min/secs according to specified format. - */ -Dms.toLon = function(deg, format, dp) { - var lon = Dms.toDMS(deg, format, dp); - return lon===null ? '–' : lon+Dms.separator + (deg<0 ? 'W' : 'E'); -}; - - -/** - * Converts numeric degrees to deg/min/sec as a bearing (0°..360°) - * - * @param {number} deg - Degrees to be formatted as specified. - * @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec. - * @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d. - * @returns {string} Degrees formatted as deg/min/secs according to specified format. - */ -Dms.toBrng = function(deg, format, dp) { - deg = (Number(deg)+360) % 360; // normalise -ve values to 180°..360° - var brng = Dms.toDMS(deg, format, dp); - return brng===null ? '–' : brng.replace('360', '0'); // just in case rounding took us up to 360°! -}; - - -/** - * Returns compass point (to given precision) for supplied bearing. - * - * @param {number} bearing - Bearing in degrees from north. - * @param {number} [precision=3] - Precision (1:cardinal / 2:intercardinal / 3:secondary-intercardinal). - * @returns {string} Compass point for supplied bearing. - * - * @example - * var point = Dms.compassPoint(24); // point = 'NNE' - * var point = Dms.compassPoint(24, 1); // point = 'N' - */ -Dms.compassPoint = function(bearing, precision) { - if (precision === undefined) precision = 3; - // note precision could be extended to 4 for quarter-winds (eg NbNW), but I think they are little used - - bearing = ((bearing%360)+360)%360; // normalise to range 0..360° - - var cardinals = [ - 'N', 'NNE', 'NE', 'ENE', - 'E', 'ESE', 'SE', 'SSE', - 'S', 'SSW', 'SW', 'WSW', - 'W', 'WNW', 'NW', 'NNW' ]; - var n = 4 * Math.pow(2, precision-1); // no of compass points at req’d precision (1=>4, 2=>8, 3=>16) - var cardinal = cardinals[Math.round(bearing*n/360)%n * 16/n]; - - return cardinal; -}; - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -if (typeof module != 'undefined' && module.exports) module.exports = Dms; // ≡ export default Dms \ No newline at end of file diff --git a/gpsFunctions.js b/gpsFunctions.js deleted file mode 100644 index 52a4866..0000000 --- a/gpsFunctions.js +++ /dev/null @@ -1,127 +0,0 @@ - -/***************************************** - FUNCTIONS - ******************************************/ -exports.rad = function (x) { - return x * Math.PI / 180; -}; - -/* - @param p1: {lat:X,lng:Y} - @param p2: {lat:X,lng:Y} - */ -exports.get_distance = function (p1, p2) { - var R = 6378137; // Earth’s mean radius in meter - var dLat = exports.rad(p2.lat - p1.lat); - var dLong = exports.rad(p2.lng - p1.lng); - var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + - Math.cos(exports.rad(p1.lat)) * Math.cos(exports.rad(p2.lat)) * - Math.sin(dLong / 2) * Math.sin(dLong / 2); - var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); - var d = R * c; - return d; // returns the distance in meter -}; - -exports.send = function (socket, msg) { - socket.write(msg); -}; - -exports.parse_data = function (data) { - data = data.replace(/(\r\n|\n|\r)/gm, ''); //Remove 3 type of break lines - var cmd_start = data.indexOf('B'); //al the incomming messages has a cmd starting with 'B' - if (cmd_start > 13)throw 'Device ID is longer than 12 chars!'; - var parts = { - 'start': data.substr(0, 1), - 'device_id': data.substring(1, cmd_start), - 'cmd': data.substr(cmd_start, 4), - 'data': data.substring(cmd_start + 4, data.length - 1), - 'finish': data.substr(data.length - 1, 1) - }; - return parts; -}; - -exports.parse_gps_data = function (str) { - var data = { - 'date': str.substr(0, 6), - 'availability': str.substr(6, 1), - 'latitude': gps_minute_to_decimal(parseFloat(str.substr(7, 9))), - 'latitude_i': str.substr(16, 1), - 'longitude': gps_minute_to_decimal(parseFloat(str.substr(17, 9))), - 'longitude_i': str.substr(27, 1), - 'speed': str.substr(28, 5), - 'time': str.substr(33, 6), - 'orientation': str.substr(39, 6), - 'io_state': str.substr(45, 8), - 'mile_post': str.substr(53, 1), - 'mile_data': parseInt(str.substr(54, 8), 16) - }; - return data; -}; - -exports.send_to = function (socket, cmd, data) { - if (typeof(socket.device_id) == 'undefined')throw 'The socket is not paired with a device_id yet'; - var str = gps_format.start; - str += socket.device_id + gps_format.separator + cmd; - if (typeof(data) != 'undefined') str += gps_format.separator + data; - str += gps_format.end; - send(socket, str); - //Example: (||) - separator: | ,start: (, end: ) -}; - -exports.minute_to_decimal = function (pos, pos_i) { - if (typeof(pos_i) === 'undefined') pos_i = 'N'; - var dg = parseInt(pos / 100); - var minutes = pos - (dg * 100); - var res = (minutes / 60) + dg; - return (pos_i.toUpperCase() === 'S' || pos_i.toUpperCase() === 'W') ? res * -1 : res; -}; - -// Send a message to all clients -exports.broadcast = function (message, sender) { - clients.forEach(function (client) { - if (client === sender) return; - client.write(message); - }); - process.stdout.write(message + '\n'); -}; - -exports.data_to_hex_array = function (data) { - var arr = []; - for (var i = 0; i < data.length; i++)arr.push(data[i].toString(16)); - return arr; -}; - -/* RETRUN AN INTEGER FROM A HEX CHAR OR integer */ -exports.hex_to_int = function (hex_char) { - return parseInt(hex_char, 16); -}; - -exports.sum_hex_array = function (hex_array) { - var sum = 0; - for (var i in hex_array)sum += exports.hex_to_int(hex_array[i]); - return sum; -}; - -exports.hex_array_to_hex_str = function (hex_array) { - var str = ''; - for (var i in hex_array) { - var char; - if (typeof(hex_array[i]) === 'number') char = hex_array[i].toString(16); - else char = hex_array[i].toString(); - str += exports.str_pad(char, 2, '0'); - } - return str; -}; - -exports.str_pad = function (input, length, string) { - string = string || '0'; - input = input + ''; - return input.length >= length ? input : new Array(length - input.length + 1).join(string) + input; -}; - -exports.crc_itu_get_verification = function (hex_data) { - var crc16 = require('crc-itu').crc16; - if (typeof(hex_data) === 'String') str = hex_data; - else str = exports.hex_array_to_hex_str(hex_data); - return crc16(str, 'hex'); -}; \ No newline at end of file diff --git a/src/app/login/login.controller.js b/src/app/login/login.controller.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/assets/image/contact.controller (1).js b/src/assets/image/contact.controller (1).js deleted file mode 100644 index c0a78d9..0000000 --- a/src/assets/image/contact.controller (1).js +++ /dev/null @@ -1,6198 +0,0 @@ - -const Contact = require('../models/contacts'); -const Otp = require('../models/otpdb'); -var jwt = require('jsonwebtoken'); -var nodemailer = require('nodemailer'); -var mailer = require('../controllers/mailer'); -var request = require("request"); -var Count = require('../models/counter') -var crypto = require('crypto'); -const Device = require('../models/device'); -var ObjectId = require('mongodb').ObjectID; -var Utilities = require('../controllers/utilities.controller'); -var mongoose = require('mongoose'); -var org = require('../models/organisation') -var couponCode = require('../controllers/discountCode.controller'); - -const _poi = require('../models/poi'); - -//signUp and Email Verification - -// first_name: "ddddd" -// last_name: "aaaaa" -// email: "ga@adnate.in" -// pass: "q1q1q1" -// phone: "4434345554" -// supAdmin: "59cbbdbe508f164aa2fef3d8" -// isDealer: true -// expdate: "2021-03-31T10:06:06.363Z" -// Dealer: "5ab471736a40122297759ae9" -// user_id: "13123234435" -module.exports.createUserPeronalTracker = function (req, res) { - var pass = req.body.pass; - // delete req.body.pass; - req.body.salt = crypto.randomBytes(16).toString('hex'); - req.body.hash = crypto.pbkdf2Sync(pass, req.body.salt, 1000, 64, 'sha1').toString('hex'); - Contact.findOne({ $or: [{ "email": req.body.email }, { "phone": req.body.phone }] }).exec(function (err, data1) { - if (err) return res.send(err); - - if (data1 == null) { - var _contact = new Contact(req.body); - _contact.save(function (err, data) { - if (err) res.status(500).json({ "message": "Something Is Wrong" }); - res.send(data); - }) - } else { - if (data1.email == req.body.email) - res.status(500).json({ "message": "email already exists" }); - if (data1.phone == req.body.phone) - res.status(500).json({ "message": "Phone already exists" }); - } - }); - -} -module.exports.createUser = function (req, res) { - var pass = req.body.pass; - // delete req.body.pass; - req.body.salt = crypto.randomBytes(16).toString('hex'); - req.body.hash = crypto.pbkdf2Sync(pass, req.body.salt, 1000, 64, 'sha1').toString('hex'); - Contact.findOne({ $or: [{ "email": req.body.email }, { "phone": req.body.phone }] }).exec(function (err, data1) { - if (err) return res.send(err); - - if (data1 == null) { - var _contact = new Contact(req.body); - _contact.save(function (err, data) { - if (err) res.status(500).json({ "message": "Something Is Wrong" }); - res.send(data); - }) - } else { - if (data1.email == req.body.email) - res.status(500).json({ "message": "email already exists" }); - if (data1.phone == req.body.phone) - res.status(500).json({ "message": "Phone already exists" }); - } - }); - -} - -module.exports.createUserMany = function (req, res, next) { - req.trackRoute = req.body.trackRoute; - req.poi = req.body.poi; - req.stopNames = req.body.stopNames; - req.body = req.body.parent; - - //console.log("req.stopNames=>", req.stopNames); - _poi.insertMany(req.stopNames, function (error, docs) { - if (error) { - return console.log("ADD STOP POI DONE ERROR"); - } - // console.log("ADD STOP POI DONE", JSON.stringify(docs)); - }); - for (var i = 0; i < req.body.length; i++) { - (function (reqdata, id) { - Contact.findOne({ phone: reqdata.phone }, function (err, adventure) { - if (adventure == null) { - (function (addPRED, id2) { - addPRED.salt = crypto.randomBytes(16).toString('hex'); - addPRED.hash = crypto.pbkdf2Sync('Reset@123', addPRED.salt, 1000, 64, 'sha1').toString('hex'); - var _contact = new Contact(addPRED); - _contact.save(function (err, data) { - if (id == (req.body.length - 1)) { - //res.send({msg:'if allDONE!'}); - - next(); - } - }) - })(reqdata, id); - } else { - if (id == (req.body.length - 1)) { - //res.send({msg:'else allDONE!'}); - next(); - } - } - }) - })(req.body[i], i); - - } -} -module.exports.createUserMany1 = function (req, res) { - - async function cm() { - for (var dd in req.body) { - - Contact.findOne({ phone: req.body[dd].phone }, function (err, adventure) { - if (err) return; - if (adventure == null) { - // - req.body[dd].salt = crypto.randomBytes(16).toString('hex'); - req.body[dd].hash = crypto.pbkdf2Sync('Reset@123', req.body[dd].salt, 1000, 64, 'sha1').toString('hex'); - var _contact = new Contact(req.body[dd]); - - _contact.save(function (err, data) { - if (err) res.status(500).json({ "message": "Something Is Wrong" }); - // res.send(data); - }) - - // - } - }); - - } - } - cm().then(function (resp) { - res.send({ "mag": "success" }); - }) - - - -} - -module.exports.editUser = function (req, res) { - var pass = req.body.pass; - req.body.salt = crypto.randomBytes(16).toString('hex'); - req.body.hash = crypto.pbkdf2Sync(pass, req.body.salt, 1000, 64, 'sha1').toString('hex'); - - Contact.update({ _id: req.body._id }, { $set: req.body }, { multi: true }, function (err, data) { - if (err) return res.send(err); - else - res.send(data); - }); -} -module.exports.updateImagePath = function (req, res) { - if (req.body.imageDoc) { - - Contact.update({ _id: req.body._id }, { $set: { imageDoc: req.body.imageDoc } }, { multi: true }, function (err, data) { - if (err) return res.send(err); - else - res.send(data); - }); - } - -} - - -module.exports.signUp = function (req, res) { - if (req.body.org_name) { - newOrgJson = { - organisation_name: req.body.org_name, - phone: req.body.org_phone, - email: req.body.org_email, - website: req.body.org_website, - }; - var newOrg = new org(JSON.parse(JSON.stringify(newOrgJson))); - newOrg.save(function (err, organisation) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - if (organisation) { - - if (req.body.email == null && req.body.phone == null || req.body.email == undefined && req.body.phone == undefined || req.body.email == "undefined" && req.body.phone == "undefined") { - return res.status(401).json({ "message": "Null Value Error" }); - } - //superadmin can able to add dealer - - else if (req.body.sysadmin == true) { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, cuscount) { - if (error) { - console.error(error); - } - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (err, dealcount) { - if (err) { - console.error(err); - } - if (req.body.email && req.body.phone) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - role: req.body.roles, - supAdmin: req.body.supAdmin, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: true, - isSuperAdmin: false, - Dealer: req.body.Dealer, - supAdmin: req.body.supAdmin, - custumerid: 'c_' + cuscount.seq, - dealerid: 'd_' + dealcount.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - }; - if (req.body.group != "") { - newUserJson.group = req.body.group; - } - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - else { - res.status(200).json({ "message": "Registered Sucessfully" }); - - } - }) - } - }); - }); - } - else if (req.body.custumer == true) { - - var Distributer_string = req.body.user_id; - var user_regex = new RegExp(["^", Distributer_string, "$"].join(""), "i"); - Contact.findOne({ $or: [{ 'email': req.body.email }, { 'phone': req.body.phone }, { user_id: user_regex }] }, function (err, user) { - if (err) { - console.error(err) - } - else if (user) { - if (user.email == req.body.email) { - res.status(200).json({ "message": "Email ID already exists" }) - } else if (req.body.user_id == user.user_id) { - res.status(200).json({ "message": "USER_ID already exists" }) - } else if (user.phone == req.body.phone) { - res.status(200).json({ "message": "Mobile Number already exists" }) - } else { - res.status(200).json({ "message": "User Duplicate" }) - } - } - else{ - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, counter) { - if (error) { - console.error(error); - } - if (req.body.email && req.body.phone) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - supAdmin: req.body.supAdmin, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - return; - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - }) - } - else if (req.body.email) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - email: req.body.email.toLowerCase(), - phone: "nophone" + counter.seq, - email_verfi: true, - phone_verfi: true, - isDealer: false, - supAdmin: req.body.supAdmin, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - }) - } - else if (req.body.phone) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - phone: req.body.phone, - email_verfi: true, - supAdmin: req.body.supAdmin, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - email: 'noEmail' + counter.seq, - - custumerid: 'c_' + counter.seq, - - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // email:'noEmail'+ counter.seq - - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - }) - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - phone: req.body.phone, - email: req.body.email.toLowerCase(), - email_verfi: true, - phone_verfi: true, - supAdmin: req.body.supAdmin, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - }; - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - }) - } - - - }) - } - }) - - } - else if (req.body.otp && req.body.phone) { - var token; - Contact.findOne({ "phone": req.body.phone }).sort({ "timestamp": -1 }).exec(function (err, otpres) { - if (err) { - console.error(err); - return err; - } - if (otpres) { - // - var dbtime = new Date(otpres.timestamp); - var curtime = new Date(); - var diffMs = (curtime - dbtime); // milliseconds between now & Christmas - var diffDays = Math.floor(diffMs / 86400000); // days - var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours - var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes - if (otpres.otp == req.body.otp) { - Contact.update({ _id: otpres._id }, { $set: { phone_verfi: true } }, function (err, result) { - if (err) { - console.error(err) - return res.status(400).send(err); - } - else { - return res.status(200).json({ "message": "Mobile Verified" }); - } - }); - } - else { - res.status(500).json({ "message": "Didn't match otp" }); - } - } - }) - } - else if (req.body.phone && req.body.email) { - var Distributer_string = req.body.user_id; - var user_regex = new RegExp(["^", Distributer_string, "$"].join(""), "i"); - Contact.findOne({ $or: [{ 'email': req.body.email }, { 'phone': req.body.phone }, { user_id: user_regex }] }, function (err, user) { - if (err) { - console.error(err) - } - else if (user) { - if (user.email == req.body.email) { - res.status(200).json({ "message": "Email ID already exists" }) - } else if (req.body.user_id == user.user_id) { - res.status(200).json({ "message": "USER_ID already exists" }) - } else if (user.phone == req.body.phone) { - res.status(200).json({ "message": "Mobile Number already exists" }) - } else { - res.status(200).json({ "message": "User Duplicate" }) - } - } - else { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var otprand = randomString(4, '#'); - var randomemail = randomString(16, '#aA!'); - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - var newUserJson = { - - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - supAdmin: req.body.supAdmin, - org: organisation._id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - otp: otprand, - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - - timezone: req.body.timezone - }; - //console.log("Inside otp function0"); - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - newUser.save(function (err) { - if (err) { - if (err.name === 'MongoError' && err.code === 11000) { - // Duplicate username - return res.status(200).send({ succes: false, message: 'User already exist!' }); - } - - // Some other error - return res.status(500).send(err); - } - else { - request({ - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + req.body.phone + Utilities.getConfig().smsApiTextKey + 'Adnate%20IOT%20Your%20OTP%20is ' + otprand, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent Failed"}) - Contact.remove({"phone" :req.body.phone}).then(function(err){ - if(err){ - res.send(err); - return err; - } - }); - } */ - res.status(200).json({ "message": "OTP sent successfully1" }) - }); - } - }) - - }) - - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - supAdmin: req.body.supAdmin, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - otp: otprand, - id_email_ver: randomemail, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - timezone: req.body.timezone - }; - - // console.log("Inside otp function1"); - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - email(req.body.first_name, req.body.email, randomemail); - request({ - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + req.body.phone + Utilities.getConfig().smsApiTextKey + 'Use%20this%20One%20Time%20Password%20to%20validate%20your%20login ' + otprand, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent Failed"}) - Contact.remove({"phone" :req.body.phone}).then(function(err){ - if(err){ - res.send(err); - return err; - } - }); - } */ - res.status(200).json({ "message": "OTP sent successfully2" }) - }); - - }) - - } - - }) - - } - }) - - } - - - else if (req.body.phone) { - Contact.findOne({ "phone": req.body.phone }, function (err, ph) { - if (err) { - console.error(err); - } - else if (ph) { - res.status(500).json({ "message": "Mobile Number already Exists" }) - } - else { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - phone: req.body.phone, - supAdmin: req.body.supAdmin, - password: req.body.password, - email_verfi: true, - phone_verfi: true, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - - timezone: req.body.timezone - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - let datastore = newUserJson; - // let a = otp(newUserJson); - otp(newUserJson, function (final_data) { - - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent0" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - } - }) - }) - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - phone: req.body.phone, - supAdmin: req.body.supAdmin, - password: req.body.password, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - email_verfi: true, - phone_verfi: true, - timezone: req.body.timezone - - }; - // otp(newUserJson); - // let a = otp(newUserJson); - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - otp(newUserJson, function (final_data) { - - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - } - - }) - } - - }) - } - }) - - - } - - - - else if (req.body.email) { - - var randomemail = Math.floor((Math.random() * 100000000000000) + 54); - Contact.findOne({ "email": req.body.email.toLowerCase() }, function (err, em) { - if (err) { - console.error(err); - } - else if (em) { - res.status(500).json({ "message": "Email ID already Exists" }) - } - else { - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - supAdmin: req.body.supAdmin, - email: req.body.email.toLowerCase(), - email_verfi: true, - phone_verfi: true, - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - - timezone: req.body.timezone - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - }) - email(req.body.first_name, req.body.email, randomemail); - }) - - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - supAdmin: req.body.supAdmin, - email: req.body.email.toLowerCase(), - email_verfi: true, - phone_verfi: true, - id_email_ver: randomemail, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - - timezone: req.body.timezone - }; - - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - }) - email(req.body.first_name, req.body.email, randomemail); - } - }) - } - }) - } - else { - res.status(500).json({ "message": "Something Is Missing Email id or Phone Number" }); - } - - } - else { - res.status(400).send({ "message": "Server error" }) - } - - }) - } - else { - // if (req.body.email == null && req.body.phone == null || req.body.email == undefined && req.body.phone == undefined || req.body.email == "undefined" && req.body.phone == "undefined") { - // return res.status(401).json({ "message": "Null Value Error" }); - // } - //superadmin can able to add dealer - - // else - if (req.body.sysadmin == true) { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, cuscount) { - if (error) { - console.error(error); - } - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (err, dealcount) { - if (err) { - console.error(err); - } - if (req.body.email && req.body.phone) { - - - var user_string = req.body.user_id; - var user_regex = new RegExp(["^", user_string, "$"].join(""), "i"); - - Contact.findOne({ $or: [{ 'email': req.body.email }, { 'phone': req.body.phone }, { 'user_id': user_regex }] }, function (err, user) { - if (err) { - console.error(err) - } - else if (user) { - if (user.email == req.body.email) { - res.status(200).json({ "message": "Email ID already exists" }) - } else if (req.body.user_id == user.user_id) { - res.status(200).json({ "message": "USER_ID already exists" }) - } else if (user.phone == req.body.phone) { - res.status(200).json({ "message": "Mobile Number already exists" }) - } else { - res.status(200).json({ "message": "User Duplicate" }) - } - } - else { - - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - role: req.body.roles, - group: req.body.group, - supAdmin: req.body.supAdmin, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: true, - isSuperAdmin: false, - Dealer: req.body.Dealer, - supAdmin: req.body.supAdmin, - custumerid: 'c_' + cuscount.seq, - dealerid: 'd_' + dealcount.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - if (req.body.customer_role) { - newUserJson['customer_role'] = req.body.customer_role; - } - - var admin_identifier = req.body.supAdmin; - var tracktiveAndroidLink = 'https://play.google.com/store/apps/details?id=com.trackTive.ionic'; - var tracktiveIOSlink = 'https://apps.apple.com/us/app/tracktive/id1467327906?ls=1'; - if (req.body.imageDoc) { - newUserJson.imageDoc = req.body.imageDoc; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - return; - } - // res.status(200).json({ "message": "Registered Sucessfully" }); - var SMSURL = Utilities.getConfig().smsUrl; - - var mobile_key = Utilities.getConfig().smsApiMobileKey; - var txt_key = Utilities.getConfig().smsApiTextKey; - - // ======================================sms according to superAdmin ================================================= - Contact.findOne({ _id: admin_identifier }, function (err, adminDetail) { - if (err) { - res.status(400).send({ "message": "not able to fetch supadmin" }); - - } - - var msgOption = adminDetail.welcome_msg; - // Saanvi Security Solution - if ((msgOption != undefined) && (msgOption == true)) { - var organisationName = ((adminDetail.organisation_name != undefined) || (adminDetail.organisation_name != '')) ? adminDetail.organisation_name : 'OneQlik GPS'; - - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password; - if (organisationName == 'Tractive VTS') { - SMSURL += '&sender=TRACTV'; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + "%20App%20%Download%20link%20Android%20" + tracktiveAndroidLink + '%20IOS%20' + tracktiveIOSlink + '%20WEB%20LOGIN%20' + 'https://www.tracktive.in/login'; - } else if (organisationName === 'IConnect Technologies') { - SMSURL = Utilities.getConfig().smsUrl_iconnect; - SMSURL += '&senderid=AMASEC'; - mobile_key = Utilities.getConfig().smsApiMobileKey_iconnect; - txt_key = Utilities.getConfig().smsApiTextKey_iconnect; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + '%20WEB%20LOGIN%20' + 'http://www.iconnectindia.in'; - } else if (organisationName === 'Saanvi Security Solution') { - SMSURL = Utilities.getConfig().smsUrl_saanvi; - mobile_key = Utilities.getConfig().smsApiMobileKey_saanvi; - txt_key = Utilities.getConfig().smsApiTextKey_saanvi; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + '%20WEB%20LOGIN%20' + 'http://www.saanvisecurity.in'; - } - else { - SMSURL += '&sender=OneQlk'; - } - - request({ - uri: SMSURL + mobile_key + req.body.phone + txt_key + userCred1, - method: "GET" - }, function (error, response, body) { - res.status(200).json({ "message": "Registered and Message Sent Successfuly" }) - }); - - } else { - res.status(200).json({ "message": "Registered" }) - } - - - }) - - // ======================================sms according to superAdmin ================================================= - - }) - } - }) - - } else if (req.body.user_id) { - var user_string = req.body.user_id; - var user_regex = new RegExp(["^", user_string, "$"].join(""), "i"); - - Contact.findOne({ 'user_id': user_regex }, function (err, user) { - if (err) { - console.error(err) - } - else if (user) { - - res.status(200).json({ "message": "User Duplicate" }) - - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - role: req.body.roles, - group: req.body.group, - supAdmin: req.body.supAdmin, - email: 'no_email' + cuscount.seq + '@testmail.com', - phone: 'no_phone' + cuscount.seq, - email_verfi: true, - phone_verfi: true, - - isSuperAdmin: false, - - supAdmin: req.body.supAdmin, - custumerid: 'c_' + cuscount.seq, - dealerid: 'd_' + dealcount.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - }; - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - if (req.body.isDealer === true) { - newUserJson['isDealer'] = req.body.isDealer; - } else { - newUserJson['isDealer'] = false; - newUserJson['Dealer'] = req.body.Dealer; - } - - - if (req.body.imageDoc) { - newUserJson.imageDoc = req.body.imageDoc; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - return; - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - }) - - } - - }); - }); - } - else if (req.body.custumer == true) { - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, counter) { - - if (error) { - console.error(error); - } - - var user_string = req.body.user_id; - var user_regex = new RegExp(["^", user_string, "$"].join(""), "i"); - Contact.findOne({ $or: [{ 'email': req.body.email }, { 'phone': req.body.phone }, { 'user_id': user_regex }] }, function (err, user) { - - if (err) { - console.error(err) - } - else if ((user) && ((req.body.phone) || (req.body.email != null))) { - if (user.email == req.body.email) { - res.status(200).json({ "message": "Email ID already exists" }) - } else if (req.body.user_id == user.user_id) { - res.status(200).json({ "message": "USER_ID already exists" }) - } else if (user.phone == req.body.phone) { - res.status(200).json({ "message": "Mobile Number already exists" }) - } else { - res.status(200).json({ "message": "User Duplicate" }) - } - }else if((user)&&(req.body.phone == undefined)&&(req.body.email == null)){ - if(req.body.user_id == user.user_id){ - res.status(200).json({ "message": "USER_ID already exists" }) - }else{ - res.status(200).json({ "message": "Error in line 1084" }) - } - } - else { - if (req.body.email && req.body.phone) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - supAdmin: req.body.supAdmin, - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - if (req.body.imageDoc) { - newUserJson.imageDoc = req.body.imageDoc; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - var admin_identifier = req.body.supAdmin; - var tracktiveAndroidLink = 'https://play.google.com/store/apps/details?id=com.trackTive.ionic'; - var tracktiveIOSlink = 'https://apps.apple.com/us/app/tracktive/id1467327906?ls=1'; - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - return; - } - // res.status(200).json({ "message": "Registered Sucessfully" }); - // console.log("INside Signup function"); - // console.log(req.body.phone); - // console.log(req.body.password); - var SMSURL = Utilities.getConfig().smsUrl; - - var mobile_key = Utilities.getConfig().smsApiMobileKey; - var txt_key = Utilities.getConfig().smsApiTextKey; - - // ======================================sms according to superAdmin ================================================= - Contact.findOne({ _id: admin_identifier }, function (err, adminDetail) { - if (err) { - res.status(400).send({ "message": "not able to fetch supadmin" }); - - } - - - var msgOption = adminDetail.welcome_msg; - - - if ((msgOption != undefined) && (msgOption == true)) { - var organisationName = ((adminDetail.organisation_name != undefined) || (adminDetail.organisation_name != '')) ? adminDetail.organisation_name : 'OneQlik GPS'; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password; - if (organisationName == 'Tractive VTS') { - SMSURL += '&sender=TRACTV'; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + "%20App%20%Download%20link%20Android%20" + tracktiveAndroidLink + '%20IOS%20' + tracktiveIOSlink + '%20WEB%20LOGIN%20' + 'https://www.tracktive.in/login'; - } else if (organisationName === 'IConnect Technologies') { - SMSURL = Utilities.getConfig().smsUrl_iconnect; - SMSURL += '&senderid=AMASEC'; - mobile_key = Utilities.getConfig().smsApiMobileKey_iconnect; - txt_key = Utilities.getConfig().smsApiTextKey_iconnect; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + '%20WEB%20LOGIN%20' + 'http://www.iconnectindia.in'; - } else if (organisationName === 'Saanvi Security Solution') { - SMSURL = Utilities.getConfig().smsUrl_saanvi; - mobile_key = Utilities.getConfig().smsApiMobileKey_saanvi; - txt_key = Utilities.getConfig().smsApiTextKey_saanvi; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + '%20WEB%20LOGIN%20' + 'http://www.saanvisecurity.in'; - } else { - SMSURL += '&sender=OneQlk'; - } - - - - request({ - uri: SMSURL + mobile_key + req.body.phone + txt_key + userCred1, - method: "GET" - }, function (error, response, body) { - res.status(200).json({ "message": "Registered and Message Sent Successfuly" }) - }); - - } else { - res.status(200).json({ "message": "Registered" }) - } - }) - - // ======================================sms according to superAdmin ================================================= - }) - } - else if (req.body.email) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: "nophone" + counter.seq, - email_verfi: true, - supAdmin: req.body.supAdmin, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - if (req.body.imageDoc) { - newUserJson.imageDoc = req.body.imageDoc; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - - }) - } - else if (req.body.phone) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: req.body.phone, - email_verfi: true, - supAdmin: req.body.supAdmin, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - email: 'noEmail' + counter.seq, - - custumerid: 'c_' + counter.seq, - - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // email:'noEmail'+ counter.seq - - }; - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - if (req.body.imageDoc) { - newUserJson.imageDoc = req.body.imageDoc; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - var admin_identifier = req.body.supAdmin; - var tracktiveAndroidLink = 'https://play.google.com/store/apps/details?id=com.trackTive.ionic'; - var tracktiveIOSlink = 'https://apps.apple.com/us/app/tracktive/id1467327906?ls=1'; - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - - var SMSURL = Utilities.getConfig().smsUrl; - var mobile_key = Utilities.getConfig().smsApiMobileKey; - var txt_key = Utilities.getConfig().smsApiTextKey; - - // ======================================sms according to superAdmin ================================================= - Contact.findOne({ _id: admin_identifier }, function (err, adminDetail) { - if (err) { - res.status(400).send({ "message": "not able to fetch supadmin" }); - - } - - var msgOption = adminDetail.welcome_msg; - - if ((msgOption != undefined) && (msgOption == true)) { - var organisationName = ((adminDetail.organisation_name != undefined) || (adminDetail.organisation_name != '')) ? adminDetail.organisation_name : 'OneQlik GPS'; - - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password; - - if (organisationName == 'Tractive VTS') { - SMSURL += '&sender=TRACTV'; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + "%20App%20%Download%20link%20Android%20" + tracktiveAndroidLink + '%20IOS%20' + tracktiveIOSlink + '%20WEB%20LOGIN%20' + 'https://www.tracktive.in/login'; - } else if (organisationName === 'IConnect Technologies') { - SMSURL = Utilities.getConfig().smsUrl_iconnect; - SMSURL += '&senderid=AMASEC'; - mobile_key = Utilities.getConfig().smsApiMobileKey_iconnect; - txt_key = Utilities.getConfig().smsApiTextKey_iconnect; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + '%20WEB%20LOGIN%20' + 'http://www.iconnectindia.in'; - } else if (organisation_name === 'Saanvi Security Solution') { - SMSURL = Utilities.getConfig().smsUrl_saanvi; - mobile_key = Utilities.getConfig().smsApiMobileKey_saanvi; - txt_key = Utilities.getConfig().smsApiTextKey_saanvi; - var userCred1 = 'Dear%20' + req.body.first_name + "%20Welcome%20to%20" + organisationName + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + req.body.phone + '%20Password%20' + req.body.password + '%20WEB%20LOGIN%20' + 'http://www.saanvisecurity.in'; - } else { - SMSURL += '&sender=OneQlk'; - } - - - request({ - uri: SMSURL + mobile_key + req.body.phone + txt_key + userCred1, - method: "GET" - }, function (error, response, body) { - res.status(200).json({ "message": "Registered and Message Sent Successfuly" }) - }); - - } else { - res.status(200).json({ "message": "Registered" }) - } - }) - - // ======================================sms according to superAdmin ================================================= - - }) - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: 'no_phone' + counter.seq, - supAdmin: req.body.supAdmin, - email: 'no_email' + counter.seq + '@testmail.com', - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - }; - - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - - if (req.body.imageDoc) { - newUserJson.imageDoc = req.body.imageDoc; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - } - }) - - - }) - - } - else if (req.body.otp && req.body.phone) { - var token; - Contact.findOne({ "phone": req.body.phone }).sort({ "timestamp": -1 }).exec(function (err, otpres) { - if (err) { - console.error(err); - return err; - } - if (otpres) { - // - var dbtime = new Date(otpres.timestamp); - var curtime = new Date(); - var diffMs = (curtime - dbtime); // milliseconds between now & Christmas - var diffDays = Math.floor(diffMs / 86400000); // days - var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours - var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes - if (otpres.otp == req.body.otp) { - Contact.update({ _id: otpres._id }, { $set: { phone_verfi: true } }, function (err, result) { - if (err) { - console.error(err) - return res.status(400).send(err); - } - else { - return res.status(200).json({ "message": "Mobile Verified" }); - } - }); - } - else { - res.status(500).json({ "message": "Didn't match otp" }); - } - } - }) - } - else if (req.body.phone && req.body.email) { - var Distributer_string = req.body.user_id; - var user_regex = new RegExp(["^", Distributer_string, "$"].join(""), "i"); - - Contact.findOne({ $or: [{ 'email': req.body.email }, { 'phone': req.body.phone }, { 'user_id': user_regex }] }, function (err, user) { - if (err) { - console.error(err) - } - else if (user) { - - if (user.email == req.body.email) { - res.status(200).json({ "message": "Email ID already exists" }) - } else if (req.body.user_id == user.user_id) { - res.status(200).json({ "message": "USER_ID already exists" }) - } else if (user.phone == req.body.phone) { - res.status(200).json({ "message": "Mobile Number already exists" }) - } else { - res.status(200).json({ "message": "User Duplicate" }) - } - - - } - else { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var otprand = randomString(4, '#'); - var randomemail = randomString(16, '#aA!'); - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - var newUserJson = { - - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - supAdmin: req.body.supAdmin, - phone_verfi: true, - otp: otprand, - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - timezone: req.body.timezone - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - if (req.body.organisation) { - newUserJson.organisation = req.body.organisation; - newUserJson.isSuperAdmin = req.body.isSuperAdmin; - newUserJson.isDealer = false; - newUserJson.phone_verfi = true; - newUserJson.organisation_name = req.body.organisation_name; - newUserJson.welcome_msg = req.body.welcome_msg; - - - newUserJson.user_id = req.body.user_id; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - newUser.save(function (err) { - if (err) { - if (err.name === 'MongoError' && err.code === 11000) { - // Duplicate username - return res.status(200).send({ succes: false, message: 'User already exist!' }); - } - - // Some other error - return res.status(500).send(err); - } - else { - request({ - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + req.body.phone + Utilities.getConfig().smsApiTextKey + 'Adnate%20IOT%20Your%20OTP%20is ' + otprand, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent Failed"}) - Contact.remove({"phone" :req.body.phone}).then(function(err){ - if(err){ - res.send(err); - return err; - } - }); - } */ - res.status(200).json({ "message": "OTP sent successfully3" }) - }); - } - }) - - }) - - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - - supAdmin: req.body.supAdmin, - Dealer: req.body.supAdmin, - phone_verfi: true, - email_verfi: true, - otp: otprand, - id_email_ver: randomemail, - isDealer: req.body.dealer ? req.body.dealer : req.body.isDealer, - custumerid: 'c_' + count.seq, - timezone: req.body.timezone, - custumer: true - }; - //console.log("Inside otp function3"); - //console.log("we are at 1158 while creating distributer"); - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - if (req.body.organisation) { - newUserJson.organisation = req.body.organisation; - newUserJson.user_id = req.body.user_id; - newUserJson.isSuperAdmin = req.body.isSuperAdmin; - newUserJson.organisation_name = req.body.organisation_name; - newUserJson.welcome_msg = req.body.welcome_msg; - newUserJson.isDealer = false; - newUserJson.phone_verfi = true; - } - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - if (req.body.purpose == "zettrack") { - var smsUri = Utilities.getConfig().ZettracksmsUrl + "&mobileNos=" + req.body.phone + "&message=" + "Welcome%20to%20ZTrack%20Sreerampore%20Use%20this%20One%20Time%20Password%20to%20validate%20your%20login" + otprand; - } else { - var smsUri = Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + req.body.phone + Utilities.getConfig().smsApiTextKey + 'Use%20this%20One%20Time%20Password%20to%20validate%20your%20login ' + otprand; - } - newUser.save(function (err, userObj) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - email(req.body.first_name, req.body.email, randomemail); - request({ - uri: smsUri, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent Failed"}) - Contact.remove({"phone" :req.body.phone}).then(function(err){ - if(err){ - res.send(err); - return err; - } - }); - } */ - res.status(200).json({ "message": "OTP sent successfully", "user": userObj }) - }); - - }) - - } - - - - }) - - - - } - }) - - } - - - else if (req.body.phone) { - Contact.findOne({ "phone": req.body.phone }, function (err, ph) { - if (err) { - console.error(err); - } - else if (ph) { - res.status(500).json({ "message": "Mobile Number already Exists" }) - } - else { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: req.body.phone, - supAdmin: req.body.supAdmin, - password: req.body.password, - phone_verfi: true, - email_verfi: true, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - - timezone: req.body.timezone - - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - let datastore = newUserJson; - // let a = otp(newUserJson); - otp(newUserJson, function (final_data) { - - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - - } - - }) - - }) - - - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: req.body.phone, - supAdmin: req.body.supAdmin, - password: req.body.password, - phone_verfi: true, - email_verfi: true, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - - timezone: req.body.timezone - - }; - // otp(newUserJson); - // let a = otp(newUserJson); - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - otp(newUserJson, function (final_data) { - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - } - - }) - } - - }) - } - }) - - - } - - - - else if (req.body.email) { - - var randomemail = Math.floor((Math.random() * 100000000000000) + 54); - Contact.findOne({ "email": req.body.email.toLowerCase() }, function (err, em) { - if (err) { - console.error(err); - } - else if (em) { - res.status(500).json({ "message": "Email ID already Exists" }) - } - else { - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - supAdmin: req.body.supAdmin, - email: req.body.email.toLowerCase(), - email_verfi: true, - phone_verfi: true, - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - - timezone: req.body.timezone - }; - - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - }) - email(req.body.first_name, req.body.email, randomemail); - }) - - } - else { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - email_verfi: true, - phone_verfi: true, - supAdmin: req.body.supAdmin, - id_email_ver: randomemail, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - - timezone: req.body.timezone - }; - if (req.body.std_code) { - newUserJson['std_code'] = req.body.std_code; - } - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - - }) - email(req.body.first_name, req.body.email, randomemail); - } - }) - - - } - }) - - - } - else { - res.status(500).json({ "message": "Something Is Missing Email id or Phone Number" }); - } - - } -} - - - -// ============================== -module.exports.signUpZogo = function (req, res) { - if (req.body.org_name) { - //console.log("Inside function"); - newOrgJson = { - organisation_name: req.body.org_name, - phone: req.body.org_phone, - email: req.body.org_email, - website: req.body.org_website, - }; - var newOrg = new org(JSON.parse(JSON.stringify(newOrgJson))); - newOrg.save(function (err, organisation) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - if (organisation) { - - if (req.body.email == null && req.body.phone == null || req.body.email == undefined && req.body.phone == undefined || req.body.email == "undefined" && req.body.phone == "undefined") { - return res.status(401).json({ "message": "Null Value Error" }); - } - //superadmin can able to add dealer - - else if (req.body.sysadmin == true) { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, cuscount) { - if (error) { - console.error(error); - } - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (err, dealcount) { - if (err) { - console.error(err); - } - if (req.body.email && req.body.phone) { - console.log("1"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - role: req.body.roles, - group: req.body.group, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: true, - isSuperAdmin: false, - Dealer: req.body.Dealer, - supAdmin: req.body.supAdmin, - custumerid: 'c_' + cuscount.seq, - dealerid: 'd_' + dealcount.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - status: req.body.status, - address: req.body.address, - purpose: "zogo", - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - }); - }); - } - else if (req.body.custumer == true) { - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, counter) { - - if (error) { - console.error(error); - } - if (req.body.email && req.body.phone) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - status: req.body.status, - purpose: "zogo", - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - return; - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - else if (req.body.email) { - //console.log("2"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - email: req.body.email.toLowerCase(), - phone: "nophone" + counter.seq, - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - status: req.body.status, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - purpose: "zogo", - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - else if (req.body.phone) { - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: false, - status: req.body.status, - - Dealer: req.body.Dealer, - email: 'noEmail' + counter.seq, - - custumerid: 'c_' + counter.seq, - - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // email:'noEmail'+ counter.seq - - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - else { - // console.log("3"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - phone: req.body.phone, - email: req.body.email.toLowerCase(), - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - status: req.body.status, - purpose: "zogo", - expire_date: new Date(req.body.expdate) - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - - - }) - - } - else if (req.body.otp && req.body.phone) { - - var token; - Contact.findOne({ "phone": req.body.phone }).sort({ "timestamp": -1 }).exec(function (err, otpres) { - if (err) { - console.error(err); - return err; - } - if (otpres) { - // - var dbtime = new Date(otpres.timestamp); - var curtime = new Date(); - var diffMs = (curtime - dbtime); // milliseconds between now & Christmas - var diffDays = Math.floor(diffMs / 86400000); // days - var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours - var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes - if (otpres.otp == req.body.otp) { - Contact.update({ _id: otpres._id }, { $set: { phone_verfi: true } }, function (err, result) { - if (err) { - console.error(err) - return res.status(400).send(err); - } - else { - return res.status(200).json({ "message": "Mobile Verified" }); - } - }); - } - else { - res.status(500).json({ "message": "Didn't match otp" }); - } - } - }) - } - else if (req.body.phone && req.body.email) { - Contact.findOne({ $or: [{ 'email': req.body.email }, { 'phone': req.body.phone }] }, function (err, user) { - if (err) { - console.error(err) - } - else if (user) { - res.status(200).json({ "message": "Email ID or Mobile Number already exists" }) - } - else { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var otprand = randomString(4, '#'); - var randomemail = randomString(16, '#aA!'); - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - //console.log("4"); - var newUserJson = { - - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: false, - phone_verfi: false, - otp: otprand, - status: req.body.status, - purpose: "zogo", - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - - timezone: req.body.timezone - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - newUser.save(function (err) { - if (err) { - if (err.name === 'MongoError' && err.code === 11000) { - // Duplicate username - return res.status(200).send({ succes: false, message: 'User already exist!' }); - } - - // Some other error - return res.status(500).send(err); - } - else { - request({ - uri: Utilities.getConfig().smsUrl_zogo + Utilities.getConfig().smsApiMobileKeyzogo + req.body.phone + Utilities.getConfig().smsApiTextKeyzogo + 'Zogo%20Rides%20Your%20OTP%20is ' + otprand, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent Failed"}) - Contact.remove({"phone" :req.body.phone}).then(function(err){ - if(err){ - res.send(err); - return err; - } - }); - } */ - res.status(200).json({ "message": "OTP sent successfully" }) - }); - } - }) - - }) - - } - else { - //console.log("5"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: false, - phone_verfi: false, - otp: otprand, - status: req.body.status, - purpose: "zogo", - id_email_ver: randomemail, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - - timezone: req.body.timezone - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - email(req.body.first_name, req.body.email, randomemail); - request({ - uri: Utilities.getConfig().smsUrl_zogo + Utilities.getConfig().smsApiMobileKeyzogo + req.body.phone + Utilities.getConfig().smsApiTextKeyzogo + 'Zogo%20Rides%20Your%20OTP%20is ' + otprand, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent Failed"}) - Contact.remove({"phone" :req.body.phone}).then(function(err){ - if(err){ - res.send(err); - return err; - } - }); - } */ - res.status(200).json({ "message": "OTP sent successfully" }) - }); - }) - } - }) - } - }) - - } - else if (req.body.phone) { - Contact.findOne({ "phone": req.body.phone }, function (err, ph) { - if (err) { - console.error(err); - } - else if (ph) { - res.status(500).json({ "message": "Mobile Number already Exists" }) - } - else { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - // console.log("6"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - phone: req.body.phone, - status: req.body.status, - password: req.body.password, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - purpose: "zogo", - timezone: req.body.timezone - - }; - let datastore = newUserJson; - // let a = otp(newUserJson); - otp(newUserJson, function (final_data) { - - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - - } - - }) - - }) - - - } - else { - //console.log("7"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - phone: req.body.phone, - password: req.body.password, - isDealer: req.body.dealer, - status: req.body.status, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - purpose: "zogo", - timezone: req.body.timezone - - }; - // otp(newUserJson); - // let a = otp(newUserJson); - otp(newUserJson, function (final_data) { - - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - } - - }) - } - - }) - } - }) - - - } - - - - else if (req.body.email) { - - var randomemail = Math.floor((Math.random() * 100000000000000) + 54); - Contact.findOne({ "email": req.body.email.toLowerCase() }, function (err, em) { - if (err) { - console.error(err); - } - else if (em) { - res.status(500).json({ "message": "Email ID already Exists" }) - } - else { - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - //console.log("8"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: organisation._id, - email: req.body.email.toLowerCase(), - email_verfi: false, - phone_verfi: false, - status: req.body.status, - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - purpose: "zogo", - timezone: req.body.timezone - }; - - - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - email(req.body.first_name, req.body.email, randomemail); - }) - - } - else { - //console.log("9"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - email: req.body.email.toLowerCase(), - email_verfi: false, - status: req.body.status, - phone_verfi: false, - id_email_ver: randomemail, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - purpose: "zogo", - timezone: req.body.timezone - }; - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - email(req.body.first_name, req.body.email, randomemail); - } - }) - - - } - }) - - - } - else { - res.status(500).json({ "message": "Something Is Missing Email id or Phone Number" }); - } - - } - else { - res.status(400).send({ "message": "Server error" }) - } - - }) - } - else { - if (req.body.email == null && req.body.phone == null || req.body.email == undefined && req.body.phone == undefined || req.body.email == "undefined" && req.body.phone == "undefined") { - return res.status(401).json({ "message": "Null Value Error" }); - } - //superadmin can able to add dealer - - else if (req.body.sysadmin == true) { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, cuscount) { - if (error) { - console.error(error); - } - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (err, dealcount) { - if (err) { - console.error(err); - } - if (req.body.email && req.body.phone) { - //console.log("10"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - role: req.body.roles, - group: req.body.group, - status: req.body.status, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: true, - isSuperAdmin: false, - Dealer: req.body.Dealer, - supAdmin: req.body.supAdmin, - custumerid: 'c_' + cuscount.seq, - dealerid: 'd_' + dealcount.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - purpose: "zogo", - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - }); - }); - } - else if (req.body.custumer == true) { - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, counter) { - - if (error) { - console.error(error); - } - if (req.body.email && req.body.phone) { - //console.log("11"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - status: req.body.status, - address: req.body.address, - purpose: "zogo", - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - newUser.save(function (err, u) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - return; - } - res.status(200).json({ "message": "Registered Sucessfully" }); - - - }) - } - else if (req.body.email) { - //console.log("12"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: "nophone" + counter.seq, - email_verfi: true, - phone_verfi: true, - status: req.body.status, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - purpose: "zogo", - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // phone:'noNumber'+ counter.seq - - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - else if (req.body.phone) { - //console.log("13"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: req.body.phone, - email_verfi: true, - phone_verfi: true, - status: req.body.status, - isDealer: false, - Dealer: req.body.Dealer, - email: 'noEmail' + counter.seq, - purpose: "zogo", - custumerid: 'c_' + counter.seq, - - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - expire_date: new Date(req.body.expdate) - // email:'noEmail'+ counter.seq - - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - else { - //console.log("14"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: req.body.phone, - email: req.body.email.toLowerCase(), - email_verfi: true, - phone_verfi: true, - isDealer: false, - Dealer: req.body.Dealer, - custumerid: 'c_' + counter.seq, - timezone: req.body.timezone, - user_id: req.body.user_id, - address: req.body.address, - purpose: "zogo", - status: req.body.status, - expire_date: new Date(req.body.expdate) - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - // var newUser = new Contact(newUserJson); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - } - - - }) - - } - else if (req.body.otp && req.body.phone) { - var token; - Contact.findOne({ "phone": req.body.phone }).sort({ "timestamp": -1 }).exec(function (err, otpres) { - if (err) { - console.error(err); - return err; - } - if (otpres) { - // - var dbtime = new Date(otpres.timestamp); - var curtime = new Date(); - var diffMs = (curtime - dbtime); // milliseconds between now & Christmas - var diffDays = Math.floor(diffMs / 86400000); // days - var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours - var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes - if (otpres.otp == req.body.otp) { - Contact.update({ _id: otpres._id }, { $set: { phone_verfi: true } }, function (err, result) { - if (err) { - console.error(err) - return res.status(400).send(err); - } - else { - // otpres.email - //console.log(otpres.email); - var mailOptions = { - from: Utilities.getConfig().mailUserZogo, // sender address - to: otpres.email, // gaurav.gupta@adnate.in list of receivers - subject: 'Zogorides', // Subject line - // text: "New Task", - html: `

` + "Hi " + otpres.first_name + `

Thanks for joining Zogorides.

Now that you have signed up, book and enjoy your ride.

Thanks!
Zogorides Team


© 2019 Zogorides. Join the conversation

Please do not reply directly to this email.

You can get help from our knowledge base.

If you don't want to receive emails like this again, please click hereto unsubscribe.


Plot No â?“ 23 Sector-18 Gurgaon,Haryana 122002
info@zogorides.com , support@zogorides.com
www.zogorides.com

` - } - mailer.sendZogoSignupMail(mailOptions); - return res.status(200).json({ "message": "Mobile Verified" }); - } - }); - } - else { - res.status(500).json({ "message": "Didn't match otp" }); - } - } - }) - } - else if (req.body.phone && req.body.email) { - //console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") - Contact.findOne({ $or: [{ 'email': req.body.email }, { 'phone': req.body.phone }] }, function (err, user) { - if (err) { - console.error(err) - } - else if (user) { - res.status(200).json({ "message": "Email ID or Mobile Number already exists" }) - } - else { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var otprand = randomString(4, '#'); - var randomemail = randomString(16, '#aA!'); - - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - // console.log("15"); - var newUserJson = { - - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: false, - phone_verfi: false, - otp: otprand, - status: req.body.status, - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - purpose: "zogo", - timezone: req.body.timezone - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - newUser.save(function (err, u) { - if (err) { - if (err.name === 'MongoError' && err.code === 11000) { - // Duplicate username - return res.status(200).send({ succes: false, message: 'User already exist!' }); - } - - // Some other error - return res.status(500).send(err); - } - if (u) { - //console.log("in uuuuu"); - var newCode = { - "code": "FirstFree", - "isPercent": false, - "amount": "50", - "expireDate": new Date(req.body.expdate), - "isActive": true, - "countMax": "1", - "onOrder": [ - "1" - ], - "maxDiscount": "50", - "minOrderAmount": "", - "type": "ONETIME" - } - newCode.user = u[0]._id - couponCode.addDiscountCodeOnSignup(newCode); - res.status(200).json({ "message": "OTP sent successfully" }); - // request({ - - - // uri: Utilities.getConfig().smsUrl_zogo + Utilities.getConfig().smsApiMobileKeyzogo + req.body.phone + Utilities.getConfig().smsApiTextKeyzogo + 'Zogo%20Rides%20Your%20OTP%20is ' + otprand, - // method: "GET" - // }, function (error, response, body) { - // /* var jsonObj = JSON.parse(response.body); - // if(jsonObj.MsgStatus == 'Sent'){ - // email(req.body.first_name,req.body.email,randomemail); - // res.status(200).json({"message" : "OTP sent successfully"}) - - // } - // else{ - // res.status(500).json({"message" : "OTP sent Failed"}) - // Contact.remove({"phone" :req.body.phone}).then(function(err){ - // if(err){ - // res.send(err); - // return err; - // } - // }); - // } */ - // res.status(200).json({ "message": "OTP sent successfully" }); - - // }); - } - }) - - }) - - } - else { - // console.log("16"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - phone: req.body.phone, - email_verfi: false, - phone_verfi: false, - otp: otprand, - id_email_ver: randomemail, - isDealer: req.body.dealer, - status: req.body.status, - custumerid: 'c_' + count.seq, - timezone: req.body.timezone, - purpose: "zogo", - }; - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - newUser.save(function (err, u) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - - - //console.log("in uuuuu", u); - var newCode = { - "code": "FirstFree", - "isPercent": false, - "amount": "50", - "expireDate": new Date(req.body.expdate), - "isActive": true, - "countMax": "1", - "onOrder": [ - "1" - ], - "maxDiscount": "50", - "minOrderAmount": "", - "type": "ONETIME" - } - newCode.user = u._id - couponCode.addDiscountCodeOnSignup(newCode); - email(req.body.first_name, req.body.email, randomemail); - request({ - - - uri: Utilities.getConfig().smsUrl_zogo + Utilities.getConfig().smsApiMobileKeyzogo + req.body.phone + Utilities.getConfig().smsApiTextKeyzogo + 'Zogo%20Rides%20Your%20OTP%20is ' + otprand, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent Failed"}) - Contact.remove({"phone" :req.body.phone}).then(function(err){ - if(err){ - res.send(err); - return err; - } - }); - } */ - - // res.status(200).json({ "message": "OTP sent successfully" }); - res.status(200).json({ "message": "OTP sent successfully" }) - }); - - }) - - } - - - - }) - - - - } - }) - - } - - - else if (req.body.phone) { - Contact.findOne({ "phone": req.body.phone }, function (err, ph) { - if (err) { - console.error(err); - } - else if (ph) { - res.status(500).json({ "message": "Mobile Number already Exists" }) - } - else { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - //console.log("17"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: req.body.phone, - password: req.body.password, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - status: req.body.status, - purpose: "zogo", - timezone: req.body.timezone - - }; - let datastore = newUserJson; - // let a = otp(newUserJson); - otp(newUserJson, function (final_data) { - - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - - } - - }) - - }) - - - } - else { - console.log("18"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - phone: req.body.phone, - password: req.body.password, - isDealer: req.body.dealer, - custumerid: 'c_' + count.seq, - email: 'noEmail' + count.seq, - status: req.body.status, - purpose: "zogo", - timezone: req.body.timezone - - }; - // otp(newUserJson); - // let a = otp(newUserJson); - otp(newUserJson, function (final_data) { - - if (final_data == true) { - res.status(200).json({ "message": "OTP Successfully Sent" }); - } - else { - res.status(500).json({ "message": "OTP sent Failed" }) - Contact.remove({ "phone": req.body.phone }).then(function (err) { - if (err) { - // res.send(err); - // return err; - } - }); - } - - }) - } - - }) - } - }) - - - } - - - - else if (req.body.email) { - - var randomemail = Math.floor((Math.random() * 100000000000000) + 54); - Contact.findOne({ "email": req.body.email.toLowerCase() }, function (err, em) { - if (err) { - console.error(err); - } - else if (em) { - res.status(500).json({ "message": "Email ID already Exists" }) - } - else { - Count.findByIdAndUpdate({ _id: 'custumer' }, { $inc: { seq: 1 } }, function (error, count) { - if (req.body.dealer == true) { - Count.findByIdAndUpdate({ _id: 'dealer' }, { $inc: { seq: 1 } }, function (error, counter) { - console.log("19"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - email_verfi: false, - phone_verfi: false, - id_email_ver: randomemail, - isDealer: req.body.dealer, - dealerid: 'd_' + counter.seq, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - status: req.body.status, - purpose: "zogo", - timezone: req.body.timezone - }; - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - email(req.body.first_name, req.body.email, randomemail); - }) - - } - else { - console.log("20"); - var newUserJson = { - first_name: req.body.first_name, - last_name: req.body.last_name, - org_name: req.body.org_name, - org: req.body.org_id, - email: req.body.email.toLowerCase(), - email_verfi: false, - phone_verfi: false, - id_email_ver: randomemail, - isDealer: req.body.dealer, - status: req.body.status, - custumerid: 'c_' + count.seq, - phone: 'noNumber' + count.seq, - purpose: "zogo", - timezone: req.body.timezone - }; - - var newUser = new Contact(JSON.parse(JSON.stringify(newUserJson))); - newUser.setPassword(req.body.password); - newUser.setLastReportDate(); - - newUser.save(function (err) { - if (err) { - res.status(500).json({ "message": "Something Is Wrong" } + err); - } - res.status(200).json({ "message": "Registered Sucessfully" }); - }) - email(req.body.first_name, req.body.email, randomemail); - } - }) - - - } - }) - - - } - else { - res.status(500).json({ "message": "Something Is Missing Email id or Phone Number" }); - } - - } -} -// ================================== -function email(fname, emailid, verid) { - - var url = "http://" + Utilities.getConfig().webAppIp + ":" + Utilities.getConfig().EPort + "/users/emailverfi?id=" + encodeURIComponent(verid); - - var mailOptions = { - from: Utilities.getConfig().mailUser, // sender address - to: emailid.toLowerCase(), // list of receivers - subject: Utilities.getConfig().orgName + "- Mail Verification", // Subject line - text: "New Task", // plaintext body emailverfi - html: 'Dear ' + fname + ',

Thank you for registering with us.
You are just one click away from using our services.Please verify your mail by clicking below button.


Thanks
Regards
Team AdnateIOT'// html body - } - mailer.sendMail(mailOptions); - - -} - -module.exports.zogoUserUpdate = function (req, res) { - if (req.body.phone) { - Contact.findOne({ "phone": req.body.phone }, function (err, user) { - if (err) { - console.error(err); - } - if (user) { - if (req.body.img_type == "adharCard") { - user.aadharImg = req.body.image_path; - } - if (req.body.img_type == "drivingLicence") { - user.dl_path = req.body.image_path; - } - if (req.body.img_type == "selfie") { - user.userImg = req.body.image_path; - } - user.save(function (err) { - if (err) { - console.error("otp error :" + err); - return err; - } - else { - res.status(200).send({ "message": "image saved successfully" }) - } - }) - } - else { - res.status(200).send({ "message": "user not found" }) - } - }) - - } - -} - - - -function otp(data, recur) { - - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var randomotp = randomString(4, '#'); - if (data.dealerid) { - var newOtpJson = { - first_name: data.first_name, - last_name: "", - org_name: data.org_name, - phone: data.phone, - otp: randomotp, - email_verfi: false, - phone_verfi: false, - isDealer: data.isDealer, - dealerid: data.dealerid, - custumerid: data.custumerid, - email: 'noEmail' + data.custumerid, - purpose: "zogo", - status: false, - timezone: req.body.timezone - - - }; - var newOtp = new Contact(JSON.parse(JSON.stringify(newOtpJson))); - newOtp.setPassword(data.password); - newOtp.setLastReportDate(); - - - newOtp.save(function (err) { - if (err) { - console.error("otp error :" + err); - return err; - } - - request({ - - - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + data.phone + Utilities.getConfig().smsApiTextKey + 'Adnate%20IOT%20Your%20OTP%20is ' + randomotp, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - // email(req.body.first_name,req.body.email,randomemail); - // res.status(200).json({"message" : "OTP sent successfully"}) - - recur(true); - } - else{ - // res.status(500).json({"message" : "OTP sent Failed"}) - recur(false); - } */ - recur(true); - }); - - }); - } - else { - var newOtpJson = { - first_name: data.first_name, - last_name: "", - org_name: data.org_name, - phone: data.phone, - otp: randomotp, - email_verfi: false, - phone_verfi: false, - isDealer: data.isDealer, - custumerid: data.custumerid, - email: 'noEmail' + data.custumerid, - purpose: "zogo", - status: false - // timezone: req.body.timezone - - }; - var newOtp = new Contact(JSON.parse(JSON.stringify(newOtpJson))); - - newOtp.setPassword(data.password); - newOtp.setLastReportDate(); - - // var newUser = new Contact(newUserJson); - - - newOtp.save(function (err) { - if (err) { - console.error("otp error :" + err); - return err; - } - - request({ - - - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + data.phone + Utilities.getConfig().smsApiTextKey + 'Adnate%20IOT%20Your%20OTP%20is ' + randomotp, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - // email(data.first_name,data.email,randomemail); - // res.status(200).json({"message" : "OTP sent successfully"}) - recur(true); - } - else{ - // res.status(500).json({"message" : "OTP sent Failed"}) - recur(false); - } */ - recur(true); - }); - - }); - } - -} - -module.exports.find = function (req, res) { - req.body = evaluate(req.body); - var qr = Contact.find(req.body._find); - if (req.body._limit) - qr.limit(req.body._limit); - if (req.body._sort) - qr.sort(req.body._sort); - if (req.body._select) - qr.select(req.body._select); - if (req.body.school) - qr.populate({ 'path': 'school', select: req.body.school }) - - qr.exec(function (err, data) { - if (err) return res.send(err); - else - res.send(data); - }) -} - -module.exports.emailverfi = function (req, res) { - - Contact.findOne({ "id_email_ver": (req.query.id) }).exec(function (err, sd) { - - if (err) { - return res.status(401).send("Error ::" + err) - console.error(err); - } - else if (sd) { - - Contact.update({ _id: sd._id }, { $set: { email_verfi: true } }, function (err, result) { - if (err) { - console.error(err) - return res.status(400).send(err); - } - else { - - return res.redirect(Utilities.getConfig().webAppDomain + '/login'); - - } - }); - - - } - else { - return res.status(401).send("Error ::" + err) - console.error(err); - } - }) -} - -// module.exports.getAllUsersForSuperUser = function(req, res) { -// Contact.findOne({_id : req.body.user, isSuperUser : true}, function(err, superUser){ -// if(err){ -// console.error(err); -// res.send(500); -// return; -// } -// else if(superUser){ -// Contact.find({isDealer : true},function(err, contacts){ -// if(err){ -// console.error(err); -// res.send(500); -// return; -// } -// res.status(200).send(contacts); - -// }); -// } -// }) - -// } - -//retreve data (signup/login) -module.exports.getAllUsers = function (req, res) { - var id = ""; - if (req.query.dealer) { - id = req.query.dealer - } else if (req.query.user) { - id = req.query.user - } - - Contact.findOne({ _id: id }, function (err, dealer) { - if (err) { - console.error(err); - res.send(500); - return; - } - if (dealer) { - var query = {}; - if (req.query.dealer) { - query = { $or: [{ 'Dealer': req.query.dealer }, { group: { $in: dealer.group } }] } - } - if (req.query.user) { - query = { $or: [{ $and: [{ 'Dealer': dealer.Dealer }, { '_id': { $nin: [req.query.user] } }] }, { '_id': dealer.Dealer }] } - } - Contact.find(query, function (err, contacts) { - if (err) { - console.error(err); - return err; - } - if (contacts.length > 0) { - res.status(200).send(contacts); - } - else { - res.status(500).send("No records found"); - } - }); - } - - else { - res.send(400); - } - }) - -} -module.exports.datatable = function (req, res) { - - var qr = req.body; - var dtop = { - conditions: qr.find, - select: qr.select - }; - Contact.dataTable(qr, dtop, function (err, data) { - if (err) { - console.error(err); - res.sendStatus(500); - return; - } - res.send(data); - }) -} - -module.exports.getAll = function (req, res) { - Contact.find({ supAdmin: req.query.supadm }, function (err, contacts) { - if (err) { - console.error(err); - return err; - } - if (contacts.length > 0) { - res.status(200).send(contacts); - } - else { - res.status(500).send("No records found"); - } - }); - -} - -//delete Data (NOT USED) -module.exports.DeleteUser = function (req, res) { - Contact.remove({ _id: req.query.id }, function (err, del) { - if (err) { - console.error(err); - return err; - } - res.status(200).json({ "message": "Deleted Successfully" }) - - }) -} - -//saving phonenum with otp -module.exports.SendOtp = function (req, res) { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var randomotp = randomString(6, '#'); - /* var randomotp=Math.floor((Math.random() * 100000) + 54); */ - var newOtpJson = { - phone_number: req.body.ph_num, - otp: randomotp - }; - - var newOtp = new Otp(JSON.parse(JSON.stringify(newOtpJson))); - newOtp.save(function (err) { - if (err) { - console.error("otp error :" + err); - return err; - } - // - request({ - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + req.body.ph_num + Utilities.getConfig().smsApiTextKey + 'Adnate%20IOT%20Your%20OTP%20is ' + randomotp, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } */ - res.status(200).json({ "message": "OTP sent successfully" }) - }); - - }); -} - - -module.exports.SendOtpZOGO = function (req, res) { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var randomotp = randomString(4, '#'); - /* var randomotp=Math.floor((Math.random() * 100000) + 54); */ - var newOtpJson = { - phone_number: req.body.ph_num, - otp: randomotp - }; - - var newOtp = new Otp(JSON.parse(JSON.stringify(newOtpJson))); - newOtp.save(function (err) { - if (err) { - console.error("otp error :" + err); - return err; - } - //req.body.ph_num - Contact.findOne({ phone: req.body.ph_num }, function (err, mobileNum) { - if (err) { - res.status(500).json({ "Error": "Device Not Found" }) - } - //console.log("Mobile Number", mobileNum); - //console.log("randonOTP", randomotp); - mobileNum.otp = randomotp; - - mobileNum.save(function (err) { - if (err) { - res.status(500).json({ "errMsg": "OTP not Updated" }) - } else { - // console.log("updatedInfo=>", mobileNum); - request({ - uri: Utilities.getConfig().smsUrl_zogo + Utilities.getConfig().smsApiMobileKeyzogo + req.body.ph_num + Utilities.getConfig().smsApiTextKeyzogo + 'Zogo%20Rides%20Your%20OTP%20is ' + randomotp, - method: "GET" - }, function (error, response, body) { - res.status(200).json({ "message": "OTP sent successfully" }) - }); - } - }) - }) - }); -} - - -//checking otp with phonenumber - -//saving phonenum with otp -//LOGIN -module.exports.LoginWithOtp = function (req, res) { - var loginType = ''; - // console.log("header",JSON.stringify(req.headers)); - var user_agent = req.headers["user-agent"]; - //console.log("UUUUUUUUUUUUUUUUUUUUUUUU",user_agent); - if (user_agent.includes("Android ") || user_agent.includes("iPhone") || user_agent.includes("blackberry")) { - loginType = "MOBILE" - } - else if (user_agent.includes("Mozilla") || user_agent.includes("AppleWebKit") || user_agent.includes("Chrome") || user_agent.includes("Safari")) { - loginType = "WEB"; - } else { - loginType = "MOBILE" - } - var token; - if (req.body.emailid) { - - Contact.findOne({ "email": req.body.emailid.toLowerCase() }).populate({ "path": "Dealer", select: "first_name last_name phone email address" }).exec(function (err, user) { - if (err) { - console.error(err); - return err; - } - if (user) { - //checking user expiration date - if (user.DeletedUser == true) { - res.status(500).json({ "message": "Account Deleted" }); - return; - } - if (user.expire_date) { - if (new Date() > user.expire_date) { - res.status(500).json({ "message": "User account is expired" }); - } - } - //console.log(user); - // - //user is active or not - if ((!user.status) && (user.purpose != 'zogo')) { - res.status(500).json({ "message": "User account is InActive" }); - } - //valid or not - if (user.email_verfi == true) { - // - if (user.validPassword(req.body.psd)) { - Contact.update({ _id: user._id }, { $set: { last_login: new Date, login_type: loginType, "user_agent": user_agent } }, function (err, re) { - if (err) { - console.log(err); - return; - } - token = user.generateJwt(); - res.status(200); - res.json({ - "token": token - }); - }) - - } else { - res.status(500).json({ "message": "Password is Wrong" }); - } - - //res.status(200).json({"message":"LoggedIn Successfully"}); - } - else { - res.status(500).json({ "message": "Email ID Not Verified" }); - } - } - else { - - res.status(500).json({ "message": "User is not registered" }); - - } - }); - - } - else if (req.body.ph_num && req.body.psd) { - - Contact.findOne({ $or: [{ "phone": req.body.ph_num }, { "user_id": req.body.ph_num }] }).populate({ "path": "Dealer", select: "first_name last_name phone email address" }).exec(function (err, user) { - if (err) { - console.error(err); - return err; - } - if (user) { - - if (user.DeletedUser == true) { - res.status(500).json({ "message": "Account Deleted" }); - return; - } - //checking user expiration date - if (user.expire_date) { - if (new Date() > user.expire_date) { - res.status(500).json({ "message": "User account is expired" }); - } - } - // - //user is active or not - if (!user.phone_verfi) { - res.status(500).json({ "message": "Mobile Phone Not Verified" }); - - } - if ((!user.status) && (user.purpose != 'zogo')) { - res.status(500).json({ "message": "User account is InActive" }); - } - //valid or not - if (user.phone_verfi == true) { - // - if (user.validPassword(req.body.psd)) { - Contact.update({ _id: user._id }, { $set: { last_login: new Date, login_type: loginType, "user_agent": user_agent } }, function (err, re) { - if (err) { - console.log(err); - return; - } - token = user.generateJwt(); - res.status(200); - res.json({ - "token": token - }); - }) - } else { - res.status(500).json({ "message": "Password is Wrong" }); - } - - //res.status(200).json({"message":"LoggedIn Successfully"}); - } - else { - res.status(500).json({ "message": "Mobile Phone Not Verified" }); - } - } - else { - res.status(500).json({ "message": "User is not registered" }); - } - }); - - } - - else if (req.body.ph_num && req.body.otp) { - - Contact.findOne({ "phone": req.body.ph_num }).populate({ "path": "Dealer", select: "first_name last_name phone email address" }).exec(function (err, user) { - if (err) { - console.error(err); - return err; - } - if (user) { - if (user.phone_verfi = true) { - Otp.findOne({ "phone_number": req.body.ph_num }).sort({ "timestamp": -1 }).exec(function (err, otpres) { - if (err) { - console.error(err); - return err; - } - if (otpres) { - // - var dbtime = new Date(otpres.timestamp); - var curtime = new Date(); - var diffMs = (curtime - dbtime); // milliseconds between now & Christmas - var diffDays = Math.floor(diffMs / 86400000); // days - var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours - var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes - if (diffDays == 0 && diffHrs < 1 && diffMins <= 10) { - if (otpres.otp == req.body.otp) { - token = user.generateJwt(); - res.status(200); - res.json({ - "token": token - }); - //res.status(200).json({"message": "Successfully Logged In"}); - } - else { - res.status(500).json({ "message": "Didn't match otp" }); - } - - } - else { - res.status(500).json({ "message": "Otp has been Expired" }); - } - // - - - } - }) - } - else { - res.status(500).json({ "message": "Mobile Number Not Verified" }); - } - } - else { - res.status(500).json({ "message": "This number is not registered.Please SignUp" }) - } - }) - - - } - //checking userid with password - else if (req.body.user_id && req.body.psd) { - - var userIDstring = req.body.user_id; - var user_id_regex = new RegExp(["^", userIDstring, "$"].join(""), "i"); - - Contact.findOne({ $or: [{ "user_id": user_id_regex }, { "phone": req.body.user_id }] }).populate({ "path": "Dealer", select: "first_name last_name phone email address" }).exec(function (err, user) { - if (err) { - console.error(err); - return err; - } - if (user) { - //checking user expiration date - if (user.DeletedUser == true) { - res.status(500).json({ "message": "Account Deleted" }); - return; - } - - if (user.expire_date) { - if (new Date() > user.expire_date) { - res.status(500).json({ "message": "User account is expired" }); - } - } - // - //user is active or not - if ((!user.status) && (user.purpose != 'zogo')) { - res.status(500).json({ "message": "User account is InActive" }); - } - if (user.validPassword(req.body.psd)) { - Contact.update({ _id: user._id }, { $set: { last_login: new Date, login_type: loginType, "user_agent": user_agent } }, function (err, re) { - if (err) { - console.log(err); - return; - } - token = user.generateJwt(); - res.status(200); - res.json({ - "token": token - }); - }) - } else { - res.status(500).json({ "message": "Password is Wrong" }); - } - } - else { - - res.status(500).json({ "message": "User is not registered" }); - - } - }); - } -} - -module.exports.SendOtpp = function (phonenumber) { - return new Promise(function (resolve, reject) { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var randomotp = randomString(6, '#'); - //var randomotp=Math.floor((Math.random() * 100000) + 54); - var newOtpJson = { - phone_number: phonenumber, - otp: randomotp - }; - - var newOtp = new Otp(JSON.parse(JSON.stringify(newOtpJson))); - newOtp.save(function (err) { - if (err) { - console.error("otp error :" + err); - return err; - } - request({ - - - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + phonenumber + Utilities.getConfig().smsApiTextKey + 'Adnate%20IOT%20Your%20OTP%20is ' + randomotp, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } */ - res.status(200).json({ "message": "OTP sent successfully" }) - }); - }); - }); -} -// - -//reset password -module.exports.resetPassword = function (req, res) { - if (req.body.dev == "Mobile") { - Contact.findOne({ "phone": req.body.phone }, function (err, result) { - if (err) { - console.error(err); - return err; - } - if (result) { - Otp.findOne({ "phone_number": req.body.phone }).sort({ "timestamp": -1 }).exec(function (err, otpres) { - if (err) { - console.error(err); - return err; - } - if (otpres) { - if (otpres.otp == req.body.otp) { - if (req.body.password) result.setPassword(req.body.password); - result.save(function (err) { - if (err) { - console.error("inside error :" + err); - return; - } - res.status(200).send(result._id); - }) - } - } - }) - // - } - else { - res.status(500).json({ "message": "This Number is not registered" }); - } - }) - - } - -} - -//mlogin send otp - -module.exports.LoginSendOtp = function (req, res) { - try { - Contact.findOne({ "phone": req.body.phone }, function (err, result) { - if (err) { - console.error(err); - return; - } - if (result) { - module.exports.SendOtpp(result.phone).then(function (success) { - res.send(success); - }, function (err) { - res.send(err); - }); - } - else { - res.status(500).json({ "message": "This Number is not registered" }); - } - }) - } - catch (e) { - console.error(e); - } -} -//userFeedback -//User Feedback -module.exports.userFeedback = function (req, res) { - - Contact.findOne({ "_id": req.body.uid }, function (err, validUser) { - - if (err) { - console.error(err); - return; - } - else if (validUser) { - Contact.update({ _id: validUser._id }, { $addToSet: { "feedback": req.body.feedback }, $set: { "rating": req.body.rating } }, function (err, result) { - if (err) { - console.error(err); - return; - } - else if (result) { - - - - var mailOptions = { - from: Utilities.getConfig().mailUser, // sender address - to: Utilities.getConfig().adminMailId, // gaurav.gupta@adnate.in list of receivers - subject: Utilities.getConfig().orgName + " - Feedback", // Subject line - text: "New Task", // plaintext body emailverfi - html: 'Dear Sir,
We have recevied a new feedback from ' + Utilities.getConfig().orgName + ' GPS Tracker Mobile App

From: ' + validUser.first_name + ' ' + validUser.last_name + '
Contact Details: ' + validUser.email + ' / ' + validUser.phone + '
Rating: ' + req.body.rating + ' Stars
Feedback: ' + req.body.feedback + '

Thanks
Regards
Team Adnate'// html body - } - mailer.sendMail(mailOptions); - - - res.status(200).json({ "message": "Thanks for your feedback" }); - } - else { - res.status(500).json({ "message": "Invalid User" }); - } - }); - - } - }) - -} - -// Push Notificaion - -module.exports.PushNotification = function (req, res) { - - Contact.update({ _id: req.body.uid }, { - $addToSet: { - "pushNotification": { - token: req.body.token, "imei": req.body.imei, "os": req.body.os - } - } - }, function (err, result) { - if (err) { - console.error(err) - res.sendStatus(500); - return; - } - res.status(200).json({ "message": "Notifcation Updated" }); - }) - -} - - -// Pull Notificaion on logout - -module.exports.PullNotification = function (req, res) { - - Contact.update({ _id: req.body.uid }, { - $pull: { - "pushNotification": { - token: req.body.token, "imei": req.body.imei, "os": req.body.os - } - } - }, function (err, result) { - if (err) { - console.error(err) - res.sendStatus(500); - return; - } - res.status(200).json({ "message": "Notifcation Updated" }); - }) - -} -// Forgot Password - -module.exports.forgotpwd = function (req, res) { - - if (req.query.cred == undefined || req.query.cred == null || req.query.cred == "undefined") { - res.status(500).json({ "message": "Blank Entry" }) - - } - else { - - Contact.findOne({ $or: [{ 'email': req.query.cred }, { 'phone': req.query.cred }] }, function (err, user) { - - if (err) { - console.error(err); - } - else if (user) { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var randomotp = randomString(6, '#'); - // var randomotp=Math.floor((Math.random() * 100000) + 54); - - if (req.query.phone && req.query.otp) { - - Contact.findOne({ $or: [{ 'email': req.query.phone }, { 'phone': req.query.phone }] }, function (err, verify) { - if (err) { - console.error(err); - res.status(500).json(err); - } - else if (verify) { - if (verify.otp == req.query.otp) { - - this.salt = crypto.randomBytes(16).toString('hex'); - this.hash = crypto.pbkdf2Sync(req.query.newpwd, this.salt, 1000, 64, 'sha1').toString('hex'); - var changedPass = req.query.newpwd; - - Contact.update({ _id: verify._id }, { $set: { "hash": this.hash, "salt": this.salt, "pass": changedPass } }, function (err, succ) { - if (err) { - console.error(err); - } - res.status(200).json({ "message": "Password Sucessfully Changes" }) - }) - } - else { - res.status(500).json({ "message": "Wrong OTP try again" }) - } - } - }) - } - else if (user.phone) { - Contact.update({ _id: user._id }, { $set: { "otp": randomotp } }, function (err, result) { - - if (err) { - console.error(err); - res.status(500).json(err); - return; - } - // res.status(200).json({"message" : "OTP sent successfully"}) - - request({ - - - uri: Utilities.getConfig().smsUrl + "&sender=OneQlk" + Utilities.getConfig().smsApiMobileKey + user.phone + Utilities.getConfig().smsApiTextKey + 'Use%20this%20One%20Time%20Password%20to%20reset%20your%20password ' + randomotp, - method: "GET" - }, function (error, response, body) { - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - // email(req.body.first_name,req.body.email,randomemail); - res.status(200).json({"message" : "OTP sent successfully"}) - - } - else{ - res.status(500).json({"message" : "OTP sent failed"}) - } */ - res.status(200).json({ "message": "OTP sent successfully" }) - }); - - }) - - } - else if (user.email) { - Contact.update({ _id: user._id }, { $set: { "otp": randomotp } }, function (err, result) { - - if (err) { - res.status(500).json(err); - console.error(err); - } - var url = "http://" + Utilities.getConfig().webAppIp + ":" + Utilities.getConfig().EPort + "/users/foremailver?key=" + randomotp + '&uid=' + user._id; - - var mailOptions = { - from: "", // sender address - to: user.email, // gaurav.gupta@adnate.in list of receivers - subject: Utilities.getConfig().orgName + " - Reset Passwod", // Subject line - text: "New Task", // plaintext body emailverfi - html: 'Dear Sir,
You can reset your password by clicking on following link



Thanks
Regards
Team Adnate'// html body - } - mailer.sendMail(mailOptions); - - - res.status(200).json({ "message": "email sent" }); - }) - - - - } - } - else { - res.status(500).json({ "message": "Email ID / Mobile Number not found" }) - } - }) - } - -} - - -module.exports.foremailver = function (req, res) { - - Contact.findOne({ "_id": req.query.uid }, function (err, res) { - if (err) { - console.error(err) - } - else if (res) { - if (req.query.key == res.otp) { - return res.redirect(Utilities.getConfig().webAppDomain + '/forgotpwd'); - - - } - } - else { - } - }) - -} -module.exports.foremailpwdchg = function (req, res) { - - Contact.findOne({ $or: [{ 'email': req.query.cred.toLowerCase() }, { 'phone': req.query.cred }] }, function (err, verify) { - - this.salt = crypto.randomBytes(16).toString('hex'); - this.hash = crypto.pbkdf2Sync(req.query.newpwd, this.salt, 1000, 64).toString('hex'); - Contact.update({ _id: verify._id }, { $set: { "hash": this.hash, "salt": this.salt } }, function (err, succ) { - if (err) { - console.error(err); - } - res.status(200).json({ "message": "Password Sucessfully Changes" }) - }) - }) - -} - -//Contact OUS -module.exports.contactous = function (req, res) { - if (req.body.phone == null || req.body.phone == undefined || req.body.phone == "undefined") { - req.body.phone == " " - } - var mailOptions = { - from: Utilities.getConfig().mailUser, // sender address - to: req.body.dealerid, // gaurav.gupta@adnate.in list of receivers - subject: Utilities.getConfig().orgName + " - Contact Ous", // Subject line - text: "New Task", // plaintext body emailverfi phone - html: 'Dear Sir,
Someone Wanted to contact ous details are :-

Email ID-' + req.body.email.toLowerCase() + '
Phone Number-' + req.body.phone + '
Title-' + req.body.title + '
Message-' + req.body.msg + '

Thanks
Regards
Team Adnate'// html body - } - mailer.sendMail(mailOptions); - - - res.status(200).json({ "message": "email sent" }); -} - -//Resend OTP -module.exports.otpResend = function (req, res) { - - Contact.findOne({ 'phone': req.query.phone }, function (err, verify) { - if (err) { - console.error(err); - res.status(500); - return; - } - else if (verify) { - function randomString(length, chars) { - var mask = ''; - if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; - if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - if (chars.indexOf('#') > -1) mask += '0123456789'; - if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*+-:";\'<>?,./|\\'; - var result = ''; - for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; - return result; - } - var randomotp = randomString(6, '#'); - Contact.update({ _id: verify._id }, { $set: { otp: randomotp } }, function (err, result) { - if (err) { - console.error(err) - return res.status(400).send(err); - } - else { - request({ - - - uri: Utilities.getConfig().smsUrl + Utilities.getConfig().smsApiMobileKey + verify.phone + Utilities.getConfig().smsApiTextKey + 'Use%20this%20One%20Time%20Password%20for%20SignUp%20 ' + randomotp, - method: "GET" - }, function (error, response, body) { - - /* var jsonObj = JSON.parse(response.body); - if(jsonObj.MsgStatus == 'Sent'){ - res.status(200).json({"message" : "OTP sent successfully"}) - } - else{ - res.status(500).json({"message" : "OTP sent failed"}) - - } */ - res.status(200).json({ "message": "OTP sent successfully" }) - }); - - } - }); - - } - else { - res.status(500).json({ "message": "User not Registered" }) - } - }) -} - -//Account Edit -module.exports.Account_Edit = function (req, res) { - var token; - Contact.findOne({ '_id': req.body.uid }, function (err, verify) { - if (err) { - console.error(err); - } - else if (verify) { - console.log("BODY",req.body) - var accountUpdate={} - if(req.body.reportSchedule){ - if(req.body.report_config){ - accountUpdate['report_config'] = req.body.report_config; - } - if(req.body.report_emailid){ - accountUpdate['report_emailid'] = req.body.report_emailid; - } - if(req.body.scheduled_excel_report){ - accountUpdate['scheduled_excel_report'] = req.body.scheduled_excel_report; - } - } - else{ - // accountUpdate = { - accountUpdate['first_name'] = req.body.fname; - accountUpdate['last_name'] = req.body.lname; - accountUpdate['org_name'] = req.body.org; - accountUpdate['GET_notif'] = req.body.noti; - accountUpdate['fuel_unit'] = req.body.fuel_unit; - accountUpdate['show_announcement'] = req.body.show_announcement?req.body.show_announcement:false; - accountUpdate['digital_input'] = req.body.digital_input?req.body.digital_input:1 - accountUpdate['label_setting']=req.body.label_setting?req.body.label_setting:false; - - if(req.body.immobilize_setting!=undefined){ - accountUpdate['immobilize_setting']=req.body.immobilize_setting?req.body.immobilize_setting:false; - } - if(req.body.tow_setting!=undefined){ - accountUpdate['tow_setting']=req.body.tow_setting?req.body.immobilize_setting:false; - } - if(req.body.parking_setting!=undefined){ - accountUpdate['parking_setting']=req.body.parking_setting?req.body.immobilize_setting:false; - } - // show_announcement:req.body.show_announcement?req.body.show_announcement:false, - // digital_input:req.body.digital_input?req.body.digital_input:1, - // first_name: req.body.fname, - // last_name: req.body.lname, - // org_name: req.body.org, - // GET_notif: req.body.noti, - // fuel_unit: req.body.fuel_unit, - } - - - - - if (req.body.timezone) { - accountUpdate['timezone'] = req.body.timezone; - } - Contact.update({ _id: verify._id }, { $set: accountUpdate }, function (err, result) { - if (err) { - console.error(err) - res.status(500); - return; - } - else { - Contact.findOne({ '_id': req.body.uid }).populate({ "path": "Dealer", select: "first_name last_name phone email address" }).exec(function (err, verifyy) { - if (err) { - console.error(err); - } - else if (verify) { - - if (result.nModified == 1) { - token = verifyy.generateJwt(); - res.status(200); - res.json({ - "token": token - }); - } - else { - token = verify.generateJwt(); - res.status(200); - res.json({ - "token": token - }); - } - } - }) - - } - }) - - - } - else { - res.status(500).json({ "message": "User not Registered" }); - } - }) -} - -module.exports.set_user_setting = function (req, res) { - if (!req.body.uid) { - res.status(200).send({ "message": "uid is mandatory" }); - return; - } - - Contact.findOne({ '_id': req.body.uid }, function (err, user) { - if (err) { - console.error(err); - } - else if (user) { - if (req.body.lang) user.language_code = req.body.lang; - if (req.body.currency_code) user.currency_code = req.body.currency_code; - if (req.body.fuelUnit) user.fuel_unit = req.body.fuelUnit; - if (req.body.notifSound) user.notification_sound = req.body.notifSound; - if (req.body.engine_cut_psd) user.engine_cut_psd = req.body.engine_cut_psd; - if (req.body.tripGeneration) user.tripGeneration = req.body.tripGeneration; - if (req.body.unit_measurement) user.unit_measurement = req.body.unit_measurement; - if (req.body.adminAlert == true || req.body.adminAlert == false) user.adminAlert = req.body.adminAlert; - if (req.body.tripGeneration) user.tripGeneration = req.body.tripGeneration; - if (req.body.voice_alert == true || req.body.voice_alert == false) user.voice_alert = req.body.voice_alert; - if (req.body.announcement) user.announcement = req.body.announcement; - user.save(function (err, result) { - if (err) { - console.error(err) - res.status(500); - return; - } - else if (result) { - if (req.body.lang) res.status(200).send({ "message": "language updated sucessfully" }) - else res.status(200).send({ "message": "announcement updated sucessfully" }) - } - }) - - - } - else { - res.status(500).json({ "message": "User not Registered" }); - } - }) - - - } -/* -module.exports.get_user_setting = function (req, res) { - - if (!req.body.uid) { - res.status(200).send({ "message": "uid is mandatory" }); - return; - } - - Contact.findOne({ '_id': ObjectId(req.body.uid) }) - - .select('language_code fuel_unit notification_sound engine_cut_psd voice_alert currency_code unit_measurement timezone adminAlert') - .lean() - .exec(function (err, user) { - if (err) { - console.error(err); - } - else if (user) { - res.status(200).send(user); - - } - else { - res.status(500).json({ "message": "User not Registered" }); - } - }) -} -*/ - -module.exports.get_user_setting = function (req, res) { - - if (!req.body.uid) { - res.status(200).send({ "message": "uid is mandatory" }); - return; - } - - Contact.findOne({ '_id': ObjectId(req.body.uid) }) - .select('language_code fuel_unit notification_sound engine_cut_psd voice_alert currency_code unit_measurement timezone adminAlert announcement show_announcement isSuperAdmin isDealer supAdmin') - .lean() - .exec(function (err, user) { - if (err) { - console.error(err); - } - else if (user) { - if(user.isSuperAdmin){ - res.status(200).send(user); - - }else{ - Contact.find({_id: ObjectId(user.supAdmin) }).exec(function (err, result) { - console.log("Result--->",result) - console.log("User---",user); - if(result[0].announcement){ - console.log("In If Condition"); - var data={ - "language_code":user.language_code, - "fuel_unit":user.fuel_unit, - "notification_sound":user.notification_sound, - "engine_cut_psd":user.engine_cut_psd, - "voice_alert":user.voice_alert, - "currency_code":user.currency_code, - "unit_measurement":user.unit_measurement, - "timezone":user.timezone, - "adminAlert":user.adminAlert, - "announcement":result[0].announcement, - "show_announcement":user.show_announcement?user.show_announcement:false, - "isSuperAdmin":user.isSuperAdmin, - "isDealer":user.isDealer, - "digital_input":user.digital_input?user.digital_input:1 - } - console.log("Data-=---",data); - res.status(200).send(data); - }else{ - console.log("In else Condition"); - - var data={ - "language_code":user.language_code, - "fuel_unit":user.fuel_unit, - "notification_sound":user.notification_sound, - "engine_cut_psd":user.engine_cut_psd, - "voice_alert":user.voice_alert, - "currency_code":user.currency_code, - "unit_measurement":user.unit_measurement, - "timezone":user.timezone, - "adminAlert":user.adminAlert, - "isSuperAdmin":user.isSuperAdmin, - "show_announcement":user.show_announcement?user.show_announcement:false, - "isDealer":user.isDealer, - "digital_input":user.digital_input?user.digital_input:1 - } - console.log("Data-=---",data); - res.status(200).send(data); - - } - }) - } - } - else { - res.status(500).json({ "message": "User not Registered" }); - } - }) -} - - -module.exports.verify_EngineCut_Password = function (req, res) { - - if (!req.body.uid) { - res.status(200).send({ "message": "uid is mandatory" }); - return; - } - - Contact.findOne({ '_id': ObjectId(req.body.uid) }) - - .exec(function (err, user) { - if (err) { - console.error(err); - } - else if (user) { - if (user.engine_cut_psd == null || user.engine_cut_psd == undefined || user.engine_cut_psd == "") { - res.status(200).send({ message: "password not set for user" }); - } else if (user.engine_cut_psd) { - if (req.body.psd == user.engine_cut_psd) { - res.status(200).send({ message: "password verified" }); - } - else { - res.status(200).send({ message: "password not matched" }); - } - } - // res.status(200).send(user); - - } - else { - res.status(500).json({ "message": "User not Registered" }); - } - }) -} - - -module.exports.cancel_signup = function (req, res) { - Contact.remove({ "phone": req.query.phone }).then(function (err) { - if (err) { - res.send(err); - return err; - } - res.status(200).json({ "message": "Sign_Canceled" }) - }); -} - -module.exports.demo = function (req, res) { - - var mailOptions = { - from: Utilities.getConfig().mailUser, // sender address - to: req.query.dealeID, // dealeID gaurav.gupta@adnate.in list of receivers - subject: "Oneqlik - Demo Request", // Subject line - text: "New Task", // plaintext body emailverfi - html: 'Dear Sir,
Someone Wanted a demo details are :-

First Name-' + req.query.fname + '
Last Name-' + req.query.lname + '
Email-' + req.query.email + '
Mobile Number-' + req.query.mobile + '

Thanks
Regards
Team Adnate'// html body - } - mailer.sendMail(mailOptions); - - - res.status(200).json({ "message": "email sent" }); -} - -//Get Custumer -module.exports.getCust = function (req, res) { - var query = {}; - query = { 'Dealer': req.query.uid, isDealer: false }; - var pageNo = parseInt(req.query.pageNo); - var size = parseInt(req.query.size); - if (pageNo < 0 || pageNo === 0) { - response = { "error": true, "message": "invalid page number, should start with 1" }; - return res.json(response) - } - // query = { isDealer: false }; - - query['$and'] = []; - if (req.query.search) { - query['$and'].push({ $or: [{ "first_name": new RegExp(req.query.search, 'i') }, { "last_name": new RegExp(req.query.search, 'i') }, { "phone": new RegExp(req.query.search, 'i') }] }) - } - - var queryNew = { "$or": [{ DeletedUser: { $exists: false } }, { "$and": [{ DeletedUser: { $exists: true } }, { DeletedUser: false }] }] }; - query['$and'].push(queryNew); - - Contact.find(query) - .populate({ path: 'Dealer', select: 'first_name last_name' }) - .sort({ first_name: 1, last_name: 1 }) - .skip(size * (pageNo - 1)) - .limit(size) - .exec(function (err, custumer) { - - if (err) { - console.error(err); - res.status(500).json({ "message": "Error Occured" } + err); - } - else if (custumer.length > 0) { - // res.status(200).json(custumer) - var pointer = 0; - var trac_pointer = 0; - let final_data = []; - for (let k = 0; k < custumer.length; k++) { - trac_pointer++; - module.exports.calDevice(custumer[k], function (id) { - final_data.push(id) - pointer++ - if (trac_pointer == pointer) { - res.send(final_data); - } - }) - } - } - else { - res.status(500).json({ "message": "No custumer Found" }); - } - }) -} - -module.exports.calDevice = function (uid, cb) { - - - Device.find({ "user": uid._id }, function (err, data) { - - if (err) { - console.error(err); - } - else if (data.length > 0) { - - if (uid.phone.charAt(0) == "n") { - let r = { - "_id": uid._id, - "first_name": uid.first_name, - "last_name": uid.last_name, - "email": uid.email, - "phone": "", - "total_vehicle": data.length, - "custumerid": uid.custumerid, - "status": uid.status, - "created_on": uid.created_on, - "pass": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "dealer_firstname": uid.Dealer.first_name, - "dealer_lastname": uid.Dealer.last_name, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - - } - cb(r); - } - else if (uid.email.charAt(0) == "n" && uid.email.charAt(2) == "E") { - let r = { - "_id": uid._id, - "first_name": uid.first_name, - "last_name": uid.last_name, - "email": "", - "phone": uid.phone, - "total_vehicle": data.length, - "custumerid": uid.custumerid, - "status": uid.status, - "created_on": uid.created_on, - "pass": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "dealer_firstname": uid.Dealer.first_name, - "dealer_lastname": uid.Dealer.last_name, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - } - cb(r); - } - else { - let r = { - "_id": uid._id, - "first_name": uid.first_name, - "last_name": uid.last_name, - "email": uid.email, - "phone": uid.phone, - "total_vehicle": data.length, - "custumerid": uid.custumerid, - "status": uid.status, - "created_on": uid.created_on, - "pass": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "dealer_firstname": uid.Dealer.first_name, - "dealer_lastname": uid.Dealer.last_name, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - } - cb(r); - } - - - - } - else { - - if (uid.phone.charAt(0) == "n") { - let r = { - "_id": uid._id, - "first_name": uid.first_name, - "last_name": uid.last_name, - "email": uid.email, - "phone": "", - "total_vehicle": 0, - "custumerid": uid.custumerid, - "status": uid.status, - "created_on": uid.created_on, - "pass": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "dealer_firstname": uid.Dealer.first_name, - "dealer_lastname": uid.Dealer.last_name, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - } - cb(r) - } - else if (uid.email.charAt(0) == "n" && uid.email.charAt(2) == "E") { - let r = { - "_id": uid._id, - "first_name": uid.first_name, - "last_name": uid.last_name, - "email": "", - "phone": uid.phone, - "total_vehicle": 0, - "custumerid": uid.custumerid, - "status": uid.status, - "created_on": uid.created_on, - "pass": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "dealer_firstname": uid.Dealer.first_name, - "dealer_lastname": uid.Dealer.last_name, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - } - cb(r) - } - else { - let r = { - "_id": uid._id, - "first_name": uid.first_name, - "last_name": uid.last_name, - "email": uid.email, - "phone": uid.phone, - "total_vehicle": 0, - "custumerid": uid.custumerid, - "status": uid.status, - "created_on": uid.created_on, - "pass": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "dealer_firstname": uid.Dealer.first_name, - "dealer_lastname": uid.Dealer.last_name, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - } - cb(r) - } - - } - }) - -} - - -//Get Custumer Token -module.exports.getCustumerDetail = function (req, res) { - - Contact.findOne({ '_id': req.query.uid }).populate({ "path": "Dealer", select: "first_name last_name phone email address" }).exec(function (err, custumer) { - - if (err) { - console.error(err); - res.status(500).json({ "message": "Error Occured" } + err); - } - else if (custumer) { - - - if (custumer.image_path) { - token = custumer.generateJwt(); - img = Utilities.getImage(custumer.image_path) - res.status(200); - res.json({ - "img": img, - "cust": custumer, - "custumer_token": token, - }); - } - else { - token = custumer.generateJwt(); - res.status(200); - res.json({ - "cust": custumer, - "custumer_token": token, - }); - } - - - } - else { - res.status(500).json({ "message": "Custumer not found" }); - } - }) - -} - -//Get Support -module.exports.getSupport = function (req, res) { - let support = { - "number": "020-65103106", - "email": "poonam.g@processfactory.in" - } - res.status(200).json(support); -} - -//Getabout -module.exports.Getabout = function (req, res) { - let about = { - "org": Utilities.getConfig().orgName, - "address": "404,purple pride square,kalewadi phata Kalewadi, Pune, Maharashtra 411057", - "Contact_Person": "Gaurav Gupta", - "Contact_per_phone": "7507500582", - "Contact_per_email": "info@processfactory.in", - "website": "https://www.oneqlik.in/home" - } - res.status(200).json(about); -} - -//Dealer Information Anshul Saxena 04/02/2018 - -module.exports.getDealerInfo = function (req, res) { - - var json = JSON.parse(require('fs').readFileSync('app_api/dealerConfig/' + req.query.url + '.json', 'utf8')); - - res.status(200).json(json); -} - -module.exports.dealer_status = function (req, res) { - // res.status(500).send({"message":"restricted"}); - Contact.findOne({ _id: ObjectId(req.body.uId) }, function (err, response) { - - if (err) { - console.error(err); - } else { - if (req.body.status == false) { - response.status = false - response.deactivated_by = req.body.loggedIn_id - response.deactivated_on = new Date(); - response.save(function (err) { - if (err) { - console.error(err); - } else { - res.sendStatus(200); - } - }) - } else if (req.body.status == true) { - response.status = true - response.activated_by = req.body.loggedIn_id - response.activated_on = new Date(); - response.save(function (err) { - if (err) { - console.error(err) - } else { - res.sendStatus(200); - } - }) - } - } - }) - -} - - -//get all dealer vehicles added by m.hemanth@12/06/2018 - -module.exports.calDevices = function (uid, cb) { - var pushArray = []; - var summation = 0; - Contact.find({ 'Dealer': uid._id }, function (err, customer) { - if (err) { - console.error(err); - res.sendStatus(500); - return; - } - if (customer.length > 0) { - function syncCustomers(index) { - if (index < customer.length) { - var t = customer[index]; - Device.find({ "user": t._id }, function (err, data) { - if (err) { - console.error(err); - res.sendStatus(500); - return; - } - if (data.length > 0) { - summation = summation + data.length; - } - else { - summation = summation; - } - syncCustomers(index + 1); - } - ); - } - else { - var obj = { - "dealer_id": uid._id, - "dealer_firstname": uid.first_name, - "dealer_lastname": uid.last_name, - "email": uid.email, - "phone": uid.phone, - "vehicleCount": summation, - "status": uid.status, - "created_on": uid.created_on, - "password": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - } - cb(obj); - } - } - syncCustomers(0) - } - else { - Device.find({ "user": uid._id }, function (err, dealerdev) { - if (err) { - console.error(err); - res.status(500).send(err); - return; - } - var obj = { - "dealer_id": uid._id, - "dealer_firstname": uid.first_name, - "dealer_lastname": uid.last_name, - "email": uid.email, - "phone": uid.phone, - "vehicleCount": dealerdev.length, - "status": uid.status, - "created_on": uid.created_on, - "password": uid.pass, - "expiration_date": uid.expire_date, - "userid": uid.user_id, - "address": uid.address, - "docObject": uid.imageDoc, - "login_type": uid.login_type, - "last_login": uid.last_login, - "last_activity_on": uid.last_activity_on - } - cb(obj); - }) - } - }); - -} - -module.exports.getAllDealerVehicles = function (req, res) { - var final_result = []; - var query = {}; - var pageNo = parseInt(req.query.pageNo); - var size = parseInt(req.query.size); - if (pageNo < 0 || pageNo === 0) { - response = { "error": true, "message": "invalid page number, should start with 1" }; - return res.json(response) - } - - if (req.query.supAdmin) { - query = { $and: [{ isDealer: true }, { supAdmin: req.query.supAdmin }] }; - } - - else { - query = { $and: [{ isDealer: true }] }; - } - - var queryNew = { "$or": [{ DeletedUser: { $exists: false } }, { "$and": [{ DeletedUser: { $exists: true } }, { DeletedUser: false }] }] }; - // console.log(queryNew) - query['$and'].push(queryNew); - - if (req.query.search) { - query['$and'].push({ $or: [{ "first_name": new RegExp(req.query.search, 'i') }, { "last_name": new RegExp(req.query.search, 'i') }, { "phone": new RegExp(req.query.search, 'i') }] }) - } - // console.log("queryforget Dealer", query) - Contact.find(query) - .sort({ first_name: 1, last_name: 1 }) - .skip(size * (pageNo - 1)) - .limit(size) - .exec(function (err, dealers) { - if (err) { - console.error(err); - res.status(500).send(err); - return; - } - if (dealers.length > 0) { - var pointer = 0; - var trac_pointer = 0; - let final_data = []; - for (var k = 0; k < dealers.length; k++) { - trac_pointer++; - module.exports.calDevices(dealers[k], function (id) { - final_data.push(id) - pointer++ - if (trac_pointer == pointer) { - res.send(final_data); - } - }) - } - } - else { - res.status(500).json({ "message": "No customer Found" }); - } - }) -} - - - -//update user details - -module.exports.editUserDetails = function (req, res) { - Contact.findOne({ "_id": mongoose.Types.ObjectId(req.body.contactid) }, function (err, contact) { - if (err) { - console.error(err); - res.status(500).send(err); - return; - } - - if (contact) { - var tempUser = JSON.parse(JSON.stringify(contact)); - if (req.body.first_name) tempUser.first_name = req.body.first_name; - if (req.body.last_name) tempUser.last_name = req.body.last_name; - if (req.body.email) tempUser.email = req.body.email; - if (req.body.phone) tempUser.phone = req.body.phone; - if (req.body.emergencyContact) tempUser.emergency_contact= req.body.emergencyContact; - - // if (typeof (req.body.status) != null) tempUser.status = req.body.status; - if (req.body.expire_date) tempUser.expire_date = req.body.expire_date; - if (req.body.address) tempUser.address = req.body.address; - if (req.body.user_id) tempUser.user_id = req.body.user_id; - if (req.body.alert) tempUser.alert = req.body.alert; - if (req.body.role) tempUser.role = req.body.role; - // if (req.body.role) tempUser.role = req.body.role; - if (req.body.group) tempUser.group = req.body.group; - if (req.body.status) tempUser.status = req.body.status; - - Contact.update({ _id: req.body.contactid }, { $set: tempUser }, function (err, data) { - if (err) { - res.status(400).send({ "message": err.errmsg }); - return; - } - res.status(200).send({ "message": "Saved" }); - }); - } - else { - res.status(500).send("No User Found"); - } - }) - -} - -module.exports.deleteuserDetails = function (req, res) { - //console.log(req.body.userId); - Contact.findOne({ "_id": mongoose.Types.ObjectId(req.body.userId) }, function (err, delcontact) { - console.log(delcontact); - if (err) { - console.error(err); - res.status(500).send(err); - return; - } - if (delcontact) { - - delcontact.DeletedUser = req.body.deleteuser; - delcontact.save(function (err) { - if (err) { - console.error("inside error :" + err); - return; - } - res.status(200).send(delcontact._id); - }); - } - else { - res.status(500).send("No User Found"); - } - - }) -} - - - - -//get all customer vehicles under dealer - -module.exports.getAllCustomerVehiclesUnderDealer = function (req, res) { - var final_result = []; - Contact.find({ isDealer: true }, function (err, dealers) { - if (err) { - console.error(err); - res.status(500).send(err); - return; - } - if (dealers.length > 0) { - var pointer = 0; - var trac_pointer = 0; - let final_data = []; - for (var k = 0; k < dealers.length; k++) { - trac_pointer++; - module.exports.callCustomerVehicles(dealers[k], function (id) { - final_data.push(id) - pointer++ - if (trac_pointer == pointer) { - res.send(final_data); - } - }) - } - } - else { - res.status(500).json({ "message": "No customer Found" }); - } - }) -} - -module.exports.callCustomerVehicles = function (uid, cb) { - var pushArray = []; - Contact.find({ 'Dealer': uid._id }, function (err, customer) { - if (err) { - console.error(err); - res.sendStatus(500); - return; - } - if (customer.length > 0) { - function syncCustomers(index) { - if (index < customer.length) { - var t = customer[index]; - Device.find({ "user": t._id }, function (err, data) { - if (err) { - console.error(err); - res.sendStatus(500); - return; - } - if (data.length > 0) { - var cusObj = { - "customerName": t.first_name, - "customerId": t._id, - "vehicleDetails": data - } - pushArray = pushArray.concat(cusObj); - } - else { - var cusObj = { - "customerName": t.first_name, - "customerId": t._id, - "vehicleDetails": [] - } - pushArray = pushArray.concat(cusObj); - } - syncCustomers(index + 1); - } - ); - } - else { - var obj = { - "dealer_id": uid._id, - "dealer_firstname": uid.first_name, - "dealer_lastname": uid.last_name, - "email": uid.email, - "CustomerDetails": pushArray - } - cb(obj); - } - - } - syncCustomers(0) - } - else { - Device.find({ "user": uid._id }, function (err, dealerdev) { - if (err) { - console.error(err); - res.status(500).send(err); - return; - } - var obj = { - "dealer_id": uid._id, - "dealer_firstname": uid.first_name, - "dealer_lastname": uid.last_name, - "email": uid.email, - "phone": uid.phone, - } - cb(obj); - - }) - } - }); - -} - -function evaluate(object) { - if (object && object.constructor === Array) { - for (var i = 0; i < object.length; i++) { - object[i] = evaluate(object[i]); - } - } else if (object && typeof object == 'object' && Object.keys(object).length > 0) { - if (Object.keys(object).indexOf('_eval') < 0) { - for (var key in object) { - object[key] = evaluate(object[key]); - } - } else switch (object['_eval']) { - case 'Id': - { - object = mongoose.Types.ObjectId(object['value']); - break; - } - case 'regex': - { - object = new RegExp(object['value'], 'i'); - break; - } - case 'date': - { - object = new Date(object['value']).getTime(); - break; - } - } - } - return object; -} - - - -module.exports.datatable = function (req, res) { - var dtop = { - conditions: evaluate(req.body.find), - select: req.body.select - }; - //console.log(JSON.stringify(dtop.conditions, null, 4)); - - Contact.dataTable(req.body, dtop, function (err, data) { - if (err) { - console.error(err); - res.sendStatus(500); - return; - } - res.send(data); - }) -} - - -module.exports.editUserMaster = function (req, res) { - Contact.findOne({ "_id": mongoose.Types.ObjectId(req.body.contactid) }, function (err, data) { - - if (err) { - res.status(500).send(err); - return; - } else { - if (data) { - if (req.body.first_name) data.first_name = req.body.first_name; - if (req.body.last_name) data.last_name = req.body.last_name; - if (req.body.email) data.email = req.body.email; - if (req.body.organisation_name) data.organisation_name = req.body.organisation_name; - if (req.body.welcome_msg == true) data.welcome_msg = req.body.welcome_msg; - if (req.body.welcome_msg == false) data.welcome_msg = req.body.welcome_msg; - if (req.body.phone) data.phone = req.body.phone; - if (req.body.isDealer == false || req.body.isDealer) data.isDealer = req.body.isDealer; - if (req.body.isSuperAdmin == false || req.body.isSuperAdmin) data.isSuperAdmin = req.body.isSuperAdmin; - if (req.body.Dealer) data.Dealer = req.body.Dealer; - if (req.body.createdOn) data.createdOn = req.body.createdOn; - if (req.body.user_id) data.user_id = req.body.user_id; - if ((req.body.status == false) || req.body.status) data.status = req.body.status; - - - var tempData = JSON.parse(JSON.stringify(data)); - - if ((req.body.isDealer == true) && (req.body.isDealer != undefined)) { - - tempData.isDealer == true; - delete tempData['Dealer']; - var uId = tempData._id; - var updateFlag = 'dealerUpdate'; - - saveUser(uId, updateFlag); - } - - - - else if ((req.body.isSuperAdmin == true) && (req.body.isSuperAdmin != undefined)) { - - if (tempData.supAdmin) { - tempData.organisation = tempData.supAdmin; - - - - } - tempData.isSuperAdmin == true; - tempData.isDealer = false; - delete tempData['Dealer']; - delete tempData['supAdmin']; - var uId = tempData._id; - var updateFlag = 'adminUpdate'; - saveUser(uId, updateFlag); - - } else { - var uId = tempData._id; - var updateFlag = 'null'; - saveUser(uId, updateFlag); - } - - - function saveUser(uId, updateFlag) { - - var updatesupAdmin = false; - var updateId = uId; - // var newObject = new Contact(JSON.parse(JSON.stringify(tempData))); - - - if (updateFlag == 'adminUpdate') { - var unsetKey = { $unset: { supAdmin: "" }, $set: tempData }; - } - if (updateFlag == 'dealerUpdate') { - var unsetKey = { $set: tempData } - } - - - if (updateFlag == 'null') { - var unsetKey = { $set: tempData } - } - - - Contact.update({ _id: tempData._id }, unsetKey, function (err, changedObject) { - if (err) { - res.status(400).send(err); - } else { - - if (updateFlag != undefined) { - - var query = { - $or: [{ user: updateId }, { Dealer: updateId }] - }; - if (updateFlag == 'dealerUpdate') { - var setDevice = { - "Dealer": updateId - }; - - } - if (updateFlag == 'adminUpdate') { - var setDevice = { - "Dealer": updateId, - "supAdmin": updateId - }; - - - - updatesupAdmin = true; - - } - - if (updateFlag == 'null') { - var changeDealer = changedObject.Dealer; - var setDevice = { - "Dealer": changeDealer, - }; - - } - - - - if (updatesupAdmin == true) { - Contact.update({ Dealer: updateId }, { $set: { supAdmin: updateId } }, { multi: true }, function (err, updated) { - if (err) { - res.status(400).send({ "message": "err during supadmin update" }) - } - Device.update(query, { $set: setDevice }, { multi: true }, function (err, deviceUpdate) { - if (err) { - res.status(400).send({ "message": "error during device update" }); - } - res.status(200).send({ "message": "Role changed and devices updated" }); - - }) - - }) - } else { - Device.update(query, { $set: setDevice }, { multi: true }, function (err, deviceUpdate) { - if (err) { - res.status(400).send({ "message": "error during device update" }); - } - res.status(200).send({ "message": "Role changed and devices updated" }); - - }) - } - - } else { - res.status(200).send("Edited Successfully!!!"); - } - } - }) - } - - } else { - res.status(500).send("No user Found !!!"); - } - - } - }) -} -module.exports.tokenCheck = function (req, res, next) { - - if (req.method == "GET") next(); - if (req.method == "POST" || req.method == "PUT") { - var token = req.header('Authorization'); - if (token != "bearer") { - req.user = jwt.decode(token); - next(); - // res.send({res:jwt.decode(token)}); - // jwt.verify(token, 'MY_SECRET', function (err, data) { - // req.user = data; - // if (err) return res.send({ msg: "forbidden" }); - // next(); - // }); - } - else - res.send({ msg: "forbidden" }); - } - -} - -// module.exports.updatePassword = function (req,res){ -// console.log(req.body); -// Contact.find({ "_id": mongoose.Types.ObjectId(req.body.ID) }-, function (err, user) { -// if(err){ -// res.status(400).send(err); -// } -// if(user){ -// console.log(user); -// res.status(200).send({"success":"Password updated"}); -// } -// else{ -// res.status(200).send({"success":"UserNot found"}); -// } -// }) - -// } - -module.exports.updatePassword = function (req, res) { - Contact.findOne({ "_id": mongoose.Types.ObjectId(req.body.ID) }, function (err, result) { - if (err) { - console.error(err); - res.status(400).send(err); - return err; - } - if (result) { - //console.log(result); - if (result.validPassword(req.body.OLD_PASS)) { - console.log("old pass found !!!!"); - result.setPassword(req.body.NEW_PASS); - result.save(function (err) { - if (err) { - console.error("inside error :" + err); - return; - } - //console.log(result); - res.status(200).send({ "message": "Password updated !!!" }); - }) - } else { - res.status(400).send({ "message": "Old password not matched" }); - } - } - else { - res.status(500).json({ "message": "USER NOT FOUND !!!" }); - } - }) -} - - -module.exports.getCostumer = function (req, res) { - var query = {}; - if (req.query.all == 'true') { - query = { 'supAdmin': ObjectId(req.query.uid), isDealer: false }; - } else { - query = { 'Dealer': ObjectId(req.query.uid), isDealer: false }; - } - console.log('query', query); - - var pageNo = parseInt(req.query.pageNo); - var size = parseInt(req.query.size); - if (pageNo < 0 || pageNo === 0) { - response = { "error": true, "message": "invalid page number, should start with 1" }; - return res.json(response) - } - // query = { isDealer: false }; - - query['$and'] = []; - if (req.query.search) { - query['$and'].push({ $or: [{ "first_name": new RegExp(req.query.search, 'i') }, { "last_name": new RegExp(req.query.search, 'i') }, { "phone": new RegExp(req.query.search, 'i') }] }) - } - - var queryNew = { $or: [{ DeletedUser: { $exists: false } }, { $and: [{ DeletedUser: { $exists: true } }, { DeletedUser: false }] }] }; - query['$and'].push(queryNew); - Contact.aggregate([ - - { - $match: query - }, - { - $project: { - "user_id": 1, "first_name": 1, "last_name": 1, "Dealer": 1, "email": 1, "phone": 1, "pass": 1, "created_on": 1, "expire_date": 1, "point_Allocated": 1, - "login_type": 1, "last_login": 1, "last_activity_on": 1, "_id": -1, "status": 1, "imageDoc": 1, "pushNotification": 1, "address": 1, "std_code": 1, "accountSuspended": 1,"emergency_contact":1, "adminAlert": 1 - } - }, - { - $sort: { _id: -1 } - }, - { - $lookup: { - from: "devInfo", - localField: "_id", - foreignField: "user", - as: "total_vehicle" - } - }, - { - $lookup: { - from: "client_master", - localField: "Dealer", - foreignField: "_id", - as: "DealerDetails" - } - }, - { - $project: { - "DealerDetails.first_name": 1, "DealerDetails.last_name": 1, "total_vehicle": { $size: "$total_vehicle" }, "delDevices": { $size: "$total_vehicle.deletedDevice" }, "user_id": 1, "first_name": 1, "last_name": 1, "address": 1, "std_code": 1, "accountSuspended": 1, - "email": 1, "phone": 1, "pass": 1, "created_on": 1, "expire_date": 1, "point_Allocated": 1, "login_type": 1, "last_login": 1, "last_activity_on": 1, "_id": -1, "status": 1,"emergency_contact":1, "imageDoc": 1, "notificationTokenCount": { $size: "$pushNotification" }, "adminAlert": 1 - } - }, - { - "$skip": (size * (pageNo - 1)) - }, - { - "$limit": size - } - ]).exec(function (err, customers) { - if (err) { - res.status(400).send(err); - } - res.status(200).send(customers); - }) - -} - - - -module.exports.getAllDealerDetails = function (req, res) { - var final_result = []; - var query = {}; - var pageNo = parseInt(req.query.pageNo); - var size = parseInt(req.query.size); - if (pageNo < 0 || pageNo === 0) { - response = { "error": true, "message": "invalid page number, should start with 1" }; - return res.json(response) - } - - if (req.query.supAdmin) { - query = { $and: [{ isDealer: true }, { supAdmin: ObjectId(req.query.supAdmin) }] }; - } - - else { - query = { $and: [{ isDealer: true }] }; - } - - if (req.query.customer_role) { - query = { $and: [{ customer_role: 'subadmin' }] }; - } - - var queryNew = { "$or": [{ DeletedUser: { $exists: false } }, { "$and": [{ DeletedUser: { $exists: true } }, { DeletedUser: false }] }] }; - //console.log(queryNew) - query['$and'].push(queryNew); - - if (req.query.search) { - query['$and'].push({ $or: [{ "first_name": new RegExp(req.query.search, 'i') }, { "last_name": new RegExp(req.query.search, 'i') }, { "phone": new RegExp(req.query.search, 'i') }] }) - } - console.log("queryforget Dealer", query); - - Contact.aggregate([ - { - $match: query - }, - { - "$skip": (size * (pageNo - 1)) - }, - { - "$limit": size - }, - { - $project: { - "phone": 1, "status": 1, "created_on": 1, "pass": 1, "expire_date": 1, "user_id": 1, "address": 1, "imageDoc": 1, "login_type": 1, "std_code": 1, "accountSuspended": 1, - "last_login": 1, "last_activity_on": 1, "_id": 1, "first_name": 1, "last_name": 1, "email": 1, "pushNotification": 1, "cust_add_permission": 1, "device_add_permission": 1, "point_Allocated": 1, "point_Shared_Other": 1 - } - }, - { - $sort: { _id: -1 } - }, - { - $lookup: { - from: "devInfo", - localField: "_id", - foreignField: "Dealer", - as: "total_vehicle" - } - }, - { - $project: { - "total_vehicle": { $size: "$total_vehicle" }, "delDevices": { $size: "$total_vehicle.deletedDevice" }, "user_id": 1, "first_name": 1, "last_name": 1, "address": 1, "cust_add_permission": 1, "device_add_permission": 1, "point_Allocated": 1, "point_Shared_Other": 1, "std_code": 1, - "email": 1, "phone": 1, "pass": 1, "created_on": 1, "expire_date": 1, "login_type": 1, "last_login": 1, "last_activity_on": 1, "_id": -1, "status": 1, "imageDoc": 1, "notificationTokenCount": { $size: "$pushNotification" }, "accountSuspended": 1 - } - } - - ]).exec(function (err, Dealers) { - if (err) { - res.status(400).send(err); - } - res.status(200).send(Dealers); - }) - -} - -module.exports.getAllDealerDetailsMobile = function (req, res) { - var final_result = []; - var query = {}; - var pageNo = parseInt(req.query.pageNo); - var size = parseInt(req.query.size); - if (pageNo < 0 || pageNo === 0) { - response = { "error": true, "message": "invalid page number, should start with 1" }; - return res.json(response) - } - - if (req.query.supAdmin) { - query = { $and: [{ isDealer: true }, { supAdmin: ObjectId(req.query.supAdmin) }] }; - } - - else { - query = { $and: [{ isDealer: true }] }; - } - - if (req.query.customer_role) { - query = { $and: [{ customer_role: 'subadmin' }] }; - } - - var queryNew = { "$or": [{ DeletedUser: { $exists: false } }, { "$and": [{ DeletedUser: { $exists: true } }, { DeletedUser: false }] }] }; - //console.log(queryNew) - query['$and'].push(queryNew); - - if (req.query.search) { - query['$and'].push({ $or: [{ "first_name": new RegExp(req.query.search, 'i') }, { "last_name": new RegExp(req.query.search, 'i') }, { "phone": new RegExp(req.query.search, 'i') }] }) - } - //console.log("queryforget Dealer", query); - - Contact.aggregate([ - { - $match: query - }, - { - "$skip": (size * (pageNo - 1)) - }, - { - "$limit": size - }, - { - $project: { - "phone": 1, "status": 1, "created_on": 1, "pass": 1, "expire_date": 1, "user_id": 1, "address": 1, "imageDoc": 1, "login_type": 1, "std_code": 1, "accountSuspended": 1, - "last_login": 1, "last_activity_on": 1, "_id": 1, "first_name": 1, "last_name": 1, "email": 1, "pushNotification": 1, "cust_add_permission": 1, "device_add_permission": 1, "point_Allocated": 1, "point_Shared_Other": 1 - } - }, - { - $sort: { _id: -1 } - }, - { - $lookup: { - from: "devInfo", - localField: "_id", - foreignField: "Dealer", - as: "total_vehicle" - } - }, - { - $project: { - "total_vehicle": { $size: "$total_vehicle" }, "user_id": 1, "first_name": 1, "last_name": 1, "point_Allocated": 1, "point_Shared_Other": 1, - "email": 1, "phone": 1, "pass": 1, "created_on": 1, "expire_date": 1, "_id": -1, "status": 1, "accountSuspended": 1, "address": 1 - } - } - // _id, first_name, last_name, email, phone, pass, created_on, total_vehicle, status, expire_date, user_id, address, point_Allocated - - ]).exec(function (err, Dealers) { - if (err) { - res.status(400).send(err); - } - res.status(200).send(Dealers); - }) - -} -module.exports.zogogetDocument = function (req, res) { - Contact.findOne({ _id: req.query.id }, function (err, data) { - if (err) { - res.status(400).send('something went wrong'); - } - res.status(200).send({ 'userdata': data }); - }) - - -} - - -module.exports.restoreUsers = function (req, res) { - Contact.findOneAndUpdate( - { _id: req.query.id }, - { $unset: { DeletedUser: "" } }, - function (err, user) { - if (err) { - res.status(400).send({ message: "no user found" }); - } - res.status(200).send(user); - } - ); -}; - - -module.exports.reportPrefrence = function (req, res) { - //console.log('req.body', req.body); - var setObject = {} - - if (req.body.reportsArr) { - setObject['report_preference'] = req.body.reportsArr; - } - if(req.body.userSetting){ - setObject['user_settings'] = req.body.userSetting; - } - - - Contact.update( - { _id: req.body.id }, - { $set: setObject }, function (err, user) { - if (err) { - req.status(400).send({ err }) - } - res.status(200).send({ "message": "Report preference updated" }); - } - ) -} - -module.exports.dashboardContent = function (req, res) { - //console.log('req.body', req.body); - var setObject = {} - - if (req.body.dashboard_column) { - setObject['dashboard_column'] = req.body.dashboard_column; - } - - - Contact.update( - { _id: req.body.user }, - { $set: setObject }, function (err, user) { - if (err) { - req.status(400).send({ err }) - } - res.status(200).send({ "message": "Dashboard Content updated" }); - } - ) -} - - -module.exports.shareUserDetails = function (req, res) { - Contact.findOne({ _id: req.query.user }) - .populate('supAdmin') - .exec(function (err, data) { - if (err) { - res.status(400).send('something went wrong'); - } - var userdata = data; - var SMSURL = Utilities.getConfig().smsUrl; - var organisation_name = data.supAdmin.organisation_name; - var tracktiveAndroidLink = 'https://play.google.com/store/apps/details?id=com.trackTive.ionic'; - var tracktiveIOSlink = 'https://apps.apple.com/us/app/tracktive/id1467327906?ls=1'; - var userCred1 = 'Dear%20' + userdata.first_name + "%20Your%20credentials%20of%20" + organisation_name + "%20are%20userId%20" + userdata.user_id + '%20Password%20' + userdata.pass; - var mobile_key = Utilities.getConfig().smsApiMobileKey; - var txt_key = Utilities.getConfig().smsApiTextKey; - - if (organisation_name == 'Tractive VTS') { - SMSURL += '&sender=TRACTV'; - userCred1 = 'Dear%20' + userdata.first_name + "%20Welcome%20to%20" + organisation_name + "%20Platform%20%2C%20Your%20Login%20credentials%20are%20UserId%20" + userdata.user_id + '%20Password%20' + userdata.pass + "%20App%20%Download%20link%20Android%20" + tracktiveAndroidLink + '%20IOS%20' + tracktiveIOSlink + '%20WEB%20LOGIN%20' + 'https://www.tracktive.in/login'; - } else if (organisation_name === 'IConnect Technologies') { - SMSURL = Utilities.getConfig().smsUrl_iconnect; - SMSURL += '&senderid=AMASEC'; - mobile_key = Utilities.getConfig().smsApiMobileKey_iconnect; - txt_key = Utilities.getConfig().smsApiTextKey_iconnect; - var userCred1 = 'Dear%20' + userdata.first_name + "%20Welcome%20to%20" + organisation_name + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + userdata.user_id + '%20Password%20' + userdata.pass + '%20WEB%20LOGIN%20' + 'http://www.iconnectindia.in'; - } else if (organisation_name === 'Saanvi Security Solution') { - SMSURL = Utilities.getConfig().smsUrl_saanvi; - mobile_key = Utilities.getConfig().smsApiMobileKey_saanvi; - txt_key = Utilities.getConfig().smsApiTextKey_saanvi; - var userCred1 = 'Dear%20' + userdata.first_name + "%20Welcome%20to%20" + organisation_name + "%20platform%20%2C%20Your%20credentials%20are%20userId%20" + userdata.user_id + '%20Password%20' + userdata.pass + '%20WEB%20LOGIN%20' + 'http://www.iconnectindia.in'; - } else { - SMSURL += '&sender=OneQlk'; - } - - - - console.log(SMSURL + mobile_key + userdata.phone + txt_key + userCred1); - - request({ - uri: SMSURL + mobile_key + userdata.phone + txt_key + userCred1, - method: "GET" - }, function (error, response, body) { - res.status(200).json({ "message": "Login Information Sent" }) - }); - }) - -} - -module.exports.hardresetPassword = function (req, res) { - console.log('inside function'); - Contact.findOne({ _id: req.body.id }, function (err, user) { - if (err) { - res.status(500).send({ "message": "No user found" }) - } - console.log('useruseruseruseruseruseruser',user); - var newUser = new Contact(user); - newUser.setPassword(req.body.pass); - newUser.save(function (err) { - if (err) { - res.status(500).send(err) - } else { - res.status(200).send({ "message": "Password updated !!!" }); - } - }) - }) - -} - - - -module.exports.setDealerPermission = function (req, res) { - Contact.findOne({ _id: req.body.uid }, function (err, user) { - if (err) { - res.status(500).send({ "message": "No user found" }) - } - - var newUser = new Contact(user); - newUser.cust_add_permission = req.body.cust_add_permission; - newUser.device_add_permission = req.body.device_add_permission; - newUser.save(function (err) { - if (err) { - res.status(500).send({ "message": "Internal Server Error" }) - } else { - res.status(200).send({ "message": "Permission updated !!!" }); - } - }) - }) -} - - -module.exports.getuserDetail = function (req, res) { - Contact.findOne({ _id: req.query.uid }, function (err, user) { - if (err) { - res.status(500).send({ "message": "No user found" }) - } - res.status(200).send(user) - - }) - - -} - -module.exports.getuserDetailBySchhol = function (req, res) { - Contact.findOne({ school: req.query.uid }, function (err, user) { - if (err) { - res.status(500).send({ "message": "No user found" }) - } - res.status(200).send(user) - - }) - -} - - - -module.exports.DemoRequest = function (req, res) { - console.log("Inside function"); - - var parseJson = req.body.url; - - var parse1 = parseJson.split('.'); - var parse2 = parse1[1]; - console.log("ParsedUrl", parse2); - - var Dealerjson = JSON.parse(require('fs').readFileSync('app_api/dealerConfig/' + parse2 + '.json', 'utf8')); - console.log('Dealerjson', Dealerjson); - if (Dealerjson == undefined) { - return res.status(500).send({ 'message': 'Url is not valid' }); - } - console.log(Dealerjson); - var DealerEmail = (Dealerjson.email != '') ? Dealerjson.email : res.status(500).send({ 'message': 'Update Email in DealerConfig' }); - console.log('DealerEmail', DealerEmail); - var DealerName = Dealerjson.dealerName; - - var client_fName = req.body.first_name; - var client_lName = req.body.last_name ? req.body.last_name : ''; - var client_phone = req.body.phone ? req.body.phone : ''; - var client_email = req.body.email; - - var htmlBody = '
' + - '
' + - '

' + 'Dear ' + DealerName + '

' + - '

' + 'Someone has requested for demo.Please find details below.' + '

' + - '

' + 'First Name : ' + client_fName + '

' + - '

' + 'Last Name : ' + client_lName + '

' + - '

' + 'Eamil : ' + client_email + '

' + - '

' + 'Phone Number :' + client_phone + '

' + - '

' + 'Thank You' + '

' - '
' + - '
'; - - var mainEmail = 'reports@oneqlik.in' - var mailOptions = { - from: mainEmail, // sender address - to: DealerEmail, // list of receivers - subject: 'Demo Request', // Subject line - // text: 'Switch Status', // plaintext body - html: htmlBody - }; - console.log(mailOptions); - mailer.sendMail(mailOptions); - res.status(200).send({ 'message': 'Demo request sent' }) - - -} - -module.exports.checkPointAvailablity = function (req, res) { - console.log('req.body', req.query); - if (!req.query.u_id) { - res.status(200).send({ message: "user_id is mandatory" }); - return; - } - if (!req.query.demanded_points) { - res.status(200).send({ message: "demanded_points is mandatory" }) - return; - } - - - Contact.findOne({ _id: req.query.u_id }, function (err, con) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (con) { - //console.log(con); - if (con.isSuperAdmin) { - Device.find({ $or: [{ user: req.query.u_id }, { Dealer: req.query.u_id }] }).count().exec(function (err, count) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (count >= 0) { - console.log(count); - if (con.point_Allocated > (count + con.point_Shared_Other)) { - - if (con.point_Allocated - (count + con.point_Shared_Other) > req.query.demanded_points) { - res.status(200).send({ available: true, available_points: con.point_Allocated - (count + con.point_Shared_Other) }) - - } - else { - res.status(200).send({ available: true, message: "only " + con.point_Allocated - (count + con.point_Shared_Other) + " points available" }) - } - } else { - res.status(200).send({ available: false, available_points: con.point_Allocated - (count + con.point_Shared_Other) }) - - } - - } - - }) - } - else if (con.isDealer) { - Device.find({ Dealer: req.query.u_id }).count().exec(function (err, count) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (count >= 0) { - console.log(count); - if (con.point_Allocated > (count + con.point_Shared_Other)) { - - if (con.point_Allocated - (count + con.point_Shared_Other) > req.query.demanded_points) { - res.status(200).send({ available: true, available_points: con.point_Allocated - (count + con.point_Shared_Other) }) - - } - else { - res.status(200).send({ available: true, message: "only " + con.point_Allocated - (count + con.point_Shared_Other) + " points available" }) - } - } else { - res.status(200).send({ available: false, available_points: con.point_Allocated - (count + con.point_Shared_Other) }) - - } - - } - - }) - } else { - Contact.findOne({ _id: con.Dealer }, function (err, con1) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (con1) { - Device.find({ Dealer: con.Dealer }).count().exec(function (err, count) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (count >= 0) { - con = con1 - console.log(count); - if (con.point_Allocated > (count + con.point_Shared_Other)) { - - if (con.point_Allocated - (count + con.point_Shared_Other) > req.query.demanded_points) { - res.status(200).send({ available: true, available_points: con.point_Allocated - (count + con.point_Shared_Other) }) - - } - else { - res.status(200).send({ available: true, message: "only " + con.point_Allocated - (count + con.point_Shared_Other) + " points available" }) - } - } else { - res.status(200).send({ available: false, available_points: con.point_Allocated - (count + con.point_Shared_Other) }) - - } - - } - - }) - } - }) - - - } - - - } else { - - res.status(200).send({ "message": "user not found" }) - } - }) -} -module.exports.getColumnSetting = function (req, res) { - - if (!req.query.u_id) { - res.status(200).send({ message: "user_id is mandatory" }); - return; - } - - - - Contact.findOne({ _id: req.query.u_id }, function (err, con) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (con) { - if (con.dashboard_column) { - res.status(200).send({ "dashboard_column": con.dashboard_column }) - } else { - res.status(200).send({ "message": "dashboard_column not found" }) - } - - - - } else { - - res.status(200).send({ "message": "user not found" }) - } - }) -} - -module.exports.setApiKey = function (req, res) { - - if (!req.body.u_id) { - res.status(200).send({ message: "user_id is mandatory" }); - return; - } - if (!req.body.dashboard_column) { - res.status(200).send({ message: "dashboard_column is mandatory" }) - return; - } - - - Contact.findOne({ _id: req.body.u_id }, function (err, con) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (con) { - Contact.update({ _id: req.body.u_id }, { $set: { dashboard_column: req.body.dashboard_column } }, function (err, upd) { - if (err) { - console.log(err); - } - if (upd) { - res.status(200).send("saved successfully"); - } - }) - - - - - } else { - - res.status(200).send({ "message": "user not found" }) - } - }) -} -module.exports.setApiKey = function (req, res) { - - if (!req.query.u_id) { - res.status(200).send({ message: "user_id is mandatory" }); - return; - } - if (!req.query.api_key) { - res.status(200).send({ message: "api key is mandatory" }) - return; - } - - - Contact.findOne({ _id: req.query.u_id }, function (err, con) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (con) { - Contact.update({ _id: req.query.u_id }, { $set: { api_key: req.query.api_key } }, function (err, upd) { - if (err) { - console.log(err); - } - if (upd) { - res.status(200).send("saved successfully"); - } - }) - - - - - } else { - - res.status(200).send({ "message": "user not found" }) - } - }) -} - - -module.exports.getApiKey = function (req, res) { - - if (!req.query.u_id) { - res.status(200).send({ message: "user_id is mandatory" }); - return; - } - - - - Contact.findOne({ _id: req.query.u_id }, function (err, con) { - if (err) { - console.log(err); - res.send(err) - return; - } - if (con) { - if (con.api_key) { - res.status(200).send({ "api_key": con.api_key }) - } else { - res.status(200).send({ "message": "api key not found" }) - } - - - - } else { - - res.status(200).send({ "message": "user not found" }) - } - }) -} -module.exports.accountSuspension = function (req, res) { - if ((req.body.accountSuspended === undefined) || (req.body.acoountId === undefined) || (req.body.suspendedBy === undefined)) { - res.status(500).send({ "message": "missing Parameters" }); - } else { - var query = {}; - - if (req.body.suspendedBy === 'org') { - query = { $or: [{ supAdmin: req.body.acoountId }, { _id: req.body.acoountId }] }; - Contact.update(query, { $set: { accountSuspended: req.body.accountSuspended } }, { multi: true }, function (err1, contactObj) { - if (err1) { - res.status(400).send({ "message": "contact noot updated" }); - } - Device.update({ supAdmin: req.body.acoountId }, { $set: { accountSuspended: req.body.accountSuspended } }, { multi: true }, function (err2, deviceObj) { - if (err2) { - res.status(400).send({ "message": "device noot updated" }); - } - res.status(200).send({ "messsage": "Contact and device status updated" }); - }) - }) - } else if (req.body.suspendedBy === 'distributer') { - Contact.update({ $or: [{ Dealer: req.body.acoountId }, { _id: req.body.acoountId }] }, { $set: { accountSuspended: req.body.accountSuspended } }, { multi: true }, function (err1, contactObj) { - if (err1) { - res.status(400).send({ "message": "contact noot updated" }); - } - Device.update({ $or: [{ Dealer: req.body.acoountId }, { user: req.body.acoountId }] }, { $set: { accountSuspended: req.body.accountSuspended } }, { multi: true }, function (err2, deviceObj) { - if (err2) { - res.status(400).send({ "message": "device noot updated" }); - } - res.status(200).send({ "messsage": "Contact and device status updated" }); - }) - }) - } else if (req.body.suspendedBy === 'dealer') { - Contact.update({ $or: [{ _id: req.body.acoountId }] }, { $set: { accountSuspended: req.body.accountSuspended } }, { multi: true }, function (err1, contactObj) { - if (err1) { - res.status(400).send({ "message": "contact noot updated" }); - } - Device.update({ $or: [{ user: req.body.acoountId }] }, { $set: { accountSuspended: req.body.accountSuspended } }, { multi: true }, function (err2, deviceObj) { - if (err2) { - res.status(400).send({ "message": "device noot updated" }); - } - res.status(200).send({ "messsage": "Contact and device status updated" }); - }) - }) - - } else { - res.status(500).send({ "message": "missing parameters" }) - - } - - } - -} - - -module.exports.getsupAdmin = function (req, res) { - Contact.find({ organisation: req.query.supAdmin }, function (err, distributers) { - if (err) { - res.status(500).send({ "message": "no distributers found" }); - } - res.status(200).send(distributers); - }) -} - -module.exports.getDealerAndcust = function (req, res) { - Contact.find({ $or: [{ supAdmin: req.query.supAdmin }, { Dealer: req.query.supAdmin }] }, function (err, distributers) { - if (err) { - res.status(500).send({ "message": "no data found" }); - } - res.status(200).send(distributers); - }) - -} - From 58fb99cc5b20f80b678476c935d920c9534afb6d Mon Sep 17 00:00:00 2001 From: Alex beart Date: Thu, 16 Mar 2023 23:22:24 +0530 Subject: [PATCH 07/10] issue screen with other Small fixes --- src/app/app.module.ts | 8 +- src/app/dashboard/dashboard.component.ts | 2 +- .../new-edit-device.component.ts | 2 +- .../issue-add/issue-add.component.html | 100 ++++++ .../issue-add/issue-add.component.scss | 111 +++++++ .../issue-add/issue-add.component.spec.ts | 25 ++ .../issue-add/issue-add.component.ts | 70 +++++ .../issue-list/issue-list.component.html | 62 ++++ .../issue-list/issue-list.component.scss | 109 +++++++ .../issue-list/issue-list.component.spec.ts | 25 ++ .../issue-list/issue-list.component.ts | 292 ++++++++++++++++++ .../kyc-approval/kyc-approval.component.html | 10 +- .../kyc-approval.component.spec.ts | 12 +- .../kyc-approval/kyc-approval.component.ts | 3 + src/app/location/location.component.ts | 2 +- 15 files changed, 820 insertions(+), 13 deletions(-) create mode 100644 src/app/kyc-approval/issue-add/issue-add.component.html create mode 100644 src/app/kyc-approval/issue-add/issue-add.component.scss create mode 100644 src/app/kyc-approval/issue-add/issue-add.component.spec.ts create mode 100644 src/app/kyc-approval/issue-add/issue-add.component.ts create mode 100644 src/app/kyc-approval/issue-list/issue-list.component.html create mode 100644 src/app/kyc-approval/issue-list/issue-list.component.scss create mode 100644 src/app/kyc-approval/issue-list/issue-list.component.spec.ts create mode 100644 src/app/kyc-approval/issue-list/issue-list.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 70504a0..665fc26 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -281,6 +281,8 @@ import { DownloadCertificateComponent } from './dashboard/download-certificate/d import { DeviceSettingComponent } from './device-setting/device-setting.component'; import { UserSettingComponent } from './user-setting/user-setting.component'; import { IndexingReportComponent } from './indexingReport/index-report.component'; +import { IssueListKycComponent } from './kyc-approval/issue-list/issue-list.component'; +import { IssueAddKycComponent } from './kyc-approval/issue-add/issue-add.component'; // import { DisatanceReportComponent } from './report/disatance-report/disatance-report.component'; // import { MainComponent } from './report/main/main.component'; // import { AcReportsComponent } from './report/ac-report/ac-report.component'; @@ -533,6 +535,8 @@ export function createTranslateLoader(http: Http) { RtoMasterComponent, DeviceKYCComponent, DeviceDocComponent, + IssueAddKycComponent, + IssueListKycComponent, NewRoutePlanReportComponent, ModelMasterComponent, TrackedUntrackedVehiclesComponent, @@ -621,8 +625,8 @@ export function createTranslateLoader(http: Http) { ], schemas: [ NO_ERRORS_SCHEMA ], - entryComponents:[PoiDtlDelComponent,EditDeviceMasterComponent,AcreportInfoComponent,GpsEditMasterComponent,RenewalHistoryComponent,PoiMenuComponent,ExpenseComponentComponent, - AddpoiBylocationComponent,CreateTripComponent,CommentWindowComponent,DetailComponent,DailyDetailsComponent,RenewVehicleComponent,ViewCustomerDetailsComponent,OtpScreenComponent,DeviceDocComponent,TrackedUntrackedVehiclesComponent,DownloadCertificateComponent, + entryComponents:[IssueAddKycComponent, PoiDtlDelComponent,EditDeviceMasterComponent,AcreportInfoComponent,GpsEditMasterComponent,RenewalHistoryComponent,PoiMenuComponent,ExpenseComponentComponent, + AddpoiBylocationComponent,CreateTripComponent,CommentWindowComponent,DetailComponent,DailyDetailsComponent,RenewVehicleComponent,ViewCustomerDetailsComponent,OtpScreenComponent,DeviceDocComponent,IssueAddKycComponent,IssueListKycComponent,TrackedUntrackedVehiclesComponent,DownloadCertificateComponent, AnnouncementComponent,SelectUntrackVehiclesComponent,ExpenselistComponent,AddPlanComponent,AddDriverComponent,ShowPullDataLinkComponent,HualtListComponent,ShoRoutePlanComponent,EChalanComponent,TrackedVehiclesComponent,ViewCertificateComponent,], providers: [/* AuthService , */ AlertService, Data, SimpleTimer,DatainjectionService,ContactService,ReportService, { provide: MD_DIALOG_DATA, useValue: {} }, diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 35d6f9c..7e6db58 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -1694,7 +1694,7 @@ testTable() { "data":null, "defaultContent": "", "render":function(data,type,row){ - if(row.kycStatus && row.kycStatus=="Approved") { + if(row.kycStatus && row.kycStatus=="Approved" && !that.superAdmin) { return '' } else { diff --git a/src/app/dashboard/new-edit-device/new-edit-device.component.ts b/src/app/dashboard/new-edit-device/new-edit-device.component.ts index 9df8d7c..c12a1b0 100644 --- a/src/app/dashboard/new-edit-device/new-edit-device.component.ts +++ b/src/app/dashboard/new-edit-device/new-edit-device.component.ts @@ -407,7 +407,7 @@ export class NewEditDeviceComponent implements OnInit { Mileage : "10", phn: this.deviceForm.value.contactNo, sim_number: this.deviceForm.value.contactNo, - created_by: this.userId, + created_by: this.deviceData.created_by && this.deviceData.created_by._id ? this.deviceData.created_by : this.userId, supAdmin: this.sup_admin, // driver_name: this.driver, // contact_number: this.dcontact, diff --git a/src/app/kyc-approval/issue-add/issue-add.component.html b/src/app/kyc-approval/issue-add/issue-add.component.html new file mode 100644 index 0000000..33ccb9a --- /dev/null +++ b/src/app/kyc-approval/issue-add/issue-add.component.html @@ -0,0 +1,100 @@ +
+
+
+
+ + +
+ + + +
+ +
+ Required field. +
+
+
+
+ + +
+
+ Required field. +
+
+
+
+ + +
+
+ Required field. +
+
+
+
+ + +
+
+ Required field. +
+
+
+
+ + +
+
+ Required field. +
+
+
+
+ + +
+
+ Required field. +
+
+
+ +
+ + + +
+
+
\ No newline at end of file diff --git a/src/app/kyc-approval/issue-add/issue-add.component.scss b/src/app/kyc-approval/issue-add/issue-add.component.scss new file mode 100644 index 0000000..566f0df --- /dev/null +++ b/src/app/kyc-approval/issue-add/issue-add.component.scss @@ -0,0 +1,111 @@ +.headStyle { + text-align: center; + font-size: 22px; + font-weight: 500; + margin-top: 10px; + color: #6b6a6a; +} +.error-msg { + color: red; +} +.InputStyle { + padding: 10px; + padding-bottom: 20px; + background-color: #efefef; + margin-bottom: 10px; + .selecStyle { + display: inherit; + width: 56%; + padding-left: 16px; + margin-left: 50px; + + border-radius: 10px; + } +} + +.topDiv { + padding-top: 59px; + background: whitesmoke; + height: 100vh; +} + +.rowStyle { + // margin: 5px; + // background: white; + height: 84vh; + // box-shadow: 3px 1px 5px 0px #b2b0ae; +} + +#deviceTable input { + border-radius: 5px; +} + +::-webkit-scrollbar { + width: 10px; +} + +/* Track */ +::-webkit-scrollbar-track { + background: rgb(153, 153, 153); +} + +/* Handle */ +::-webkit-scrollbar-thumb { + // background: rgb(74, 118, 184); + background: #868e96; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background: #555; +} + +#toast { + visibility: hidden; + max-width: 150px; + height: 50px; + /*margin-left: -125px;*/ + margin: auto; + background-color: #333; + color: #fff; + text-align: center; + border-radius: 2px; + + position: fixed; + z-index: 1; + left: 60%; + right: 0; + bottom: 80%; + font-size: 13px; + white-space: nowrap; +} +#toast #img { + width: 150px; + height: 150px; + + 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; +} diff --git a/src/app/kyc-approval/issue-add/issue-add.component.spec.ts b/src/app/kyc-approval/issue-add/issue-add.component.spec.ts new file mode 100644 index 0000000..f7dd662 --- /dev/null +++ b/src/app/kyc-approval/issue-add/issue-add.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { IssueListKycComponent } from './issue-list.component'; + +describe('IssueListKycComponent', () => { + let component: IssueListKycComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ IssueListKycComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(IssueListKycComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/kyc-approval/issue-add/issue-add.component.ts b/src/app/kyc-approval/issue-add/issue-add.component.ts new file mode 100644 index 0000000..7d13df7 --- /dev/null +++ b/src/app/kyc-approval/issue-add/issue-add.component.ts @@ -0,0 +1,70 @@ +import { Component, OnInit, TemplateRef } from '@angular/core'; +import { BsDatepickerConfig, BsModalRef, BsModalService } from 'ngx-bootstrap'; + +declare var $: any; +declare var swal: any +import * as moment from 'moment'; +import { ContactService } from '../../contact.service'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; +import { MdDialogRef } from '@angular/material'; +@Component({ + selector: 'app-issue-add-kyc', + templateUrl: './issue-add.component.html', + styleUrls: ['./issue-add.component.scss'] +}) +export class IssueAddKycComponent implements OnInit { + issues=[]; + + bsConfig: Partial; + issueForm:FormGroup; + userId + colorTheme = 'theme-dark-blue'; + Load: boolean; + constructor(private contactService:ContactService,private dialogRef: MdDialogRef) { + this.bsConfig = Object.assign({ dateInputFormat: 'DD-MM-YYYY, h:mm:ss a' }, { containerClass: this.colorTheme }); + this.issueForm = new FormGroup({ + VehicleNo:new FormControl('',[Validators.required,]), + DeviceIMEI:new FormControl('',[Validators.required,]), + email:new FormControl('',[Validators.required,]), + mobile:new FormControl('',[Validators.required,]), + fileName:new FormControl(''), + msg:new FormControl('',[Validators.required,]), + }) + } + get VehicleNo() { return this.issueForm.get('VehicleNo'); } + get DeviceIMEI() { return this.issueForm.get('DeviceIMEI'); } + get email() { return this.issueForm.get('email'); } + get mobile() { return this.issueForm.get('mobile'); } + get fileName() { return this.issueForm.get('fileName'); } + get msg() { return this.issueForm.get('msg'); } + + ngOnInit() { + + this.userId= JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id; + // this.getIssues() + } + submit() { + if(this.issueForm.valid) { + let postObj = this.issueForm.value; + postObj.user = this.userId + this.contactService.post('/customer_support/post_inquiry',postObj).subscribe(res=>{ + console.log(res); + swal({ + title: 'Saved!', + html: 'Your Issue has been Created.', + icon: 'success' + }) + this.dialogRef.close() + + }) + } + } + + + + + + + + +} diff --git a/src/app/kyc-approval/issue-list/issue-list.component.html b/src/app/kyc-approval/issue-list/issue-list.component.html new file mode 100644 index 0000000..eaa3bfa --- /dev/null +++ b/src/app/kyc-approval/issue-list/issue-list.component.html @@ -0,0 +1,62 @@ +
+
+
+

{{'Issue List' | translate}}

+
+
+ +
+
+
+
+ +
+
+
+ + + +
+
+
+
+ + + +
+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + +
{{'Ticket ID'|translate}} {{'Posted By'|translate}} {{'Email'|translate}} {{'Phone'|translate}} {{'Posted On' | translate}}{{'Assigned To' | translate}}{{'Message' | translate}}{{'Status' | translate}}{{'Remark' | translate}}{{'Closed Date' | translate}}{{'Update Status' | translate}}
+ + +
+ diff --git a/src/app/kyc-approval/issue-list/issue-list.component.scss b/src/app/kyc-approval/issue-list/issue-list.component.scss new file mode 100644 index 0000000..ab6827e --- /dev/null +++ b/src/app/kyc-approval/issue-list/issue-list.component.scss @@ -0,0 +1,109 @@ +.headStyle { + text-align: center; + font-size: 22px; + font-weight: 500; + margin-top: 10px; + color: #6b6a6a; +} + +.InputStyle { + padding: 10px; + padding-bottom: 20px; + background-color: #efefef; + margin-bottom: 10px; + .selecStyle { + display: inherit; + width: 56%; + padding-left: 16px; + margin-left: 50px; + + border-radius: 10px; + } +} + +.topDiv { + padding-top: 59px; + background: whitesmoke; + height: 100vh; +} + +.rowStyle { + // margin: 5px; + // background: white; + height: 84vh; + // box-shadow: 3px 1px 5px 0px #b2b0ae; +} + +#deviceTable input { + border-radius: 5px; +} + +::-webkit-scrollbar { + width: 10px; +} + +/* Track */ +::-webkit-scrollbar-track { + background: rgb(153, 153, 153); +} + +/* Handle */ +::-webkit-scrollbar-thumb { + // background: rgb(74, 118, 184); + background: #868e96; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background: #555; +} + +#toast { + visibility: hidden; + max-width: 150px; + height: 50px; + /*margin-left: -125px;*/ + margin: auto; + background-color: #333; + color: #fff; + text-align: center; + border-radius: 2px; + + position: fixed; + z-index: 1; + left: 60%; + right: 0; + bottom: 80%; + font-size: 13px; + white-space: nowrap; +} +#toast #img { + width: 150px; + height: 150px; + + 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; +} diff --git a/src/app/kyc-approval/issue-list/issue-list.component.spec.ts b/src/app/kyc-approval/issue-list/issue-list.component.spec.ts new file mode 100644 index 0000000..f7dd662 --- /dev/null +++ b/src/app/kyc-approval/issue-list/issue-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { IssueListKycComponent } from './issue-list.component'; + +describe('IssueListKycComponent', () => { + let component: IssueListKycComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ IssueListKycComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(IssueListKycComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/kyc-approval/issue-list/issue-list.component.ts b/src/app/kyc-approval/issue-list/issue-list.component.ts new file mode 100644 index 0000000..c66f616 --- /dev/null +++ b/src/app/kyc-approval/issue-list/issue-list.component.ts @@ -0,0 +1,292 @@ +import { Component, OnInit, TemplateRef } from '@angular/core'; +import { BsDatepickerConfig, BsModalRef, BsModalService } from 'ngx-bootstrap'; +import {MdDialog} from '@angular/material'; +declare var $: any; +declare var swal: any +import * as moment from 'moment'; +import { ContactService } from '../../contact.service'; +import { IssueAddKycComponent } from '../issue-add/issue-add.component'; +@Component({ + selector: 'app-issue-list-kyc', + templateUrl: './issue-list.component.html', + styleUrls: ['./issue-list.component.scss'] +}) +export class IssueListKycComponent implements OnInit { + issues=[]; + modalRef: BsModalRef; + bsConfig: Partial; + fromDate=new Date(); + toDate=new Date(); + tabelObj: any; + userId + colorTheme = 'theme-dark-blue'; + Load: boolean; + constructor(private contactService:ContactService,private modalService: BsModalService,private dialog:MdDialog) { + this.bsConfig = Object.assign({ dateInputFormat: 'DD-MM-YYYY, h:mm:ss a' }, { containerClass: this.colorTheme }); + } + + ngOnInit() { + var fTime = new Date(); + fTime.setHours(0,0,0,0); + this.fromDate = new Date(fTime); + + var today = new Date(); + var startDate = new Date(today.getFullYear(), today.getMonth(), 1); + this.fromDate=startDate + this.userId= JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id; + // this.getIssues() + this.testTable() + } + + getIssues(){ + + + this.contactService.get("/customer_support/getIssues?user="+this.userId+"&from="+this.fromDate+"&to="+this.toDate).subscribe((res:any)=>{ + console.log(res); + this.issues=res; + }) + } + + + addIssue(): void { + const dialogRef = this.dialog.open(IssueAddKycComponent, { + data: {}, + }); + + dialogRef.afterClosed().subscribe(result => { + this.testTable(); + }); + } + testTable() { + const that = this; + console.log("inside function"); + $(document).ready(function () { + that.tabelObj = $('#deviceTable').DataTable({ + // dom: 'Bfrtip', + // buttons: [ 'copy', 'csv', 'ex cel', 'pdf', 'print' ], + "autoWidth": true, + 'deferRender':true, + "processing": true, + "searching": true, + pagingType: 'full_numbers', + pageLength: 25, + serverSide: false, + "scrollX": true, + "scrollY": '65vh', + "scrollCollapse": true, + lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], + "rowCallback": function(row: Node, data: any | Object, index: number){ + $('#edit', row).bind('click', () => { + + console.log(data); + + var body={} + if(data.support_status=='OPEN'){ + body={ + title: "Update Status", + // text: "Please Enter Solution Remark:", + // input: 'text', + showCancelButton: true , + confirmButtonColor: 'green', + confirmButtonText:'IN PROGRESS' + } + }else{ + body={ + title: "Update Status", + text: "Please Enter Solution Remark:", + input: 'text', + showCancelButton: true , + confirmButtonColor: 'green', + + } + } + // var req={ + // id:data._id, + // ticketStatus:'RESOLVED' + // } + // that.contactService.post('/customer_support/updateCustomerQuery',req).subscribe(res=>{ + // console.log(res); + // that.tabelObj.ajax.reload() + // }) + swal(body + // { + // // title: 'Are you sure?', + // title: "Update Status", + // text: "Please Enter Solution Remark:", + // input: 'text', + // showCancelButton: true , + // confirmButtonColor: 'green', + // } + ).then((result) =>{ + if(result){ + console.log(result); + var req={ + id:data._id, + solutionRemarks:data.support_status=='OPEN'?undefined:result, + ticketStatus:data.support_status=='OPEN'?'IN PROGRESS':'CLOSE' + } + that.contactService.post('/customer_support/updateCustomerQuery',req).subscribe(res=>{ + console.log(res); + that.tabelObj.ajax.reload() + }) + + }else{ + console.log(result); + } + + }) + + }); + }, + ajax: (dataTablesParameters, callback) => { + console.log('temptemptemptemptemp', dataTablesParameters); + that.Load = true; + var suburl = ""; + that.contactService.get("/customer_support/getIssues?user="+that.userId+"&from="+that.fromDate+"&to="+that.toDate).subscribe((res:any)=>{ + console.log(res); + that.issues=res; + for(var i=0;i`; + } else{ + button=``; + } + return button + } + }, + + ], + "columnDefs": [ + { className: "dt-body-left", "targets": [0,1,2,3,4,5,6,7,8,9,10] }, + { + "targets": '_all', + "createdCell": function (td, cellData, rowData, row, col) { + $(td).css('padding', '18px') + } + }, + { "width": "10px", "targets": 0 }, + { "width": "40px", "targets": 1 }, + { "width": "100px", "targets": 2 }, + { "width": "70px", "targets": 3 }, + { "width": "70px", "targets": 4 }, + { "width": "70px", "targets": 5 }, + { "width": "70px", "targets": 6 }, + { "width": "70px", "targets": 7 }, + { "width": "70px", "targets": 8 }, + { "width": "70px", "targets": 9 }, + { "width": "70px", "targets": 10 }, + + ], order: [[ 4, 'desc' ], [ 0, 'asc' ]] + }); + + }); + + } + changeDate(){ + console.log("chabjhdsb",this.toDate,this.fromDate); + + this.tabelObj.ajax.reload(); + } + + openModal(template: TemplateRef,data) { + this.modalRef = this.modalService.show(template,{'backdrop':'static',class:'modal-lg modal-dialog-centered'}); + + } + + + +} diff --git a/src/app/kyc-approval/kyc-approval.component.html b/src/app/kyc-approval/kyc-approval.component.html index a02454f..c0cbd6a 100644 --- a/src/app/kyc-approval/kyc-approval.component.html +++ b/src/app/kyc-approval/kyc-approval.component.html @@ -26,7 +26,10 @@ Customer KYC --> + @@ -50,7 +53,7 @@
{{ data_descip }}
Loading…
-
+
diff --git a/src/app/location/create-trip/create-trip.component.html b/src/app/location/create-trip/create-trip.component.html index 77e86ce..dacbc1b 100644 --- a/src/app/location/create-trip/create-trip.component.html +++ b/src/app/location/create-trip/create-trip.component.html @@ -37,15 +37,35 @@
-
- - +
+ + + +
+
+ + + +
+
+ + + +
+ +
+
+
+ + Error : {{errorMessage}}
-
-

Total Distance:

-
+
+
+ + +
diff --git a/src/app/location/create-trip/create-trip.component.ts b/src/app/location/create-trip/create-trip.component.ts index 10fc494..7da48ea 100644 --- a/src/app/location/create-trip/create-trip.component.ts +++ b/src/app/location/create-trip/create-trip.component.ts @@ -14,7 +14,10 @@ export class CreateTripComponent implements OnInit { addlng: number; AddMapObj: any; addressString: any; - source_address: any; + source_address = { + lat:0, +long:0 + }; poiRadius:any; POINAME:any; TripName:any; @@ -27,7 +30,9 @@ export class CreateTripComponent implements OnInit { IMEI: any; Dealer: any; supAdmin: any; - + trip_charge:string; + cargo_weight:string; + cargo_content:string; constructor(public dialogRef: MdDialogRef, @Inject(MD_DIALOG_DATA) public data: any,public contactService: ContactService) { console.log("dataVehicle=>",data); @@ -36,9 +41,15 @@ export class CreateTripComponent implements OnInit { ngOnInit() { this.mapFunction(); - this.source_address = new google.maps.places.Autocomplete(document.getElementById('txtSource')); + let autocompleted = new google.maps.places.Autocomplete(document.getElementById('txtSource')); + autocompleted.addListener('place_changed', ()=>{ + var place = autocompleted.getPlace(); - this.contactService.getdevById(this.vehData.vehicleId).subscribe(res=>{ + this.source_address.lat = place.geometry.location.lat(), + this.source_address.long = place.geometry.location.lng(); + console.log(place,autocompleted) + }); + this.contactService.getdevById(this.vehData.Device_ID).subscribe(res=>{ var tempObj = JSON.parse(res['_body']); console.log("tempObj", tempObj); @@ -266,27 +277,33 @@ export class CreateTripComponent implements OnInit { }); } + errorMessage = ''; create_trip(){ - + this.errorMessage = ''; if(this.TripName == undefined){ - console.log("TripName is Mendatory"); - }else{ + this.errorMessage = "TripName is Mendatory"; + } else if(!this.source_address.lat) { + this.errorMessage = "Place is Mendatory"; + } else{ var payload = { "user": this.useridd, "device": this.IMEI, - "start_loc": { - "lat": this.addLat, - "long": this.addlng - }, + "start_loc": this.vehData.LatLng, "trip_status": 'Started', - "end_loc": { - "lat": this.destLat, - "long": this.destLong - }, + "end_loc": this.source_address, "trip_name": this.TripName, - "start_time": new Date().toISOString() + "start_time": new Date().toISOString(), + "trip_charge":this.trip_charge, + "cargo_weight":this.cargo_weight, + "cargo_content" :this.cargo_content + } + { + + + + } if(this.Dealer != undefined){ diff --git a/src/app/location/location.component.ts b/src/app/location/location.component.ts index 4665c0a..cd304d7 100644 --- a/src/app/location/location.component.ts +++ b/src/app/location/location.component.ts @@ -6133,11 +6133,7 @@ export class LocationComponent implements OnInit, OnDestroy { playPause: boolean = true; startCreatingFlightPath: boolean = false; createTrip(dev) { - // console.log('devicedevicedevice=>', dev); - - var DeviceObj = localStorage.getItem('devDetail') ? JSON.parse(localStorage.getItem('devDetail')) : {}; - - + let DeviceObj = dev; var vehicleLatLng = { lat: this.latToPass, long: this.longToPass diff --git a/src/app/location/sho-route-plan/sho-route-plan.component.ts b/src/app/location/sho-route-plan/sho-route-plan.component.ts index 3338fdd..cd8c44a 100644 --- a/src/app/location/sho-route-plan/sho-route-plan.component.ts +++ b/src/app/location/sho-route-plan/sho-route-plan.component.ts @@ -17,6 +17,12 @@ export class ShoRoutePlanComponent implements OnInit { destination: string; constructor(private fb:FormBuilder,public dialogRef: MdDialogRef,@Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService) { console.log(data); + this.userId = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id; + this.routeForm=this.fb.group({ + routeName:[''], + source:[''], + destination:[''] + }) if(data.data.length>0){ this.clocation_1(data.data[0].lat,data.data[0].lng,'source'); this.clocation_1(data.data[data.data.length-1].lat,data.data[data.data.length-1].lng,'destination'); @@ -24,17 +30,13 @@ export class ShoRoutePlanComponent implements OnInit { this.location.push([element.lng,element.lat]) }); } + + + console.log(this.location,this.source,this.destination); } ngOnInit() { - this.userId = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id; - this.routeForm=this.fb.group({ - routeName:[''], - source:[''], - destination:[''] - }) - - console.log(this.location,this.source,this.destination); + } @@ -93,28 +95,28 @@ export class ShoRoutePlanComponent implements OnInit { console.log("IN",res); if (res.message == "Address not found in databse") { if(type=="source"){ - this.routeForm.patchValue({ + outerThis.routeForm.patchValue({ source:"" }) - this.source="" + outerThis.source="" }else{ - this.routeForm.patchValue({ + outerThis.routeForm.patchValue({ destination:"" }) - this.destination="" + outerThis.destination="" } } else { if(type=="source"){ - this.routeForm.patchValue({ + outerThis.routeForm.patchValue({ source:res.address }) - this.source=res.address + outerThis.source=res.address }else{ - this.routeForm.patchValue({ + outerThis.routeForm.patchValue({ destination:res.address }) - this.destination=res.address + outerThis.destination=res.address } // latlngObj['address'] = res.address; diff --git a/src/app/report/report component/trip-management/trip-management-report.component.html b/src/app/report/report component/trip-management/trip-management-report.component.html new file mode 100644 index 0000000..4a62b6a --- /dev/null +++ b/src/app/report/report component/trip-management/trip-management-report.component.html @@ -0,0 +1,161 @@ + +
+
+
+

{{'Trip Management'|translate}}

+
+
+ +
+ +
+
+
+
Loading…
+
+ + + + + + + + + + + + + + +
{{'Trip Name' | translate}}{{'Start Time' | translate}}{{'End Time' | translate}}{{'Trip Status' | translate}}{{'Start Address' | translate}}{{'End Address' | translate}}{{'Amount' | translate}}{{'Weight' | translate}}{{'Material' | translate}}
+
+
+
+
+
+
+ + + + + + + +
+ Report Interval from {{f_date | date:"medium"}} to {{t_date | + date:"medium"}} +
+ diff --git a/src/app/report/report component/trip-management/trip-management-report.component.scss b/src/app/report/report component/trip-management/trip-management-report.component.scss new file mode 100644 index 0000000..63b6859 --- /dev/null +++ b/src/app/report/report component/trip-management/trip-management-report.component.scss @@ -0,0 +1,36 @@ +.topDiv { + // padding-top: 59px; + background: whitesmoke; + height: 100vh; +} + +.rowStyle { + // margin: 5px; + // background: white; + height: 84vh; + // box-shadow: 3px 1px 5px 0px #b2b0ae; +} + +#deviceTable input { + border-radius: 5px; +} + +::-webkit-scrollbar { + width: 10px; +} + +/* Track */ +::-webkit-scrollbar-track { + background: rgb(153, 153, 153); +} + +/* Handle */ +::-webkit-scrollbar-thumb { + // background: rgb(74, 118, 184); + background: #868e96; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background: #555; +} diff --git a/src/app/report/report component/trip-management/trip-management-report.component.spec.ts b/src/app/report/report component/trip-management/trip-management-report.component.spec.ts new file mode 100644 index 0000000..8c61d68 --- /dev/null +++ b/src/app/report/report component/trip-management/trip-management-report.component.spec.ts @@ -0,0 +1,26 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { TripManagementReportComponent } from './trip-management-report.component'; + + + +describe('TripManagementReportComponent', () => { + let component: TripManagementReportComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TripManagementReportComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TripManagementReportComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/report/report component/trip-management/trip-management-report.component.ts b/src/app/report/report component/trip-management/trip-management-report.component.ts new file mode 100644 index 0000000..d99162b --- /dev/null +++ b/src/app/report/report component/trip-management/trip-management-report.component.ts @@ -0,0 +1,635 @@ +import { Component, OnInit } from '@angular/core'; +import { ContactService } from '../../../contact.service'; +import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material'; +import { MyaccountComponent } from '../../../myaccount/myaccount.component'; +import { Params,Router, ActivatedRoute, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; +declare var google: any; +declare var jsPDF : any; +declare var $: any; +const PDF_EXTENSION = ".pdf" +import * as moment from 'moment'; +import { PlayTripComponent } from '../../../play-trip/play-trip.component'; +import { ReportService } from '../../report.service'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; + +@Component({ + selector: 'app-trip-management-report', + templateUrl: './trip-management-report.component.html', + styleUrls: ['./trip-management-report.component.scss'] +}) +export class TripManagementReportComponent implements OnInit { + dataSelect: any[]; + addressLink1: string; + finalArr=[] + private finalise = new Subject(); + constructor(private _service:ReportService,private contactService: ContactService,private router: Router,public dialog: MdDialog) { + this._service.invokeEventFortripMReport.pipe( + takeUntil(this.finalise) + ).subscribe(value => { + if(value){ + this.getReport(value); + } + }); + } + ngOnDestroy(){ + + this.finalise.next(void 0); + } + date1:any; + neww:any; + fs : any; + ls : any; + emailid : any; + or : any; + useridd :any; + time :any; + device_data:any; + devicess:any; + identifier : String = "trip_report"; + final:any; + custtype:any; + cust:boolean=false; + Load : Boolean = false; + date : any; + devicesss:any; + mb:any; + logoutbut:boolean; + dealer:boolean; + text:any; + option:any; + finall:any; + Fromdate:any; + + todate:any; + options=[]; + logo:any; + before:any; + superAdmin:Boolean = false; + ngOnInit() { + + this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin; + + 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; + this.mb = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn; + this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer; + + + + if(this.custtype == true){ + this.cust = true; + } + if(this.mb.charAt(0)=="n"){ + this.mb = ' ' + } + + + if( window.localStorage['Custumer'] == 'ON'){ + this.logoutbut = false + this.dealer = true + } + else{ + this.logoutbut = true + } + + this.logo=window.localStorage['logo']; + this.text=window.localStorage['text']; + this.testTable(); + + } + + +device_summary =[]; +summary:any; +d_name:any; +total_running_time:any; +stop_time:any; +overSpeed:any; +route_violation:any; +trips:any; +total_km:any; +address_show:any; +end_add_show:any; +start_add:any; +end_add:any; +start_add_lat:any; +start_add_long:any; +end_add_lat:any; +end_add_long:any; +uId:any; +devId:any; + +Durations:any; +deviceArr:any=[]; + +getReport(event){ + if(event == 'getExcel'){ + this.exportExcel(); + } else if(event=='getPdf') + { + this.expotToPdf(); + }else{ + var deviceId: any; + var tpdata = event ; + var that = this; + var fd = new Date(tpdata.fromDate); + var td = new Date(tpdata.toDate); + if(event.deviceArr.length==0){ + deviceId=[]; + }else{ + deviceId= event.deviceArr; + } + this.deviceArr = deviceId; + this.Fromdate = fd; + this.todate = td; + + + + this.tabelObj.ajax.reload(); + + + } + + + +} + + +tab:any; +exportExcel() +{ + + + var tab_text=""; + var textRange; var j=0; + var table = $('#deviceTable').clone(); + table[0].querySelector("thead").remove(); + table[0].prepend($(".dataTable thead").clone()[0]); + this.tab = table[0];//document.getElementById('deviceTable'); // id of table + + for(j = 0 ; j < this.tab.rows.length ; j++) + { + tab_text=tab_text+this.tab.rows[j].innerHTML+""; + //tab_text=tab_text+""; + } + + tab_text=tab_text+"
"; + // tab_text= tab_text.replace(/]*>|<\/A>/g, "");//remove if u want links in your table + tab_text= tab_text.replace(/]*>/gi,""); // remove if u want images in your table + tab_text= tab_text.replace(/]*>|<\/input>/gi, ""); // reomves input params + + var ua = window.navigator.userAgent; + var msie = ua.indexOf("MSIE "); + + var sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text)); + + return (sa); +} + +filterStates(val) { + + // console.log(val) + + + if (val==""){ + + this.dataSelect = []; + // console.log("deviceValue",this.dataSelect); + } else{ + + const filterValue:any = val; + + this.dataSelect = this.options.filter(function(d){ + var t = d.value.toLocaleLowerCase().indexOf(filterValue.toLocaleLowerCase()); + // this.option = this.options[i]; + + + return t > -1; + }); + + return this.dataSelect; + } + +} + +addressLink = ""; +getlink(report : any){ + + // console.log("report=>",report); + var lat = report.start_lat?report.start_lat:0; + var lng = report.start_long?report.start_long:0; + this.addressLink = 'https://maps.google.com/?q=' + lat + ',' + lng; + return this.addressLink ; +} + +getlink1(report:any){ + + // console.log("report=>",report); + var lat = report.end_lat?report.end_lat:0; + var lng = report.end_long?report.end_long:0; + this.addressLink1 = 'https://maps.google.com/?q=' + lat + ',' + lng; + return this.addressLink ; +} + +tabelObj: any ; +testTable() { + const that = this; + console.log("inside function"); + $(document).ready(function() { + + that.tabelObj = $('#deviceTable').DataTable({ + dom: 'lBftip', + buttons: [ + 'copy', + 'print', + 'excel' + ], + "processing": false, + "searching": true, + pagingType: 'full_numbers', + pageLength: 25, + serverSide: false, + "scrollY":'65vh', + "scrollCollapse": true, + lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], + ajax: (dataTablesParameters,callback) => { + console.log('temptemptemptemptemp',dataTablesParameters); + var deviceID; + that.Load = true + console.log('that.deviceArr',that.deviceArr); + var from_date = that.Fromdate; + var to_date = that.todate; + var user = that.useridd; + var temp = { + from_date : from_date, + to_date : to_date, + user : user + } + that.finalArr=[] + var suburl = ""; + if((temp.from_date != undefined)&&(temp.to_date != undefined)){ + suburl = "/user_trip/listPlannedTrip"; + + that.contactService.post(suburl, + { + "device": that.deviceArr.length ? that.deviceArr[0] : [], + "isAnnotated":true, + "from":new Date(temp.from_date).toISOString(), + "to":new Date(temp.to_date).toISOString() + + }).subscribe((resp:any) => { + if(resp.length) { + resp.map(ite=>{ + ite.end_time = ite.end_time ? ite.end_time : '' + }) + } + that.finalArr=resp + that.Load = false ; + resp.sort((a, b) => new Date(b.start_time).getTime() - new Date(a.start_time).getTime()); + + callback({data : resp }); + }, err => { + that.Load= false; + console.log("error",err) ; + }); + + }else{ + that.Load = false ; + callback({data : [] }); + + } + + + }, + "rowCallback": function(row: Node, data: any | Object, index: number){ + $('#playTrip', row).bind('click', () => { + console.log(data); + var fd = new Date(data.start_time).toISOString(); + var td = new Date(data.end_time).toISOString(); + var replayObj= { + fromdate:fd, + todate : td, + user : that.useridd, + device:{imei: data.device.Device_ID,_id: data.device._id,iconType:data.device.iconType}, + distance: (typeof data.distance === 'number')?(parseFloat(data.distance).toFixed(2)):0 + + } + + let dialogRef = that.dialog.open(PlayTripComponent, { + data: replayObj + }); + + dialogRef.afterClosed().subscribe(result => { + console.log(result); + if(result == 'cancelled'){ + + } + }) + + + }); + + } + , + + + "columns": [ + { + "data": "trip_name", + render: function(data, type, row) { + return data?data:''; + } + }, + { + "data": "start_time", + render: function(data, type, row) { + var st = new Date(data); + return data ? (moment(st).format('llll')) : ""; + + } + }, + { + "data": "end_time", + render: function(data, type, row) { + var et = new Date(data); + return data ? (moment(et).format('llll')) : ""; + } + } , + { + "data": "trip_status", + render: function(data, type, row) { + // var st = new Date(data); + return data ? data : ""; + + } + }, + { + "data": "startAddress", + "defaultContent": "_id", + render: function(data, type, row) { + var lat = row.start_lat?row.start_lat:0; + var long = row.start_long?row.start_long:0; + var addressLink_start = ' '; + return data?data : addressLink_start; + + } + }, + + { + "data": "endAddress", + "defaultContent": "_id", + render: function(data, type, row) { + var lat = row.end_lat?row.end_lat:0; + var long = row.end_long?row.end_long:0; + var addressLink_end = ' '; + return data?data : addressLink_end; + + } + }, + + { + "data": "trip_charge", + render: function(data, type, row) { + return data?data:''; + } + }, + { + "data": "cargo_weight", + render: function(data, type, row) { + return data?data:''; + } + }, + { + "data": "cargo_content", + render: function(data, type, row) { + return data?data:''; + } +}, + + ], + "columnDefs": [ + { className: "dt-body-left", "targets": [ 0,1,2,3,4,5 ] }, + { + "targets": '_all', + "createdCell": function (td, cellData, rowData, row, col) { + $(td).css('padding', '18px') + } + } , + { targets: 1, type: 'date' }, + + + + ] + }); + + }); + +} + +expotToPdf(){ + console.log(this.finalArr); + + this.downloadPdf() + + } + +// downloadPdf() { +// let fileName = +// "Trip Report" + +// new Date().getTime() + +// PDF_EXTENSION; +// var pdfsize = "a2"; + +// var doc = new jsPDF("p", "pt", pdfsize); + +// doc.setFontSize(15); +// doc.text('Trip Report ', 20, 30); +// doc.setFontStyle("arial"); +// var header = function(data) { +// doc.setFontSize(15); +// doc.setTextColor(40); +// doc.setFontStyle('normal'); + +// }; + +// var options = { +// beforePageContent: header, +// margin: { +// top: 120 +// }, +// startY: doc.autoTableEndPosY() + 20 +// }; + +// doc.autoTable({ +// head: this.headRows(), +// // margin: { top: 80 }, +// body: this.bodyRows(this.finalArr.length, this.finalArr), +// options + +// }); +// doc.save(fileName); +// } + +startAddress; + +endAddress; +f_date +t_date +downloadPdf() { + var outerThis=this + let fileName = + "Trip Management Report" + + new Date()+ + PDF_EXTENSION; + var pdfsize = "a2"; + var totalPagesExp = "{total_pages_count_string}"; +// outerThis.startAddress= outerThis.finalArr[0].address; +// outerThis.endAddress= outerThis.finalArr[outerThis.finalArr.length-1].address + var doc = new jsPDF("p", "pt", pdfsize); + outerThis.f_date = moment(this.Fromdate).format('lll'); + outerThis.t_date =moment(this.todate).format('lll'); + // var date_combine = f_date + ' to ' + t_date; + // doc.setFontSize(30); + var pageHeight = doc.internal.pageSize.height || doc.internal.pageSize.getHeight(); +var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth(); + doc.setFontSize(15); + // doc.text(60, 20, 'Travel Path Report (Date='+date_combine+') Device Name='+this.device_name,); + + doc.text("Trip Report", 500, 30); + doc.setFontStyle("arial"); + + var header = function(data) { + doc.setFontSize(30); + doc.setTextColor(40); + doc.setFontStyle('arial'); + + }; + + var options = { + beforePageContent: header, + margin: { + top: 120 + }, + + startY: doc.autoTableEndPosY() + 20 + }; + var logo=localStorage.getItem('logo1'); + outerThis.toDataURL(logo, function (dataUrl) { + + doc.autoTable({ + head: outerThis.headRows(), + // margin: { top: 80 }, + // startY: doc.autoTable.previous.finalY + 200, + body: outerThis.bodyRows(outerThis.finalArr.length, outerThis.finalArr), + options, + styles: {overflow: 'linebreak'}, + // tableLineColor: [0, 0, 0], //choose RGB + // tableLineWidth: 0.5, //table border width + // bodyStyles: { + // margin: 40, + // fontSize: 10, + // lineWidth: 0.2, + // lineColor: [0, 0, 0] + // }, + theme:'grid', + didDrawPage: function (data) { + // Header + doc.setFontSize(20); + doc.setTextColor(40); + doc.setFontStyle('arial'); + // logo=localStorage.getItem('logo1'); + if(logo) + doc.addImage(dataUrl, 'JPEG', pageWidth-100, 6, 75, 75); + doc.autoTable({html:"#headerTable",margin:{bottom:140,left:20,right:8,top:40},theme:'plain'}); + + // Footer + var str = "Page " + doc.internal.getNumberOfPages() + // Total page number plugin only available in jspdf v1.0+ + if (typeof doc.putTotalPages === 'function') { + str = str + " of " + totalPagesExp; + } + doc.setFontSize(10); + + // jsPDF 1.4+ uses getWidth, <1.4 uses .width + var pageSize = doc.internal.pageSize; + var pageHeight = pageSize.height ? pageSize.height : pageSize.getHeight(); + doc.text(str, data.settings.margin.left, pageHeight - 10); + }, + + margin: {top: 85}, + + }); + if (typeof doc.putTotalPages === 'function') { + doc.putTotalPages(totalPagesExp); + } + doc.save(fileName); + }) + } + + toDataURL(url, callback) { + + 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(); + } + headRows() { + + return [ + // displayedColumns=['vehicleName','IMEI','totalDistance','fuel','ignOn','ignOff','idleTime','outOfReach','noGps','trips','maxSpeed','startLocation','endLocation','details']; + + { + + trip_name:"Trip name", +start_time: "Start time", +end_time: "End time", +trip_status: "Trip status", +startAddress: "Start Address", +endAddress: "End Address", +trip_charge: "Amount", +cargo_weight: "Weight", +cargo_content: "Material", + + + } + ]; + } + + bodyRows(rowCount, pdfBody) { + console.log(rowCount, pdfBody); + + rowCount = rowCount || 10; + let body = []; + for (var j = 0; j < rowCount; j++) { + var stime = pdfBody[j].start_time ? new Date(pdfBody[j].start_time) : ''; + var endTime = pdfBody[j].end_time? new Date(pdfBody[j].end_time):''; + + body.push({ + trip_name:pdfBody[j].trip_name, + start_time: pdfBody[j].start_time? moment(pdfBody[j].start_time).format('llll'):'', + end_time: pdfBody[j].end_time ? moment(pdfBody[j].end_time).format('lll'):'', + startAddress:pdfBody[j].startAddress?pdfBody[j].startAddress:'N/A', + endAddress:pdfBody[j].endAddress?pdfBody[j].endAddress:'N/A', + trip_status:pdfBody[j].trip_status?pdfBody[j].trip_status:'N/A', + trip_charge:pdfBody[j].trip_charge?pdfBody[j].trip_charge:'N/A', + cargo_weight:pdfBody[j].cargo_weight?pdfBody[j].cargo_weight:'N/A', + cargo_content:pdfBody[j].cargo_content?pdfBody[j].cargo_content:'N/A', + }); + } + return body; + } + + + +} diff --git a/src/app/report/report component/trip-report/trip-report.component.html b/src/app/report/report component/trip-report/trip-report.component.html index c309cb3..67bb749 100644 --- a/src/app/report/report component/trip-report/trip-report.component.html +++ b/src/app/report/report component/trip-report/trip-report.component.html @@ -2,7 +2,7 @@
-

{{'1 Trip Report'|translate}}

+

{{'Trip Report'|translate}}

- + From 81e5b8cf525b24d8a8bf72f72c4613c9761400d5 Mon Sep 17 00:00:00 2001 From: Pranav Date: Mon, 24 Jul 2023 11:36:46 +0000 Subject: [PATCH 09/10] 24 jul update --- .../account-detail.component.ts | 1 - src/app/account/account.component.ts | 3 +- src/app/add-cust/add-cust.component.ts | 3 +- .../add-device-model.component.ts | 5 +- src/app/add-driver/add-driver.component.ts | 9 +- .../add-edit-vehicle-type.component.ts | 5 +- src/app/add/add.component.ts | 8 +- .../reset-password.component.ts | 2 +- src/app/all-menus/all-menus.component.html | 3 + src/app/all-menus/all-menus.component.ts | 10 +- src/app/app.module.ts | 2 + src/app/app.router.ts | 3 +- src/app/const/const.component.ts | 37 +- src/app/contact.service.ts | 1 - .../add-new-device.component.ts | 16 +- src/app/dashboard/dashboard.component.ts | 2 +- .../new-edit-device.component.ts | 7 +- .../dealers-info/dealers-info.component.html | 20 +- .../dealers-info/dealers-info.component.scss | 5 + .../dealers-info/dealers-info.component.ts | 5 +- .../device-renew/device-renew.component.ts | 2 +- .../alert-report/alert-report.component.ts | 5 +- .../device-sosreport.component.ts | 2 +- .../device-speed-report.component.ts | 5 +- .../distance-report.component.ts | 5 +- .../drivers-performance-report.component.ts | 5 +- .../geofancing-report.component.html | 2 +- .../geofancing-report.component.ts | 5 +- .../ideal-report/ideal-report.component.ts | 5 +- .../ign-report/ign-report.component.ts | 5 +- .../ignition-report.component.ts | 5 +- .../report-filter.component.html | 22 +- .../report-filter/report-filter.component.ts | 11 +- .../summary-report.component.ts | 5 +- src/app/device/device.component.ts | 2 +- ...dialog-content-example-dialog.component.ts | 7 +- .../geofence-add/geofence-add.component.ts | 2 +- .../geofencing-view.component.ts | 5 +- src/app/geofencing/geofencing.component.ts | 5 +- src/app/group/group.component.ts | 6 +- src/app/home/home.component.ts | 6 +- .../device-doc/device-doc.component.html | 444 ++++++++--------- .../device-kyc/device-kyc.component.html | 26 +- .../device-kyc/device-kyc.component.ts | 29 +- .../kyc-approval/kyc-approval.component.ts | 3 +- src/app/location/cmd-ui/cmd-ui.component.ts | 2 +- .../command-window.component.ts | 2 +- src/app/location/location.component.html | 21 +- src/app/location/location.component.ts | 450 +++++++++--------- src/app/login/login.component.ts | 27 +- .../notification/notification.component.ts | 2 +- src/app/poi-list/poi-list.component.ts | 3 +- .../poi-master-edit.component.ts | 2 +- src/app/poidetails/poidetails.component.ts | 5 +- .../point-of-intrest.component.ts | 5 +- src/app/point-share/point-share.component.ts | 2 +- .../report/all-menus/all-menus.component.html | 4 +- .../report/all-menus/all-menus.component.ts | 12 +- src/app/report/header/header.component.ts | 7 +- src/app/report/main/main.component.ts | 3 + .../notification/notification.component.ts | 4 +- .../alert-report/alert-report.component.ts | 5 +- .../day-wise-report.component.html | 4 +- .../day-wise-report.component.ts | 42 +- .../device-sosreport.component.ts | 2 +- .../device-speed-report.component.ts | 5 +- .../drivers-performance-report.component.ts | 5 +- .../fuel-report/fuel-report.component.ts | 5 +- .../geofancing-report.component.ts | 22 +- .../ideal-report/ideal-report.component.ts | 5 +- .../ign-report/ign-report.component.ts | 5 +- .../ignition-report.component.ts | 5 +- .../new-travel-path-report.component.ts | 34 +- .../notification-master.component.ts | 4 +- .../over-speed/over-speed.component.ts | 5 +- .../route-violation.component.ts | 5 +- .../summary-report.component.html | 4 +- .../summary-report.component.ts | 31 +- .../report-filter.component.html | 13 + .../report-filter/report-filter.component.ts | 30 +- .../route-map-add/route-map-add.component.ts | 3 +- .../route-mapping/route-mapping.component.ts | 3 +- src/app/route-plan/route-plan.component.ts | 2 +- src/app/route-set/route-set.component.ts | 4 +- src/app/show-route/show-route.component.ts | 2 +- .../show-vehicles/show-vehicles.component.ts | 28 +- src/app/sidebar/sidebar.component.ts | 18 +- .../addsubadmin/addsubadmin.component.ts | 2 +- src/app/sub-amin/sub-amin.component.ts | 3 +- src/app/technician/technician.component.ts | 10 +- .../vehicle-type/vehicle-type.component.ts | 9 +- .../virtual-device.component.html | 149 ++++++ .../virtual-device.component.scss | 84 ++++ .../virtual-device.component.spec.ts | 24 + .../virtual-device.component.ts | 156 ++++++ src/environments/environment.prod.ts | 6 +- src/environments/environment.ts | 10 +- src/index.html | 2 +- src/styles.css | 5 +- 99 files changed, 1373 insertions(+), 695 deletions(-) create mode 100644 src/app/virtual-device/virtual-device.component.html create mode 100644 src/app/virtual-device/virtual-device.component.scss create mode 100644 src/app/virtual-device/virtual-device.component.spec.ts create mode 100644 src/app/virtual-device/virtual-device.component.ts diff --git a/src/app/account-detail/account-detail.component.ts b/src/app/account-detail/account-detail.component.ts index 53856e6..16d7680 100644 --- a/src/app/account-detail/account-detail.component.ts +++ b/src/app/account-detail/account-detail.component.ts @@ -452,7 +452,6 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); } } diff --git a/src/app/account/account.component.ts b/src/app/account/account.component.ts index 6dbdbe9..82fc926 100644 --- a/src/app/account/account.component.ts +++ b/src/app/account/account.component.ts @@ -158,7 +158,8 @@ logout(){ soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } diff --git a/src/app/add-cust/add-cust.component.ts b/src/app/add-cust/add-cust.component.ts index 066bd07..d3b9570 100644 --- a/src/app/add-cust/add-cust.component.ts +++ b/src/app/add-cust/add-cust.component.ts @@ -1096,7 +1096,8 @@ openNav() { this.router.navigateByUrl("device-report/ideal-report"); } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } new(){ diff --git a/src/app/add-device-model/add-device-model.component.ts b/src/app/add-device-model/add-device-model.component.ts index 7a08d99..baa04b3 100644 --- a/src/app/add-device-model/add-device-model.component.ts +++ b/src/app/add-device-model/add-device-model.component.ts @@ -95,7 +95,8 @@ export class AddDeviceModelComponent implements OnInit { } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } @@ -313,7 +314,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } /* TOKEN GENERATION */ diff --git a/src/app/add-driver/add-driver.component.ts b/src/app/add-driver/add-driver.component.ts index 7fb75b4..23523d2 100644 --- a/src/app/add-driver/add-driver.component.ts +++ b/src/app/add-driver/add-driver.component.ts @@ -97,7 +97,8 @@ export class AddDriverComponent implements OnInit { } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } @@ -337,7 +338,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } /* TOKEN GENERATION */ @@ -541,7 +542,7 @@ else{ // return metadata; // }; // onUploadFinished(file) { -// debugger; +// // console.log(file); // this.imageFile=file; // console.log(this.imageFile.file.name); @@ -569,7 +570,7 @@ else{ // return metadata; // }; // onUploadFinished1(file) { -// debugger; +// // console.log(file); // this.imageFile=file; // console.log(this.imageFile.file.name); diff --git a/src/app/add-edit-vehicle-type/add-edit-vehicle-type.component.ts b/src/app/add-edit-vehicle-type/add-edit-vehicle-type.component.ts index 8ab016f..93a8c1b 100644 --- a/src/app/add-edit-vehicle-type/add-edit-vehicle-type.component.ts +++ b/src/app/add-edit-vehicle-type/add-edit-vehicle-type.component.ts @@ -116,7 +116,8 @@ export class AddEditVehicleTypeComponent implements OnInit { } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } @@ -332,7 +333,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } /* TOKEN GENERATION */ diff --git a/src/app/add/add.component.ts b/src/app/add/add.component.ts index 79cc447..127c6f9 100644 --- a/src/app/add/add.component.ts +++ b/src/app/add/add.component.ts @@ -342,7 +342,8 @@ export class AddComponent implements OnInit { localStorage.setItem("dlrchk", dlrStatus) - this.router.navigateByUrl("const?_status=" + "OK"); + +this.router.navigateByUrl("const?_status=" + "OK"); // console.log('testing', this.useridd); } @@ -399,7 +400,8 @@ export class AddComponent implements OnInit { this.router.navigateByUrl("device-report/ideal-report"); } soon() { - this.router.navigateByUrl("const?_i=" + window.localStorage.token); + +this.router.navigateByUrl("const?_i=" + window.localStorage.token); } new() { @@ -442,7 +444,7 @@ export class AddComponent implements OnInit { if (window.localStorage['DataLoaded'] = 'True') { window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } diff --git a/src/app/add/reset-password/reset-password.component.ts b/src/app/add/reset-password/reset-password.component.ts index 85902cb..4d35c5b 100644 --- a/src/app/add/reset-password/reset-password.component.ts +++ b/src/app/add/reset-password/reset-password.component.ts @@ -55,7 +55,7 @@ export class ResetPasswordComponent implements OnInit { showBtn : boolean = true; showBtn_1 : boolean = true; show_hide_pass(id){ - debugger; + console.log(id); if(id == 0){ this.iType = 'text'; diff --git a/src/app/all-menus/all-menus.component.html b/src/app/all-menus/all-menus.component.html index fd3f8aa..a9352ff 100644 --- a/src/app/all-menus/all-menus.component.html +++ b/src/app/all-menus/all-menus.component.html @@ -125,6 +125,9 @@ {{'User Finder' | translate}} + {{'User Master' | translate}} {{'Vehicle Type' | translate}} diff --git a/src/app/all-menus/all-menus.component.ts b/src/app/all-menus/all-menus.component.ts index 9b678dc..afa4bd5 100644 --- a/src/app/all-menus/all-menus.component.ts +++ b/src/app/all-menus/all-menus.component.ts @@ -268,8 +268,10 @@ export class AllMenusComponent implements OnInit { //2 menu dashboard soon(id) { + this.menuFlag = this.contactService.menuReturnSet(id); - this.router.navigateByUrl("const?_i=" + window.localStorage.token); + +this.router.navigateByUrl("const?_i=" + window.localStorage.token); } // 3 menu group(id) { @@ -369,6 +371,9 @@ export class AllMenusComponent implements OnInit { this.router.navigateByUrl("vehicle/reminder_service"); } + virtualDevice(id) { + this.router.navigateByUrl("virtualDevice"); + } @@ -657,7 +662,6 @@ fuel_report(id){ localStorage.removeItem('profilePic'); } this.router.navigateByUrl("add"); - // this.router.navigateByUrl("const?_status="+"OK"); } } @@ -690,7 +694,7 @@ fuel_report(id){ } this.router.navigateByUrl("dealerInfo"); - // this.router.navigateByUrl("const?_status="+"OK"); + } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 877d9c4..f04f77e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -284,6 +284,7 @@ import { IndexingReportComponent } from './indexingReport/index-report.component import { IssueListKycComponent } from './kyc-approval/issue-list/issue-list.component'; import { IssueAddKycComponent } from './kyc-approval/issue-add/issue-add.component'; import { TripManagementReportComponent } from './report/report component/trip-management/trip-management-report.component'; +import { VirtualDeviceComponent } from './virtual-device/virtual-device.component'; // import { DisatanceReportComponent } from './report/disatance-report/disatance-report.component'; // import { MainComponent } from './report/main/main.component'; // import { AcReportsComponent } from './report/ac-report/ac-report.component'; @@ -476,6 +477,7 @@ export function createTranslateLoader(http: Http) { ProductOverviewComponent, PointShareComponent, MessageUtilityComponent, + VirtualDeviceComponent, TripLoadUnloadComponent, BuyNowComponent, BillingInfoComponent, diff --git a/src/app/app.router.ts b/src/app/app.router.ts index 9a1116d..d19f566 100644 --- a/src/app/app.router.ts +++ b/src/app/app.router.ts @@ -212,6 +212,7 @@ import { UserSettingComponent } from './user-setting/user-setting.component'; import { CurrentPositionReportComponent } from './report/report component/current-position/current-position.component'; import { IndexingReportComponent } from './indexingReport/index-report.component'; import { TripManagementReportComponent } from './report/report component/trip-management/trip-management-report.component'; +import { VirtualDeviceComponent } from './virtual-device/virtual-device.component'; // import { DeviceFuelReportComponent } from './device-report/device-fuel-report/device-fuel-report.component'; // import { DeviceSOSreportComponent } from './device-report/device-sosreport/device-sosreport.component'; // import { TripByDeviceComponent } from './device-report/trip-by-device/trip-by-device.component'; @@ -314,7 +315,7 @@ export const router: Routes =[ {path : 'PointShareComponent',component : PointShareComponent}, {path: 'messageUtility',component : MessageUtilityComponent}, {path: 'censor',component : CensorDisplayComponent}, - // {path : 'live',component : LiveTrackingComponent}, + {path : 'virtualDevice',component : VirtualDeviceComponent}, {path: 'fuelComp',component: SidemenuFuelComponent}, {path: 'vehicleRoute',component: VehicleRouteComponent}, {path: 'setRoute',component: RouteSetComponent}, diff --git a/src/app/const/const.component.ts b/src/app/const/const.component.ts index 33fc126..64c0784 100644 --- a/src/app/const/const.component.ts +++ b/src/app/const/const.component.ts @@ -621,7 +621,7 @@ export class ConstComponent implements OnInit { if (window.localStorage['DataLoaded'] = 'True') { window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } logo: any; @@ -738,15 +738,13 @@ export class ConstComponent implements OnInit { this.sidebarData(10); }); - - - - // var retrievedData = localStorage.getItem("devices"); - // var cord = JSON.parse(retrievedData); - // this.final = cord; - - - + this.activatedRoute.queryParams.subscribe((params: Params) => { + // //console.log('p3'); + + if(params['redirect']) { + this.router.navigateByUrl("location?pageid=locationComponent"); + } + }) this.timer = Observable.timer(100, 100); this.subscription = this.timer.subscribe(t => { var retrievedData = localStorage.getItem("devices"); @@ -843,7 +841,7 @@ export class ConstComponent implements OnInit { this.getuserObject(); this.getLanguage(); - this.getNotificationCount() + this.getNotificationCount(); } @@ -1414,7 +1412,7 @@ selectedlanguage:any // localStorage.setItem('Dealer',"OFF"); // localStorage.setItem('superadmin',"OFF") //console.log('this.superAdmin',this.superAdmin); - // debugger; + // if(this.superAdmin === true){ localStorage.setItem('supAdminAcessToCust', 'true' ); } @@ -1423,7 +1421,8 @@ selectedlanguage:any localStorage.setItem("dlrchk", dlrStatus) - this.router.navigateByUrl("const?_status=" + "OK"); + +this.router.navigateByUrl("const?_status=" + "OK"); // //console.log('testing', this.useridd); } @@ -1463,8 +1462,8 @@ selectedlanguage:any // //console.log("Inside View Dev",dataStatus); if (type == "Tracker") { localStorage.setItem('last_speed',lastSpeed ); - this.router.navigateByUrl("location?_dname=" + name + "_id=" + id); - window.localStorage['devDetail'] = JSON.stringify(dataStatus); + //this.router.navigateByUrl("location?_dname=" + name + "_id=" + id); + //window.localStorage['devDetail'] = JSON.stringify(dataStatus); } else { localStorage.setItem('last_speed',lastSpeed ); @@ -2247,7 +2246,7 @@ selectedlanguage:any getfuel(device,ind){ // //console.log(ind); // //console.log(device); - // debugger; + // var show_val = ''; if(this.fuelflag == 'l'){ if((device.currentFuel == undefined)||(device.currentFuel == NaN)||(device.currentFuel == null)){ @@ -2917,7 +2916,7 @@ selectedlanguage:any getApiKey(){ - // debugger; + // var api_key = 'AIzaSyA_ycttLXPMfCSSNAfPOsaENPQ85i17lPU'; var apiIdentifier = localStorage.getItem('apiIdentifier'); if(apiIdentifier == null){ @@ -3225,7 +3224,9 @@ selectedlanguage:any else { window.localStorage['checker'] = params['_status']; } - + if(params['redirect']) { + this.router.navigateByUrl("location?pageid=locationComponent"); + } }); this.latLongDetail() diff --git a/src/app/contact.service.ts b/src/app/contact.service.ts index cce1e22..a63b0be 100644 --- a/src/app/contact.service.ts +++ b/src/app/contact.service.ts @@ -1655,7 +1655,6 @@ getLanguages(payload){ getAddressByApi(latlng){ if(this.latLongAddress[latlng.long+'_'+latlng.lat]) { - console.log('get address for cache'); return Observable.of(this.latLongAddress[latlng.long+'_'+latlng.lat]); } else { return this.http.post(this.dev_url +'/googleAddress/getGoogleAddress',latlng) diff --git a/src/app/dashboard/add-new-device/add-new-device.component.ts b/src/app/dashboard/add-new-device/add-new-device.component.ts index 3033dd1..3cee855 100644 --- a/src/app/dashboard/add-new-device/add-new-device.component.ts +++ b/src/app/dashboard/add-new-device/add-new-device.component.ts @@ -210,7 +210,7 @@ export class AddNewDeviceComponent implements OnInit { SMSPlan:[''], city:[''], deviceModel:[''], - trackingExp:new Date(this.expDate), + trackingExp:new Date(new Date().setFullYear(new Date().getFullYear() + 2)), eSimExpiry:[''], model:[''], email:[""], @@ -234,15 +234,17 @@ export class AddNewDeviceComponent implements OnInit { that.checkDeviceEMI(value); for(var i=0;i - +
-

{{dealer.first_name}} {{dealer.last_name}}

+

{{dealer.first_name}} {{dealer.last_name}}

-

{{dealer.email}}

+

{{dealer.email}}

-

{{dealerPhone(dealer)}}

+

{{dealerPhone(dealer)}}

diff --git a/src/app/dealers-info/dealers-info.component.scss b/src/app/dealers-info/dealers-info.component.scss index 7ce05e0..b07d8f7 100644 --- a/src/app/dealers-info/dealers-info.component.scss +++ b/src/app/dealers-info/dealers-info.component.scss @@ -1,3 +1,8 @@ +.ftd-mp { + padding-top: 14px; + padding-bottom: 12px; +} + // #body{ // overflow-x: hidden; // overflow-y: hidden; diff --git a/src/app/dealers-info/dealers-info.component.ts b/src/app/dealers-info/dealers-info.component.ts index dd944bd..199101a 100644 --- a/src/app/dealers-info/dealers-info.component.ts +++ b/src/app/dealers-info/dealers-info.component.ts @@ -355,7 +355,8 @@ export class DealersInfoComponent implements OnInit { if (window.localStorage['DataLoaded'] = 'True') { - this.router.navigateByUrl("const?_status=" + "OK"); + +this.router.navigateByUrl("const?_status=" + "OK"); } }); } @@ -596,7 +597,7 @@ export class DealersInfoComponent implements OnInit { //Add the header row. var row = table.insertRow(-1); - debugger; + for (var i = 0; i < columnCount; i++) { var headerCell = document.createElement("TH"); headerCell.innerHTML = customers[0][i] diff --git a/src/app/device-renew/device-renew.component.ts b/src/app/device-renew/device-renew.component.ts index fbe5ae3..8f9ac3a 100644 --- a/src/app/device-renew/device-renew.component.ts +++ b/src/app/device-renew/device-renew.component.ts @@ -769,7 +769,7 @@ export class DeviceRenewComponent implements OnInit { const filtersimValue: any = simnum; this.simNumberSelect = []; this.simNumberSelect = this.deviceObj.filter(function (pptt) { - // debugger; + // // console.log(pp); var t = pptt.sim_Number.toLocaleLowerCase().indexOf(filtersimValue.toLocaleLowerCase()); return t > -1; diff --git a/src/app/device-report/alert-report/alert-report.component.ts b/src/app/device-report/alert-report/alert-report.component.ts index 1a7bc23..b74ac59 100644 --- a/src/app/device-report/alert-report/alert-report.component.ts +++ b/src/app/device-report/alert-report/alert-report.component.ts @@ -180,7 +180,8 @@ devi(){ } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } new(){ @@ -226,7 +227,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } diff --git a/src/app/device-report/device-sosreport/device-sosreport.component.ts b/src/app/device-report/device-sosreport/device-sosreport.component.ts index 082b0c3..f285f7d 100644 --- a/src/app/device-report/device-sosreport/device-sosreport.component.ts +++ b/src/app/device-report/device-sosreport/device-sosreport.component.ts @@ -208,7 +208,7 @@ export class DeviceSOSreportComponent implements OnInit { }); // $('#deviceTable tbody').on('click', 'button', function() { - // debugger; + // // var data = that.tabelObj.row($(this).parents('tr')).data(); // console.log("button clicked"); // }); diff --git a/src/app/device-report/device-speed-report/device-speed-report.component.ts b/src/app/device-report/device-speed-report/device-speed-report.component.ts index 45b7539..555d1db 100644 --- a/src/app/device-report/device-speed-report/device-speed-report.component.ts +++ b/src/app/device-report/device-speed-report/device-speed-report.component.ts @@ -50,7 +50,8 @@ export class DeviceSpeedReportComponent implements OnInit { // } // soon() { - // this.router.navigateByUrl("const?_i=" + window.localStorage.token); + // +// this.router.navigateByUrl("const?_i=" + window.localStorage.token); // } @@ -214,7 +215,7 @@ export class DeviceSpeedReportComponent implements OnInit { if (window.localStorage['DataLoaded'] = 'True') { window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } _lineChartData: any; diff --git a/src/app/device-report/distance-report/distance-report.component.ts b/src/app/device-report/distance-report/distance-report.component.ts index 8d0b238..d88d3d5 100644 --- a/src/app/device-report/distance-report/distance-report.component.ts +++ b/src/app/device-report/distance-report/distance-report.component.ts @@ -196,7 +196,8 @@ firstcall:boolean=true; // } // soon(){ -// this.router.navigateByUrl("const?_i="+window.localStorage.token); +// +// this.router.navigateByUrl("const?_i="+window.localStorage.token); // } @@ -253,7 +254,7 @@ firstcall:boolean=true; // if(window.localStorage['DataLoaded'] = 'True'){ // window.localStorage['Custumer'] = 'OFF' // this.router.navigateByUrl("add") -// // this.router.navigateByUrl("const?_status="+"OK"); +// // } // } diff --git a/src/app/device-report/drivers-performance-report/drivers-performance-report.component.ts b/src/app/device-report/drivers-performance-report/drivers-performance-report.component.ts index 2f27c50..c187982 100644 --- a/src/app/device-report/drivers-performance-report/drivers-performance-report.component.ts +++ b/src/app/device-report/drivers-performance-report/drivers-performance-report.component.ts @@ -156,7 +156,8 @@ devi(){ } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } @@ -223,7 +224,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } diff --git a/src/app/device-report/geofancing-report/geofancing-report.component.html b/src/app/device-report/geofancing-report/geofancing-report.component.html index 1ef4ebe..5e6cc39 100644 --- a/src/app/device-report/geofancing-report/geofancing-report.component.html +++ b/src/app/device-report/geofancing-report/geofancing-report.component.html @@ -2,7 +2,7 @@
-

{{'Geofencing Report' | translate}}

+

{{'Geofencing Report 1' | translate}}

- - - - + + + + State RTO Certificate @@ -75,167 +76,179 @@ - -
- -
+ +
+ +
-
- - - - - - - - - +
+
NameImageDate
+ + - - - - - - - - - - - - + + + - - - - + + + - - - - - + + + - - + + + + + + + + + + + + + + + + + + + +
State RTO Certificate - - - - - - Not Available - - - {{state_certifcate_date |date:"medium"}} - NameImageDate
Vahan Certificate
State RTO Certificate - - - - - - - Not Available - - + + + + - {{vaahan_certifcate_date |date:"medium"}} + + Not Available +
+ {{state_certifcate_date |date:"medium"}} +
Vahan Certificate + + + + + + + Not Available + + + {{vaahan_certifcate_date |date:"medium"}} +
-
- - - + +
+
+ + + + + + + + + - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameImageDateDownload
NameImageDateDownloadState RTO Certificate + + + + + + Not Available + + + {{state_certifcate_date |date:"medium"}} + + + + + + +
State RTO Certificate - - - - - - Not Available - - - {{state_certifcate_date |date:"medium"}} - - - - - - - -
Vahan Certificate - - - - - - Not Available - - - {{vaahan_certifcate_date |date:"medium"}} - - - - - - -
- -
-
-

Documents Not Uploaded

-
+ + Vahan Certificate + + + + + + + + + + + + Not Available + + + + + + {{vaahan_certifcate_date |date:"medium"}} + + + + + + + + + + + + + + + + + +
+
+

Documents Not Uploaded

+
+
- - - - - - - - - - - +
- {{item}} -
- {{value[i]}} -
+ + + + + + + + + + -
+ {{item}} +
+ {{value[i]}} +
+
- +
- - + \ No newline at end of file diff --git a/src/app/kyc-approval/device-kyc/device-kyc.component.html b/src/app/kyc-approval/device-kyc/device-kyc.component.html index c1b1e93..ec66610 100644 --- a/src/app/kyc-approval/device-kyc/device-kyc.component.html +++ b/src/app/kyc-approval/device-kyc/device-kyc.component.html @@ -161,6 +161,16 @@ {{ "RTO City" | translate }} + + {{ "Ignition" | translate }} + {{ "Power" | translate }} + {{ "Last Update" | translate }} + {{ "Address" | translate }} + {{ "Speed" | translate }} + {{ "GPS" | translate }} + {{ "gsm" | translate }} + {{ "Panic" | translate }} + {{ "Followup Contact" | translate }} {{ "KYC Status" | translate }} @@ -170,7 +180,7 @@ {{ "View" | translate }} - + {{ "Edit" | translate }} @@ -302,6 +312,18 @@ cust_array.transportOfficeCity ? cust_array.transportOfficeCity : "" }} + + + {{cust_array.last_ACC ? (cust_array.last_ACC == "1"? 'On':'Off') : ""}} + {{cust_array.power ? (cust_array.power == "1"? 'On':'Off') : ""}} + {{cust_array.last_ping_on ?( cust_array.last_ping_on | date: "medium" ): ""}} + {{cust_array.lastAddress ? cust_array.lastAddress : ""}} + {{cust_array.last_speed ? cust_array.last_speed : ""}} + {{cust_array.gpsTracking ? (cust_array.gpsTracking == "1"? 'Fixed':'Unfixed') : ""}} + {{cust_array.gsmSignal ? cust_array.gsmSignal : ""}} + {{cust_array.sos ? cust_array.sos : ""}} + {{cust_array.CID_No ? cust_array.CID_No : ""}} +
-
-
+
+
diff --git a/src/app/location/location.component.ts b/src/app/location/location.component.ts index cd304d7..fce3bf4 100644 --- a/src/app/location/location.component.ts +++ b/src/app/location/location.component.ts @@ -52,10 +52,12 @@ export class LocationComponent implements OnInit, OnDestroy { @ViewChild('main') main: ElementRef; modelChanged: Subject = new Subject(); area = 0; + singleMap :any; toppings = new FormControl(); isLastPosition = false; toppingList: string[] = ['Extra cheese', 'Mushroom', 'Onion', 'Pepperoni', 'Sausage', 'Tomato']; imei + markers = []; latLongAddress={}; // private fuelComponent: SidemenuFuelComponent; showLabels: boolean = true; @@ -615,14 +617,14 @@ export class LocationComponent implements OnInit, OnDestroy { let map; this.geofun = true; runMaps(); - + let that = this; function runMaps() { // console.log("Running GeoFencing") if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { - - map = new google.maps.Map(document.getElementById('map'), { + + map = that.getMapObject({ center: { lat: position.coords.latitude, lng: position.coords.longitude @@ -630,6 +632,8 @@ export class LocationComponent implements OnInit, OnDestroy { zoom: 15, }); + + google.maps.event.addListener(map, 'click', function (event) { placeMarker(event.latLng); // console.log(event.latLng.toUrlValue(5)); @@ -641,7 +645,8 @@ export class LocationComponent implements OnInit, OnDestroy { map: map, }); - + + that.markers.push(marker); } var all_overlays = []; var selectedShape; @@ -1160,28 +1165,21 @@ export class LocationComponent implements OnInit, OnDestroy { function channelListener(newChannel) { return function (msg, initData, deviceInfo) { - - outerThis.tempDevInfo = {}; + if(outerThis.currentPage != 2) { + outerThis.tempDevInfo = {}; outerThis.flightPathArr.push({ lat: msg.latDecimal, lng: msg.longDecimal }); if (outerThis.enabletrail == true) { outerThis.draw_flight_trail(outerThis.flightPathArr); } - - // console.log('device object coming from service',outerThis.deviceList) - // if((a != null) && (a != undefined)&&(outerThis.navId != 'locationComponent')){ - // if (deviceInfo.status != 'RUNNING') { - // outerThis.addressConversion(msg); - // } - - // }else{ - // console.log('no address api call'); - // } - // console.log('outerThis.deviceList',outerThis.deviceList); outerThis.deviceList.filter(function (dd, index) { if (dd.Device_ID === deviceInfo.Device_ID) { deviceInfo['checked'] = dd.checked; + if(deviceInfo['last_ping_on']) { + dd.last_ping_on = deviceInfo['last_ping_on']; + } + } }) // console.log('1345678909876543267898765432345676543=>',deviceInfo.checked); @@ -1457,6 +1455,7 @@ export class LocationComponent implements OnInit, OnDestroy { } flag = false; } + } } } @@ -1808,7 +1807,10 @@ export class LocationComponent implements OnInit, OnDestroy { marker[device].setIcon(icons[iconType]); marker[device].setPosition(new google.maps.LatLng(lat, lng)); - if (outerThis.deviceToTrack.length == 1) map.setCenter({ lat: lat, lng: lng }); + if (outerThis.deviceToTrack.length == 1) { + + //map.setCenter({ lat: lat, lng: lng }); + } ongoingMoveMarker[device] = setTimeout(moveMarker, delay); } else { @@ -2042,7 +2044,7 @@ export class LocationComponent implements OnInit, OnDestroy { // zoomControl: true, scaleControl: true, // mapTypeControl:true, - streetViewControl: true, + streetViewControl: false, overviewMapControl: true, rotateControl: true, @@ -2058,9 +2060,8 @@ export class LocationComponent implements OnInit, OnDestroy { } }; - - - map = new google.maps.Map(document.getElementById('map'), myOptions); + map = that.getMapObject(myOptions,true); + map.mapTypes.set('darkmode', styledMapType); outerThis.mapNew = map; var trafficLayer = new google.maps.TrafficLayer(); @@ -2264,6 +2265,8 @@ export class LocationComponent implements OnInit, OnDestroy { icon: pinImage, title: "Source" }); + + outerThis.markers.push(marker); allSourceDestinationMarkers.push(marker); // console.log(allSourceDestinationMarkers); @@ -2285,6 +2288,7 @@ export class LocationComponent implements OnInit, OnDestroy { strokeOpacity: 1.0, strokeWeight: 6 }); + outerThis.polyLinePathObject = flightPath; allRoutePathPoints.push(flightPath); // console.log(mapData); flightPath.setMap(map); @@ -2354,7 +2358,8 @@ export class LocationComponent implements OnInit, OnDestroy { title: pois[i].poi.poiname }); poiMarkers.push(marker); - + + outerThis.markers.push(marker); var infobox_numberPlate = new InfoBox({ content: "
" + pois[i].poi.poiname + "
", disableAutoPan: false, @@ -2398,57 +2403,10 @@ export class LocationComponent implements OnInit, OnDestroy { } function initializeMarker(elementRef, lat, long, device, deviceName, status, since, lastUpdatedTime, msg, initData, iconType, _devInfo) { - // console.log("Initialize marker called"); - // console.log("Vehicle Speed",msg.speed); - - - outerThis.latToPass = lat; - outerThis.longToPass = long; - - - - - // ======================================Converting Address============================================================== + outerThis.latToPass = lat; + outerThis.longToPass = long; var liveAddress = ""; - // if((a != null) && (a != undefined)&&(outerThis.navId != 'locationComponent')){ - // var geocoder = new google.maps.Geocoder(); - // var latlng = new google.maps.LatLng(lat, long); - - // var request = { - // latLng: latlng - // }; - console.log("staticLatLongVal", lat, long) - - - // geocoder.geocode(request, function (data, status) { - - // if (status == google.maps.GeocoderStatus.OK) { - // if (data[0] != null) { - // liveAddress = data[0].formatted_address; - // var add = liveAddress; - - // } else { - - // liveAddress = "No address available"; - // } - // } - // else { - - // liveAddress = 'static address'; - - - // } - - // }) - - // } - - - - // ======================================Converting Address============================================================== - - - // console.log("time coming from socket", since); + @@ -2507,34 +2465,9 @@ export class LocationComponent implements OnInit, OnDestroy { } - - - // console.log(marker[device]); - // console.log(marker); if (marker[device] == null || marker[device] == undefined) { - // var lastPing = new Date(_devInfo.last_ping_on).getTime(); - // var currTime = new Date().getTime(); - // var timediff = currTime-lastPing; - // var totMin =timediff / 60000; - // var tothours =totMin/60; - // var thours = Math.floor(tothours); - // console.log('totalHours=>',thours); - // ==================================================below code commented on 15-may-2019 =============================== - // if((icons[iconType] != null)||(icons[iconType] != undefined)){ - // if (status == "OUT OF REACH") { - // icons[iconType].fillColor = "blue"; - // }else if (status == "STOPPED") { - // icons[iconType].fillColor = "red"; - // } else if (status == "RUNNING") { - // icons[iconType].fillColor = "green"; - // } else if (status == "IDLING") { - // icons[iconType].fillColor = "yellow"; - // } - // } - - // ==================================================above code commented on 15-may-2019 =============================== - + let markerDOM: any; @@ -2568,45 +2501,22 @@ export class LocationComponent implements OnInit, OnDestroy { // markerDOM = elementRef.nativeElement.querySelector("img[src='/assets/images/liveTrackIcons/idle_car.png']"); } } - // ==========================commented on 4-1-2019 ========================== - // if (timediff>oneHourVal) { - // icons[iconType].fillColor = "blue"; - // }else if ((_devInfo.last_ACC == 0) && (msg.speed == 0)) { - // icons[iconType].fillColor = "red"; - // } else if ((_devInfo.last_ACC == 1) && (msg.speed > 0)) { - // icons[iconType].fillColor = "green"; - // } else if ((_devInfo.last_ACC == 1) && (msg.speed == 0)) { - // icons[iconType].fillColor = "yellow"; - // } - // ==========================commented on on 4-1-2019========================== - - + var m = new google.maps.Marker({ position: new google.maps.LatLng(lat, long), map: map, icon: icons[iconType], }); + + outerThis.markers.push(m); - - // var mtemp = { - // marker : m, - // // imei: _devInfo, - // icon :icons[iconType], - // lat: lat, - // lng:long - // } - // outerThis.markerArray.push(mtemp); - // console.log('marker Temp array=>',outerThis.markerArray); - - // var sec_last_lat = _devInfo.sec_last_location?_devInfo.sec_last_location.lat:null; - // var sec_last_lng = _devInfo.sec_last_location?_devInfo.sec_last_location.long:null; + var Initial_head = _devInfo ? parseFloat(_devInfo.heading) : 0; - // var Initial_head = google.maps.geometry.spherical.computeHeading(new google.maps.LatLng(sec_last_lat,sec_last_lng),new google.maps.LatLng(lat,long)); - // console.log('Initial_head',Initial_head); + if (count == 0) { var marker_init = setTimeout(function () { - var markerDOM_temp = that.elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']"); + var markerDOM_temp = icons[iconType].url ? that.elementRef.nativeElement.querySelector("img[src='" + icons[iconType].url + "']") : ''; if (markerDOM_temp) { markerDOM_temp.style.transform = 'rotate(' + Initial_head + 'deg)'; count = 1; @@ -2864,17 +2774,17 @@ export class LocationComponent implements OnInit, OnDestroy { var fenway = { lat: m.position.lat(), lng: m.position.lng() }; // console.log("latlnglitrals",m.position.lat(),m.position.lng()); // console.log(fenway); - var panorama = new google.maps.StreetViewPanorama( - document.getElementById("viewParanoma"), - { - position: fenway, - pov: { - heading: 34, - pitch: 10 - } - } - ); - map.setStreetView(panorama); + // var panorama = new google.maps.StreetViewPanorama( + // document.getElementById("viewParanoma"), + // { + // position: fenway, + // pov: { + // heading: 34, + // pitch: 10 + // } + // } + // ); + // map.setStreetView(panorama); // console.log('111111111111111111111111111111111111111111111111111=>',this) this['infowindow'].open(map, this); }); @@ -3508,7 +3418,7 @@ export class LocationComponent implements OnInit, OnDestroy { center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; - map = new google.maps.Map(document.getElementById("map2"), myOptions); + map = new google.maps.Map(document.getElementById("map"), myOptions); marker = new google.maps.Marker({ position: latlng, @@ -3516,7 +3426,7 @@ export class LocationComponent implements OnInit, OnDestroy { title: "Your current location!", }); - + outerThis.markers.push(marker); @@ -3604,7 +3514,7 @@ export class LocationComponent implements OnInit, OnDestroy { if (window.localStorage['DataLoaded'] = 'True') { window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } @@ -3871,17 +3781,16 @@ export class LocationComponent implements OnInit, OnDestroy { } else { cumulativeDistance += this.latlongObjArr[i].distanceFromPrevious ? parseFloat(this.latlongObjArr[i].distanceFromPrevious) : 0; } - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); + //this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); } else { - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); + //this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); } - var arr = []; arr.push(this.latlongObjArr[i].lat); arr.push(this.latlongObjArr[i].lng); arr.push(this.latlongObjArr[i].speed); - arr.push(this.latlongObjArr[i].cummulative_distance); + arr.push(this.latlongObjArr[i].cummulative ? this.latlongObjArr[i].cummulative.toFixed(2) : 0); arr.push(this.datee); arr.push(this.latlongObjArr[i].external_Battery); let cord = { @@ -3916,7 +3825,7 @@ export class LocationComponent implements OnInit, OnDestroy { icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, map: map, }) - + this.markers.push(markersPasts); markersPasts['infowindow'] = new google.maps.InfoWindow({ content: content }); @@ -4004,6 +3913,7 @@ export class LocationComponent implements OnInit, OnDestroy { map: map, icon: iconDest }); + outerThis.markers.push(markerCurrent) // outerThis.marker4 = markerCurrent; map.setCenter(new google.maps.LatLng(this.lat, this.lng)) flightPath.setMap(map); @@ -4016,6 +3926,7 @@ export class LocationComponent implements OnInit, OnDestroy { icon: iconSrc, scaledSize: new google.maps.Size(20, 20), }); + this.markers.push(markerSrc); // markerSrc['infowindow'] = new google.maps.InfoWindow({ content: content }); const infowindow = new google.maps.InfoWindow({ content: contentString, @@ -4049,6 +3960,7 @@ export class LocationComponent implements OnInit, OnDestroy { icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, map: map, }) + this.markers.push(markersPasts); markersPasts['infowindow'] = new google.maps.InfoWindow({ content: content }); google.maps.event.addListener(markersPasts, 'click', function () { // console.log("inside info window function 1"); @@ -4064,7 +3976,7 @@ export class LocationComponent implements OnInit, OnDestroy { map: map, icon: iconDest }); - + outerThis.markers.push(markerCurrent); // outerThis.marker4 = markerCurrent; map.setCenter(new google.maps.LatLng(this.lat, this.lng)) flightPath.setMap(map); @@ -4078,6 +3990,7 @@ export class LocationComponent implements OnInit, OnDestroy { map: map, icon: iconSrc }) + outerThis.markers.push(markerSrc); outerThis.marker4 = markerSrc; } } @@ -4118,8 +4031,8 @@ export class LocationComponent implements OnInit, OnDestroy { let a = this.data2["Distance"] ? this.data2["Distance"] : 0; if (this.coloumnClicked === false) { tempData['mileage'] = a; + tempData['aIndex'] = this.tempMapHistory.length; this.tempMapHistory.push(tempData); - } @@ -4165,9 +4078,11 @@ export class LocationComponent implements OnInit, OnDestroy { }) outerThis.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { + if(latLongAddress && latLongAddress.length) { data3.forEach((deData,index)=>{ outerThis.contactService.latLongAddress[deData.lng+'_'+deData.lat] = latLongAddress[index]; }) + } // console.log('countercountercountercountercountercountercounter',counter,data3); var ft = new Date(fromtime); @@ -4207,7 +4122,6 @@ export class LocationComponent implements OnInit, OnDestroy { var cumulativeDistance = 0; for (let i = this.latlongObjArr.length - 1; i > 0; i--) { - console.log(this.latlongObjArr[i]); var d_name = (this.navId === 'locationHistory') ? this.dev_id.viewValue : this.dev_id.Device_Name; this.speed = this.latlongObjArr[i].speed + "Km/hr"; this.im = this.latlongObjArr[i].imei; @@ -4283,17 +4197,17 @@ export class LocationComponent implements OnInit, OnDestroy { } else { cumulativeDistance += this.latlongObjArr[i].distanceFromPrevious ? parseFloat(this.latlongObjArr[i].distanceFromPrevious) : 0; } - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); + // this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); } else { - this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); + + // this.latlongObjArr[i]['cummulative_distance'] = (cumulativeDistance).toFixed(2); } - var arr = []; arr.push(this.latlongObjArr[i].lat); arr.push(this.latlongObjArr[i].lng); arr.push(this.latlongObjArr[i].speed); - arr.push(this.latlongObjArr[i].cummulative_distance); + arr.push(this.latlongObjArr[i].cummulative ? this.latlongObjArr[i].cummulative.toFixed(2) : 0); arr.push(this.datee); arr.push(this.latlongObjArr[i].external_Battery); let cord = { @@ -4336,7 +4250,7 @@ export class LocationComponent implements OnInit, OnDestroy { }) markersPast['infowindow'] = new google.maps.InfoWindow({ content: content }); - + this.markers.push(markersPast); google.maps.event.addListener(markersPast, 'click', function () { @@ -4418,6 +4332,7 @@ export class LocationComponent implements OnInit, OnDestroy { map: map, icon: iconDest }); + outerThis.markers.push(markerCurrent); // outerThis.marker4 = markerCurrent; map.setCenter(new google.maps.LatLng(this.lat, this.lng)) flightPath.setMap(map); @@ -4430,6 +4345,7 @@ export class LocationComponent implements OnInit, OnDestroy { icon: iconSrc, scaledSize: new google.maps.Size(20, 20), }); + outerThis.markers.push(markerSrc); markerSrc['infowindow'] = new google.maps.InfoWindow({ content: content }); const infowindow = new google.maps.InfoWindow({ content: contentString, @@ -4467,6 +4383,7 @@ export class LocationComponent implements OnInit, OnDestroy { icon: { path: google.maps.SymbolPath.CIRCLE, fillColor: fill_color, fillOpacity: 0.6, strokeColor: stroke_color, strokeOpacity: 0.9, strokeWeight: 5, scale: 2 }, map: map, }) + this.markers.push(markersPast); markersPast['infowindow'] = new google.maps.InfoWindow({ content: content }); google.maps.event.addListener(markersPast, 'click', function () { // console.log("inside info window function 1"); @@ -4482,7 +4399,7 @@ export class LocationComponent implements OnInit, OnDestroy { map: map, icon: iconDest }); - + outerThis.markers.push(markerCurrent); // outerThis.marker4 = markerCurrent; map.setCenter(new google.maps.LatLng(this.lat, this.lng)) flightPath.setMap(map); @@ -4497,6 +4414,7 @@ export class LocationComponent implements OnInit, OnDestroy { icon: iconSrc }) outerThis.marker4 = markerSrc; + outerThis.markers.push(markerSrc); } } } @@ -4528,7 +4446,6 @@ export class LocationComponent implements OnInit, OnDestroy { this.data2 = data3; // initialize(); - console.log("__________________", this.data2, this.distanceVariation); let a = Number(this.data2["Distance"] ? this.data2["Distance"] : 0); // if(this.distanceVariation){ // if(this.distanceVariation[0]=="+"){ @@ -4544,6 +4461,8 @@ export class LocationComponent implements OnInit, OnDestroy { // } if (this.coloumnClicked === false) { tempData['mileage'] = a.toFixed(2); + + tempData['aIndex'] = this.tempMapHistory.length; this.tempMapHistory.push(tempData); } @@ -4562,7 +4481,6 @@ export class LocationComponent implements OnInit, OnDestroy { var playerSeekbar: any; $(document).ready(function () { playerSeekbar = document.getElementById('slider1'); - console.log("ready!", playerSeekbar['value']); playerSeekbar.oninput = function () { zoomToObject(flightPath); @@ -4581,7 +4499,7 @@ export class LocationComponent implements OnInit, OnDestroy { let min_time = this.minIdleTime; - var deviceObjectid = (this.navId === 'locationHistory') ? this.dev_id.id : this.dev_id._id; + var deviceObjectid = (this.navId === 'locationHistory') ? this.dev_id._id : this.dev_id._id; // console.log(deviceObjectid); if (this.idleColor === true) { @@ -4620,8 +4538,7 @@ export class LocationComponent implements OnInit, OnDestroy { } - // debugger; - console.log("initParking", stop_locations.length) + // if (stop_locations.length > 0) { // for(var l=0;l" + pois[i].poi.poiname + "
", disableAutoPan: false, @@ -5009,7 +4929,7 @@ export class LocationComponent implements OnInit, OnDestroy { strokeOpacity: 1, scale: 4 }; - + var flightPath = new google.maps.Polyline({ geodesic: true, strokeColor: '#0000FF', @@ -5042,8 +4962,11 @@ export class LocationComponent implements OnInit, OnDestroy { ], }); - - + + outerThis.polyLinePathObject = flightPath; + outerThis.polyLinePathArrayNew[(new Date()).getTime()] = flightPath; + outerThis.polyLinePathArray[outerThis.tempMapHistory.length] = flightPath; + function zoomToObject(obj) { var bounds = new google.maps.LatLngBounds(); var points = obj.getPath().getArray(); @@ -5126,13 +5049,13 @@ export class LocationComponent implements OnInit, OnDestroy { initMap(GeoFencCoords); let outerThis = this; function initMap(GeoFencCoords) { - map = new google.maps.Map(document.getElementById('map'), { + //map = new google.maps.Map(document.getElementById('map'), ); + + map = outerThis.getMapObject({ zoom: 17, center: { lat: GeoFencCoords[0].lat, lng: GeoFencCoords[0].lng }, mapTypeId: 'terrain' - }); - - + }) var bermudaTriangle = new google.maps.Polygon({ paths: GeoFencCoords, strokeColor: '#FF0000', @@ -5327,7 +5250,7 @@ export class LocationComponent implements OnInit, OnDestroy { this.activatedRoute.queryParams.subscribe((params: Params) => { this.navId = params['pageid']; - + if (this.navId === 'locationHistory') { this.tabIndexValue = "2"; this.showHistory = true; @@ -5342,7 +5265,7 @@ export class LocationComponent implements OnInit, OnDestroy { }, mapTypeId: google.maps.MapTypeId.ROADMAP }; - var mapHistory = new google.maps.Map(document.getElementById("map2"), myOptions); + var mapHistory = new google.maps.Map(document.getElementById("map"), myOptions); var marker = new google.maps.Marker({ center: { @@ -5352,7 +5275,8 @@ export class LocationComponent implements OnInit, OnDestroy { map: mapHistory, title: "Your current location!", }); - + + this.markers.push(marker) }) } @@ -5541,7 +5465,6 @@ export class LocationComponent implements OnInit, OnDestroy { this.socket_Notify = this.injectData.getSocket_notifIO(); this.socket_Notify.on('connect', function (this) { - console.log('notify connect ', this); }); this.bsConfig = Object.assign({ dateInputFormat: 'DD-MM-YYYY, h:mm:ss a' }, { containerClass: this.colorTheme }); @@ -5657,7 +5580,7 @@ export class LocationComponent implements OnInit, OnDestroy { // this.checker = 'OK'; window.localStorage['checker'] = 'Data' - // debugger; + // // console.log("this.fin=>",this.fin); this.activatedRoute.queryParams.subscribe((params: Params) => { this.getData = params['_dname']; @@ -5870,7 +5793,10 @@ export class LocationComponent implements OnInit, OnDestroy { } - this.foods.push(a); + if(!this.foods.find(k=>k.did == a.did)) { + + this.foods.push(a); + } } @@ -5905,14 +5831,17 @@ export class LocationComponent implements OnInit, OnDestroy { }) } filterDevicesNew(dlr) { - if ((this.navId === 'locationHistory')) { + if (true) { if (dlr) { const filterdealerValue: any = dlr; this.foods = []; this.masterFoods.forEach(pp => { let t = pp.viewValue.toLocaleLowerCase().indexOf(filterdealerValue.toLocaleLowerCase()); if (t > -1) { - this.foods.push(pp) + if(!this.foods.find(k=>k.did == pp.did)) { + + this.foods.push(pp) + } } }); } else { @@ -6434,7 +6363,8 @@ export class LocationComponent implements OnInit, OnDestroy { map: map, icon: idelImage, }); - + + this.markers.push(marker_idle); var content_idle = '
Idle Start-: ' + arrivalTime_idle + '

Idle End-: ' + departureTime_idle + '

Time Duration (HH:MM:SS)-: ' @@ -6699,7 +6629,7 @@ export class LocationComponent implements OnInit, OnDestroy { // console.log("1111111199999"); this.livetrack(device.Device_ID); } - this.getLastTrip(device.Device_ID); + this.getLastTrip(device._id); } getVehColor(colorid, devicestatus) { @@ -6873,7 +6803,9 @@ export class LocationComponent implements OnInit, OnDestroy { iconType: this.deviceList[k].iconType, // checked: true } - this.foods.push(a); + if(!this.foods.find(k=>k.did == a.did)) { + this.foods.push(a); + } if (k === (this.deviceList.length - 1)) { // console.log("1111111110100000"); if (this.navId != 'locationHistory') { @@ -7024,6 +6956,7 @@ export class LocationComponent implements OnInit, OnDestroy { this.deviceSelect = this.buindhistoryDevice; } this.disableSearch = true; + let that = this; navigator.geolocation.getCurrentPosition(function (position) { var myOptions = { zoom: 18, @@ -7033,16 +6966,17 @@ export class LocationComponent implements OnInit, OnDestroy { }, mapTypeId: google.maps.MapTypeId.ROADMAP }; - var mapHistory = new google.maps.Map(document.getElementById("map2"), myOptions); + // var mapHistory = new google.maps.Map(document.getElementById("map"), myOptions); var marker = new google.maps.Marker({ center: { lat: position.coords.latitude, lng: position.coords.longitude }, - map: mapHistory, + map: that.map, title: "Your current location!", }); + //that.markers.push(marker); } ) @@ -7061,11 +6995,12 @@ export class LocationComponent implements OnInit, OnDestroy { if (id === 'datapoint') { this.dataColor = !this.dataColor }; } - removetracks(id1, arrIndex) { + removetracks(id1, arrIndex,actualIndex) { // console.log('id1', id1); // console.log('arrIndex', arrIndex); if ((id1 === 'all') && (arrIndex == null)) { clearTimeout(this.start); + this.removePath(); this.tempMapHistory = []; this.playingHistory = false; @@ -7075,6 +7010,7 @@ export class LocationComponent implements OnInit, OnDestroy { } if (id1 === 'single') { clearTimeout(this.start); + this.removePathByIndex(actualIndex); this.tempMapHistory.splice(arrIndex, 1); // console.log('this.tempMapHistory', this.tempMapHistory); if (this.tempMapHistory.length === 0) { @@ -7088,6 +7024,7 @@ export class LocationComponent implements OnInit, OnDestroy { refresh_map() { + let outerThis = this; navigator.geolocation.getCurrentPosition(function (position) { var myOptions = { zoom: 18, @@ -7097,7 +7034,7 @@ export class LocationComponent implements OnInit, OnDestroy { }, mapTypeId: google.maps.MapTypeId.ROADMAP }; - var mapHistory = new google.maps.Map(document.getElementById("map2"), myOptions); + var mapHistory = new google.maps.Map(document.getElementById("map"), myOptions); var marker = new google.maps.Marker({ center: { @@ -7107,7 +7044,7 @@ export class LocationComponent implements OnInit, OnDestroy { map: mapHistory, title: "Your current location!", }); - + outerThis.markers.push(marker); }) } @@ -7209,8 +7146,7 @@ export class LocationComponent implements OnInit, OnDestroy { } else { devModelId = deviceObj.device_model._id; } - - + debugger this.contactService.getDeviceModelbyID(devModelId).subscribe(resModel => { var deviceType = resModel[0].device_type; // console.log('resModel', deviceType); @@ -7428,13 +7364,7 @@ export class LocationComponent implements OnInit, OnDestroy { this.enabletrail = !this.enabletrail; if (this.enabletrail == false) { this.flightPathArr = []; - // this.flightPath_live = new google.maps.Polyline({ - // path: this.flightPathArr, - // geodesic: true, - // strokeOpacity: 1.0, - // strokeColor: "#0000FF", - // strokeWeight: 6 - // }); + this.flightPath_live.setMap(null); @@ -7458,17 +7388,14 @@ export class LocationComponent implements OnInit, OnDestroy { // } // that.elm++; if (flightPathArr.length != 0) { - console.log("ARRAY", flightPathArr); if (that.elm) { flightPathArr.splice(0, 0, that.elm) flightPathArr.join() } - console.log("ARRAY", flightPathArr); that.elm = flightPathArr[flightPathArr.length - 1]; flightPathArr.splice(flightPathArr.length - 1, 1); - console.log("ARRAY2", flightPathArr); clearTimeout(tempTimeInterval); tempTimeInterval = setTimeout(function () { that.flightPath_live = new google.maps.Polyline({ @@ -7479,6 +7406,7 @@ export class LocationComponent implements OnInit, OnDestroy { strokeWeight: 6 }); // console.log(mapData); + that.flightPath_live.setMap(that.mapNew); }, time) @@ -7486,8 +7414,35 @@ export class LocationComponent implements OnInit, OnDestroy { } - - + polyLinePathObject:any; + polyLinePathArray:any = {}; + polyLinePathArrayNew:any = {}; + removePathByIndex(index) { + if(this.polyLinePathArray[index]) { + this.polyLinePathArray[index].setMap(null); + } + + this.onlyRemoveMarkers(); + this.markers = []; + } + removePath() { + if(this.flightPath_live) { + this.flightPath_live.setMap(null); + } + if(this.polyLinePathObject) { + this.polyLinePathObject.setMap(null); + } + this.removeAllPath(this.polyLinePathArrayNew); + this.onlyRemoveMarkers(); + this.markers = []; + } + removeAllPath(dataArry) { + for (const [key, value] of Object.entries(dataArry)) { + if(dataArry[key]) { + dataArry[key].setMap(null); + } + } + } saveAddress(lat, lng, address) { var addressObj = { "lat": lat, @@ -7887,7 +7842,9 @@ export class LocationComponent implements OnInit, OnDestroy { // checked:true } - this.foods.push(a); + if(!this.foods.find(k=>k.did == a.did)) { + this.foods.push(a); + } if (k === (this.deviceList.length - 1)) { // console.log("1111111121212"); this.livetrack(null); @@ -7931,13 +7888,11 @@ export class LocationComponent implements OnInit, OnDestroy { viewStreet() { - console.log("Street View"); } triggerDeviceCmd(dev) { - console.log('device Object', dev); // CmdUIComponent let dialogRef = this.dialog.open(CommandWindowComponent, { width: '500px', @@ -8015,7 +7970,7 @@ export class LocationComponent implements OnInit, OnDestroy { var limit = 200; // console.log('what is skip here',skip); - this.contactService.filteredNotifications(fd, td, this.bulkVar, device_imei, userid, skip, limit) + this.contactService.filteredNotifications(fd, td, this.bulkVar, dev._id, userid, skip, limit) .subscribe(res => { // console.log('res=>',res); this.notifArray = []; @@ -8137,6 +8092,8 @@ export class LocationComponent implements OnInit, OnDestroy { map: this.mapNew, icon: this.markerArray[indexSwitch].icon, }); + + this.markers.push(m); this.markerArray[indexSwitch].marker = m; this.mapNew.setCenter({ lat: this.markerArray[indexSwitch].lat, lng: this.markerArray[indexSwitch].lng }); if (this.markerArray[indexSwitch].number_plate) @@ -8246,7 +8203,7 @@ export class LocationComponent implements OnInit, OnDestroy { var imei = JSON.parse(localStorage.getItem('devDetail')) ? JSON.parse(localStorage.getItem('devDetail')) : this.temptrackingDev // console.log(imei,"====>",imei,this.temptrackingDev); if (!imei) { - imei = this.deviceSelect[0].did + imei = this.deviceSelect[0].did } else { if (imei.vehicleId) { imei = imei.vehicleId @@ -8296,7 +8253,7 @@ export class LocationComponent implements OnInit, OnDestroy { // console.log(zzz[0].lat) // initMap(GeoFencCoords); // function initMap(GeoFencCoords) { - // map = new google.maps.Map(document.getElementById('map2'), { + // map = new google.maps.Map(document.getElementById('map'), { // zoom: 17, // center: {lat: GeoFencCoords[0].lat, lng: GeoFencCoords[0].lng}, // mapTypeId: 'terrain' @@ -8345,10 +8302,20 @@ export class LocationComponent implements OnInit, OnDestroy { change(device) { // console.log(device); - this.deviceSelect[0] = device; + this.deviceSelect[0] = device; + if(this.deviceSelect[0] && this.deviceList.length ) { + let filterDevice = this.deviceList.find(dData=>dData.Device_ID== this.deviceSelect[0].did); + if(filterDevice) { + this.deviceSelect[0] = filterDevice; + this.deviceSelect[0].did = filterDevice.Device_ID + } + } // console.log(this.deviceSelect); } + checkData() { + console.log('tabIndexValue',this.currentPage); + } startAddress: any; deviceNameForPDF startTime @@ -8396,7 +8363,7 @@ export class LocationComponent implements OnInit, OnDestroy { image pdf() { var image = "" - if (this.deviceList[0].supAdmin.imageDoc.length != 0) { + if (this.deviceList[0].supAdmin.imageDoc && this.deviceList[0].supAdmin.imageDoc.length != 0) { var str = this.deviceList[0].supAdmin.imageDoc[0] var splitStr = str.split('/'); var concatStr = ''; @@ -8427,7 +8394,7 @@ export class LocationComponent implements OnInit, OnDestroy { // console.log(this.tempMapHistory,this.startAddress,this.endAddress, this.image); - var element = $('#map2'); + var element = $('#map'); var pdfOptions = { orientation: "landscape", // One of "portrait" or "landscape" (or shortcuts "p" (Default), "l") unit: "mm", //Measurement unit to be used when coordinates are specified. One of "pt" (points), "mm" (Default), "cm", "in" @@ -8579,8 +8546,10 @@ export class LocationComponent implements OnInit, OnDestroy { iconType: this.final[i].iconType } + if(!this.foods.find(k=>k.did == a.did)) { - this.foods.push(a); + this.foods.push(a); + } } @@ -8609,8 +8578,8 @@ export class LocationComponent implements OnInit, OnDestroy { center: new google.maps.LatLng(18.602941, 73.777147), mapTypeId: google.maps.MapTypeId.ROADMAP }; - - var map = new google.maps.Map(document.getElementById('map'), myOptions); + + var map = this.getMapObject(myOptions) // console.log('mapmapmapmapmapmapmapmapmapmapmapmapmapmap',map); var trafficLayer = new google.maps.TrafficLayer(); // trafficLayer.setMap(map); @@ -8688,13 +8657,16 @@ export class LocationComponent implements OnInit, OnDestroy { }) this.contactService.getAddressByApiBulk(latLongArray).subscribe(latLongAddress => { - this.reportArr1.forEach((deData,index)=>{ - let latLng = { - lat: deData.latDecimal ? deData.latDecimal : 0, - long: deData.longDecimal ? deData.longDecimal : 0 - } - this.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[index]; - }) + if(latLongAddress && latLongAddress.length) { + + this.reportArr1.forEach((deData,index)=>{ + let latLng = { + lat: deData.latDecimal ? deData.latDecimal : 0, + long: deData.longDecimal ? deData.longDecimal : 0 + } + this.contactService.latLongAddress[latLng.long+'_'+latLng.lat] = latLongAddress[index]; + }) + } @@ -8972,7 +8944,8 @@ export class LocationComponent implements OnInit, OnDestroy { // console.log(this.tempMapHistory[0]); var date1 = new Date(this.datefrom).toISOString(); var date2 = new Date(this.date2).toISOString(); - this.contactService.get('/notifs/ignitionReportForMobile?from_date=' + date1 + '&to_date=' + date2 + '&_u=' + this.useridd + '&device=' + device.Device_ID).subscribe((res: any) => { + + this.contactService.get('/notifs/ignitionReportForMobile?from_date=' + date1 + '&to_date=' + date2 + '&_u=' + this.useridd + '&device=' + device._id).subscribe((res: any) => { // console.log(res); if (res.length > 0) { this.workingHours = res[0].workingHours != "" && res[0].workingHours ? res[0].workingHours : 0 @@ -8993,5 +8966,28 @@ export class LocationComponent implements OnInit, OnDestroy { // console.log(err); }) } - + getMapObject(myOptions,setZoom = false) { + this.deleteMarkers(); + if(!this.singleMap) { + this.singleMap = new google.maps.Map(document.getElementById('map'), myOptions); + } + if(setZoom) { + this.singleMap.setCenter(myOptions.center); + this.singleMap.setZoom(myOptions.zoom) + } + return this.singleMap; + } + deleteMarkers() { + //Loop through all the markers and remove + this.onlyRemoveMarkers(); + this.markers = []; + this.removePath(); +}; +onlyRemoveMarkers(){ + for (var i = 0; i < this.markers.length; i++) { + if(this.markers[i]) { + this.markers[i].setMap(null); + } +} +} } diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index bc2cde8..128dce3 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -250,7 +250,7 @@ passwordIcon:any = "visibility_off"; psd: this.password } this.showLoader = true; - // debugger; + // this.dataService.log(newlog) .subscribe(login => { @@ -292,6 +292,7 @@ passwordIcon:any = "visibility_off"; this.showLoader = true; this.dataService.log(newlog) .subscribe(login => { + debugger this.showLoader = false; this.logins.push(login); // console.log(JSON.parse("TOKEN",login.token)); @@ -303,7 +304,7 @@ passwordIcon:any = "visibility_off"; localStorage.setItem('currentuser',JSON.parse(atob(login.token.split('.')[1]))._id); var userId = JSON.parse(atob(login.token.split('.')[1]))._id; this.getLanguage(userId,isOperator,JSON.parse(atob(login.token.split('.')[1])).customer_role); - + debugger }, (err: any) => { // console.log(err.status); // console.log(err); @@ -343,7 +344,8 @@ this.dataService.log(newlog) - //this.router.navigateByUrl("const?_i="+login.token); + // +this.router.navigateByUrl("const?_i="+login.token); } , (err: any) => { // console.log(err.status); @@ -525,8 +527,10 @@ this.dataService.log(newlog) window.localStorage['currentpwd'] = this.password localStorage.setItem('currentuser',JSON.parse(atob(login.token.split('.')[1]))._id); // if() - this.router.navigateByUrl("const?_status="+"OK"); - // this.router.navigateByUrl("const?_i="+login.token); + +this.router.navigateByUrl("const?_status="+"OK"); + // +this.router.navigateByUrl("const?_i="+login.token); } , (err: any) => { console.log(err.status); // console.log(err); @@ -688,10 +692,12 @@ countdown( elementName, minutes, seconds ) if( window.localStorage['Custumer'] == 'ON'){ window.localStorage['token'] = window.localStorage['Dealer_token']; window.localStorage['Custumer'] = 'OFF' - this.router.navigateByUrl("const?_status="+"OK"); + +this.router.navigateByUrl("const?_status="+"OK"); } else{ - this.router.navigateByUrl("const?_status="+"OK"); + +this.router.navigateByUrl("const?_status="+"OK&&redirect=true"); } } @@ -921,13 +927,14 @@ getLanguage(userid,isOperator,customer_role){ launch_toast(); }else{ - if(customer_role=="kycApproval"){ + if(customer_role=="kycApproval" || customer_role=="tag"){ this.router.navigateByUrl("KycApproval"); - }else if(customer_role=="cc"){ + }else if(customer_role=="cc" ){ this.router.navigateByUrl("reports/notification_master"); }else{ - this.router.navigateByUrl("const?_status="+"OK"); + +this.router.navigateByUrl("const?_status="+"OK&&redirect=true"); } } diff --git a/src/app/notification/notification.component.ts b/src/app/notification/notification.component.ts index 7940764..3b70b4c 100644 --- a/src/app/notification/notification.component.ts +++ b/src/app/notification/notification.component.ts @@ -71,7 +71,7 @@ export class NotificationComponent implements OnInit, OnDestroy { return function(msg){ // console.log(msg); - // debugger; theft alert + // theft alert if((outerThis.superAdmin=== true)&&(msg.item._type === "Ignition Alert" || msg.item._type==="Theft Alert" || msg.item._type=="Max Stoppage Alert" || msg.item._type=="Max Idling Alert")){ // console.log("msgmsgmsgmsgmsgmsgmsgmsgmsgmsg",msg); }else{ diff --git a/src/app/poi-list/poi-list.component.ts b/src/app/poi-list/poi-list.component.ts index 753375c..5b0260d 100644 --- a/src/app/poi-list/poi-list.component.ts +++ b/src/app/poi-list/poi-list.component.ts @@ -39,7 +39,8 @@ export class PoiListComponent implements OnInit { } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } diff --git a/src/app/poi-master-edit/poi-master-edit.component.ts b/src/app/poi-master-edit/poi-master-edit.component.ts index a8ffcf1..72f480a 100644 --- a/src/app/poi-master-edit/poi-master-edit.component.ts +++ b/src/app/poi-master-edit/poi-master-edit.component.ts @@ -337,7 +337,7 @@ export class PoiMasterEditComponent implements OnInit { "address" : outerthis.addressString_edit, "radius" : outerthis.poiRadius } - debugger; + if(outerthis.poitype != undefined){ editPOIobj['poi_type'] = outerthis.poitype; } diff --git a/src/app/poidetails/poidetails.component.ts b/src/app/poidetails/poidetails.component.ts index 9adb130..864c65b 100644 --- a/src/app/poidetails/poidetails.component.ts +++ b/src/app/poidetails/poidetails.component.ts @@ -147,7 +147,7 @@ export class POIdetailsComponent implements OnInit { if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } @@ -190,7 +190,8 @@ export class POIdetailsComponent implements OnInit { } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } diff --git a/src/app/point-of-intrest/point-of-intrest.component.ts b/src/app/point-of-intrest/point-of-intrest.component.ts index a7c6797..832a12d 100644 --- a/src/app/point-of-intrest/point-of-intrest.component.ts +++ b/src/app/point-of-intrest/point-of-intrest.component.ts @@ -168,7 +168,8 @@ export class PointOfIntrestComponent implements OnInit { } soon() { - this.router.navigateByUrl("const?_i=" + window.localStorage.token); + +this.router.navigateByUrl("const?_i=" + window.localStorage.token); } new() { @@ -314,7 +315,7 @@ export class PointOfIntrestComponent implements OnInit { } routePath: any = []; // routeDetails(uId){ - // debugger; + // // console.log("routeDetails",uId); // this.contactService.getRouteDetail(uId) // .subscribe(res=>{ diff --git a/src/app/point-share/point-share.component.ts b/src/app/point-share/point-share.component.ts index f705ce7..71661a5 100644 --- a/src/app/point-share/point-share.component.ts +++ b/src/app/point-share/point-share.component.ts @@ -37,7 +37,7 @@ export class PointShareComponent implements OnInit { this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin; this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer; console.log({'this.superAdmin':this.superAdmin,'this.custtype': this.custtype}); - // debugger; + // // if(this.superAdmin === true){ // this.pointId = this.useridd ; // } diff --git a/src/app/report/all-menus/all-menus.component.html b/src/app/report/all-menus/all-menus.component.html index b54316f..c3c5c1b 100644 --- a/src/app/report/all-menus/all-menus.component.html +++ b/src/app/report/all-menus/all-menus.component.html @@ -118,7 +118,9 @@ style="cursor: pointer;border-bottom: 1px solid;padding-top: 7px;padding-bottom: 7px;font-size: 14px;" *ngIf="superAdmin || custtype" (click)="VType('admin')">{{'Vehicle Type' | translate}} - + diff --git a/src/app/report/all-menus/all-menus.component.ts b/src/app/report/all-menus/all-menus.component.ts index b764b47..4dbad99 100644 --- a/src/app/report/all-menus/all-menus.component.ts +++ b/src/app/report/all-menus/all-menus.component.ts @@ -266,7 +266,8 @@ export class AllMenusComponent implements OnInit { //2 menu dashboard soon(id) { this.menuFlag = this.contactService.menuReturnSet(id); - this.router.navigateByUrl("const?_i=" + window.localStorage.token); + +this.router.navigateByUrl("const?_i=" + window.localStorage.token); } // 3 menu group(id) { @@ -362,7 +363,9 @@ export class AllMenusComponent implements OnInit { this.router.navigateByUrl("vehicle/reminder_service"); } - + virtualDevice(id) { + this.router.navigateByUrl("virtualDevice"); + } TrackingHistory(id){ @@ -642,7 +645,7 @@ fuel_report(id){ localStorage.removeItem('profilePic'); } this.router.navigateByUrl("add"); - // this.router.navigateByUrl("const?_status="+"OK"); + } } @@ -675,7 +678,7 @@ fuel_report(id){ } this.router.navigateByUrl("dealerInfo"); - // this.router.navigateByUrl("const?_status="+"OK"); + } @@ -723,6 +726,7 @@ fuel_report(id){ } checkPassword(){ + this.contactService.getImagePath(this.useridd).subscribe((res:any)=>{ if(localStorage.getItem('currentpwd') && localStorage.getItem('currentuser')){ diff --git a/src/app/report/header/header.component.ts b/src/app/report/header/header.component.ts index d837453..bb8a155 100644 --- a/src/app/report/header/header.component.ts +++ b/src/app/report/header/header.component.ts @@ -218,7 +218,8 @@ export class HeaderComponent implements OnInit { //2 menu dashboard soon(id) { this.menuFlag = this.contactService.menuReturnSet(id); - this.router.navigateByUrl("const?_i=" + window.localStorage.token); + +this.router.navigateByUrl("const?_i=" + window.localStorage.token); } // 3 menu group(id) { @@ -594,7 +595,7 @@ fuel_report(id){ localStorage.removeItem('profilePic'); } this.router.navigateByUrl("add"); - // this.router.navigateByUrl("const?_status="+"OK"); + } } @@ -627,7 +628,7 @@ fuel_report(id){ } this.router.navigateByUrl("dealerInfo"); - // this.router.navigateByUrl("const?_status="+"OK"); + } diff --git a/src/app/report/main/main.component.ts b/src/app/report/main/main.component.ts index f55c35b..3c273d2 100644 --- a/src/app/report/main/main.component.ts +++ b/src/app/report/main/main.component.ts @@ -56,7 +56,10 @@ export class MainComponent implements OnInit { res => { console.log(res); // this.groups = res["group_details"]; + if(res["group_details"]) { + localStorage.setItem("groupData",JSON.stringify(res["group_details"])) + } // console.log(this.grpName); }) } diff --git a/src/app/report/notification/notification.component.ts b/src/app/report/notification/notification.component.ts index f61d091..45b463a 100644 --- a/src/app/report/notification/notification.component.ts +++ b/src/app/report/notification/notification.component.ts @@ -69,7 +69,7 @@ export class NotificationComponent implements OnInit, OnDestroy { var outerThis = this; return function(msg){ // console.log("msg",msg); - // debugger; theft alert + // theft alert if((outerThis.superAdmin=== true)&&outerThis.isCC&&(msg.item._type === "Ignition Alert" || msg.item._type==="Theft Alert" || msg.item._type=="Max Stoppage Alert" || msg.item._type=="Max Idling Alert")){ // console.log("msgmsgmsgmsgmsgmsgmsgmsgmsgmsg",msg); }else{ @@ -168,7 +168,7 @@ mb:any if(this.mb.charAt(0)=="n"){ this.mb = ' ' } - if(cc=="cc"){ + if(cc=="cc" ){ this.isCC=false; } diff --git a/src/app/report/report component/alert-report/alert-report.component.ts b/src/app/report/report component/alert-report/alert-report.component.ts index e4280f7..efd0d6e 100644 --- a/src/app/report/report component/alert-report/alert-report.component.ts +++ b/src/app/report/report component/alert-report/alert-report.component.ts @@ -180,7 +180,8 @@ devi(){ } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } new(){ @@ -226,7 +227,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } diff --git a/src/app/report/report component/day-wise-report/day-wise-report.component.html b/src/app/report/report component/day-wise-report/day-wise-report.component.html index 1ebc6f1..8611013 100644 --- a/src/app/report/report component/day-wise-report/day-wise-report.component.html +++ b/src/app/report/report component/day-wise-report/day-wise-report.component.html @@ -2,7 +2,7 @@
-

{{'Daywise Report' | translate}}

+

{{'Daywise Report 1' | translate}}

@@ -32,6 +32,8 @@ {{'Stoppage Time (hh:mm)' | translate}} {{'Idle Time (hh:mm)' | translate}} {{'Fuel Consumed' | translate}} + {{'Avg Speed' | translate}} + {{'Max Speed' | translate}} {{"Start Location" | translate}} {{'End Location' | translate}} diff --git a/src/app/report/report component/day-wise-report/day-wise-report.component.ts b/src/app/report/report component/day-wise-report/day-wise-report.component.ts index eb0ceba..b0c4cdb 100644 --- a/src/app/report/report component/day-wise-report/day-wise-report.component.ts +++ b/src/app/report/report component/day-wise-report/day-wise-report.component.ts @@ -418,28 +418,28 @@ export class DayWiseReportComponent implements OnInit { return hhmm; } }, - { - "data": "Mileage", - "defaultContent": "_id", + "data": "fuel", + "defaultContent": "", render: function (data, type, row) { - // return data ? parseFloat(data).toFixed(2) : 0.0; - - if(data){ - if(row['Distance(Kms)']){ - var mileage=parseFloat(row['Distance(Kms)']) /parseFloat(data) - return mileage.toFixed(2) - }else{ - return '' - } - - }else{ - - return '' - } - // return hhmm; + return data?data.toFixed(2):''; } }, + { + "data": "avgSpeed", + "defaultContent": "", + render: function (data, type, row) { + return data?data:''; + } + }, + { + "data": "maxSpeed", + "defaultContent": "", + render: function (data, type, row) { + return data?data:''; + } + }, + { "data": "startAddress", "defaultContent": "_id", @@ -805,6 +805,8 @@ var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth(); 'Stoppage Time':'Stoppage Time (HH:MM)', 'Idle Time':'Idle Time (HH:MM)', fuelConsumed: 'Fuel Consumed', + avgSpeed:'Avg Speed', + maxSpeed :'max Speed', startAddress:'Start Location', endAddress:'End Location', } @@ -825,7 +827,9 @@ var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth(); 'Moving Time':this.conversion(pdfBody[j]['Moving Time']), 'Stoppage Time':this.conversion(pdfBody[j]['Stoppage Time']), "Idle Time":this.conversion(pdfBody[j]['Idle Time']), - fuelConsumed: this.fuleConvert((pdfBody[j]['Distance(Kms)']).toFixed(2), pdfBody[j]['Mileage']), + fuelConsumed: pdfBody[j].fuel ? pdfBody[j].fuel.toFixed(2) : '', + avgSpeed: pdfBody[j].avgSpeed ? pdfBody[j].avgSpeed : '', + maxSpeed: pdfBody[j].maxSpeed ? pdfBody[j].maxSpeed : '', startAddress:pdfBody[j].startAddress, endAddress:pdfBody[j].endAddress, }); diff --git a/src/app/report/report component/device-sosreport/device-sosreport.component.ts b/src/app/report/report component/device-sosreport/device-sosreport.component.ts index 59b1e93..d99451d 100644 --- a/src/app/report/report component/device-sosreport/device-sosreport.component.ts +++ b/src/app/report/report component/device-sosreport/device-sosreport.component.ts @@ -232,7 +232,7 @@ private finalise = new Subject(); }); // $('#deviceTable tbody').on('click', 'button', function() { - // debugger; + // // var data = that.tabelObj.row($(this).parents('tr')).data(); // console.log("button clicked"); // }); diff --git a/src/app/report/report component/device-speed-report/device-speed-report.component.ts b/src/app/report/report component/device-speed-report/device-speed-report.component.ts index 62c6628..deba6c3 100644 --- a/src/app/report/report component/device-speed-report/device-speed-report.component.ts +++ b/src/app/report/report component/device-speed-report/device-speed-report.component.ts @@ -66,7 +66,8 @@ export class DeviceSpeedReportComponent implements OnInit { // } // soon() { - // this.router.navigateByUrl("const?_i=" + window.localStorage.token); + // +// this.router.navigateByUrl("const?_i=" + window.localStorage.token); // } @@ -230,7 +231,7 @@ export class DeviceSpeedReportComponent implements OnInit { if (window.localStorage['DataLoaded'] = 'True') { window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } _lineChartData: any; diff --git a/src/app/report/report component/drivers-performance-report/drivers-performance-report.component.ts b/src/app/report/report component/drivers-performance-report/drivers-performance-report.component.ts index be0d1c3..bd403d3 100644 --- a/src/app/report/report component/drivers-performance-report/drivers-performance-report.component.ts +++ b/src/app/report/report component/drivers-performance-report/drivers-performance-report.component.ts @@ -156,7 +156,8 @@ devi(){ } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } @@ -223,7 +224,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } diff --git a/src/app/report/report component/fuel-report/fuel-report.component.ts b/src/app/report/report component/fuel-report/fuel-report.component.ts index c206815..fd19d25 100644 --- a/src/app/report/report component/fuel-report/fuel-report.component.ts +++ b/src/app/report/report component/fuel-report/fuel-report.component.ts @@ -138,7 +138,8 @@ devi(){ } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } new(){ @@ -189,7 +190,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } diff --git a/src/app/report/report component/geofancing-report/geofancing-report.component.ts b/src/app/report/report component/geofancing-report/geofancing-report.component.ts index fd48678..ea872f9 100644 --- a/src/app/report/report component/geofancing-report/geofancing-report.component.ts +++ b/src/app/report/report component/geofancing-report/geofancing-report.component.ts @@ -150,7 +150,7 @@ export class GeofancingReportComponent implements OnInit { // if(window.localStorage['DataLoaded'] = 'True'){ // window.localStorage['Custumer'] = 'OFF' // this.router.navigateByUrl("add") - // // this.router.navigateByUrl("const?_status="+"OK"); + // // } // } @@ -178,7 +178,8 @@ export class GeofancingReportComponent implements OnInit { // } // soon(){ - // this.router.navigateByUrl("const?_i="+window.localStorage.token); + // +// this.router.navigateByUrl("const?_i="+window.localStorage.token); // } @@ -409,7 +410,8 @@ export class GeofancingReportComponent implements OnInit { that.contactService.postWithURL(suburl, { "from_date": temp.from_date, "to_date": temp.to_date, - "geoidlist": that.deviceArr.length ? that.deviceArr : [] + "geoidlist": that.deviceArr.length ? that.deviceArr : [], + 'device':that.deviceStrings }).subscribe((resp: any) => { // console.log(ignReport.length); that.Load = false; @@ -541,7 +543,7 @@ export class GeofancingReportComponent implements OnInit { user: user } var suburl = ""; - suburl += "/notifs/GeoFencingReport?from_date=" + temp.from_date + '&to_date=' + temp.to_date + '&_u=' + temp.user; + suburl += "/notifs/GeoFencingReport?from_date=" + temp.from_date + '&to_date=' + temp.to_date + '&_u=' + temp.user +'&imeis='+that.imeisStrings; that.finalArr = [] // console.log(this.deviceArr); if (that.deviceArr.length != 0) { @@ -743,7 +745,8 @@ export class GeofancingReportComponent implements OnInit { } } - + deviceStrings = ''; + imeisStrings = ''; getReport(event) { if (event == 'getExcel') { if(this.isNormalView) { @@ -760,12 +763,19 @@ export class GeofancingReportComponent implements OnInit { var that = this; var fd = new Date(tpdata.fromDate); var td = new Date(tpdata.toDate); - + if (event.deviceArr.length == 0) { deviceId = []; } else { deviceId = event.deviceArr; } + if(event.device) { + this.deviceStrings = event.device + + } + if(event.iemi) { + this.imeisStrings = event.iemi; + } this.deviceArr = deviceId; this.Fromdate = fd.toISOString(); diff --git a/src/app/report/report component/ideal-report/ideal-report.component.ts b/src/app/report/report component/ideal-report/ideal-report.component.ts index cfdfc86..9eceee8 100644 --- a/src/app/report/report component/ideal-report/ideal-report.component.ts +++ b/src/app/report/report component/ideal-report/ideal-report.component.ts @@ -127,7 +127,8 @@ this.contactService.getIdealData(neww.did,r).subscribe( } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } @@ -229,7 +230,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } report_speed(){ diff --git a/src/app/report/report component/ign-report/ign-report.component.ts b/src/app/report/report component/ign-report/ign-report.component.ts index 6be412e..502b00b 100644 --- a/src/app/report/report component/ign-report/ign-report.component.ts +++ b/src/app/report/report component/ign-report/ign-report.component.ts @@ -49,7 +49,8 @@ devi(){ } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } new(){ @@ -202,7 +203,7 @@ creategraph(a){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } getdata(final){ diff --git a/src/app/report/report component/ignition-report/ignition-report.component.ts b/src/app/report/report component/ignition-report/ignition-report.component.ts index 8f13eaa..1810da2 100644 --- a/src/app/report/report component/ignition-report/ignition-report.component.ts +++ b/src/app/report/report component/ignition-report/ignition-report.component.ts @@ -236,7 +236,8 @@ ngOnDestroy(){ // } // soon(){ -// this.router.navigateByUrl("const?_i="+window.localStorage.token); +// +// this.router.navigateByUrl("const?_i="+window.localStorage.token); // } // new(){ @@ -287,7 +288,7 @@ ngOnDestroy(){ // if(window.localStorage['DataLoaded'] = 'True'){ // window.localStorage['Custumer'] = 'OFF' // this.router.navigateByUrl("add") -// // this.router.navigateByUrl("const?_status="+"OK"); +// // } // } diff --git a/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts b/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts index b3c4f92..6585ec1 100644 --- a/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts +++ b/src/app/report/report component/new-travel-path-report/new-travel-path-report.component.ts @@ -122,9 +122,9 @@ export class NewTravelPathReportComponent implements OnInit { let result = []; for (let i = 0; i < that.reportArr.length; i++) { - + // char.speed !== last.speed let char = that.reportArr[i]; - if (char.speed !== last.speed) { + if (true) { var cum_distance = parseFloat(that.reportArr[i].odo) - parseFloat(that.reportArr[0].odo); char.cum_distance = Math.abs(parseFloat(cum_distance.toFixed(2))) @@ -238,8 +238,8 @@ export class NewTravelPathReportComponent implements OnInit { { "data": "distanceFromPrevious", "render": function (data, type, row) { - // var res = that.get_distance(row.index) - return data; + var res = that.get_distance(row.index) + return data ?data : '0' ; } // return end_time; }, @@ -248,7 +248,7 @@ export class NewTravelPathReportComponent implements OnInit { "data": "speed", "render": function (data, type, row) { - return data; + return data? data : '0'; } // return row.event_time; }, @@ -256,7 +256,7 @@ export class NewTravelPathReportComponent implements OnInit { "data": "avgSpeed", "render": function (data, type, row) { // var res = that.getavgSpeed(row.index) - return data; + return data ? data : '0';; } }, { @@ -275,14 +275,14 @@ export class NewTravelPathReportComponent implements OnInit { }, { - "data": "cum_distance", + "data": "cummulative", "render": function (data, type, row) { // var res=that.getcummulative_distance(row,row.index) - return data; + return data ? data.toFixed(2) : '0'; } }, { - "data": "address", + "data": "latDecimal", "render": function (data, type, row) { var str = (row.latDecimal ? row.latDecimal : 0) + ' , ' + (row.longDecimal ? row.longDecimal : 0) @@ -750,12 +750,12 @@ export class NewTravelPathReportComponent implements OnInit { imei: pdfBody[j].imei, date: moment(pdfBody[j].date).format('lll'), odo: pdfBody[j].odo ? (pdfBody[j].odo).toFixed(2) : 0, - distanceFromPrevious: pdfBody[j].distanceFromPrevious, + distanceFromPrevious: this.get_distanceNew(j,pdfBody), speed: pdfBody[j].speed, avgSpeed: pdfBody[j].avgSpeed, externalBattery: pdfBody[j].external_Battery ? pdfBody[j].external_Battery : '0', temperature: pdfBody[j].temp ? (parseFloat(pdfBody[j].temp) / 10).toFixed(2) : '0', - cumDistance: pdfBody[j].cum_distance, + cumDistance: pdfBody[j].cummulative ?pdfBody[j].cummulative.toFixed(2) :0 , location: (pdfBody[j].latDecimal ? pdfBody[j].latDecimal : 0) + ' , ' + (pdfBody[j].longDecimal ? pdfBody[j].longDecimal : 0), address: pdfBody[j].address, @@ -788,7 +788,17 @@ export class NewTravelPathReportComponent implements OnInit { if (index_1 == 0) { return 0.00; } else { - var cum_distance = parseFloat(this.reportArr1[index_1].odo) - parseFloat(this.reportArr1[index_1 - 1].odo); + var cum_distance = parseFloat(this.reportArr1[index_1].cummulative) - parseFloat(this.reportArr1[index_1 - 1].cummulative); + // console.log(cum_distance); + return Math.abs(parseFloat(cum_distance.toFixed(2))); + } + + } + get_distanceNew(index_1,array) { + if (index_1 == 0) { + return 0.00; + } else { + var cum_distance = parseFloat(array[index_1].cummulative) - parseFloat(array[index_1 - 1].cummulative); // console.log(cum_distance); return Math.abs(parseFloat(cum_distance.toFixed(2))); } diff --git a/src/app/report/report component/notification-master/notification-master.component.ts b/src/app/report/report component/notification-master/notification-master.component.ts index 7cc13d2..55ef2a1 100644 --- a/src/app/report/report component/notification-master/notification-master.component.ts +++ b/src/app/report/report component/notification-master/notification-master.component.ts @@ -133,7 +133,7 @@ private finalise = new Subject(); accListener(){ var outerThis = this; return function(msg){ - // debugger; theft alert + // theft alert if((outerThis.superAdmin=== true || !outerThis.isCC)&&(msg.item._type === "Ignition Alert" || msg.item._type==="Theft Alert" || msg.item._type=="Max Stoppage Alert" || msg.item._type=="Max Idling Alert")){ // console.log("msgmsgmsgmsgmsgmsgmsgmsgmsgmsg",msg); }else{ @@ -289,7 +289,7 @@ document.getElementById("mdMenu").style.display="none" var cc= JSON.parse(window.atob(window.localStorage.token.split('.')[1])).customer_role; - if(cc=="cc"){ + if(cc=="cc" ){ this.isCC=false; } this.logo=window.localStorage['logo']; diff --git a/src/app/report/report component/over-speed/over-speed.component.ts b/src/app/report/report component/over-speed/over-speed.component.ts index a754e5c..2b10383 100644 --- a/src/app/report/report component/over-speed/over-speed.component.ts +++ b/src/app/report/report component/over-speed/over-speed.component.ts @@ -219,7 +219,8 @@ option:any; // } // soon(){ -// this.router.navigateByUrl("const?_i="+window.localStorage.token); +// +// this.router.navigateByUrl("const?_i="+window.localStorage.token); // } // new(){ @@ -265,7 +266,7 @@ option:any; // if(window.localStorage['DataLoaded'] = 'True'){ // window.localStorage['Custumer'] = 'OFF' // this.router.navigateByUrl("add") -// // this.router.navigateByUrl("const?_status="+"OK"); +// // } // } diff --git a/src/app/report/report component/route-violation/route-violation.component.ts b/src/app/report/report component/route-violation/route-violation.component.ts index 6de31ee..c1f579b 100644 --- a/src/app/report/report component/route-violation/route-violation.component.ts +++ b/src/app/report/report component/route-violation/route-violation.component.ts @@ -187,7 +187,8 @@ ngOnDestroy(){ // } // soon(){ -// this.router.navigateByUrl("const?_i="+window.localStorage.token); +// +// this.router.navigateByUrl("const?_i="+window.localStorage.token); // } // new(){ @@ -233,7 +234,7 @@ ngOnDestroy(){ // if(window.localStorage['DataLoaded'] = 'True'){ // window.localStorage['Custumer'] = 'OFF' // this.router.navigateByUrl("add") -// // this.router.navigateByUrl("const?_status="+"OK"); +// // } // } diff --git a/src/app/report/report component/summary-report/summary-report.component.html b/src/app/report/report component/summary-report/summary-report.component.html index 08d63b2..7d3db38 100644 --- a/src/app/report/report component/summary-report/summary-report.component.html +++ b/src/app/report/report component/summary-report/summary-report.component.html @@ -36,12 +36,14 @@ {{'Running (HH:MM)' | translate}} {{'Stop (HH:MM)' | translate}} + {{'Avg Speed' | translate}} + {{'Max Speed' | translate}} + {{'Consumption' | translate}} {{'Details' | translate}} diff --git a/src/app/report/report component/summary-report/summary-report.component.ts b/src/app/report/report component/summary-report/summary-report.component.ts index 91fc598..07d8ae4 100644 --- a/src/app/report/report component/summary-report/summary-report.component.ts +++ b/src/app/report/report component/summary-report/summary-report.component.ts @@ -646,10 +646,30 @@ testTable() { "data": "today_stopped", "defaultContent": "", render: function (data, type, row) { - console.log("today_stopped",data); return data?that.millisecondConversion(data):0; } }, + { + "data": "avgSpeed", + "defaultContent": "", + render: function (data, type, row) { + return data?data:''; + } + }, + { + "data": "maxSpeed", + "defaultContent": "", + render: function (data, type, row) { + return data?data:''; + } + }, + { + "data": "fuel", + "defaultContent": "", + render: function (data, type, row) { + return data?data.toFixed(2):''; + } + }, // { @@ -1157,6 +1177,9 @@ var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth(); total_odo:'Total Km', today_running:'Running (HH:MM)', today_stopped:'Stop (HH:MM)', + avgSpeed:'Avg Speed', + maxSpeed:'Max Speed', + fuel:'Consumption', } ]; @@ -1175,8 +1198,10 @@ var pageWidth = doc.internal.pageSize.width || doc.internal.pageSize.getWidth(); endAddress:pdfBody[j].endAddress?pdfBody[j].endAddress:'N/A', total_odo:pdfBody[j].total_odo?(pdfBody[j].total_odo).toFixed(2):0, today_running:this.millisecondConversion(pdfBody[j].today_running), - today_stopped:this.millisecondConversion(pdfBody[j].today_stopped) - }); + today_stopped:this.millisecondConversion(pdfBody[j].today_stopped), + avgSpeed: pdfBody[j].avgSpeed ? pdfBody[j].avgSpeed : '', + maxSpeed: pdfBody[j].maxSpeed ? pdfBody[j].maxSpeed : '', + fuel: pdfBody[j].fuel ? pdfBody[j].fuel.toFixed(2) : ''}); } return body; } diff --git a/src/app/report/report-filter/report-filter.component.html b/src/app/report/report-filter/report-filter.component.html index a4b2411..c33fe01 100644 --- a/src/app/report/report-filter/report-filter.component.html +++ b/src/app/report/report-filter/report-filter.component.html @@ -138,6 +138,19 @@
+
+
+

{{'Devices ' | translate}} :

+
+
+
+ +
+ +
+
{ this.devicesss = JSON.parse(localStorage.getItem('vehicaleData')); - this.groups=JSON.parse(localStorage.getItem('groupData')) + let ax = localStorage.getItem('groupData'); + if(ax) { + this.groups=JSON.parse(localStorage.getItem('groupData')); + } console.log(this.devicesss); this.finall = (this.devicesss); @@ -464,7 +467,13 @@ export class ReportFilterComponent implements OnInit { that.showLoader = false; }, 100); - + if(this.componentIdentifier === 'geofence_report') { + $('#dbselectIMEI').multipleSelect({ + width: 200, + placeholder: "Devices", + filter: true, + }) + } if(this.componentIdentifier === 'billing_detail'){ setTimeout(() => { @@ -831,8 +840,21 @@ export class ReportFilterComponent implements OnInit { } - if(this.componentIdentifier=="geofence_report") - this.reportService.geofenceReport(filter) + if(this.componentIdentifier=="geofence_report") { + + let dIEMI = $('#dbselectIMEI').multipleSelect('getSelects','value'); + let deviceIds = []; + dIEMI.forEach(demi=>{ + let fDevice = this.devicesss.find(d=>d.Device_ID == demi); + if(fDevice) { + deviceIds.push(fDevice._id); + } + }) + + filter['device'] = deviceIds.toString(); + filter['iemi']=dIEMI.toString(); + this.reportService.geofenceReport(filter) + } if(this.componentIdentifier=="idle_report") this.reportService.idleReport(filter) diff --git a/src/app/route-map-add/route-map-add.component.ts b/src/app/route-map-add/route-map-add.component.ts index 8d2b6bf..9a97e6d 100644 --- a/src/app/route-map-add/route-map-add.component.ts +++ b/src/app/route-map-add/route-map-add.component.ts @@ -149,7 +149,8 @@ export class RouteMapAddComponent implements OnInit { } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } new(){ diff --git a/src/app/route-mapping/route-mapping.component.ts b/src/app/route-mapping/route-mapping.component.ts index d0862c5..a3a66f7 100644 --- a/src/app/route-mapping/route-mapping.component.ts +++ b/src/app/route-mapping/route-mapping.component.ts @@ -102,7 +102,8 @@ export class RouteMappingComponent implements OnInit { } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } new(){ diff --git a/src/app/route-plan/route-plan.component.ts b/src/app/route-plan/route-plan.component.ts index d9d641f..70c6c91 100644 --- a/src/app/route-plan/route-plan.component.ts +++ b/src/app/route-plan/route-plan.component.ts @@ -623,7 +623,7 @@ console.log(selectedVehicle,vehicle[0].substr(vehicle[0].indexOf(' ')+1), this.R // this.wapointArray=[]; - // // debugger; + // // // console.log(this.waypoints); // for(var z = 0 ; z',this) this['infowindow'].open(map, this); }); @@ -3552,7 +3552,7 @@ zoomSet(){ if (window.localStorage['DataLoaded'] = 'True') { window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } @@ -4516,7 +4516,7 @@ zoomSet(){ } - // debugger; + // console.log("initParking",stop_locations.length) if (stop_locations.length > 0) { // for(var l=0;l",this.fin); this.activatedRoute.queryParams.subscribe((params: Params) => { this.getData = params['token']; diff --git a/src/app/sidebar/sidebar.component.ts b/src/app/sidebar/sidebar.component.ts index 947e4ee..1334121 100644 --- a/src/app/sidebar/sidebar.component.ts +++ b/src/app/sidebar/sidebar.component.ts @@ -46,7 +46,7 @@ refresh() this.total_final = this.final console.log(this.final,"-------------------------------->") - if(this.final.length == 0 ||this.final == null || !this.final){ + if(!this.final || this.final.length == 0 ||this.final == null || !this.final){ this.add_dev = false console.log("Load1"); // this.Load=false; @@ -87,7 +87,7 @@ refresh() console.log("7444444444444",this.final); this.total_final = this.final - if(this.final.length == 0 ||this.final == null || !this.final){ + if(!this.final ||this.final.length == 0 ||this.final == null || !this.final){ this.add_dev = false console.log("Load3"); // this.Load=false; @@ -125,7 +125,7 @@ refresh() var cord = JSON.parse(retrievedData); this.final = cord this.total_final = this.final - if(this.final.length == 0 ||this.final == null || !this.final){ + if(!this.final ||this.final.length == 0 ||this.final == null || !this.final){ this.add_dev = false; console.log("Load6"); // this.Load=false; @@ -148,9 +148,9 @@ refresh() this.injectData.getData(this.emailid,this.useridd,this.groupId,this.skip,this.limit,this.search,this.supAdm,this.DealerID).subscribe( (data)=> { this.devicess = data - this.final = this.devicess.devices + this.final = this.devicess.devices ? this.devicess.devices : [] this.total_final = this.final; - if(this.final.length == 0 ||this.final == null || !this.final){ + if(!this.final ||this.final.length == 0 ||this.final == null || !this.final){ this.add_dev = false console.log("Load8"); // this.Load=false; @@ -263,7 +263,7 @@ refresh() */ } else{ - // debugger; + // this.router.navigateByUrl("account?_did="+id+"."+name); } } @@ -405,7 +405,7 @@ $(window).resize(function() { Ing_Status(){ this.ing_Arr = [] - + this.final = this.final && this.final.length? this.final : [] for(var y=0; y{ // this.groupData = resp.map(function(d){ // d.vehicleDetails.map(function(d1){ - // debugger; + // // socket_Ing.emit('acc',d1.Device_ID ) // socket_Ing.on(d1.Device_ID+'acc',()=>{ // return function(ind,data){ @@ -493,7 +493,7 @@ getrequest(para){ // socket_Ing.emit('stat',d1.Device_ID,d1.Device_Name,new Date().setHours(0,0,0,0),null) // socket_Ing.on(d1.Device_ID+'stat',()=>{ // return function(ind,data){ - // debugger; + // // console.log("459",data); // d1=data; // } diff --git a/src/app/sub-amin/addsubadmin/addsubadmin.component.ts b/src/app/sub-amin/addsubadmin/addsubadmin.component.ts index c2a32de..1015295 100644 --- a/src/app/sub-amin/addsubadmin/addsubadmin.component.ts +++ b/src/app/sub-amin/addsubadmin/addsubadmin.component.ts @@ -63,7 +63,7 @@ export class AddsubadminComponent implements OnInit { logo:any; text:any; userID:any; - role=[{name:'SubAdmin',value:'subadmin'},{name:"CC",value:'cc'}] + role=[{name:'SubAdmin',value:'subadmin'},{name:"CC",value:'cc'},{name:"tag",value:'tag'}] role1=[{name:'SubAdmin',value:'subadmin'},{name:"KYC Approval",value:'kycApproval'},{name:"CC",value:'cc'}] documentDetail:any; imageURL:any; diff --git a/src/app/sub-amin/sub-amin.component.ts b/src/app/sub-amin/sub-amin.component.ts index 6ab410e..0fdacbe 100644 --- a/src/app/sub-amin/sub-amin.component.ts +++ b/src/app/sub-amin/sub-amin.component.ts @@ -174,7 +174,8 @@ export class SubAminComponent implements OnInit { if (window.localStorage['DataLoaded'] = 'True') { - this.router.navigateByUrl("const?_status=" + "OK"); + +this.router.navigateByUrl("const?_status=" + "OK"); } }); } diff --git a/src/app/technician/technician.component.ts b/src/app/technician/technician.component.ts index 0f8892d..b1b486c 100644 --- a/src/app/technician/technician.component.ts +++ b/src/app/technician/technician.component.ts @@ -331,7 +331,7 @@ export class TechnicianComponent implements OnInit { // localStorage.setItem('Dealer',"OFF"); // localStorage.setItem('superadmin',"OFF") console.log('this.superAdmin',this.superAdmin); - debugger; + if(this.superAdmin === true){ localStorage.setItem('supAdminAcessToCust', 'true' ); } @@ -340,7 +340,8 @@ export class TechnicianComponent implements OnInit { localStorage.setItem("dlrchk", dlrStatus) - this.router.navigateByUrl("const?_status=" + "OK"); + +this.router.navigateByUrl("const?_status=" + "OK"); // console.log('testing', this.useridd); } @@ -395,7 +396,8 @@ export class TechnicianComponent implements OnInit { this.router.navigateByUrl("device-report/ideal-report"); } soon() { - this.router.navigateByUrl("const?_i=" + window.localStorage.token); + +this.router.navigateByUrl("const?_i=" + window.localStorage.token); } new() { @@ -438,7 +440,7 @@ export class TechnicianComponent implements OnInit { if (window.localStorage['DataLoaded'] = 'True') { window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } diff --git a/src/app/vehicle-type/vehicle-type.component.ts b/src/app/vehicle-type/vehicle-type.component.ts index b353593..13f5452 100644 --- a/src/app/vehicle-type/vehicle-type.component.ts +++ b/src/app/vehicle-type/vehicle-type.component.ts @@ -145,7 +145,8 @@ logout(){ this.router.navigateByUrl("login"); } soon(){ - this.router.navigateByUrl("const?_i="+window.localStorage.token); + +this.router.navigateByUrl("const?_i="+window.localStorage.token); } addcus(){ @@ -559,7 +560,7 @@ mydealer(){ if(window.localStorage['DataLoaded'] = 'True'){ window.localStorage['Custumer'] = 'OFF' this.router.navigateByUrl("add") - // this.router.navigateByUrl("const?_status="+"OK"); + } } getdev(){ @@ -772,7 +773,7 @@ report_map(){ // // } // // outerThis.deviceData[i].status = outerThis.status_toShow ; - // // debugger; + // // // // if(outerThis.deviceData[i].last_location==undefined){ // // outerThis.lattitude = null; // // outerThis.longitude = null; @@ -791,7 +792,7 @@ report_map(){ // // }; - // // debugger; + // // // // geocoder.geocode(request, function(data,status){ // // if(status == google.maps.GeocoderStatus.OK){ // // if(data[0]!=null){ diff --git a/src/app/virtual-device/virtual-device.component.html b/src/app/virtual-device/virtual-device.component.html new file mode 100644 index 0000000..8f0f87e --- /dev/null +++ b/src/app/virtual-device/virtual-device.component.html @@ -0,0 +1,149 @@ + +
+
+
+
+
+ +
+ +
+
+
+
+
+ + + + + + + +
+
+

{{'IMEI'| translate}}* :

+
+
+ +
+
+
+
+

{{'Host'| translate}}* :

+
+
+ +
+
+
+
+

{{'Port'| translate}}* :

+
+
+ +
+
+
+
+

{{'Model'| translate}}* :

+
+
+
+
+ + + + +
+
+
+
+
+
+

{{'Upload Lat/long'| translate}}* :

+
+
+
+
+ + + + +
+
+
+
+ + + +
+
+
+

{{ errorMsg }}

+ +
+
+

{{ successMesssage }}

+ +
+
+
+
+ + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + +
Host IMEI Port Model
{{vdevice.host}}{{vdevice.imei}}{{vdevice.port}}{{vdevice.model}}
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/app/virtual-device/virtual-device.component.scss b/src/app/virtual-device/virtual-device.component.scss new file mode 100644 index 0000000..065ecad --- /dev/null +++ b/src/app/virtual-device/virtual-device.component.scss @@ -0,0 +1,84 @@ +.limiter{ + width:100%; + height:100vh; + padding-top: 7vh; + +} + +.rowStyle{ + width:100%; + margin: 0; + height:100vh; +} + + +.container { + padding: 2rem 0rem; + } + + h4 { + margin: 2rem 0rem 1rem; + } + + .table-image { + td, th { + vertical-align: middle; + } + } + + + .table-wrap { + height: 80px; + overflow-y: auto; + } + + + #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; +} \ No newline at end of file diff --git a/src/app/virtual-device/virtual-device.component.spec.ts b/src/app/virtual-device/virtual-device.component.spec.ts new file mode 100644 index 0000000..85bee3e --- /dev/null +++ b/src/app/virtual-device/virtual-device.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { VirtualDeviceComponent } from './virtual-device.component'; + +describe('VirtualDeviceComponent', () => { + let component: VirtualDeviceComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ VirtualDeviceComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(VirtualDeviceComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/virtual-device/virtual-device.component.ts b/src/app/virtual-device/virtual-device.component.ts new file mode 100644 index 0000000..bbb5b59 --- /dev/null +++ b/src/app/virtual-device/virtual-device.component.ts @@ -0,0 +1,156 @@ +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { ContactService } from '../contact.service'; +import { Router } from '@angular/router'; +import * as XLSX from 'xlsx'; + +declare var $:any; + +@Component({ + selector: 'app-virtual-device', + templateUrl: './virtual-device.component.html', + styleUrls: ['./virtual-device.component.scss'] +}) +export class VirtualDeviceComponent implements OnInit { + errorMsg=''; + showError; + arrayBuffer:any; + file:File; + submittedList = []; + virtualDevice ={ + "imei":"", + "port":'', + "host":"", + "model":"", + "route":[ + ] + } + tabelObj: any; + useridd: any; + superAdmin: any; + custtype: any; + orgChek: any; + supAdminDropDown = false; + +distributerValue +dealerValue; +@ViewChild("fileInput") + + // this InputVar is a reference to our input. + + InputVar: ElementRef; + constructor(private contactService: ContactService,private router: Router) { + + + } + + selectedItems=[]; + resetData() { + this.InputVar.nativeElement.value = ""; + this.errorMsg = ''; + this.file = null; + this.virtualDevice = { + "imei":"", + "port":'', + "host":"", + "model":"", + "route":[ + ] + } + } + ngOnInit() { + + + if(this.orgChek === true){ + this.supAdminDropDown = true; + } + // this.loadropdown(); + + + var that = this; + + + + } + + onChange(event) { + this.file = event.target.files[0]; + } + onUpload() { + this.showError = false; + if(this.file) { + + this.realExcelData(); + } else { + this.showError = true; + this.errorMsg = 'Please select file' + } + + + + } + realExcelData() { + let fileReader = new FileReader(); + fileReader.onload = (e) => { + this.arrayBuffer = fileReader.result; + var data = new Uint8Array(this.arrayBuffer); + var arr = new Array(); + for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]); + var bstr = arr.join(""); + var workbook = XLSX.read(bstr, {type:"binary"}); + var first_sheet_name = workbook.SheetNames[0]; + var worksheet = workbook.Sheets[first_sheet_name]; + this.setDataToAPI(XLSX.utils.sheet_to_json(worksheet,{raw:true})) + + } + fileReader.readAsArrayBuffer(this.file); + } + setDataToAPI(data) { + console.log(data) + let newData = []; + if(data.length) { + data = data.forEach(d => { + if(d.Lattitude && d.Longitude) { + newData.push( { + lat:d.Lattitude, + lng:d.Longitude + }) + } + }); + } + this.virtualDevice.route = newData; + this.submit(this.virtualDevice); + + } +successMesssage = ''; +submit(virtualDevice,isAdd =true){ + this.successMesssage = ''; + if(!virtualDevice.route.length) { + this.errorMsg = 'Please Upload Lat/long' + } else if(!virtualDevice.host) { + this.errorMsg = 'Please enter Host' + } else if(!virtualDevice.imei) { + this.errorMsg = 'Please enter IMEI' + } else if(!virtualDevice.port) { + this.errorMsg = 'Please enter port' + } else if(!virtualDevice.model) { + this.errorMsg = 'Please enter model' + } else { + let postObj = Object.assign({},virtualDevice); + if(isAdd) { + this.submittedList.unshift(postObj); + } + this.contactService.post('/virtualDevice',postObj,false).subscribe(resp => { +this.resetData(); +this.successMesssage = 'Data uploaded successfully' + console.log(resp) + + + },err=>{ + this.errorMsg = 'Request Failed' + }) + } + + +} + +} diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3e9a61d..d499034 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,7 +1,9 @@ export const environment = { production: true, - hostUrl: "https://www.oneqlik.in", - hostUrl2: "https://www.oneqlik.in", + hostUrl: document.location.origin != 'http://localhost:4200'? document.location.origin : "https://www.oneqlik.in", + hostUrl2: document.location.origin != 'http://localhost:4200'? document.location.origin : "https://www.oneqlik.in", + //hostUrl:"https://www.oneqlik.in", + //hostUrl2:"https://www.oneqlik.in", // hostUrl:"https://socket.oneqlik.in", // hostUrl2:"https://socket.oneqlik.in", diff --git a/src/environments/environment.ts b/src/environments/environment.ts index f500afd..f640085 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,12 +5,10 @@ export const environment = { production: false, - // hostUrl: "http://localhost:3000", - // hostUrl2: "http://localhost:3000", - // hostUrl: "https://socket.oneqlik.in", - // hostUrl2: "https://socket.oneqlik.in", - hostUrl: "https://www.oneqlik.in", - hostUrl2: "https://www.oneqlik.in", + // hostUrl:"https://dev.oneqlik.in", + // hostUrl2:"https://dev.oneqlik.in", + hostUrl: document.location.origin != 'http://localhost:4200'? document.location.origin : "https://www.oneqlik.in", + hostUrl2: document.location.origin != 'http://localhost:4200'? document.location.origin : "https://www.oneqlik.in", socket5000: "", showLandingpageMenu: ["www.drsupergps.com", "www.vpngps.tech", "www.globaltechnohelp.com", "www.tracktive.in", "www.sohamshakti.in", "www.spygpstrack.com", "www.mtelematics.in", "www.dstrackingsolutions.com", "www.vctrack.in", "www.hltgps.in", "www.xcelgps.com"] diff --git a/src/index.html b/src/index.html index c32a28b..844b7aa 100644 --- a/src/index.html +++ b/src/index.html @@ -357,7 +357,7 @@ - + diff --git a/src/styles.css b/src/styles.css index 05f9775..b3d63e1 100644 --- a/src/styles.css +++ b/src/styles.css @@ -5,7 +5,10 @@ body { margin: 0; font-family: Roboto, sans-serif; } - +.ftd-mp { + padding-top: 13px !important; + padding-bottom: 12.5px !important; +} md-card { max-width: 80%; margin: 2em auto; From 017919aa4b693cd4cb9ef6ef3d32fb582cd7a31f Mon Sep 17 00:00:00 2001 From: vivekm2 Date: Wed, 15 Jan 2025 18:26:54 +0530 Subject: [PATCH 10/10] all work till 15 jan --- build.sh | 2 + build2.sh | 2 + run.sh | 2211 ++++ src/README.md | 45 - .../account-detail.component.html | 2051 ++-- .../account-detail.component.ts | 2385 ++-- src/app/add-cust/add-cust.component.html | 17 + src/app/add-cust/add-cust.component.ts | 2638 ++--- src/app/add-dealer/add-dealer.component.html | 25 +- src/app/add-dealer/add-dealer.component.ts | 49 +- src/app/add/add.component.scss | 6 +- src/app/add/add.component.ts | 1158 +- .../admin-device-kyc.component.html | 19 + .../admin-device-kyc.component.scss | 0 .../admin-device-kyc.component.spec.ts | 25 + .../admin-device-kyc.component.ts | 15 + src/app/all-menus/all-menus.component.html | 1164 +- src/app/all-menus/all-menus.component.ts | 1342 ++- src/app/app.component.html | 178 +- src/app/app.component.ts | 315 +- src/app/app.module.ts | 722 +- src/app/app.router.ts | 990 +- src/app/const/const.component.html | 1319 ++- src/app/const/const.component.ts | 4003 +++---- src/app/contact.service.ts | 5209 +++++---- .../add-new-device.component.html | 388 +- .../add-new-device.component.ts | 1941 ++-- .../add-new-device.component.html | 857 ++ .../add-new-device.component.scss | 63 + .../add-new-device.component.spec.ts | 25 + .../add-new-device.component.ts | 1579 +++ src/app/dashboard/add-new-device2/index.html | 325 + src/app/dashboard/dashboard.component.html | 396 +- src/app/dashboard/dashboard.component.scss | 47 +- src/app/dashboard/dashboard.component.ts | 4181 +++---- .../device-edit/device-edit.component.ts | 1827 ++-- .../download-certificate.component.html | 151 +- .../download-certificate.component.ts | 432 +- .../download-certificate.component.html | 470 + .../download-certificate.component.scss | 45 + .../download-certificate.component.spec.ts | 25 + .../download-certificaterdm.component.ts | 647 ++ .../new-edit-device.component.html | 353 +- .../new-edit-device.component.ts | 1936 ++-- .../view-certificate.component.html | 254 +- src/app/datainjection.service.ts | 430 +- .../db-edit-device.component.html | 854 ++ .../db-edit-device.component.scss | 58 + .../db-edit-device.component.spec.ts | 25 + .../db-edit-device.component.ts | 1612 +++ src/app/dbauth.guard.spec.ts | 15 + src/app/dbauth.guard.ts | 30 + src/app/dblive/dblive.component.html | 3 + src/app/dblive/dblive.component.scss | 0 src/app/dblive/dblive.component.spec.ts | 25 + src/app/dblive/dblive.component.ts | 15 + .../dealers-info/dealers-info.component.html | 658 +- .../dealers-info/dealers-info.component.scss | 413 +- .../dealers-info/dealers-info.component.ts | 842 +- ...device-inventory-edit-popup.component.html | 288 + ...device-inventory-edit-popup.component.scss | 6 + ...ice-inventory-edit-popup.component.spec.ts | 25 + .../device-inventory-edit-popup.component.ts | 147 + .../device-inventory.component.html | 1668 ++- .../device-inventory.component.ts | 1472 +-- src/app/device-list/device-list.component.ts | 585 +- .../device-renew/device-renew.component.ts | 1828 ++-- .../ac-report/ac-report.component.ts | 1 + .../day-wise-report.component.ts | 1 + .../fuel-report/fuel-report.component.html | 250 +- .../poi-report/poi-report.component.ts | 2 +- .../report-filter.component.html | 1988 ++-- .../report-filter/report-filter.component.ts | 1987 ++-- .../summary-report.component.ts | 2 +- .../device-setting.component.ts | 416 +- src/app/device/device.component.ts | 2030 ++-- .../edit-device-master.component.html | 2 +- .../edit-device-master.component.ts | 977 +- .../normal-cert/normal-cert.component.html | 2 +- .../dhananjay2/dhananjay2-routing.module.ts | 10 + src/app/dhananjay2/dhananjay2.component.html | 3 + src/app/dhananjay2/dhananjay2.component.scss | 0 .../dhananjay2/dhananjay2.component.spec.ts | 25 + src/app/dhananjay2/dhananjay2.component.ts | 15 + src/app/dhananjay2/dhananjay2.module.ts | 17 + ...alog-content-example-dialog.component.html | 1797 +-- ...dialog-content-example-dialog.component.ts | 3370 +++--- .../dialog-content-example-dialog/test.html | 36 + .../edit-dealer/edit-dealer.component.html | 26 + src/app/edit-dealer/edit-dealer.component.ts | 34 +- .../finance-approval.component.html | 315 + .../finance-approval.component.scss | 3 + .../finance-approval.component.spec.ts | 25 + .../finance-approval.component.ts | 328 + src/app/firmware/firmware.component.html | 78 + src/app/firmware/firmware.component.scss | 7 + src/app/firmware/firmware.component.spec.ts | 25 + src/app/firmware/firmware.component.ts | 121 + src/app/fota/fota.component.html | 242 + src/app/fota/fota.component.scss | 0 src/app/fota/fota.component.spec.ts | 25 + src/app/fota/fota.component.ts | 192 + src/app/fota/fota.service.spec.ts | 15 + src/app/fota/fota.service.ts | 70 + .../fuel-report-graph.component.ts | 268 +- .../geofence-add/geofence-add.component.ts | 5 +- .../geofencing-view.component.ts | 17 +- src/app/geofencing/geofencing.component.ts | 1 + .../select-untrack-vehicles.component.ts | 560 +- .../gprs-commnd-table-popup.component.html | 89 + .../gprs-commnd-table-popup.component.scss | 62 + .../gprs-commnd-table-popup.component.spec.ts | 25 + .../gprs-commnd-table-popup.component.ts | 62 + src/app/gps-master/gps-master.component.html | 172 +- src/app/gps-master/gps-master.component.ts | 726 +- src/app/group/group.component.scss | 1149 +- src/app/home/home.component.ts | 183 +- .../indexingReport/index-report.component.ts | 437 +- .../inventory-list.component.ts | 2 +- .../device-doc/device-doc.component.html | 253 +- .../device-doc/device-doc.component.scss | 16 + .../device-doc/device-doc.component.ts | 854 +- .../device-kyc/device-kyc.component.html | 407 +- .../device-kyc/device-kyc.component.scss | 45 + .../device-kyc/device-kyc.component.ts | 1608 ++- .../issue-add/issue-add.component.html | 80 +- .../issue-add/issue-add.component.ts | 122 +- .../issue-list/issue-list.component.html | 182 +- .../issue-list/issue-list.component.ts | 474 +- .../kyc-approval/kyc-approval.component.html | 311 +- .../kyc-approval/kyc-approval.component.ts | 574 +- .../newissuelist/newissuelist.component.html | 1013 ++ .../newissuelist/newissuelist.component.scss | 399 + .../newissuelist.component.spec.ts | 25 + .../newissuelist/newissuelist.component.ts | 458 + .../command-window.component.ts | 577 +- .../live-history/live-history.component.ts | 1248 ++- src/app/location/location.component.html | 2621 +++-- src/app/location/location.component.scss | 1464 +-- src/app/location/location.component.ts | 8380 +++++++------- .../location2/location2.component.html | 3421 ++++++ .../location2/location2.component.scss | 843 ++ .../location2/location2.component.spec.ts | 25 + .../location/location2/location2.component.ts | 9597 +++++++++++++++++ src/app/location/move-marker.service.ts | 204 + src/app/location/new-location/function.txt | 2680 +++++ .../location.component copy 2.txt | 8218 ++++++++++++++ .../new-location/location.component copy.txt | 7979 ++++++++++++++ .../new-location/location.component.html | 2039 ++++ .../new-location/location.component.scss | 825 ++ .../new-location/location.component.spec.ts | 26 + .../new-location/location.component.ts | 8228 ++++++++++++++ .../service/location-comman.service.spec.ts | 15 + .../service/location-comman.service.ts | 431 + .../share-loc/share-loc.component.html | 59 +- .../location/share-loc/share-loc.component.ts | 267 +- src/app/login/login.component.css | 765 +- src/app/login/login.component.html | 378 +- src/app/login/login.component.ts | 1777 +-- .../notification/notification.component.ts | 428 +- src/app/open-map/open-map.component.html | 40 + src/app/open-map/open-map.component.scss | 19 + src/app/open-map/open-map.component.spec.ts | 25 + src/app/open-map/open-map.component.ts | 788 ++ .../tracked-untracked-vehicles.component.ts | 579 +- .../order-details.component.html | 118 +- .../order-details.component.scss | 43 + .../order-details/order-details.component.ts | 21 +- .../order-summary.component.html | 480 +- .../order-summary/order-summary.component.ts | 627 +- .../raw-data-command.component.html | 81 + .../raw-data-command.component.scss | 0 .../raw-data-command.component.spec.ts | 25 + .../raw-data-command.component.ts | 98 + src/app/raw/raw.component.html | 104 + src/app/raw/raw.component.scss | 20 + src/app/raw/raw.component.spec.ts | 25 + src/app/raw/raw.component.ts | 354 + .../renewal-documents.component.html | 196 + .../renewal-documents.component.scss | 11 + .../renewal-documents.component.spec.ts | 25 + .../renewal-documents.component.ts | 592 + src/app/report/main/main.component.html | 67 +- src/app/report/main/main.component.scss | 4 +- src/app/report/main/main.component.ts | 191 +- .../notification/notification.component.ts | 419 +- .../ac-report/ac-report.component.ts | 2 +- .../current-position.component.ts | 886 +- .../daily-details/daily-details.component.ts | 2 +- .../daily-logs/daily-logs.component.ts | 2 +- .../daily-report/daily-report.component.ts | 2364 ++-- .../day-wise-report.component.ts | 2 +- .../device-sosreport.component.ts | 2 +- .../device-speed-report.component.ts | 2 +- .../disatance-report.component.ts | 4 +- .../geofancing-report.component.ts | 30 +- .../idle-report/idle-report.component.html | 36 +- .../idle-report/idle-report.component.ts | 1149 +- .../ignition-report.component.ts | 2 +- .../new-travel-path-report.component.ts | 2 +- .../noti-location.component.scss | 4 +- .../over-speed/over-speed.component.ts | 2 +- .../performance-report.component.ts | 2 +- .../poi-report/poi-report.component.ts | 2 +- .../push-data-report.component.ts | 2 +- .../stoppage-report.component.ts | 2 +- .../summary-report.component.ts | 2 +- .../trip-load-unload.component.ts | 4 +- .../trip-management-report.component.ts | 2 +- .../trip-report/trip-report.component.ts | 3 +- .../working-hour-detail.component.ts | 2 +- .../working-hour-report.component.ts | 4 +- .../report-filter.component.html | 967 +- src/app/report/report-routing.module.ts | 8 +- src/app/report/report.service.ts | 1 + .../show-vehicles.component.scss | 16 +- .../show-vehicles/show-vehicles.component.ts | 9411 ++++++++-------- src/app/sidebar/sidebar.component.ts | 856 +- src/app/spec-dev/spec-dev.component.ts | 209 +- src/app/sub-amin/sub-amin.component.scss | 117 +- src/app/sub-amin/sub-amin.component.ts | 269 +- src/app/technician/technician.component.scss | 4 +- src/app/technician/technician.component.ts | 928 +- .../trip-history/trip-history.component.ts | 1 + src/app/user-master/user-master.component.ts | 664 +- .../tracked-vehicles.component.ts | 540 +- .../virtual-device.component.ts | 197 +- src/app/vivek/vivek.component.html | 3 + src/app/vivek/vivek.component.scss | 0 src/app/vivek/vivek.component.spec.ts | 25 + src/app/vivek/vivek.component.ts | 15 + src/assets/css/data.csv | 6 + src/assets/css/sweetalert2.min.css | 1 + src/assets/download/download.xlsx | Bin 0 -> 10769 bytes src/assets/i18n/pashto.json | 558 + src/assets/image/Pulse-1s-200px.gif | Bin 0 -> 56353 bytes src/assets/images/RDM.jpg | Bin 0 -> 12699 bytes src/assets/index.html | 46 + src/assets/js/db_list.json | 7477 +++++++++++++ src/assets/js/infobox.js | 4 +- src/assets/js/sweetalert2.all.min.js | 6 + ...e-select@1.3.1_dist_multiple-select.min.js | 10 + src/assets/notifSOS.mp3 | Bin 0 -> 255664 bytes src/assets/notification.mp3 | Bin 0 -> 44453 bytes src/environments/environment.prod.ts | 30 +- src/environments/environment.ts | 39 +- src/index.html | 778 +- src/styles.css | 90 +- test.html | 44 + 249 files changed, 127261 insertions(+), 45869 deletions(-) create mode 100644 build.sh create mode 100644 build2.sh create mode 100644 run.sh create mode 100644 src/app/admin-device-kyc/admin-device-kyc.component.html create mode 100644 src/app/admin-device-kyc/admin-device-kyc.component.scss create mode 100644 src/app/admin-device-kyc/admin-device-kyc.component.spec.ts create mode 100644 src/app/admin-device-kyc/admin-device-kyc.component.ts create mode 100644 src/app/dashboard/add-new-device2/add-new-device.component.html create mode 100644 src/app/dashboard/add-new-device2/add-new-device.component.scss create mode 100644 src/app/dashboard/add-new-device2/add-new-device.component.spec.ts create mode 100644 src/app/dashboard/add-new-device2/add-new-device.component.ts create mode 100644 src/app/dashboard/add-new-device2/index.html create mode 100644 src/app/dashboard/download-certificate_rdm/download-certificate.component.html create mode 100644 src/app/dashboard/download-certificate_rdm/download-certificate.component.scss create mode 100644 src/app/dashboard/download-certificate_rdm/download-certificate.component.spec.ts create mode 100644 src/app/dashboard/download-certificate_rdm/download-certificaterdm.component.ts create mode 100644 src/app/db-edit-device/db-edit-device.component.html create mode 100644 src/app/db-edit-device/db-edit-device.component.scss create mode 100644 src/app/db-edit-device/db-edit-device.component.spec.ts create mode 100644 src/app/db-edit-device/db-edit-device.component.ts create mode 100644 src/app/dbauth.guard.spec.ts create mode 100644 src/app/dbauth.guard.ts create mode 100644 src/app/dblive/dblive.component.html create mode 100644 src/app/dblive/dblive.component.scss create mode 100644 src/app/dblive/dblive.component.spec.ts create mode 100644 src/app/dblive/dblive.component.ts create mode 100644 src/app/device-inventory-edit-popup/device-inventory-edit-popup.component.html create mode 100644 src/app/device-inventory-edit-popup/device-inventory-edit-popup.component.scss create mode 100644 src/app/device-inventory-edit-popup/device-inventory-edit-popup.component.spec.ts create mode 100644 src/app/device-inventory-edit-popup/device-inventory-edit-popup.component.ts create mode 100644 src/app/dhananjay2/dhananjay2-routing.module.ts create mode 100644 src/app/dhananjay2/dhananjay2.component.html create mode 100644 src/app/dhananjay2/dhananjay2.component.scss create mode 100644 src/app/dhananjay2/dhananjay2.component.spec.ts create mode 100644 src/app/dhananjay2/dhananjay2.component.ts create mode 100644 src/app/dhananjay2/dhananjay2.module.ts create mode 100644 src/app/dialog-content-example-dialog/test.html create mode 100644 src/app/finance-approval/finance-approval.component.html create mode 100644 src/app/finance-approval/finance-approval.component.scss create mode 100644 src/app/finance-approval/finance-approval.component.spec.ts create mode 100644 src/app/finance-approval/finance-approval.component.ts create mode 100644 src/app/firmware/firmware.component.html create mode 100644 src/app/firmware/firmware.component.scss create mode 100644 src/app/firmware/firmware.component.spec.ts create mode 100644 src/app/firmware/firmware.component.ts create mode 100644 src/app/fota/fota.component.html create mode 100644 src/app/fota/fota.component.scss create mode 100644 src/app/fota/fota.component.spec.ts create mode 100644 src/app/fota/fota.component.ts create mode 100644 src/app/fota/fota.service.spec.ts create mode 100644 src/app/fota/fota.service.ts create mode 100644 src/app/gprs-commnd-table-popup/gprs-commnd-table-popup.component.html create mode 100644 src/app/gprs-commnd-table-popup/gprs-commnd-table-popup.component.scss create mode 100644 src/app/gprs-commnd-table-popup/gprs-commnd-table-popup.component.spec.ts create mode 100644 src/app/gprs-commnd-table-popup/gprs-commnd-table-popup.component.ts create mode 100644 src/app/kyc-approval/newissuelist/newissuelist.component.html create mode 100644 src/app/kyc-approval/newissuelist/newissuelist.component.scss create mode 100644 src/app/kyc-approval/newissuelist/newissuelist.component.spec.ts create mode 100644 src/app/kyc-approval/newissuelist/newissuelist.component.ts create mode 100644 src/app/location/location2/location2.component.html create mode 100644 src/app/location/location2/location2.component.scss create mode 100644 src/app/location/location2/location2.component.spec.ts create mode 100644 src/app/location/location2/location2.component.ts create mode 100644 src/app/location/move-marker.service.ts create mode 100644 src/app/location/new-location/function.txt create mode 100644 src/app/location/new-location/location.component copy 2.txt create mode 100644 src/app/location/new-location/location.component copy.txt create mode 100644 src/app/location/new-location/location.component.html create mode 100644 src/app/location/new-location/location.component.scss create mode 100644 src/app/location/new-location/location.component.spec.ts create mode 100644 src/app/location/new-location/location.component.ts create mode 100644 src/app/location/service/location-comman.service.spec.ts create mode 100644 src/app/location/service/location-comman.service.ts create mode 100644 src/app/open-map/open-map.component.html create mode 100644 src/app/open-map/open-map.component.scss create mode 100644 src/app/open-map/open-map.component.spec.ts create mode 100644 src/app/open-map/open-map.component.ts create mode 100644 src/app/raw-data-command/raw-data-command.component.html create mode 100644 src/app/raw-data-command/raw-data-command.component.scss create mode 100644 src/app/raw-data-command/raw-data-command.component.spec.ts create mode 100644 src/app/raw-data-command/raw-data-command.component.ts create mode 100644 src/app/raw/raw.component.html create mode 100644 src/app/raw/raw.component.scss create mode 100644 src/app/raw/raw.component.spec.ts create mode 100644 src/app/raw/raw.component.ts create mode 100644 src/app/renewal-documents/renewal-documents.component.html create mode 100644 src/app/renewal-documents/renewal-documents.component.scss create mode 100644 src/app/renewal-documents/renewal-documents.component.spec.ts create mode 100644 src/app/renewal-documents/renewal-documents.component.ts create mode 100644 src/app/vivek/vivek.component.html create mode 100644 src/app/vivek/vivek.component.scss create mode 100644 src/app/vivek/vivek.component.spec.ts create mode 100644 src/app/vivek/vivek.component.ts create mode 100644 src/assets/css/data.csv create mode 100644 src/assets/css/sweetalert2.min.css create mode 100644 src/assets/download/download.xlsx create mode 100644 src/assets/i18n/pashto.json create mode 100644 src/assets/image/Pulse-1s-200px.gif create mode 100644 src/assets/images/RDM.jpg create mode 100644 src/assets/index.html create mode 100644 src/assets/js/db_list.json create mode 100644 src/assets/js/sweetalert2.all.min.js create mode 100644 src/assets/js/unpkg.com_multiple-select@1.3.1_dist_multiple-select.min.js create mode 100644 src/assets/notifSOS.mp3 create mode 100644 src/assets/notification.mp3 create mode 100644 test.html diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..ebabf99 --- /dev/null +++ b/build.sh @@ -0,0 +1,2 @@ +nvm use 8.12.0 +time node --max_old_space_size=99999999 node_modules/@angular/cli/bin/ng build --prod --sourcemaps \ No newline at end of file diff --git a/build2.sh b/build2.sh new file mode 100644 index 0000000..f6ed9fb --- /dev/null +++ b/build2.sh @@ -0,0 +1,2 @@ +nvm use 8.12.0 +time node --max_old_space_size=99999 node_modules/@angular/cli/bin/ng build --prod \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..4ccbcc9 --- /dev/null +++ b/run.sh @@ -0,0 +1,2211 @@ +nvm use 8.12.0 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 +node_modules/@angular/cli/bin/ng serve --port 5200 \ No newline at end of file diff --git a/src/README.md b/src/README.md index 91bc915..e69de29 100644 --- a/src/README.md +++ b/src/README.md @@ -1,45 +0,0 @@ -# fSelect -A jQuery select box replacement library ([live demo](https://facetwp.com/wp-content/plugins/facetwp/assets/vendor/fSelect/test.html)) - - - -### Usage - -```javascript -$('.your-select').fSelect(); -``` - -### Available options - -```js -$('.your-select').fSelect({ - placeholder: 'Select some options', - numDisplayed: 3, - overflowText: '{n} selected', - noResultsText: 'No results found', - searchText: 'Search', - showSearch: true -}); -``` - -* **placeholder** (str) - the default placeholder text -* **numDisplayed** (int) - the number of values to show before switching to the `overflowText` -* **overflowText** (str) - the text to show after exceeding the `numDisplayed` limit -* **noResultsText** (str) - the text to show if no choices exist (or an empty string) -* **searchText** (str) - the search box placeholder text -* **showSearch** (bool) - show the search box? - -### Methods - -```js -$('.your-select').fSelect('reload'); -$('.your-select').fSelect('destroy'); -``` - -### Single vs. multi-select - -Add the `multiple` attribute to your ` -``` diff --git a/src/app/account-detail/account-detail.component.html b/src/app/account-detail/account-detail.component.html index 363e3d5..785dfb1 100644 --- a/src/app/account-detail/account-detail.component.html +++ b/src/app/account-detail/account-detail.component.html @@ -1,135 +1,135 @@ -
-
-
{{data_descip}}
-
- - + - - -
- + +
-
+ +
- -
-
- -
-
{{'General Setting' | translate}}
- - + + + + +
+ + + + + + + + + +
+ + +
+ + +
+
+ +
+
{{'General Setting' | translate}}
+ + -
- -
-
-
-
- - -
-
+
+ +
+
+
+
+ + +
+
- -
-
+ +
+
- - {{text}} -
-
- -
+ + {{text}} +
+
+ +
- - - {{text2}} + + + {{text2}}
- - + +
-
- - - - - - {{fuel}} - - +
+ + + + + + {{fuel}} + +
-
- + -
+
- - + +
- +
- +
- +
-
+
-
- - - - {{hours.name}} - - - -
-
-
- - +
+ + + + {{hours.name}} + + + +
+
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
-
- -
-
- -
-
{{'Trip Setting' | translate}}
-
- -
-
-
-
- - - - - - {{trip.view}} - - - -
- +
+
+ +
+
{{'Trip Setting' | translate}}
+
+ +
+
+
+
+ + + + + + {{trip.view}} + + + +
+ -
- -
- - -
-
- -
-
{{'Language Setting' | translate}}
-
- -
-
-
-
- - - - - - {{language.view}} - - - -
- +
+
+ +
+
{{'Language Setting' | translate}}
+
+ +
+
+
+
+ + + + + + {{language.view}} + + + +
+ -
-
+
- -
- - -
-
- -
-
{{'Currency Setting' | translate}}
-
- -
-
-
-
- - - - - - {{ option.country }} - - - -
-
- -
-
-
-
-
-
-
- -
- - -
-
- -
-
{{'API Setting' | translate}}
-
- -
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
- + +
+ + +
+
+ +
+
{{'Currency Setting' | translate}}
+
+ +
+
+
+
+ + + + + + {{ option.country }} + + + +
+
+ +
+
+
+
+
+
+
+ +
+ + +
+
+ +
+
{{'API Setting' | translate}}
+
+ +
+
+
+
+ +
+ + +
+
+
+
+
+
+
+ +
+
+
{{'Notification Settings' | translate}}
-
- +
+
@@ -446,23 +530,23 @@
-
+
-
+
-
+
-
+
-
+
{{'Priority' | translate}}
@@ -477,26 +561,43 @@ {{'Ignition Notification' | translate}}
- +
- +
- +
- - + + -
+

@@ -550,30 +668,50 @@ {{'Power Notification' | translate}}
- +
- +
- +
-
- - - -
+

@@ -584,32 +722,50 @@ {{'Fuel Notification' | translate}}
- +
- +
- +
-
- - - -
+

@@ -620,32 +776,49 @@ {{'Geo-Fence Notification' | translate}}
- +
- +
- +
-
- - - -
+

@@ -656,35 +829,53 @@ {{'Overspeed Notification' | translate}}
- +
- +
- +
-
- - - -
+

- +
@@ -693,36 +884,54 @@ {{'Route Notification' | translate}}
- +
- - - + + +
- - - + + +
-
- - - -
+

@@ -733,34 +942,51 @@ {{'AC Notification' | translate}}
- +
- - + +
- - + +
-
- - - -
+

@@ -771,34 +997,52 @@ {{'Max-Stoppage Notification' | translate}}
- +
- - + +
- - + +
-
- - - -
+

@@ -809,37 +1053,54 @@ {{'SOS Notification' | translate}}
- +
- - + +
- - + +
-
- - - -
+
- - + +
@@ -850,28 +1111,34 @@
-
-
- - + [(ngModel)]="data.vibration.email_status" + (change)=" tab('vibration','email_status')">
- + [(ngModel)]="data.vibration.sms_status" + (change)=" tab('vibration','sms_status')"> + +
+
+ +
{{'High' | translate}} + style="margin-left: 20px;color: white;width: 70px;height: 17px;cursor:pointer">{{'High' + | translate}} {{'Medium' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Medium' + | translate}} {{'Low' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Low' + | translate}}
@@ -892,7 +1159,7 @@
- +
@@ -903,28 +1170,34 @@
+ [(ngModel)]="data.lowBattery.email_status" + (change)=" tab('lowBattery','email_status')">
- + [(ngModel)]="data.lowBattery.sms_status" + (change)=" tab('lowBattery','sms_status')"> +
- + [(ngModel)]="data.lowBattery.notif_status" + (change)=" tab('lowBattery','notif_status')"> +
{{'High' | translate}} + style="margin-left: 20px;color: white;width: 70px;height: 17px;cursor:pointer">{{'High' + | translate}} {{'Medium' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Medium' + | translate}} {{'Low' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Low' + | translate}}
@@ -958,28 +1231,34 @@
+ [(ngModel)]="data.accAlarm.email_status" + (change)=" tab('accAlarm','email_status')">
- + [(ngModel)]="data.accAlarm.sms_status" + (change)=" tab('accAlarm','sms_status')"> +
- + [(ngModel)]="data.accAlarm.notif_status" + (change)=" tab('accAlarm','notif_status')"> +
{{'High' | translate}} + style="margin-left: 20px;color: white;width: 70px;height: 17px;cursor:pointer">{{'High' + | translate}} {{'Medium' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Medium' + | translate}} {{'Low' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Low' + | translate}}
@@ -1013,28 +1292,34 @@
+ [(ngModel)]="data.toll.email_status" + (change)=" tab('toll','email_status')">
- + [(ngModel)]="data.toll.sms_status" + (change)=" tab('toll','sms_status')"> +
- + [(ngModel)]="data.toll.notif_status" + (change)=" tab('toll','notif_status')"> +
{{'High' | translate}} + style="margin-left: 20px;color: white;width: 70px;height: 17px;cursor:pointer">{{'High' + | translate}} {{'Medium' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Medium' + | translate}} {{'Low' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Low' + | translate}}
@@ -1066,28 +1351,34 @@
+ [(ngModel)]="data.harshBreak.email_status" + (change)=" tab('harshBreak','email_status')">
- + [(ngModel)]="data.harshBreak.sms_status" + (change)=" tab('harshBreak','sms_status')"> +
- + [(ngModel)]="data.harshBreak.notif_status" + (change)=" tab('harshBreak','notif_status')"> +
{{'High' | translate}} + style="margin-left: 20px;color: white;width: 70px;height: 17px;cursor:pointer">{{'High' + | translate}} {{'Medium' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Medium' + | translate}} {{'Low' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Low' + | translate}}
@@ -1119,28 +1410,34 @@
+ [(ngModel)]="data.harshAcceleration.email_status" + (change)=" tab('harshAcceleration','email_status')">
- + [(ngModel)]="data.harshAcceleration.sms_status" + (change)=" tab('harshAcceleration','sms_status')"> +
- + [(ngModel)]="data.harshAcceleration.notif_status" + (change)=" tab('harshAcceleration','notif_status')"> +
{{'High' | translate}} + style="margin-left: 20px;color: white;width: 70px;height: 17px;cursor:pointer">{{'High' + | translate}} {{'Medium' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Medium' + | translate}} {{'Low' | translate}} + style="margin-left: 10px;cursor:pointer;color: white;width: 70px;height: 17px;">{{'Low' + | translate}}
@@ -1163,173 +1460,184 @@

-
-
- -
-
- {{'Over Stopped Notification' | translate}} -
-
- - -
-
- - - -
-
- - - -
- -
-
- - - -
-
- +
+
+ +
+
+ +
+
+ {{'Over Idle Notification' | translate}} +
+
+ + +
+
+ + + +
+
+ + + +
+ +
-
- -
-
- {{'Over Idle Notification' | translate}} -
-
- - -
-
- - - -
-
- - - -
- -
-
- - - -
-
+
+
- -
+ +
+
+
+ +
+
+ {{'Parking Notification' | translate}} +
+
+ + +
+
+ + + +
+
+ + + +
+ +
-
- -
-
- {{'Parking Notification' | translate}} -
-
- - -
-
- - - -
-
- - - -
- -
-
- - - -
-
+
+
@@ -1343,7 +1651,7 @@
-
+
@@ -1353,65 +1661,112 @@
{{'TRANSACTION DETAIL' | translate}}
- +
-
+
- - + +
- - + +
- +
-
-
-
- +
+
+
+
- - - - - - - - - + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + +
{{'Sold By' | translate}}{{'Purchased By' | translate}}{{'Allocation Date' | translate}}{{'Points' | translate}}{{'Rate' | translate}}{{'Total Amount' | translate}}{{'Payment Mode' | translate}}{{'Credit Date' | translate}}{{'Remarks' | translate}} + {{'Sold By' | translate}} + {{'Purchased By' | translate}} + {{'Allocation Date' | translate}} + {{'Points' | translate}} + {{'Rate' | translate}} + {{'Total Amount' | translate}} + {{'Payment Mode' | translate}} + {{'Credit Date' | translate}} + {{'Remarks' | translate}}
{{point.by.first_name?point.by.first_name:''}} {{point.by.last_name?point.by.last_name:''}}{{point.to.first_name?point.to.first_name:''}} {{point.to.last_name?point.to.last_name:''}}{{point.created_date|date:'dd/MM/yyyy , h:mm:ss a'}}{{point.points}}{{point.rate}}{{point.totalAmount}}{{point.Payment_type}}{{point.credit_date?(point.credit_date|date:'dd/MM/yyyy , h:mm:ss a'):''}}{{point.remarks?point.remarks:''}}
+ {{point.by.first_name?point.by.first_name:''}} + {{point.by.last_name?point.by.last_name:''}} + {{point.to.first_name?point.to.first_name:''}} + {{point.to.last_name?point.to.last_name:''}} + {{point.created_date|date:'dd/MM/yyyy , h:mm:ss a'}} + {{point.points}}{{point.rate}} + {{point.totalAmount}} + {{point.Payment_type}} + {{point.credit_date?(point.credit_date|date:'dd/MM/yyyy , h:mm:ss a'):''}} + {{point.remarks?point.remarks:''}}
-
-
-
+
+
+
@@ -1419,168 +1774,175 @@
-
-
- -
-
{{'Announcement' | translate}}
-
- -
-
-
-
- -
- - +
+
+ +
+
{{'Announcement' | translate}}
+
+ +
+
+
+
+ +
+ + +
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- -
-
{{'Support And Services' | translate}}
+
+
+
+ +
+
{{'Support And Services' | translate}}
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
+
-
- -
+
-
-
-
-
-
+
-
-
- - - -
-
-
-
{{'Recharge Plans' | translate}}
- -
-
-
-
- - - - + + +
@@ -1589,7 +1951,7 @@ - +
@@ -1620,5 +1982,4 @@
-
--> - +
--> \ No newline at end of file diff --git a/src/app/account-detail/account-detail.component.ts b/src/app/account-detail/account-detail.component.ts index 16d7680..f2dd676 100644 --- a/src/app/account-detail/account-detail.component.ts +++ b/src/app/account-detail/account-detail.component.ts @@ -1,90 +1,116 @@ -import { Component, OnInit, Output, EventEmitter, ViewChild } from '@angular/core'; -import { Router } from '@angular/router'; -import { ContactService } from '../contact.service'; -import {Contact} from '../contact'; -import * as moment from 'moment-timezone'; -import { FlashMessagesService } from 'angular2-flash-messages'; -import { MdDialog } from '@angular/material'; -import { NotificationSettingComponent } from '../notification-setting/notification-setting.component'; -import { TranslateService } from 'ng2-translate'; -import { AllMenusComponent } from '../all-menus/all-menus.component'; -import { BsDatepickerConfig } from 'ngx-bootstrap'; -import { AddPlanComponent } from './add-plan/add-plan.component'; +import { + Component, + OnInit, + Output, + EventEmitter, + ViewChild, +} from "@angular/core"; +import { Router } from "@angular/router"; +import { ContactService } from "../contact.service"; +import { Contact } from "../contact"; +import * as moment from "moment-timezone"; +import { FlashMessagesService } from "angular2-flash-messages"; +import { MdDialog } from "@angular/material"; +import { NotificationSettingComponent } from "../notification-setting/notification-setting.component"; +import { TranslateService } from "ng2-translate"; +import { AllMenusComponent } from "../all-menus/all-menus.component"; +import { BsDatepickerConfig } from "ngx-bootstrap"; +import { AddPlanComponent } from "./add-plan/add-plan.component"; declare var swal: any; -declare var $:any; +declare var $: any; @Component({ - selector: 'app-account-detail', - templateUrl: './account-detail.component.html', - styleUrls: ['./account-detail.component.scss'] + selector: "app-account-detail", + templateUrl: "./account-detail.component.html", + styleUrls: ["./account-detail.component.scss"], }) export class AccountDetailComponent implements OnInit { - @ViewChild(AllMenusComponent ) languageChangeDetection: AllMenusComponent ; + @ViewChild(AllMenusComponent) languageChangeDetection: AllMenusComponent; data_descip: string; - phone_number:'numer'; + phone_number: "numer"; final_counter: number; text3: string; - driverManagement:boolean=false; - paymentGateway:boolean=false + driverManagement: boolean = false; + paymentGateway: boolean = false; // relay_timer:boolean=false; - announcement:any; - renewalCharges; - show:boolean=false; - service2 - service1 - support1 + announcement: any; + renewalCharges; + show: boolean = false; + service2; + service1; + support1; support2; - support3 + support3; bsConfig: Partial; - api_key:any; - available_languages = [{ - view : "English", - id : "en" - },{ - view : "Spanish", - id : "sp" - },{ - view : "Persian", - id : "fa" -},{ - view : "Arabic", - id : "ar" -},{ - view : "Portuguese", - id : "pr" -}, -{ - view : "Albanian", - id : "newLan2" -}, -{ - view : "French", - id : "fr" -}, -{ - view : "Indonesian", - id : "bhasa_web" -}]; - fuelunitArr = ['PERCENTAGE', 'LITRE']; - workingHoursArray=[{name:'Digital input1',id:1},{name:'Digital input2',id:2}]; - workingHours=1; - fuelunit = 'LITRE'; - selectedlanguage='en'; - GET_notif:any; - GET_announcememt:any; - showAnnouncementMenu:boolean=false; + api_key: any; + secondary_emails: any = { + flag: false, + data: [], + }; + available_languages = [ + { + view: "English", + id: "en", + }, + { + view: "Spanish", + id: "sp", + }, + { + view: "Persian", + id: "fa", + }, + { + view: "Arabic", + id: "ar", + }, + { + view: "Portuguese", + id: "pr", + }, + { + view: "Albanian", + id: "newLan2", + }, + { + view: "French", + id: "fr", + }, + { + view: "Indonesian", + id: "bhasa_web", + }, + { + view: "Pashto", + id: "pashto", + }, + ]; + fuelunitArr = ["PERCENTAGE", "LITRE"]; + workingHoursArray = [ + { name: "Digital input1", id: 1 }, + { name: "Digital input2", id: 2 }, + ]; + workingHours = 1; + fuelunit = "LITRE"; + selectedlanguage = "en"; + GET_notif: any; + GET_announcememt: any; + showAnnouncementMenu: boolean = false; symbol3: string; - timezone:any = 'Asia/Kolkata'; + timezone: any = "Asia/Kolkata"; final_counter2: number; text2: string; symbol2: string; - timezoneArray=[]; + timezoneArray = []; phone_verfi: boolean; text: string; final_counter1: number; - tripGenerationVal:any; - tripGenerationArr=[{'view': 'Automatic','value':'auto'},{'view' :'Manual', 'value':'manual'}] + tripGenerationVal: any; + tripGenerationArr = [ + { view: "Automatic", value: "auto" }, + { view: "Manual", value: "manual" }, + ]; symbol: string; email_verfi: boolean; logo: any; @@ -95,1302 +121,1351 @@ export class AccountDetailComponent implements OnInit { mb: any; useridd: any; or: any; -fs :any; -ls:any; -cond:Boolean = false; -point : any = 0; -before:any; -emailid:any; -mobile:any; -contacts: Contact[]=[]; -contact: Contact; + fs: any; + ls: any; + cond: Boolean = false; + point: any = 0; + before: any; + emailid: any; + mobile: any; + contacts: Contact[] = []; + contact: Contact; Notification: any[]; data: any = { ign: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, poi: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, power: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, fuel: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, geo: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, overspeed: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, AC: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, route: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, maxstop: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, sos: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, sms: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - vibration: { - sms_status: false, email_status: false, + vibration: { + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - lowBattery: { - sms_status: false, email_status: false, + lowBattery: { + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, accAlarm: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, toll: { - sms_status: false, email_status: false, + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - harshBreak:{ - sms_status: false, email_status: false, + harshBreak: { + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - harshAcceleration:{ - sms_status: false, email_status: false, + harshAcceleration: { + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - over_stopped:{ - sms_status: false, email_status: false, + over_stopped: { + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - over_idle:{ - sms_status: false, email_status: false, + over_idle: { + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - theft:{ - sms_status: false, email_status: false, + theft: { + sms_status: false, + email_status: false, notif_status: false, - priority: 1, emails:[], phones:[] + priority: 1, + emails: [], + phones: [], }, - }; dataOriginal: any; - fData: any = { - - }; + fData: any = {}; Load: boolean; notifType: any; - isAddEmail: boolean =false; + isAddEmail: boolean = false; emailList: any; isAddPhone: boolean = false; phonelist: any; - shownotifdiv: boolean=true; + shownotifdiv: boolean = true; allocatedPoints: any; - colorTheme = 'theme-dark-blue'; + colorTheme = "theme-dark-blue"; optiondefault: any; - labelSetting:boolean=true + labelSetting: boolean = true; - constructor(private router: Router,private contactService: ContactService,public translate: TranslateService,private _flashMessagesService: FlashMessagesService,public dialog: MdDialog) { + constructor( + private router: Router, + private contactService: ContactService, + public translate: TranslateService, + private _flashMessagesService: FlashMessagesService, + public dialog: MdDialog + ) { 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"); + script.setAttribute( + "src", + "https://unpkg.com/multiple-select@1.3.1/dist/multiple-select.min.js" + ); document.getElementsByTagName("head")[0].appendChild(script); - this.bsConfig = Object.assign({ dateInputFormat: 'DD-MM-YYYY, h:mm:ss a' }, { containerClass: this.colorTheme }); - } - superAdmin:Boolean = false; - from_date= new Date(); + this.bsConfig = Object.assign( + { dateInputFormat: "DD-MM-YYYY, h:mm:ss a" }, + { containerClass: this.colorTheme } + ); + } + superAdmin: Boolean = false; + from_date = new Date(); to_date = new Date(); ngOnInit() { - var timeZones = moment.tz.names(); - console.log('timeZones',timeZones); + console.log("timeZones", timeZones); - var fTime = new Date().setHours(0,0,0,0); + var fTime = new Date().setHours(0, 0, 0, 0); this.from_date = new Date(fTime); - var td = new Date().setHours(23,59,59,999); + var td = new Date().setHours(23, 59, 59, 999); this.to_date = new Date(td); - - - this.timezoneArray=[]; + + this.timezoneArray = []; for (var i in timeZones) { - this.timezoneArray.push({ viewValue: "(GMT" + moment.tz(timeZones[i]).format('Z') + ")" + timeZones[i], value: timeZones[i] }); + this.timezoneArray.push({ + viewValue: + "(GMT" + moment.tz(timeZones[i]).format("Z") + ")" + timeZones[i], + value: timeZones[i], + }); } - setTimeout(() => { - $('#dbselect').multipleSelect({ - width:420, - placeholder: 'Select Timezone', + $("#dbselect").multipleSelect({ + width: 420, + placeholder: "Select Timezone", filter: true, single: true, - selectAll: false - }) + selectAll: false, + }); }, 100); + this.logo = window.localStorage["logo"]; - - this.logo=window.localStorage['logo']; - - this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin; - 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; - this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer; - this.mobile = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn; - this.email_verfi = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).email_verfi; - this.phone_verfi = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phone_verfi; - this.GET_notif = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).GET_notif; - this.mb = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn; - this.fuelunit = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).fuel_unit + this.superAdmin = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).isSuperAdmin; + 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; + this.custtype = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).isDealer; + this.mobile = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).phn; + this.email_verfi = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).email_verfi; + this.phone_verfi = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).phone_verfi; + this.GET_notif = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).GET_notif; + this.mb = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).phn; + this.fuelunit = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).fuel_unit; //console.log(this.mobile) email_verfi phone_verfi // console.log(JSON.parse(window.atob(window.localStorage.token.split('.')[1])))\ - var supadm = localStorage.getItem('superadmin'); - console.log("superadmin=>",supadm); - if((supadm == 'ON')||(supadm == 'OFF')||(this.custtype)||(this.superAdmin)){ - + var supadm = localStorage.getItem("superadmin"); + console.log("superadmin=>", supadm); + if (supadm == "ON" || supadm == "OFF" || this.custtype || this.superAdmin) { this.shownotifdiv = false; } - console.log("shownotifVeh=>",this.shownotifdiv); - + console.log("shownotifVeh=>", this.shownotifdiv); + this.getAlert(); - if(this.custtype == true){ + if (this.custtype == true) { this.cust = true; - } - if(this.mb.charAt(0)=="n"){ - this.mb = ' ' + } + if (this.mb.charAt(0) == "n") { + this.mb = " "; } + if (window.localStorage["Custumer"] == "ON") { + this.logoutbut = false; + this.dealer = true; + } else { + this.logoutbut = true; + } - if( window.localStorage['Custumer'] == 'ON'){ - this.logoutbut = false - this.dealer = true - } - else{ - this.logoutbut = true - } - - this.logo=window.localStorage['logo']; - this.text=window.localStorage['text']; + this.logo = window.localStorage["logo"]; + this.text = window.localStorage["text"]; - this.getCurrencies(); - this.getLanguage(); + this.getCurrencies(); + this.getLanguage(); - this.getToken(); - this.getApiKey(); - this.getTransectionDetail(); - if(this.superAdmin) - this.getRechargePlans() - - -} - - -myaccount(){ - - - this.cond = false - this.router.navigateByUrl("accountSettings"); - - - -// let dialogRef = this.dialog.open(MyaccountComponent, { -// width: '903px', -// data: {} -// }); - -// dialogRef.afterClosed().subscribe(result => { - -// if(result == "succ"){ -// console.log("Updated") -// } - -// }); - - -} -tost1(divid){ - if(divid == "nofsls"){ - this.data_descip = "Please Enter Mandatory Fields"; - launch_toast(); + this.getToken(); + this.getApiKey(); + this.getTransectionDetail(); + if (this.superAdmin) this.getRechargePlans(); } - else if(divid == "succ"){ - this.data_descip = "Succesfully Updated"; - launch_toast(); - } - else if(divid == "currset"){ - this.data_descip = "Currency Updated"; - launch_toast(); - } else if(divid == "alertset"){ - this.data_descip = "Alert preference set"; - launch_toast(); - } + + myaccount() { + this.cond = false; + this.router.navigateByUrl("accountSettings"); + + // let dialogRef = this.dialog.open(MyaccountComponent, { + // width: '903px', + // data: {} + // }); + + // dialogRef.afterClosed().subscribe(result => { + + // if(result == "succ"){ + // console.log("Updated") + // } + + // }); + } + tost1(divid) { + if (divid == "nofsls") { + this.data_descip = "Please Enter Mandatory Fields"; + launch_toast(); + } else if (divid == "succ") { + this.data_descip = "Succesfully Updated"; + launch_toast(); + } else if (divid == "currset") { + this.data_descip = "Currency Updated"; + launch_toast(); + } else if (divid == "alertset") { + this.data_descip = "Alert preference set"; + launch_toast(); + } function launch_toast() { - // console.log(divid); - var x = document.getElementById("toast_1") + // console.log(divid); + var x = document.getElementById("toast_1"); //console.log(x); x.className = "show"; - setTimeout(function(){ x.className = x.className.replace("show", ""); }, 1500); + setTimeout(function () { + x.className = x.className.replace("show", ""); + }, 1500); + } } - } - -editAccount(){ - if(this.fs == "" || this.ls == "" || this.fs == " " || this.ls == " " ){ - this.tost1("nofsls") - } - else{ - var tzone = $('#dbselect').multipleSelect('getSelects','value'); - console.log('tzone=>',tzone[0]); - const newContact ={ - fname: this.fs, - lname: this.ls, - org: this.or, - noti: this.GET_notif, - uid:this.useridd, - show_announcement:this.GET_announcememt, - label_setting:this.labelSetting?this.labelSetting:false, - digital_input:this.workingHours, - driverManagement:this.driverManagement, - paymentGateway:this.paymentGateway - // relay_timer:this.relay_timer - } - if(this.renewalCharges!=undefined){ - newContact['renewal_charges']=this.renewalCharges - } - if(tzone != undefined){ - newContact['timezone'] = tzone[0]; - } - - if(this.fuelunit != undefined){ - newContact['fuel_unit'] = this.fuelunit; - } + editAccount() { + if (this.fs == "" || this.ls == "" || this.fs == " " || this.ls == " ") { + this.tost1("nofsls"); + } else { + var tzone = $("#dbselect").multipleSelect("getSelects", "value"); + console.log("tzone=>", tzone[0]); + const newContact = { + fname: this.fs, + lname: this.ls, + org: this.or, + noti: this.GET_notif, + uid: this.useridd, + show_announcement: this.GET_announcememt, + label_setting: this.labelSetting ? this.labelSetting : false, + digital_input: this.workingHours, + driverManagement: this.driverManagement, + paymentGateway: this.paymentGateway, + // relay_timer:this.relay_timer + }; + if (this.renewalCharges != undefined) { + newContact["renewal_charges"] = this.renewalCharges; + } + if (tzone != undefined) { + newContact["timezone"] = tzone[0]; + } - if(this.support1 != undefined){ - newContact['support1'] = this.support1; -} - if(this.support2 != undefined){ - newContact['support2'] = this.support2; -} - if(this.support3 != undefined){ - newContact['support3'] = this.support3; -} - if(this.service1 != undefined){ - newContact['service1'] = this.service1 -} - if(this.service2 != undefined){ - newContact['service2'] = this.service2 -} + if (this.fuelunit != undefined) { + newContact["fuel_unit"] = this.fuelunit; + } + if (this.support1 != undefined) { + newContact["support1"] = this.support1; + } + if (this.support2 != undefined) { + newContact["support2"] = this.support2; + } + if (this.support3 != undefined) { + newContact["support3"] = this.support3; + } + if (this.service1 != undefined) { + newContact["service1"] = this.service1; + } + if (this.service2 != undefined) { + newContact["service2"] = this.service2; + } + if (this.secondary_emails.flag == true) { + newContact["secondary_emails"] = + this.secondary_emails.data.filter(Boolean); + } - - - console.log(newContact); - this.contactService.updateuid(newContact) .subscribe(contact => { + console.log(newContact); + this.contactService.updateuid(newContact).subscribe( + (contact) => { this.contacts.push(contact); this.tost1("succ"); - window.localStorage['token'] = contact.token ; + window.localStorage["token"] = contact.token; this.getToken(); this.ngOnInit(); - } , (err: any) => { - - if(err.status == 500) { - - } - else{ - - + }, + (err: any) => { + if (err.status == 500) { + } else { + } } - } - ); + ); + } } -} - -mydealer(){ - window.localStorage['token'] = window.localStorage['Dealer_token']; - localStorage.removeItem('devices'); - window.localStorage['DataUpdate'] = 'True'; - if(window.localStorage['DataLoaded'] = 'True'){ - window.localStorage['Custumer'] = 'OFF' - this.router.navigateByUrl("add") + mydealer() { + window.localStorage["token"] = window.localStorage["Dealer_token"]; + localStorage.removeItem("devices"); + window.localStorage["DataUpdate"] = "True"; + if ((window.localStorage["DataLoaded"] = "True")) { + window.localStorage["Custumer"] = "OFF"; + this.router.navigateByUrl("add"); + } } -} -verify_email(){ - if(this.email_verfi == true){ - this.symbol = '\u2714'; - this.text = "Email Verified" - this.final_counter1 = 0; - return true + verify_email() { + if (this.email_verfi == true) { + this.symbol = "\u2714"; + this.text = "Email Verified"; + this.final_counter1 = 0; + return true; + } else { + this.symbol = "X"; + this.text = "Email Not Verified"; + this.final_counter1 = 1; + return true; + } } - else{ - this.symbol = 'X' - this.text = "Email Not Verified" - this.final_counter1 = 1; - return true + + verify_phone() { + if (this.phone_verfi == true) { + this.symbol2 = "\u2714"; + this.text2 = "Mobile Verified"; + this.final_counter2 = 0; + return true; + } else { + this.symbol2 = "X"; + this.text2 = "Mobile Not Verified"; + this.final_counter2 = 1; + return true; + } } -} -verify_phone(){ - if(this.phone_verfi == true){ - this.symbol2 = '\u2714'; - this.text2 = "Mobile Verified" - this.final_counter2 = 0; - return true + notifications() { + this.cond = false; + this.router.navigateByUrl("notifications"); } - else{ - this.symbol2 = 'X' - this.text2 = "Mobile Not Verified" - this.final_counter2 =1; - return true + + deal() { + if (this.custtype == true) { + this.symbol3 = "\u2714"; + this.text3 = "Dealer"; + this.final_counter = 0; + return true; + } else { + this.symbol3 = "X"; + this.text3 = "Not a Dealer"; + this.final_counter = 1; + return true; + } } -} -notifications(){ - this.cond = false - this.router.navigateByUrl("notifications"); -} - - - - -deal(){ - if(this.custtype == true){ - this.symbol3 = '\u2714'; - this.text3 = "Dealer" - this.final_counter = 0; - return true - } - else{ - this.symbol3 = 'X' - this.text3 = "Not a Dealer" - this.final_counter =1; - return true - } -} - - - - - a(){ + a() { // console.log(this.point); - if(this.point == 0){ + if (this.point == 0) { this.cond = true; - this.point ++; - } - else if(this.point % 2 == 0){ - this.cond = true; - this.point ++; - } - else{ - this.cond = false - this.point ++; - } - - + this.point++; + } else if (this.point % 2 == 0) { + this.cond = true; + this.point++; + } else { + this.cond = false; + this.point++; + } } - report(){ - this.cond = false + report() { + this.cond = false; this.router.navigateByUrl("device-report"); - } - vehicleRoute(){ + vehicleRoute() { this.router.navigateByUrl("vehicleRoute"); - } - dealerInfo(){ - this.cond = false + dealerInfo() { + this.cond = false; this.router.navigateByUrl("dealerInfo"); } - route_map(){ + route_map() { this.router.navigateByUrl("routeMapping"); - } - - Ddetail(){ + Ddetail() { this.router.navigateByUrl("driverdetail"); } - DModel(){ + DModel() { this.router.navigateByUrl("deviceModel"); } - VType(){ + VType() { this.router.navigateByUrl("VehicleType"); } - - - - report_speed(){ + report_speed() { // console.log("report speed call") - this.cond = false + this.cond = false; this.router.navigateByUrl("device-report/device-speed-report"); } - driverPerformance(){ - this.cond = false + driverPerformance() { + this.cond = false; this.router.navigateByUrl("device-report/Driver-performance"); } - geo(){ + geo() { this.router.navigateByUrl("geofencing"); - } - ideal(){ + ideal() { this.router.navigateByUrl("device-report/ideal-report"); } -run(){ + run() {} + openNav() { + /* document.getElementById("myNav").style.width = "100%"; + */ + this.router.navigateByUrl("location"); + } -} -openNav() { - /* document.getElementById("myNav").style.width = "100%"; -*/ - this.router.navigateByUrl("location"); - -} + logout() { + window.localStorage.clear(); + this.router.navigateByUrl("login"); + } + devi() { + this.router.navigateByUrl("dashboard"); + } + soon() { + this.router.navigateByUrl("const"); + } -logout(){ - window.localStorage.clear(); - this.router.navigateByUrl("login"); -} -devi(){ - this.router.navigateByUrl("dashboard"); + summaryReport() { + this.cond = false; + this.router.navigateByUrl("device-report/summary-report"); + } -} -soon(){ - this.router.navigateByUrl("const"); - -} + geofancingReport() { + this.cond = false; + this.router.navigateByUrl("device-report/geofancing"); + } -summaryReport(){ + overspeed() { + this.cond = false; + this.router.navigateByUrl("device-report/overspeed"); + } + routeViolation() { + this.cond = false; + this.router.navigateByUrl("device-report/routeViolation"); + } - this.cond = false - this.router.navigateByUrl("device-report/summary-report"); -} + stoppage_report() { + this.cond = false; + this.router.navigateByUrl("device-report/stoppage_report"); + } + ignition_report() { + this.cond = false; + this.router.navigateByUrl("device-report/ignition_report"); + } -geofancingReport(){ - this.cond = false - this.router.navigateByUrl("device-report/geofancing"); -} + alert_report() { + this.cond = false; + this.router.navigateByUrl("device-report/alert_report"); + } + trip_report() { + this.cond = false; + this.router.navigateByUrl("device-report/trip_report"); + } -overspeed(){ - this.cond = false - this.router.navigateByUrl("device-report/overspeed"); + group() { + this.cond = false; + this.router.navigateByUrl("group_view"); + } -} -routeViolation(){ - this.cond = false - this.router.navigateByUrl("device-report/routeViolation"); + distance_report() { + this.cond = false; + this.router.navigateByUrl("device-report/distance_report"); + } -} + new() { + this.router.navigateByUrl("new"); + } + addcus() { + this.router.navigateByUrl("add"); + } + selectedFile: File; + imageURL: any; + onFileChanged(event) { + this.selectedFile = event.target.files[0]; + } -stoppage_report(){ - this.cond = false - this.router.navigateByUrl("device-report/stoppage_report"); + onUpload() { + const fd = new FormData(); + fd.append("photo", this.selectedFile, this.selectedFile.name); + console.log("Binaryimage = > ", fd); + this.contactService.imageupload(fd).subscribe( + (res) => { + console.log(res); + if (res) { + var pld = { + _id: this.useridd, + imageDoc: [res["_body"]], + }; -} -ignition_report(){ - this.cond = false - this.router.navigateByUrl("device-report/ignition_report"); - - -} - -alert_report(){ - this.cond = false - this.router.navigateByUrl("device-report/alert_report"); - - -} -trip_report(){ - this.cond = false - this.router.navigateByUrl("device-report/trip_report"); - -} - -group(){ - this.cond = false - this.router.navigateByUrl("group_view"); -} - - -distance_report(){ - this.cond = false - this.router.navigateByUrl("device-report/distance_report"); -} - -new(){ - this.router.navigateByUrl("new"); - -} -addcus(){ - this.router.navigateByUrl("add"); -} -selectedFile: File; -imageURL:any; -onFileChanged(event) { - - this.selectedFile = event.target.files[0]; -} - -onUpload() { - - const fd = new FormData(); - fd.append('photo',this.selectedFile,this.selectedFile.name) - console.log("Binaryimage = > ",fd ); - this.contactService.imageupload(fd) - .subscribe(res=>{ - console.log(res); - if(res){ - var pld = { - _id : this.useridd, - imageDoc : [res['_body']] + this.contactService.updateImage(pld).subscribe((res) => { + console.log(res); + var chkPP = localStorage.getItem("profilePic"); + if (chkPP != null) { + localStorage.removeItem("profilePic"); + } + this.data_descip = "Image Succesfully Shared"; + launch_toast(); + }); } - - this.contactService.updateImage(pld).subscribe(res=>{ - console.log(res); - var chkPP = localStorage.getItem('profilePic'); - if(chkPP != null){ - localStorage.removeItem('profilePic'); - } - this.data_descip = "Image Succesfully Shared"; - launch_toast(); - }) - - } - console.log(res); - },err=>{ - console.log(err); - }) + console.log(res); + }, + (err) => { + console.log(err); + } + ); function launch_toast() { // console.log(divid); - var x = document.getElementById("toast_1") - //console.log(x); - x.className = "show"; - setTimeout(function(){ x.className = x.className.replace("show", ""); }, 1500); - } + var x = document.getElementById("toast_1"); + //console.log(x); + x.className = "show"; + setTimeout(function () { + x.className = x.className.replace("show", ""); + }, 1500); + } + } -} + // https://www.oneqlik.in/users/uploadImage + getAlert() { + this.Load = true; + this.contactService.getcustToken(this.useridd).subscribe( + (resp) => { + console.log(resp); + this.Load = false; + console.log(resp); + if (resp["cust"].alert != undefined) { + console.log("aasas", resp["cust"].alert); + var dummy = resp["cust"].alert; + // this.data = resp['cust'].alert; -// https://www.oneqlik.in/users/uploadImage -getAlert() { - this.Load = true; - this.contactService.getcustToken(this.useridd).subscribe(resp => { - console.log(resp); - this.Load = false; - console.log(resp); - if (resp['cust'].alert != undefined){ - console.log("aasas", resp['cust'].alert); - var dummy=resp['cust'].alert; - // this.data = resp['cust'].alert; - + for (var mData in this.data) { + for (var pData in dummy) { + if (mData === pData) { + console.log(dummy[mData]); + this.data[mData] = dummy[mData]; + } else { + this.data[pData] = dummy[pData]; + } + } + } - for(var mData in this.data){ - for(var pData in dummy){ - if(mData === pData){ - console.log(dummy[mData]); - this.data[mData]=dummy[mData]; - }else{ - this.data[pData]= dummy[pData]; + console.log("kkkk", this.data); + this.dataOriginal = JSON.parse(JSON.stringify(this.data)); } + }, + (err) => { + this.Load = false; + console.log("err", err); } - - } - - console.log("kkkk", this.data); - this.dataOriginal = JSON.parse(JSON.stringify(this.data)); - } - }, err => { - this.Load = false; - console.log("err", err); - }) - -} - -tab(key1, key2) { - if (key1 && key2) - this.data[key1][key2] = !this.data[key1][key2]; - - if (JSON.stringify(this.data) === JSON.stringify(this.dataOriginal)) - return; - - this.fData.contactid = this.useridd; - this.fData.alert = this.data; - this.Load = true; - this.contactService.editDealer(this.fData).subscribe(resp => { - this.Load = false; - this._flashMessagesService.show("Setting Updated", { cssClass: 'alert-success', timeout: 2000 }); - // toastr.success("Setting Updated"); - // this.router.navigateByUrl("/account") - this.dataOriginal = JSON.parse(JSON.stringify(this.data)); - }, err => { - this.Load = false; - this._flashMessagesService.show("Server error , Try after sometime !!!", { cssClass: 'alert-denger', timeout: 2000 }); - console.log("err", err); - }) -} - -tab1(key1, key2, value) { - if (key1 && key2) - if (!value) - this.data[key1][key2] = !this.data[key1][key2]; - else - this.data[key1][key2] = value; - if (JSON.stringify(this.data) === JSON.stringify(this.dataOriginal)) - return; - - this.fData.contactid = this.useridd; - this.fData.alert = this.data; - this.Load = true; - this.contactService.editDealer(this.fData).subscribe(resp => { - // toastr.success("Setting Updated"); - this.Load = false; - this._flashMessagesService.show("Setting Updated", { cssClass: 'alert-success', timeout: 2000 }); - // this.router.navigateByUrl("/account") - this.dataOriginal = JSON.parse(JSON.stringify(this.data)); - }, err => { - this.Load = false; - this._flashMessagesService.show("Server error , Try after sometime !!!", { cssClass: 'alert-denger', timeout: 2000 }); - console.log("err", err); - }) -} - - -onClickAddEmail(noti){ - console.log(this.data); - console.log(noti); - this.notifType=noti; - this.isAddEmail=true; - var data = { - "buttonClick" : 'email', - "notifType" : this.notifType, - "compData" : this.data + ); } - //this.emailList=this.data[noti].emails; - // console.log("in Email",this.emailList); - let dialogRef = this.dialog.open(NotificationSettingComponent, { - data: {"notifData":data} - }); - dialogRef.afterClosed().subscribe(result => { - // console.log(result); - if (result == "close") { - - } - }); -// this.modelService.getModal('myModal').open(); -} -onClickAddPhone(noti){ - console.log(this.data); - this.notifType=noti; - this.isAddPhone=true; - var data = { - buttonClick : 'phone', - "notifType" : this.notifType, - "compData" :this.data - } - // this.phonelist=this.data[noti].phones; -//console.log("in Email",this.phonelist) -// this.modelService.getModal('myModal').open(); -let dialogRef = this.dialog.open(NotificationSettingComponent, { - data: {"notifData":data} -}); -dialogRef.afterClosed().subscribe(result => { - // console.log(result); - if (result == "close") { - - } -}); + tab(key1, key2) { + if (key1 && key2) this.data[key1][key2] = !this.data[key1][key2]; -} + if (JSON.stringify(this.data) === JSON.stringify(this.dataOriginal)) return; - -setPriority(notiType, priority) { - console.log(priority); - console.log(this.data); - switch (notiType) { - case 'ign': - this.data.ign.priority = priority; - return; - case 'geo': - this.data.geo.priority = priority; - return; - case 'poi': - this.data.poi.priority = priority; - return; - case 'route': - this.data.route.priority = priority; - return; - case 'overspeed': - this.data.overspeed.priority = priority; - return; - case 'maxstop': - this.data.maxstop.priority = priority; - return; - case 'fuel': - this.data.fuel.priority = priority; - return; - case 'AC': - this.data.AC.priority = priority; - return; - case 'power': - this.data.power.priority = priority; - return; - case 'sos': - this.data.sos.priority = priority; - return; - default: - return; - }; - - -} - - -changelanguage(){ - console.log("inside function"); - var payload = { - uid: this.useridd, - lang: this.selectedlanguage - } - this.contactService.setlanguage(payload).subscribe(res=>{ - console.log(res); - // this.translate.use(this.selectedlanguage); - if(res.message == 'language updated sucessfully'){ - console.log("language saved"); - localStorage.setItem('appLang',this.selectedlanguage); - this.languageChangeDetection.getLanguage() - // this.getLanguage() - } - // this.translate.setDefaultLang('es'); - },err=>{ - this.selectedlanguage = 'en' ; - }) - -} - -getLanguage(){ - var that = this; -var Var = { uid: this.useridd }; - this.contactService.getLanguages(Var).subscribe(res=>{ - this.selectedlanguage = res.language_code ; - console.log("fdkjjdfj",res); - - if(res.isSuperAdmin) - { - this.showAnnouncementMenu=true - }else{ - this.showAnnouncementMenu=false - } - this.support1=res.support1?res.support1:undefined - this.support2=res.support2?res.support2:undefined - this.support3=res.support3?res.support3:undefined - this.service1=res.service1?res.service1:undefined - this.service2=res.service2?res.service2:undefined - this.announcement=res.announcement?res.announcement:undefined - this.GET_announcememt=res.show_announcement?res.show_announcement:false; - - console.log(res.isSuperAdmin,this.showAnnouncementMenu,this.announcement,this.GET_announcememt); - - this.translate.setDefaultLang(this.selectedlanguage); - - this.translate.use(this.selectedlanguage); - var currencyfiltered = this.currency.filter(d=>{ - if(res.currency_code != undefined){ - if(d.currencyVal === res.currency_code){ - return d.country; + this.fData.contactid = this.useridd; + this.fData.alert = this.data; + this.Load = true; + this.contactService.editDealer(this.fData).subscribe( + (resp) => { + this.Load = false; + this._flashMessagesService.show("Setting Updated", { + cssClass: "alert-success", + timeout: 2000, + }); + // toastr.success("Setting Updated"); + // this.router.navigateByUrl("/account") + this.dataOriginal = JSON.parse(JSON.stringify(this.data)); + }, + (err) => { + this.Load = false; + this._flashMessagesService.show( + "Server error , Try after sometime !!!", + { cssClass: "alert-denger", timeout: 2000 } + ); + console.log("err", err); } - }else{ - if(d.currencyVal === 'INR'){ - return d.country; - } - } - }) - this.optiondefault = currencyfiltered[0].country; - - - },err=>{ - console.log(err); - }) - -} - -getToken(){ - - this.contactService.getUserObj(this.useridd).subscribe(res=>{ - this.timezone = res.timezone; - this.support1=res.support1?res.support1:undefined - this.support2=res.support2?res.support2:undefined - this.support3=res.support3?res.support3:undefined - this.service1=res.service1?res.service1:undefined - this.service2=res.service2?res.service2:undefined; - this.driverManagement=res.driverManagement?res.driverManagement:false; - this.paymentGateway=res.paymentgateway?res.paymentgateway:false; - if(res.digital_input){ - this.workingHours=res.digital_input - } - if(res.renewal_charges){ - this.renewalCharges=res.renewal_charges - } - if(res.tripGeneration != undefined){ - this.tripGenerationVal = res.tripGeneration ; - } - // if(res.relay_timer!=undefined){ - // this.relay_timer=res.relay_timer - // } - if(res.label_setting!=undefined){ - this.labelSetting=res.label_setting - } - console.log("LABLE SETTING", this.labelSetting); - - setTimeout(() => { - $('#dbselect').multipleSelect({ - width: 300, - placeholder: 'Select Timezone', - filter: true, - single: true, - selectAll: false - }) - }, 100); - - }) - -} - - - - -getTransectionDetail(){ - console.log("Inside Transection Detail Page"); - this.allocatedPoints =[]; - if(this.from_date){ - var fd = this.from_date.toISOString(); - } - if(this.to_date){ - var td = this.to_date.toISOString() + ); } - this.contactService.getPointDetails(this.useridd,fd,td).subscribe(res=>{ - console.log('allocatedPoint',res); - this.allocatedPoints = res; - this.show=true; - }) -} + tab1(key1, key2, value) { + if (key1 && key2) + if (!value) this.data[key1][key2] = !this.data[key1][key2]; + else this.data[key1][key2] = value; + if (JSON.stringify(this.data) === JSON.stringify(this.dataOriginal)) return; - -tripGenerationFunc(ev){ - console.log(ev); - var payload = { - uid: this.useridd, - tripGeneration: ev.value + this.fData.contactid = this.useridd; + this.fData.alert = this.data; + this.Load = true; + this.contactService.editDealer(this.fData).subscribe( + (resp) => { + // toastr.success("Setting Updated"); + this.Load = false; + this._flashMessagesService.show("Setting Updated", { + cssClass: "alert-success", + timeout: 2000, + }); + // this.router.navigateByUrl("/account") + this.dataOriginal = JSON.parse(JSON.stringify(this.data)); + }, + (err) => { + this.Load = false; + this._flashMessagesService.show( + "Server error , Try after sometime !!!", + { cssClass: "alert-denger", timeout: 2000 } + ); + console.log("err", err); + } + ); } - this.contactService.setlanguage(payload).subscribe(res=>{ - console.log('res=>',res); - this.getToken() - this.data_descip = "Setting Saved"; - launch_toast(); - }) + onClickAddEmail(noti) { + console.log(this.data); + console.log(noti); + this.notifType = noti; + this.isAddEmail = true; + var data = { + buttonClick: "email", + notifType: this.notifType, + compData: this.data, + }; + //this.emailList=this.data[noti].emails; + // console.log("in Email",this.emailList); + let dialogRef = this.dialog.open(NotificationSettingComponent, { + data: { notifData: data }, + }); + dialogRef.afterClosed().subscribe((result) => { + // console.log(result); + if (result == "close") { + } + }); + // this.modelService.getModal('myModal').open(); + } + onClickAddPhone(noti) { + console.log(this.data); + this.notifType = noti; + this.isAddPhone = true; + var data = { + buttonClick: "phone", + notifType: this.notifType, + compData: this.data, + }; + // this.phonelist=this.data[noti].phones; + //console.log("in Email",this.phonelist) + // this.modelService.getModal('myModal').open(); + let dialogRef = this.dialog.open(NotificationSettingComponent, { + data: { notifData: data }, + }); + dialogRef.afterClosed().subscribe((result) => { + // console.log(result); + if (result == "close") { + } + }); + } - - 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); - } + setPriority(notiType, priority) { + console.log(priority); + console.log(this.data); + switch (notiType) { + case "ign": + this.data.ign.priority = priority; + return; + case "geo": + this.data.geo.priority = priority; + return; + case "poi": + this.data.poi.priority = priority; + return; + case "route": + this.data.route.priority = priority; + return; + case "overspeed": + this.data.overspeed.priority = priority; + return; + case "maxstop": + this.data.maxstop.priority = priority; + return; + case "fuel": + this.data.fuel.priority = priority; + return; + case "AC": + this.data.AC.priority = priority; + return; + case "power": + this.data.power.priority = priority; + return; + case "sos": + this.data.sos.priority = priority; + return; + default: + return; + } + } -} -btnTag:boolean = false; -btnKey= 'Save' -getApiKey(){ - this.contactService.getgoogleApi(this.useridd).subscribe(res=>{ - if(res.message != "api key not found"){ - this.api_key = res.api_key; + changelanguage() { + console.log("inside function"); + var payload = { + uid: this.useridd, + lang: this.selectedlanguage, + }; + this.contactService.setlanguage(payload).subscribe( + (res) => { + console.log(res); + // this.translate.use(this.selectedlanguage); + if (res.message == "language updated sucessfully") { + console.log("language saved"); + localStorage.setItem("appLang", this.selectedlanguage); + this.languageChangeDetection.getLanguage(); + // this.getLanguage() + } + // this.translate.setDefaultLang('es'); + }, + (err) => { + this.selectedlanguage = "en"; + } + ); + } + + getLanguage() { + var that = this; + var Var = { uid: this.useridd }; + this.contactService.getLanguages(Var).subscribe( + (res) => { + this.selectedlanguage = res.language_code; + console.log("fdkjjdfj", res); + + if (res.isSuperAdmin) { + this.showAnnouncementMenu = true; + } else { + this.showAnnouncementMenu = false; + } + this.support1 = res.support1 ? res.support1 : undefined; + this.support2 = res.support2 ? res.support2 : undefined; + this.support3 = res.support3 ? res.support3 : undefined; + this.service1 = res.service1 ? res.service1 : undefined; + this.service2 = res.service2 ? res.service2 : undefined; + this.announcement = res.announcement ? res.announcement : undefined; + this.GET_announcememt = res.show_announcement + ? res.show_announcement + : false; + + console.log( + res.isSuperAdmin, + this.showAnnouncementMenu, + this.announcement, + this.GET_announcememt + ); + + this.translate.setDefaultLang(this.selectedlanguage); + + this.translate.use(this.selectedlanguage); + var currencyfiltered = this.currency.filter((d) => { + if (res.currency_code != undefined) { + if (d.currencyVal === res.currency_code) { + return d.country; + } + } else { + if (d.currencyVal === "INR") { + return d.country; + } + } + }); + this.optiondefault = currencyfiltered[0].country; + }, + (err) => { + console.log(err); + } + ); + } + + getToken() { + this.contactService.getUserObj(this.useridd).subscribe((res) => { + this.timezone = res.timezone; + this.support1 = res.support1 ? res.support1 : undefined; + this.support2 = res.support2 ? res.support2 : undefined; + this.support3 = res.support3 ? res.support3 : undefined; + this.service1 = res.service1 ? res.service1 : undefined; + this.service2 = res.service2 ? res.service2 : undefined; + this.driverManagement = res.driverManagement + ? res.driverManagement + : false; + this.paymentGateway = res.paymentgateway ? res.paymentgateway : false; + if (res.digital_input) { + this.workingHours = res.digital_input; + } + if (res.renewal_charges) { + this.renewalCharges = res.renewal_charges; + } + if (res.tripGeneration != undefined) { + this.tripGenerationVal = res.tripGeneration; + } + // if(res.relay_timer!=undefined){ + // this.relay_timer=res.relay_timer + // } + if (res.label_setting != undefined) { + this.labelSetting = res.label_setting; + } + console.log("LABLE SETTING", this.labelSetting); + + if (res.secondary_emails.length > 0) { + this.secondary_emails.flag = true; + this.secondary_emails.data = res.secondary_emails; + } + setTimeout(() => { + $("#dbselect").multipleSelect({ + width: 300, + placeholder: "Select Timezone", + filter: true, + single: true, + selectAll: false, + }); + }, 100); + }); + } + + getTransectionDetail() { + console.log("Inside Transection Detail Page"); + this.allocatedPoints = []; + if (this.from_date) { + var fd = this.from_date.toISOString(); + } + if (this.to_date) { + var td = this.to_date.toISOString(); + } + + this.contactService + .getPointDetails(this.useridd, fd, td) + .subscribe((res) => { + console.log("allocatedPoint", res); + this.allocatedPoints = res; + this.show = true; + }); + } + + tripGenerationFunc(ev) { + console.log(ev); + var payload = { + uid: this.useridd, + tripGeneration: ev.value, + }; + this.contactService.setlanguage(payload).subscribe((res) => { + console.log("res=>", res); + this.getToken(); + + this.data_descip = "Setting Saved"; + launch_toast(); + }); + + function launch_toast() { + // console.log(divid); + var x = document.getElementById("toast"); + //console.log(x); + x.className = "show"; + setTimeout(function () { + x.className = x.className.replace("show", ""); + }, 1500); + } + } + btnTag: boolean = false; + btnKey = "Save"; + getApiKey() { + this.contactService.getgoogleApi(this.useridd).subscribe((res) => { + if (res.message != "api key not found") { + this.api_key = res.api_key; this.btnTag = true; - this.btnKey= 'Change'; - - }else{ - - console.log('this.api_key',this.api_key); + this.btnKey = "Change"; + } else { + console.log("this.api_key", this.api_key); } - }) -} - -saveApi(){ - if(this.btnKey === 'Change'){ - this.btnTag = false; - this.btnKey = 'Save'; - return; + }); } - if(this.btnKey === 'Save'){ - var pld= { - u_id: this.useridd, - api_key: this.api_key - } - this.contactService.setgoogleApi(pld).subscribe(res=>{ - console.log(res); - this.data_descip = "Google API Key Saved"; - launch_toast(); - - }) - - } - - function launch_toast() { - // console.log(divid); - var x = document.getElementById("toast_1") - //console.log(x); - x.className = "show"; - setTimeout(function(){ x.className = x.className.replace("show", ""); }, 1500); - } -} - -createAnnouncement(){ - console.log("In announcement"); - var payload = { - uid: this.useridd, - announcement: this.announcement - } - this.contactService.setlanguage(payload).subscribe(res=>{ - console.log(res); - // this.translate.use(this.selectedlanguage); - if(res.message == 'announcement updated sucessfully'){ - console.log("announcement saved"); - this.tost1("succ"); - this.getLanguage() + saveApi() { + if (this.btnKey === "Change") { + this.btnTag = false; + this.btnKey = "Save"; + return; } - // this.translate.setDefaultLang('es'); - }) - -} -currency=[]; -getCurrencies(){ - this.currency = []; - // this.contactService.getCurrencies().subscribe(res=>{ - var currencyObj = this.currencyJson; - for(var i in currencyObj){ - if(this.data.currency != undefined){ - var devicecurr = this.data.currency ; - if(i == devicecurr){ - this.optiondefault = i+ '-' + currencyObj[i]; - } + if (this.btnKey === "Save") { + var pld = { + u_id: this.useridd, + api_key: this.api_key, + }; + this.contactService.setgoogleApi(pld).subscribe((res) => { + console.log(res); + this.data_descip = "Google API Key Saved"; + launch_toast(); + }); + } - }else{ - // if(i == 'INR'){ + function launch_toast() { + // console.log(divid); + var x = document.getElementById("toast_1"); + //console.log(x); + x.className = "show"; + setTimeout(function () { + x.className = x.className.replace("show", ""); + }, 1500); + } + } + + createAnnouncement() { + console.log("In announcement"); + var payload = { + uid: this.useridd, + announcement: this.announcement, + }; + this.contactService.setlanguage(payload).subscribe((res) => { + console.log(res); + // this.translate.use(this.selectedlanguage); + if (res.message == "announcement updated sucessfully") { + console.log("announcement saved"); + this.tost1("succ"); + this.getLanguage(); + } + // this.translate.setDefaultLang('es'); + }); + } + + currency = []; + getCurrencies() { + this.currency = []; + // this.contactService.getCurrencies().subscribe(res=>{ + var currencyObj = this.currencyJson; + for (var i in currencyObj) { + if (this.data.currency != undefined) { + var devicecurr = this.data.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] - } + + var tempObj = { + currencyVal: i, + country: i + "-" + currencyObj[i], + }; this.currency.push(tempObj); } - + console.log(this.currency); // this.loadropdown(); - // }) -} + // }) + } -dataSelect=[]; + 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) { - return d.country.toLocaleLowerCase().indexOf(filterValue.toLocaleLowerCase()) > -1; + 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) { + return ( + d.country + .toLocaleLowerCase() + .indexOf(filterValue.toLocaleLowerCase()) > -1 + ); + }); + + return this.dataSelect; + } + } + + currencySet() { + console.log(this.dataSelect); + var pld = { + uid: this.useridd, + currency_code: + this.dataSelect.length != 0 + ? this.dataSelect[0].currencyVal + : this.optiondefault.split("-")[0], + }; + console.log(pld); + this.contactService.setlanguage(pld).subscribe((res) => { + console.log(res); + this.tost1("currset"); }); - - return this.dataSelect; } - -} - -currencySet(){ - console.log(this.dataSelect); - var pld= { - uid : this.useridd, - currency_code : (this.dataSelect.length !=0)? this.dataSelect[0].currencyVal : this.optiondefault.split('-')[0] - } - console.log(pld); - this.contactService.setlanguage(pld).subscribe(res=>{ - console.log(res); - this.tost1('currset'); - }) -} -rechargePlans -getRechargePlans(){ - this.contactService.get('/RechargePlan/get?SupAdmin='+this.useridd).subscribe(res=>{ - console.log(res); - this.rechargePlans=res; - - }) -} - -addNewPlan(){ - -let dialogRef = this.dialog.open(AddPlanComponent, { - width: '600px', - height:'400px', - data: null -}); - -dialogRef.afterClosed().subscribe(result => { - - if(result == "succ"){ - this.getRechargePlans() + rechargePlans; + getRechargePlans() { + this.contactService + .get("/RechargePlan/get?SupAdmin=" + this.useridd) + .subscribe((res) => { + console.log(res); + this.rechargePlans = res; + }); } -}); -} + addNewPlan() { + let dialogRef = this.dialog.open(AddPlanComponent, { + width: "600px", + height: "400px", + data: null, + }); -deletePlan(id){ - this.contactService.get('/RechargePlan/delete?id='+id).subscribe(res=>{ - console.log(res); - this.getRechargePlans() - - }) -} -editPlan(item){ - let dialogRef = this.dialog.open(AddPlanComponent, { - width: '600px', - height:'400px', - data: item -}); - -dialogRef.afterClosed().subscribe(result => { - - if(result == "succ"){ - this.getRechargePlans() + dialogRef.afterClosed().subscribe((result) => { + if (result == "succ") { + this.getRechargePlans(); + } + }); } -}); -} + deletePlan(id) { + this.contactService + .get("/RechargePlan/delete?id=" + id) + .subscribe((res) => { + console.log(res); + this.getRechargePlans(); + }); + } + editPlan(item) { + let dialogRef = this.dialog.open(AddPlanComponent, { + width: "600px", + height: "400px", + data: item, + }); + dialogRef.afterClosed().subscribe((result) => { + if (result == "succ") { + this.getRechargePlans(); + } + }); + } - -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" -} + 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", + }; } diff --git a/src/app/add-cust/add-cust.component.html b/src/app/add-cust/add-cust.component.html index b1248f3..c3aadc2 100644 --- a/src/app/add-cust/add-cust.component.html +++ b/src/app/add-cust/add-cust.component.html @@ -7,7 +7,24 @@
+ +
+ +
+
+ + +
+
+ + +
+
+
diff --git a/src/app/add-cust/add-cust.component.ts b/src/app/add-cust/add-cust.component.ts index d3b9570..fc8515a 100644 --- a/src/app/add-cust/add-cust.component.ts +++ b/src/app/add-cust/add-cust.component.ts @@ -1,1449 +1,1599 @@ -import { FormGroup, FormControl, Validators, FormBuilder} from '@angular/forms'; -import {ResponseOptions, Response} from '@angular/http'; -import {Contact} from '../contact'; -import {ContactService} from '../contact.service'; -import {Otp} from '../otp'; +import { + FormGroup, + FormControl, + Validators, + FormBuilder, +} from "@angular/forms"; +import { ResponseOptions, Response } from "@angular/http"; +import { Contact } from "../contact"; +import { ContactService } from "../contact.service"; +import { Otp } from "../otp"; // import {Md5} from 'ts-md5/dist/md5'; -import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; -import { FlashMessagesService } from 'angular2-flash-messages'; -import { AbstractControl, NG_VALIDATORS, Validator, ValidatorFn } from '@angular/forms'; -const EMAIL_REGEX =/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; -import { Component, OnInit,Inject } from '@angular/core'; -import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material'; -import * as moment from 'moment-timezone'; -import { ReportService } from '../report/report.service'; -declare var google :any; +import { + Router, + CanActivate, + ActivatedRouteSnapshot, + RouterStateSnapshot, +} from "@angular/router"; +import { FlashMessagesService } from "angular2-flash-messages"; +import { + AbstractControl, + NG_VALIDATORS, + Validator, + ValidatorFn, +} from "@angular/forms"; +const EMAIL_REGEX = + /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; +import { Component, OnInit, Inject } from "@angular/core"; +import { MdDialog, MdDialogRef, MD_DIALOG_DATA } from "@angular/material"; +import * as moment from "moment-timezone"; +import { ReportService } from "../report/report.service"; +declare var google: any; - -declare var swal: any,$:any; +declare var swal: any, $: any; @Component({ - selector: 'app-add-cust', - templateUrl: './add-cust.component.html', - styleUrls: ['./add-cust.component.scss'], - providers:[ContactService] + selector: "app-add-cust", + templateUrl: "./add-cust.component.html", + styleUrls: ["./add-cust.component.scss"], + providers: [ContactService], }) export class AddCustComponent implements OnInit { superAdmin: any; - role - show1:boolean = false; - show2:boolean = true; - show3:boolean = false; - first_name:any=null; - last_name:any=null; - passwordd:any=null; - org_name:any=null; - emaill:any=null; - timezone:any = 'Asia/Kolkata'; - phone:any=null; - executed:any; - $event2:any; - dealer:any; - contacts: Contact[]=[]; + role; + bussinessType:any = '0'; + show1: boolean = false; + show2: boolean = true; + show3: boolean = false; + first_name: any = null; + last_name: any = null; + passwordd: any = null; + org_name: any = null; + emaill: any = null; + timezone: any = "Asia/Kolkata"; + phone: any = null; + executed: any; + $event2: any; + dealer: any; + contacts: Contact[] = []; contact: Contact; - login1:any; - mess2:any; - mess:any; - otp:any; - userID:any; - address:any; - str:boolean = false; - password2:any=null; - dealerName:any; - isTechnician:boolean=false; - dealerSelect: any=[]; + login1: any; + mess2: any; + mess: any; + otp: any; + userID: any; + address: any; + str: boolean = false; + password2: any = null; + dealerName: any; + isTechnician: boolean = false; + dealerSelect: any = []; imageuploadObject = []; sup_admin: any; countrySelected: {}; timezoneArray: any[]; - emergencyForm:FormGroup; - title="ADD CUSTOMER" - report(){ - this.cond = false + emergencyForm: FormGroup; + title = "ADD CUSTOMER"; + report() { + this.cond = false; this.router.navigateByUrl("device-report"); - } - report_speed(){ + report_speed() { // console.log("report speed call") - this.cond = false + this.cond = false; this.router.navigateByUrl("device-report/device-speed-report"); } - stre(){ - this.str =true; + stre() { + this.str = true; } - stren(){ - this.str =false; + stren() { + this.str = false; } - addcus(){ + addcus() { this.router.navigateByUrl("add"); } - clear(){ - this.first_name=' ' - this.last_name=' ' - this.emaill = null - this.phone = null + clear() { + this.first_name = " "; + this.last_name = " "; + this.emaill = null; + this.phone = null; } - before:any; - emmnerr:any; - Load:any - $event:any; - constructor(private contactService: ContactService,private router: Router,private _flashMessagesService: FlashMessagesService,public dialogRef: MdDialogRef,private fb:FormBuilder,private reportService:ReportService - ,@Inject(MD_DIALOG_DATA) public data: any) { - console.log("DATATATATA",data); - if(data){ - if(data.role=="technitian"){ - this.title="ADD TECHNICIAN"; - this.isTechnician=true; - this.role=data.role - } + before: any; + emmnerr: any; + Load: any; + $event: any; + constructor( + private contactService: ContactService, + private router: Router, + private _flashMessagesService: FlashMessagesService, + public dialogRef: MdDialogRef, + private fb: FormBuilder, + private reportService: ReportService, + @Inject(MD_DIALOG_DATA) public data: any + ) { + console.log("DATATATATA", data); + if (data) { + if (data.role == "technitian") { + this.title = "ADD TECHNICIAN"; + this.isTechnician = true; + this.role = data.role; } - var script = document.createElement("script"); - script.setAttribute("type", "text/javascript"); - script.setAttribute("src", "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.0/js/intlTelInput-jquery.min.js"); - document.getElementsByTagName("head")[0].appendChild(script); - - var initialObj = { - doctype:'', - image:'', - phone:'' - } - this.imageuploadObject.push(initialObj); } + var script = document.createElement("script"); + script.setAttribute("type", "text/javascript"); + script.setAttribute( + "src", + "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.0/js/intlTelInput-jquery.min.js" + ); + document.getElementsByTagName("head")[0].appendChild(script); - addContact2(){ + var initialObj = { + doctype: "", + image: "", + phone: "", + }; + this.imageuploadObject.push(initialObj); + } + + addContact2() { console.log(this.router.url); - var tzone - if(this.router.url=="/add-device"){ + var tzone; + if (this.router.url == "/add-device") { console.log("in"); - tzone=['Asia/Kolkata'] - this.reportService.addCustomerFunction('') - }else{ + tzone = ["Asia/Kolkata"]; + this.reportService.addCustomerFunction(""); + } else { + tzone = $("#dbselect").multipleSelect("getSelects", "value"); + console.log(tzone); + } + // var tzone + console.log("EMERGENCY FORM", this.emergencyForm.value); - tzone = $('#dbselect').multipleSelect('getSelects','value'); - console.log(tzone); - } - // var tzone - console.log("EMERGENCY FORM",this.emergencyForm.value); - var expDate = new Date(); - expDate.setFullYear(expDate.getFullYear()+1); - var countryData = $('#telephone').intlTelInput("getSelectedCountryData"); - console.log(countryData); + expDate.setFullYear(expDate.getFullYear() + 1); + var countryData = $("#telephone").intlTelInput("getSelectedCountryData"); + console.log(countryData); this.countrySelected = { - countryCode : countryData.iso2, - dialcode: countryData.dialCode + countryCode: countryData.iso2, + dialcode: countryData.dialCode, + }; + if ( + this.first_name == null || + this.last_name == null || + this.passwordd == null + ) { + return this._flashMessagesService.show("Please fill all Requied fields", { + cssClass: "alert-danger", + timeout: 3000, + }); } - if(this.first_name==null || this.last_name==null || this.passwordd==null ) - { - return this._flashMessagesService.show('Please fill all Requied fields', { cssClass: 'alert-danger', timeout: 3000 }); - + // else if((this.userID == undefined)||(this.userID.trim() == '')){ + // return this._flashMessagesService.show('User ID is required', { cssClass: 'alert-danger', timeout: 3000 }); + // } + // else if((this.emaill == undefined)||(this.emaill.trim() == '')){ + + // return this._flashMessagesService.show('Email is mandatory', { cssClass: 'alert-danger', timeout: 3000 }); + // } + else if (this.password2 != this.passwordd) { + // this._flashMessagesService.show('Password and Confirm Password do not match', { cssClass: 'alert-danger', timeout: 3000 }); + this.tost1("psdnmtch"); + } else if (this.emaill && this.phone) { + this.Load = true; + var emergencyContact = { + contact1: { + name: this.emergencyForm.value.emg_name1, + cell1: this.emergencyForm.value.emg_cell1, + cell2: this.emergencyForm.value.emg_cell2, + phone1: this.emergencyForm.value.emg_phone1, + phone2: this.emergencyForm.value.emg_phone2, + }, + contact2: { + name: this.emergencyForm.value.emg_name2, + cell1: this.emergencyForm.value.emg_cell3, + cell2: this.emergencyForm.value.emg_cell4, + phone1: this.emergencyForm.value.emg_phone3, + phone2: this.emergencyForm.value.emg_phone4, + }, + }; + if (this.dealerObj) { + this.useridd = this.dealerObj.dealer_id; + // console.log(this.useridd); + } + let newContact2 :any= { + first_name: this.first_name, + last_name: this.last_name, + email: this.emaill, + password: this.passwordd, + phone: this.phone, + supAdmin: this.sup_admin, + isDealer: false, + expdate: new Date(expDate).toISOString(), + Dealer: this.useridd, + custumer: true, + user_id: this.userID, + address: this.address, + emergencyContact: emergencyContact, + }; + console.log("1->", newContact2); + if (this.countrySelected != undefined) { + newContact2["std_code"] = this.countrySelected; + } + if (tzone != undefined) { + newContact2["timezone"] = tzone[0]; + } + if (this.role != undefined) { + newContact2["role"] = this.role; } - // else if((this.userID == undefined)||(this.userID.trim() == '')){ - // return this._flashMessagesService.show('User ID is required', { cssClass: 'alert-danger', timeout: 3000 }); - // } - // else if((this.emaill == undefined)||(this.emaill.trim() == '')){ - - // return this._flashMessagesService.show('Email is mandatory', { cssClass: 'alert-danger', timeout: 3000 }); - // } - else if(this.password2 != this.passwordd){ - // this._flashMessagesService.show('Password and Confirm Password do not match', { cssClass: 'alert-danger', timeout: 3000 }); - this.tost1("psdnmtch") - } - else if (this.emaill && this.phone){ - this.Load=true - var emergencyContact={ - contact1:{ - name:this.emergencyForm.value.emg_name1, - cell1:this.emergencyForm.value.emg_cell1, - cell2:this.emergencyForm.value.emg_cell2, - phone1:this.emergencyForm.value.emg_phone1, - phone2:this.emergencyForm.value.emg_phone2 - - }, - contact2:{ - name:this.emergencyForm.value.emg_name2, - cell1:this.emergencyForm.value.emg_cell3, - cell2:this.emergencyForm.value.emg_cell4, - phone1:this.emergencyForm.value.emg_phone3, - phone2:this.emergencyForm.value.emg_phone4 + if (this.imageuploadObject.length > 0) { + for (var d = 0; d < this.imageuploadObject.length; d++) { + if ( + this.imageuploadObject[d].doctype == "" && + this.imageuploadObject[d].image == "" && + this.imageuploadObject[d].phone == "" + ) { + this.imageuploadObject.splice(d, 1); } } - if(this.dealerObj){ - this.useridd= this.dealerObj.dealer_id; - // console.log(this.useridd); - } - const newContact2 ={ - first_name: this.first_name, - last_name: this.last_name, - email: this.emaill, - password: this.passwordd, - phone: this.phone, - supAdmin:this.sup_admin, - isDealer: false, - expdate : new Date(expDate).toISOString(), - Dealer: this.useridd, - custumer:true, - user_id:this.userID, - address:this.address, - emergencyContact:emergencyContact - } - console.log("1->",newContact2); - if(this.countrySelected != undefined){ - newContact2['std_code']=this.countrySelected; - } - if(tzone != undefined){ - newContact2['timezone'] = tzone[0]; - } - if(this.role != undefined){ - newContact2['role'] = this.role; - } + } + console.log("Final DOC ARRAY", this.imageuploadObject); + newContact2["imageDoc"] = this.imageuploadObject; + console.log(newContact2); - if(this.imageuploadObject.length > 0){ - - for(var d = 0 ;d { - if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "User Duplicate"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Email ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Mobile Number already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else{ - this.clear(); - console.log(contact); - // USER_ID already exists - this.Load=false - if(this.router.url!="/add-device"){ - this.onNoClick("succ"); - this.contacts.push(contact); - }else{ - this._flashMessagesService.show(contact.message, { cssClass: 'alert-success', timeout: 3000 }); - } - } - - }, (err: any) => { - // console.log(err.status); - console.log(err); - if(err.status == 500) - { - this.Load=false - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.split(':')[1]; - console.log(this.data_descip); - this._flashMessagesService.show(this.data_descip, { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // this.data_descip, - // 'error' - // ) - } - else if(err.status==401){ - this.Load=false; - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.message + if(this.sup_admin == '620ca3e45abdcf25b5d866df'){ - this._flashMessagesService.show("Access Denied", { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // 'Internal Server error , Please try after sometime !!!', - // 'error' - // ) - - }else{ - this.Load=false; - this._flashMessagesService.show("Internal Server Error, Please try after sometime !!!", { cssClass: 'alert-danger', timeout: 3000 }); - } - }); - - } - else if(this.phone){ - this.Load=true - if(this.dealerObj){ - this.useridd= this.dealerObj.dealer_id; - } - var emergencyContact={ - contact1:{ - name:this.emergencyForm.value.emg_name1, - cell1:this.emergencyForm.value.emg_cell1, - cell2:this.emergencyForm.value.emg_cell2, - phone1:this.emergencyForm.value.emg_phone1, - phone2:this.emergencyForm.value.emg_phone2 - - }, - contact2:{ - name:this.emergencyForm.value.emg_name2, - cell1:this.emergencyForm.value.emg_cell3, - cell2:this.emergencyForm.value.emg_cell4, - phone1:this.emergencyForm.value.emg_phone3, - phone2:this.emergencyForm.value.emg_phone4 + newContact2.bussinessType = this.bussinessType; + } + this.contactService.addContact(newContact2).subscribe( + (contact) => { + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "User Duplicate") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Email ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Mobile Number already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else { + this.clear(); + console.log(contact); + // USER_ID already exists + this.Load = false; + if (this.router.url != "/add-device") { + this.onNoClick("succ"); + this.contacts.push(contact); + } else { + this._flashMessagesService.show(contact.message, { + cssClass: "alert-success", + timeout: 3000, + }); + } + } + }, + (err: any) => { + // console.log(err.status); + console.log(err); + if (err.status == 500) { + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.split(":")[1]; + console.log(this.data_descip); + this._flashMessagesService.show(this.data_descip, { + cssClass: "alert-danger", + timeout: 3000, + }); + // swal( + // 'Error', + // this.data_descip, + // 'error' + // ) + } else if (err.status == 401) { + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.message; + this._flashMessagesService.show("Access Denied", { + cssClass: "alert-danger", + timeout: 3000, + }); + // swal( + // 'Error', + // 'Internal Server error , Please try after sometime !!!', + // 'error' + // ) + } else { + this.Load = false; + this._flashMessagesService.show( + "Internal Server Error, Please try after sometime !!!", + { cssClass: "alert-danger", timeout: 3000 } + ); } } + ); + } else if (this.phone) { + this.Load = true; + if (this.dealerObj) { + this.useridd = this.dealerObj.dealer_id; + } + var emergencyContact = { + contact1: { + name: this.emergencyForm.value.emg_name1, + cell1: this.emergencyForm.value.emg_cell1, + cell2: this.emergencyForm.value.emg_cell2, + phone1: this.emergencyForm.value.emg_phone1, + phone2: this.emergencyForm.value.emg_phone2, + }, + contact2: { + name: this.emergencyForm.value.emg_name2, + cell1: this.emergencyForm.value.emg_cell3, + cell2: this.emergencyForm.value.emg_cell4, + phone1: this.emergencyForm.value.emg_phone3, + phone2: this.emergencyForm.value.emg_phone4, + }, + }; - // if (!this.executed) { - // this.executed = true; - const newContact2 ={ - first_name: this.first_name, - last_name: this.last_name, - password: this.passwordd, - supAdmin:this.sup_admin, - expdate : new Date(expDate).toISOString(), - phone: this.phone, - isDealer: false, - Dealer: this.useridd, - custumer:true, - user_id:this.userID, - address:this.address, - emergencyContact:emergencyContact - } -console.log("2->",newContact2); + // if (!this.executed) { + // this.executed = true; + const newContact2 = { + first_name: this.first_name, + last_name: this.last_name, + password: this.passwordd, + supAdmin: this.sup_admin, + expdate: new Date(expDate).toISOString(), + phone: this.phone, + isDealer: false, + Dealer: this.useridd, + custumer: true, + user_id: this.userID, + address: this.address, + emergencyContact: emergencyContact, + }; + console.log("2->", newContact2); - - if(this.countrySelected != undefined){ - newContact2['std_code']=this.countrySelected; - } - if(this.role != undefined){ - newContact2['role'] = this.role; - } + if (this.countrySelected != undefined) { + newContact2["std_code"] = this.countrySelected; + } + if (this.role != undefined) { + newContact2["role"] = this.role; + } - if(tzone != undefined){ - newContact2['timezone'] = tzone[0]; - } + if (tzone != undefined) { + newContact2["timezone"] = tzone[0]; + } - if(this.imageuploadObject.length > 0){ - - for(var d = 0 ;d 0) { + for (var d = 0; d < this.imageuploadObject.length; d++) { + if ( + this.imageuploadObject[d].doctype == "" && + this.imageuploadObject[d].image == "" && + this.imageuploadObject[d].phone == "" + ) { + this.imageuploadObject.splice(d, 1); + } } } - } - newContact2['imageDoc'] = this.imageuploadObject; - this.contactService.addContact(newContact2) - .subscribe(contact => { - console.log(contact); - if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "User Duplicate"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Email ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Mobile Number already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else{ - this.clear(); - this.Load=false; - if(this.router.url!="/add-device"){ - - this.onNoClick("succ"); - this.contacts.push(contact); - }else{ - this._flashMessagesService.show(contact.message, { cssClass: 'alert-success', timeout: 3000 }); - } - + newContact2["imageDoc"] = this.imageuploadObject; + this.contactService.addContact(newContact2).subscribe( + (contact) => { + console.log(contact); + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "User Duplicate") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Email ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Mobile Number already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else { + this.clear(); + this.Load = false; + if (this.router.url != "/add-device") { + this.onNoClick("succ"); + this.contacts.push(contact); + } else { + this._flashMessagesService.show(contact.message, { + cssClass: "alert-success", + timeout: 3000, + }); + } + } + // USER_ID already exists + }, + (err: any) => { + if (err.status == 500) { + // console.log(err._body); + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.split(":")[1]; + console.log(this.data_descip); + this._flashMessagesService.show(this.data_descip, { + cssClass: "alert-danger", + timeout: 3000, + }); + // swal( + // 'Error', + // this.data_descip, + // 'error' + // ) + } else if (err.status == 401) { + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.message; + // console.log("dadsa"); + this._flashMessagesService.show("Access Denied", { + cssClass: "alert-danger", + timeout: 3000, + }); + } else { + this._flashMessagesService.show( + "Internal Server Error, Please try after sometime", + { cssClass: "alert-danger", timeout: 3000 } + ); + } } - // USER_ID already exists - - }, (err: any) => { - if(err.status == 500) - { - // console.log(err._body); - this.Load=false - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.split(':')[1]; - console.log(this.data_descip); - this._flashMessagesService.show(this.data_descip, { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // this.data_descip, - // 'error' - // ) - } - else if(err.status==401){ + ); + } else if (this.emaill || this.userID) { + // if (!this.executed) { + // this.executed = true; + console.log("we are here"); + if (this.dealerObj) { + this.useridd = this.dealerObj.dealer_id; + } + var emergencyContact = { + contact1: { + name: this.emergencyForm.value.emg_name1, + cell1: this.emergencyForm.value.emg_cell1, + cell2: this.emergencyForm.value.emg_cell2, + phone1: this.emergencyForm.value.emg_phone1, + phone2: this.emergencyForm.value.emg_phone2, + }, + contact2: { + name: this.emergencyForm.value.emg_name2, + cell1: this.emergencyForm.value.emg_cell3, + cell2: this.emergencyForm.value.emg_cell4, + phone1: this.emergencyForm.value.emg_phone3, + phone2: this.emergencyForm.value.emg_phone4, + }, + }; + console.log(emergencyContact); - this.Load=false; - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.message - // console.log("dadsa"); - this._flashMessagesService.show("Access Denied", { cssClass: 'alert-danger', timeout: 3000 }); - }else{ - this._flashMessagesService.show("Internal Server Error, Please try after sometime", { cssClass: 'alert-danger', timeout: 3000 }); - }})} - else if((this.emaill)||(this.userID)){ - // if (!this.executed) { - // this.executed = true; - console.log("we are here"); - if(this.dealerObj){ - this.useridd= this.dealerObj.dealer_id - - } - var emergencyContact={ - contact1:{ - name:this.emergencyForm.value.emg_name1, - cell1:this.emergencyForm.value.emg_cell1, - cell2:this.emergencyForm.value.emg_cell2, - phone1:this.emergencyForm.value.emg_phone1, - phone2:this.emergencyForm.value.emg_phone2 + const newContact2 = { + first_name: this.first_name, + last_name: this.last_name, + password: this.passwordd, + org_name: this.org_name, + email: this.emaill == null ? "" : this.emaill, + phone: this.phone == null ? "" : this.phone, + expdate: new Date(expDate).toISOString(), + supAdmin: this.sup_admin, + isDealer: false, + Dealer: this.useridd, + custumer: true, + user_id: this.userID, + address: this.address, + emergencyContact: emergencyContact, + }; + console.log("3->", newContact2); - }, - contact2:{ - name:this.emergencyForm.value.emg_name2, - cell1:this.emergencyForm.value.emg_cell3, - cell2:this.emergencyForm.value.emg_cell4, - phone1:this.emergencyForm.value.emg_phone3, - phone2:this.emergencyForm.value.emg_phone4 + if (this.countrySelected != undefined) { + newContact2["std_code"] = this.countrySelected; + } + if (this.role != undefined) { + newContact2["role"] = this.role; + } - } - } - console.log(emergencyContact); - - const newContact2 ={ - first_name: this.first_name, - last_name: this.last_name, - password: this.passwordd, - org_name: this.org_name, - email: this.emaill == null?'':this.emaill, - phone : this.phone == null?'':this.phone, - expdate : new Date(expDate).toISOString(), - supAdmin:this.sup_admin, - isDealer: false, - Dealer: this.useridd, - custumer:true, - user_id:this.userID, - address:this.address, - emergencyContact:emergencyContact + if (tzone != undefined) { + newContact2["timezone"] = tzone[0]; + } -} -console.log("3->",newContact2); + if (this.imageuploadObject.length > 0) { + for (var d = 0; d < this.imageuploadObject.length; d++) { + if ( + this.imageuploadObject[d].doctype == "" && + this.imageuploadObject[d].image == "" && + this.imageuploadObject[d].phone == "" + ) { + this.imageuploadObject.splice(d, 1); + } + } + } + newContact2["imageDoc"] = this.imageuploadObject; + this.contactService.addContact(newContact2).subscribe( + (contact) => { + //this.tost1("succ") + console.log(contact); + // USER_ID already exists + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "User Duplicate") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Email ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Mobile Number already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else { + this.clear(); + this.Load = false; + if (this.router.url != "/add-device") { + this.onNoClick("succ"); + this.contacts.push(contact); + } else { + this._flashMessagesService.show(contact.message, { + cssClass: "alert-success", + timeout: 3000, + }); + } + } + }, + (err: any) => { + console.log(); + if (err.status == 500) { + // console.log(err._body); + this.Load = false; + this.emmnerr = JSON.parse(err._body); -if(this.countrySelected != undefined){ - newContact2['std_code']=this.countrySelected; - - } - if(this.role != undefined){ - newContact2['role'] = this.role; - } - - if(tzone != undefined){ - newContact2['timezone'] = tzone[0]; - } - -if(this.imageuploadObject.length > 0){ - - for(var d = 0 ;d { - //this.tost1("succ") - console.log(contact); - // USER_ID already exists - if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "User Duplicate"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Email ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Mobile Number already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else{ - this.clear(); - this.Load=false - if(this.router.url!="/add-device"){ - this.onNoClick("succ"); - this.contacts.push(contact); - }else{ - this._flashMessagesService.show(contact.message, { cssClass: 'alert-success', timeout: 3000 }); - } - - } - -}, (err: any) => { - console.log(); - - if(err.status == 500) - { - // console.log(err._body); - this.Load=false - this.emmnerr=JSON.parse(err._body); - - this.data_descip = this.emmnerr.split(':')[1]; - console.log(this.data_descip); - this._flashMessagesService.show(this.data_descip, { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // this.data_descip, - // 'error' - // ) - // console.log("error to display",this.emmnerr); - // this.tost1("Error") - } - else if(err.status == 401){ - this.Load=false; - this._flashMessagesService.show("Access Denied", { cssClass: 'alert-danger', timeout: 3000 }); - // this.emmnerr=JSON.parse(err._body); - // swal( - // 'Error', - // this.emmnerr.message, - // 'error' - // ) - }else{ - this.Load=false; - this._flashMessagesService.show("Internal Server Error, Please try again sometime !!", { cssClass: 'alert-danger', timeout: 3000 }); - // this.emmnerr=JSON.parse(err._body); - // swal( - // 'Error', - // this.emmnerr.message, - // 'error' - // ) - } -}); - - - } - - - } - - addContact3(){ - - var tzone - if(this.router.url=="/add-device"){ + addContact3() { + var tzone; + if (this.router.url == "/add-device") { console.log("in"); - tzone=['Asia/Kolkata'] - this.reportService.addCustomerFunction('') - }else{ + tzone = ["Asia/Kolkata"]; + this.reportService.addCustomerFunction(""); + } else { + tzone = $("#dbselect").multipleSelect("getSelects", "value"); + console.log(tzone); + } - tzone = $('#dbselect').multipleSelect('getSelects','value'); - console.log(tzone); - } - - // var tzone = $('#dbselect').multipleSelect('getSelects','value'); + // var tzone = $('#dbselect').multipleSelect('getSelects','value'); // console.log(tzone); - console.log("EMERGENCY FORM",this.emergencyForm.value); - + console.log("EMERGENCY FORM", this.emergencyForm.value); + var expDate = new Date(); - expDate.setFullYear(expDate.getFullYear()+1); - var countryData = $('#telephone').intlTelInput("getSelectedCountryData"); - console.log(countryData); + expDate.setFullYear(expDate.getFullYear() + 1); + var countryData = $("#telephone").intlTelInput("getSelectedCountryData"); + console.log(countryData); this.countrySelected = { - countryCode : countryData.iso2, - dialcode: countryData.dialCode + countryCode: countryData.iso2, + dialcode: countryData.dialCode, + }; + if ( + this.first_name == null || + this.last_name == null || + this.passwordd == null + ) { + return this._flashMessagesService.show("Please fill all Requied fields", { + cssClass: "alert-danger", + timeout: 3000, + }); } - if(this.first_name==null || this.last_name==null || this.passwordd==null ) - { - return this._flashMessagesService.show('Please fill all Requied fields', { cssClass: 'alert-danger', timeout: 3000 }); - + // else if((this.userID == undefined)||(this.userID.trim() == '')){ + // return this._flashMessagesService.show('User ID is required', { cssClass: 'alert-danger', timeout: 3000 }); + // } + // else if((this.emaill == undefined)||(this.emaill.trim() == '')){ + + // return this._flashMessagesService.show('Email is mandatory', { cssClass: 'alert-danger', timeout: 3000 }); + // } + else if (this.password2 != this.passwordd) { + // this._flashMessagesService.show('Password and Confirm Password do not match', { cssClass: 'alert-danger', timeout: 3000 }); + this.tost1("psdnmtch"); + } else if (this.emaill && this.phone) { + this.Load = true; + var emergencyContact = { + contact1: { + name: this.emergencyForm.value.emg_name1, + cell1: this.emergencyForm.value.emg_cell1, + cell2: this.emergencyForm.value.emg_cell2, + phone1: this.emergencyForm.value.emg_phone1, + phone2: this.emergencyForm.value.emg_phone2, + }, + contact2: { + name: this.emergencyForm.value.emg_name2, + cell1: this.emergencyForm.value.emg_cell3, + cell2: this.emergencyForm.value.emg_cell4, + phone1: this.emergencyForm.value.emg_phone3, + phone2: this.emergencyForm.value.emg_phone4, + }, + }; + if (this.dealerObj) { + this.useridd = this.dealerObj.dealer_id; + // console.log(this.useridd); + } + const newContact2 = { + first_name: this.first_name, + last_name: this.last_name, + email: this.emaill, + password: this.passwordd, + phone: this.phone, + supAdmin: this.sup_admin, + isDealer: false, + expdate: new Date(expDate).toISOString(), + Dealer: this.useridd, + custumer: true, + user_id: this.userID, + address: this.address, + emergencyContact: emergencyContact, + }; + console.log("1->", newContact2); + if (this.countrySelected != undefined) { + newContact2["std_code"] = this.countrySelected; + } + if (tzone != undefined) { + newContact2["timezone"] = tzone[0]; + } + if (this.role != undefined) { + newContact2["role"] = this.role; } - // else if((this.userID == undefined)||(this.userID.trim() == '')){ - // return this._flashMessagesService.show('User ID is required', { cssClass: 'alert-danger', timeout: 3000 }); - // } - // else if((this.emaill == undefined)||(this.emaill.trim() == '')){ - - // return this._flashMessagesService.show('Email is mandatory', { cssClass: 'alert-danger', timeout: 3000 }); - // } - else if(this.password2 != this.passwordd){ - // this._flashMessagesService.show('Password and Confirm Password do not match', { cssClass: 'alert-danger', timeout: 3000 }); - this.tost1("psdnmtch") - } - else if (this.emaill && this.phone){ - this.Load=true - var emergencyContact={ - contact1:{ - name:this.emergencyForm.value.emg_name1, - cell1:this.emergencyForm.value.emg_cell1, - cell2:this.emergencyForm.value.emg_cell2, - phone1:this.emergencyForm.value.emg_phone1, - phone2:this.emergencyForm.value.emg_phone2 - - }, - contact2:{ - name:this.emergencyForm.value.emg_name2, - cell1:this.emergencyForm.value.emg_cell3, - cell2:this.emergencyForm.value.emg_cell4, - phone1:this.emergencyForm.value.emg_phone3, - phone2:this.emergencyForm.value.emg_phone4 + if (this.imageuploadObject.length > 0) { + for (var d = 0; d < this.imageuploadObject.length; d++) { + if ( + this.imageuploadObject[d].doctype == "" && + this.imageuploadObject[d].image == "" && + this.imageuploadObject[d].phone == "" + ) { + this.imageuploadObject.splice(d, 1); } } - if(this.dealerObj){ - this.useridd= this.dealerObj.dealer_id; - // console.log(this.useridd); - } - const newContact2 ={ - first_name: this.first_name, - last_name: this.last_name, - email: this.emaill, - password: this.passwordd, - phone: this.phone, - supAdmin:this.sup_admin, - isDealer: false, - expdate : new Date(expDate).toISOString(), - Dealer: this.useridd, - custumer:true, - user_id:this.userID, - address:this.address, - emergencyContact:emergencyContact - } - console.log("1->",newContact2); - if(this.countrySelected != undefined){ - newContact2['std_code']=this.countrySelected; - } - if(tzone != undefined){ - newContact2['timezone'] = tzone[0]; - } - if(this.role != undefined){ - newContact2['role'] = this.role; - } - - if(this.imageuploadObject.length > 0){ - - for(var d = 0 ;d { - if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "User Duplicate"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Email ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Mobile Number already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else{ - this.clear(); - console.log(contact); - // USER_ID already exists - this.Load=false - if(this.router.url!="/add-device"){ - - this.onNoClick("succ"); - this.contacts.push(contact); - }else{ - this._flashMessagesService.show(contact.message, { cssClass: 'alert-success', timeout: 3000 }); - } - // this.onNoClick("succ"); - // this.contacts.push(contact); - } - - }, (err: any) => { - // console.log(err.status); - console.log(err); - if(err.status == 500) - { - this.Load=false - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.split(':')[1]; - console.log(this.data_descip); - this._flashMessagesService.show(this.data_descip, { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // this.data_descip, - // 'error' - // ) - } - else if(err.status==401){ - this.Load=false - this.Load=false - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.message; - this._flashMessagesService.show("Access Denied", { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // 'Internal Server error , Please try after sometime !!!', - // 'error' - // ) - - }else{ - this.Load=false - swal( - 'Error', - 'Internal Server error , Please try after sometime !!!', - 'error' - ) - } - }); - - } - else if(this.phone){ - this.Load=true - if(this.dealerObj){ - this.useridd= this.dealerObj.dealer_id; - } - var emergencyContact={ - contact1:{ - name:this.emergencyForm.value.emg_name1, - cell1:this.emergencyForm.value.emg_cell1, - cell2:this.emergencyForm.value.emg_cell2, - phone1:this.emergencyForm.value.emg_phone1, - phone2:this.emergencyForm.value.emg_phone2 - - }, - contact2:{ - name:this.emergencyForm.value.emg_name2, - cell1:this.emergencyForm.value.emg_cell3, - cell2:this.emergencyForm.value.emg_cell4, - phone1:this.emergencyForm.value.emg_phone3, - phone2:this.emergencyForm.value.emg_phone4 - + } + console.log("Final DOC ARRAY", this.imageuploadObject); + newContact2["imageDoc"] = this.imageuploadObject; + console.log(newContact2); + this.contactService.post("/users/addTechnician", newContact2).subscribe( + (contact: any) => { + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "User Duplicate") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Email ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Mobile Number already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else { + this.clear(); + console.log(contact); + // USER_ID already exists + this.Load = false; + if (this.router.url != "/add-device") { + this.onNoClick("succ"); + this.contacts.push(contact); + } else { + this._flashMessagesService.show(contact.message, { + cssClass: "alert-success", + timeout: 3000, + }); + } + // this.onNoClick("succ"); + // this.contacts.push(contact); + } + }, + (err: any) => { + // console.log(err.status); + console.log(err); + if (err.status == 500) { + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.split(":")[1]; + console.log(this.data_descip); + this._flashMessagesService.show(this.data_descip, { + cssClass: "alert-danger", + timeout: 3000, + }); + // swal( + // 'Error', + // this.data_descip, + // 'error' + // ) + } else if (err.status == 401) { + this.Load = false; + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.message; + this._flashMessagesService.show("Access Denied", { + cssClass: "alert-danger", + timeout: 3000, + }); + // swal( + // 'Error', + // 'Internal Server error , Please try after sometime !!!', + // 'error' + // ) + } else { + this.Load = false; + swal( + "Error", + "Internal Server error , Please try after sometime !!!", + "error" + ); } } + ); + } else if (this.phone) { + this.Load = true; + if (this.dealerObj) { + this.useridd = this.dealerObj.dealer_id; + } + var emergencyContact = { + contact1: { + name: this.emergencyForm.value.emg_name1, + cell1: this.emergencyForm.value.emg_cell1, + cell2: this.emergencyForm.value.emg_cell2, + phone1: this.emergencyForm.value.emg_phone1, + phone2: this.emergencyForm.value.emg_phone2, + }, + contact2: { + name: this.emergencyForm.value.emg_name2, + cell1: this.emergencyForm.value.emg_cell3, + cell2: this.emergencyForm.value.emg_cell4, + phone1: this.emergencyForm.value.emg_phone3, + phone2: this.emergencyForm.value.emg_phone4, + }, + }; - // if (!this.executed) { - // this.executed = true; - const newContact2 ={ - first_name: this.first_name, - last_name: this.last_name, - password: this.passwordd, - supAdmin:this.sup_admin, - expdate : new Date(expDate).toISOString(), - phone: this.phone, - isDealer: false, - Dealer: this.useridd, - custumer:true, - user_id:this.userID, - address:this.address, - emergencyContact:emergencyContact - } -console.log("2->",newContact2); + // if (!this.executed) { + // this.executed = true; + const newContact2 = { + first_name: this.first_name, + last_name: this.last_name, + password: this.passwordd, + supAdmin: this.sup_admin, + expdate: new Date(expDate).toISOString(), + phone: this.phone, + isDealer: false, + Dealer: this.useridd, + custumer: true, + user_id: this.userID, + address: this.address, + emergencyContact: emergencyContact, + }; + console.log("2->", newContact2); - - if(this.countrySelected != undefined){ - newContact2['std_code']=this.countrySelected; - } - if(this.role != undefined){ - newContact2['role'] = this.role; - } + if (this.countrySelected != undefined) { + newContact2["std_code"] = this.countrySelected; + } + if (this.role != undefined) { + newContact2["role"] = this.role; + } - if(tzone != undefined){ - newContact2['timezone'] = tzone[0]; - } + if (tzone != undefined) { + newContact2["timezone"] = tzone[0]; + } - if(this.imageuploadObject.length > 0){ - - for(var d = 0 ;d 0) { + for (var d = 0; d < this.imageuploadObject.length; d++) { + if ( + this.imageuploadObject[d].doctype == "" && + this.imageuploadObject[d].image == "" && + this.imageuploadObject[d].phone == "" + ) { + this.imageuploadObject.splice(d, 1); + } } } - } - newContact2['imageDoc'] = this.imageuploadObject; - this.contactService.post('/users/addTechnician',newContact2) - .subscribe((contact:any) => { - console.log(contact); - if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "User Duplicate"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Email ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Mobile Number already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else{ - this.clear(); - this.Load=false; - if(this.router.url!="/add-device"){ - - this.onNoClick("succ"); - this.contacts.push(contact); - }else{ - this._flashMessagesService.show(contact.message, { cssClass: 'alert-success', timeout: 3000 }); - } - // this.onNoClick("succ"); - // this.contacts.push(contact); + newContact2["imageDoc"] = this.imageuploadObject; + this.contactService.post("/users/addTechnician", newContact2).subscribe( + (contact: any) => { + console.log(contact); + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "User Duplicate") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Email ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Mobile Number already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else { + this.clear(); + this.Load = false; + if (this.router.url != "/add-device") { + this.onNoClick("succ"); + this.contacts.push(contact); + } else { + this._flashMessagesService.show(contact.message, { + cssClass: "alert-success", + timeout: 3000, + }); + } + // this.onNoClick("succ"); + // this.contacts.push(contact); + } + // USER_ID already exists + }, + (err: any) => { + if (err.status == 500) { + // console.log(err._body); + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.split(":")[1]; + console.log(this.data_descip); + swal("Error", this.data_descip, "error"); + } else if (err.status == 401) { + this.Load = false; + this.emmnerr = JSON.parse(err._body); + console.log(this.emmnerr); + this.data_descip = this.emmnerr.message; + this._flashMessagesService.show("Access Denied", { + cssClass: "alert-danger", + timeout: 3000, + }); + // swal( + // 'Error', + // 'Internal Server error , Please try after sometime !!!', + // 'error' + // ) + } else { + this.Load = false; + this._flashMessagesService.show( + "Internal Server error , Please try after sometime !!!", + { cssClass: "alert-danger", timeout: 3000 } + ); + } } - // USER_ID already exists - - }, (err: any) => { - if(err.status == 500) - { - // console.log(err._body); - this.Load=false - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.split(':')[1]; - console.log(this.data_descip); - swal( - 'Error', - this.data_descip, - 'error' - ) - } - else if(err.status==401){ - this.Load=false - this.emmnerr=JSON.parse(err._body); - console.log(this.emmnerr); - this.data_descip = this.emmnerr.message; - this._flashMessagesService.show("Access Denied", { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // 'Internal Server error , Please try after sometime !!!', - // 'error' - // ) - }else{ - this.Load=false; - this._flashMessagesService.show('Internal Server error , Please try after sometime !!!', { cssClass: 'alert-danger', timeout: 3000 }); - } - })} - else if((this.emaill)||(this.userID)){ - // if (!this.executed) { - // this.executed = true; - console.log("we are here"); - if(this.dealerObj){ - this.useridd= this.dealerObj.dealer_id - - } - var emergencyContact={ - contact1:{ - name:this.emergencyForm.value.emg_name1, - cell1:this.emergencyForm.value.emg_cell1, - cell2:this.emergencyForm.value.emg_cell2, - phone1:this.emergencyForm.value.emg_phone1, - phone2:this.emergencyForm.value.emg_phone2 + ); + } else if (this.emaill || this.userID) { + // if (!this.executed) { + // this.executed = true; + console.log("we are here"); + if (this.dealerObj) { + this.useridd = this.dealerObj.dealer_id; + } + var emergencyContact = { + contact1: { + name: this.emergencyForm.value.emg_name1, + cell1: this.emergencyForm.value.emg_cell1, + cell2: this.emergencyForm.value.emg_cell2, + phone1: this.emergencyForm.value.emg_phone1, + phone2: this.emergencyForm.value.emg_phone2, + }, + contact2: { + name: this.emergencyForm.value.emg_name2, + cell1: this.emergencyForm.value.emg_cell3, + cell2: this.emergencyForm.value.emg_cell4, + phone1: this.emergencyForm.value.emg_phone3, + phone2: this.emergencyForm.value.emg_phone4, + }, + }; + console.log(emergencyContact); - }, - contact2:{ - name:this.emergencyForm.value.emg_name2, - cell1:this.emergencyForm.value.emg_cell3, - cell2:this.emergencyForm.value.emg_cell4, - phone1:this.emergencyForm.value.emg_phone3, - phone2:this.emergencyForm.value.emg_phone4 + const newContact2 = { + first_name: this.first_name, + last_name: this.last_name, + password: this.passwordd, + org_name: this.org_name, + email: this.emaill, + expdate: new Date(expDate).toISOString(), + supAdmin: this.sup_admin, + isDealer: false, + Dealer: this.useridd, + custumer: true, + user_id: this.userID, + address: this.address, + emergencyContact: emergencyContact, + }; + console.log("3->", newContact2); - } - } - console.log(emergencyContact); - - const newContact2 ={ - first_name: this.first_name, - last_name: this.last_name, - password: this.passwordd, - org_name: this.org_name, - email: this.emaill, - expdate : new Date(expDate).toISOString(), - supAdmin:this.sup_admin, - isDealer: false, - Dealer: this.useridd, - custumer:true, - user_id:this.userID, - address:this.address, - emergencyContact:emergencyContact + if (this.countrySelected != undefined) { + newContact2["std_code"] = this.countrySelected; + } + if (this.role != undefined) { + newContact2["role"] = this.role; + } -} -console.log("3->",newContact2); + if (tzone != undefined) { + newContact2["timezone"] = tzone[0]; + } + if (this.imageuploadObject.length > 0) { + for (var d = 0; d < this.imageuploadObject.length; d++) { + if ( + this.imageuploadObject[d].doctype == "" && + this.imageuploadObject[d].image == "" && + this.imageuploadObject[d].phone == "" + ) { + this.imageuploadObject.splice(d, 1); + } + } + } + newContact2["imageDoc"] = this.imageuploadObject; + this.contactService.post("/users/addTechnician", newContact2).subscribe( + (contact: any) => { + //this.tost1("succ") + console.log(contact); + // USER_ID already exists + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } + if (contact.message == "USER_ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "User Duplicate") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Email ID already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (contact.message == "Mobile Number already exists") { + return this._flashMessagesService.show(contact.message, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else { + this.clear(); + this.Load = false; + if (this.router.url != "/add-device") { + this.onNoClick("succ"); + this.contacts.push(contact); + } else { + this._flashMessagesService.show(contact.message, { + cssClass: "alert-success", + timeout: 3000, + }); + } + // this.onNoClick("succ"); + // this.contacts.push(contact); + } + }, + (err: any) => { + if (err.status == 500) { + // console.log(err._body); + this.Load = false; + this.emmnerr = JSON.parse(err._body); -if(this.countrySelected != undefined){ - newContact2['std_code']=this.countrySelected; - - } - if(this.role != undefined){ - newContact2['role'] = this.role; - } - - if(tzone != undefined){ - newContact2['timezone'] = tzone[0]; - } - -if(this.imageuploadObject.length > 0){ - - for(var d = 0 ;d { - //this.tost1("succ") - console.log(contact); - // USER_ID already exists - if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }if(contact.message == "USER_ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "User Duplicate"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Email ID already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else if(contact.message == "Mobile Number already exists"){ - return this._flashMessagesService.show(contact.message, { cssClass: 'alert-danger', timeout: 3000 }); - }else{ - this.clear(); - this.Load=false; - if(this.router.url!="/add-device"){ - - this.onNoClick("succ"); - this.contacts.push(contact); - }else{ - this._flashMessagesService.show(contact.message, { cssClass: 'alert-success', timeout: 3000 }); - } - // this.onNoClick("succ"); - // this.contacts.push(contact); - } - -}, (err: any) => { - if(err.status == 500) - { - // console.log(err._body); - this.Load=false - this.emmnerr=JSON.parse(err._body); - - this.data_descip = this.emmnerr.split(':')[1]; - console.log(this.data_descip); - this._flashMessagesService.show(this.data_descip, { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // this.data_descip, - // 'error' - // ) - // console.log("error to display",this.emmnerr); - // this.tost1("Error") - } - else if(err.status==401){ - this.Load=false; - this.emmnerr=JSON.parse(err._body); - this.data_descip = this.emmnerr.message; - this._flashMessagesService.show("Access Denied", { cssClass: 'alert-danger', timeout: 3000 }); - // swal( - // 'Error', - // 'Internal Server error , Please try after sometime !!!', - // 'error' - // ) - }else{ - this.Load=false; - this._flashMessagesService.show( 'Internal Server error , Please try after sometime !!!', { cssClass: 'alert-danger', timeout: 3000 }); - }}); - - - } - - - } - data_descip:any; - onNoClick(a): void { - this.dialogRef.close(a); - } - - closebox(){ - this.dialogRef.close(null); - } - tost1(divid){ - if(divid == "Error"){ - this.data_descip = "User already registerd" - this._flashMessagesService.show(this.data_descip, { cssClass: 'alert-danger', timeout: 3000 }); - } - else if(divid == "succ"){ - this.data_descip = "Custumer Successfully Added" - this._flashMessagesService.show("Custumer Successfully Added", { cssClass: 'alert-success', timeout: 3000 }); - } - else if(divid == "psdnmtch"){ - this.data_descip = "Error: Password and confirm password do not match" - this._flashMessagesService.show(this.data_descip, { cssClass: 'alert-danger', timeout: 3000 }); - } - // 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", ""); }, 450000); - // } - } - - valclear(){ - this._flashMessagesService.show("Cleared", { cssClass: 'alert-warning', timeout: 200000 }); - + data_descip: any; + onNoClick(a): void { + this.dialogRef.close(a); } - click1(event){ - this.show2=false; - this.show3=true; - if((event.keyCode >= 48 && event.keyCode <= 57) || event.keyCode == 9 || event.keyCode == 8 || event.keyCode == 46 || event.keyCode == 37 || event.keyCode == 39){ + closebox() { + this.dialogRef.close(null); + } + tost1(divid) { + if (divid == "Error") { + this.data_descip = "User already registerd"; + this._flashMessagesService.show(this.data_descip, { + cssClass: "alert-danger", + timeout: 3000, + }); + } else if (divid == "succ") { + this.data_descip = "Custumer Successfully Added"; + this._flashMessagesService.show("Custumer Successfully Added", { + cssClass: "alert-success", + timeout: 3000, + }); + } else if (divid == "psdnmtch") { + this.data_descip = "Error: Password and confirm password do not match"; + this._flashMessagesService.show(this.data_descip, { + cssClass: "alert-danger", + timeout: 3000, + }); } + // 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", ""); }, 450000); + // } + } + + valclear() { + this._flashMessagesService.show("Cleared", { + cssClass: "alert-warning", + timeout: 200000, + }); + } + + click1(event) { + this.show2 = false; + this.show3 = true; + if ( + (event.keyCode >= 48 && event.keyCode <= 57) || + event.keyCode == 9 || + event.keyCode == 8 || + event.keyCode == 46 || + event.keyCode == 37 || + event.keyCode == 39 + ) { + } else event.preventDefault(); /* if(event.keyCode===13){ this.otp_window(); } */ - - else - event.preventDefault(); - } - click2(event2){ - this.show2=true; - this.show3=false; - - } - call(e) { - { - if (e.keyCode == 32) { - e.preventDefault(); - } - } - } - geo(){ - this.router.navigateByUrl("geofencing"); - } - devicess:any; - final:any; - getdev(){ - let foods = [] - this.contactService.getDevice(this.emailid,this.useridd).subscribe( - - data => { - this.devicess = data - + click2(event2) { + this.show2 = true; + this.show3 = false; + } + call(e) { + { + if (e.keyCode == 32) { + e.preventDefault(); + } + } + } + geo() { + this.router.navigateByUrl("geofencing"); + } + devicess: any; + final: any; + getdev() { + let foods = []; + this.contactService + .getDevice(this.emailid, this.useridd) + .subscribe((data) => { + this.devicess = data; + let swap; - for(let g = 0;gthis.devicess.devices[c+1].Device_Name){ - swap = this.devicess.devices[c]; - this.devicess.devices[c] = this.devicess.devices[c+1]; - this.devicess.devices[c+1] = swap; + for (let g = 0; g < this.devicess.devices.length - 1; g++) { + for (let c = 0; c < this.devicess.devices.length - g - 1; c++) { + if ( + this.devicess.devices[c].Device_Name > + this.devicess.devices[c + 1].Device_Name + ) { + swap = this.devicess.devices[c]; + this.devicess.devices[c] = this.devicess.devices[c + 1]; + this.devicess.devices[c + 1] = swap; } } } - - this.final = this.devicess.devices - - for(let i=0;i { + $("#telephone").intlTelInput({ + allowDropdown: true, + autoPlaceholder: "Enter Mobile Number", + initialCountry: "in", + preferredCountries: ["in", "us"], + separateDialCode: true, + }); + }, 300); - this.emergencyForm=this.fb.group({ - emg_name1:[''], - emg_name2:[''], - emg_cell1:[''], - emg_cell2:[''], - emg_cell3:[''], - emg_cell4:[''], - emg_phone1:[''], - emg_phone2:[''], - emg_phone3:[''], - emg_phone4:[''] - - }) - setTimeout(() => { - $("#telephone").intlTelInput({ - allowDropdown:true, - autoPlaceholder:"Enter Mobile Number", - initialCountry:"in", - preferredCountries: ["in","us" ], - separateDialCode:true, - }); - }, 300); - - this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin; + this.superAdmin = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).isSuperAdmin; // console.log(this.superAdmin) - this.fs = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).fn; - this.ls = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).ln; - if(!this.superAdmin){ - this.dealerName = this.fs + this.fs = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).fn; + this.ls = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).ln; + if (!this.superAdmin) { + this.dealerName = this.fs; } - 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; - this.mb = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn; + 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; + 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.custtype = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).isDealer; - this.sup_admin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).supAdmin; - console.log("superAdmin=>",this.sup_admin); + this.sup_admin = JSON.parse( + window.atob(window.localStorage.token.split(".")[1]) + ).supAdmin; + console.log("superAdmin=>", this.sup_admin); - if(this.superAdmin){ + if (this.superAdmin) { this.sup_admin = this.useridd; } - // this.getdev(); - if(this.mb.charAt(0)=="n"){ - this.mb = ' ' - } - if(this.custtype == true){ - this.cust = true; - } - - this.logo=window.localStorage['logo']; - this.text=window.localStorage['text']; - this.dealerDetail(); - - var Phoneinput = document.getElementById('telephone'); - var that = this; - Phoneinput.addEventListener("countrychange",function(p) { - console.log("Inside Function"); - var countryData = $('#telephone').intlTelInput("getSelectedCountryData"); - console.log(countryData); - that.countrySelected = { - countryCode : countryData.iso2, - dialcode: countryData.dialCode + // this.getdev(); + if (this.mb.charAt(0) == "n") { + this.mb = " "; } + if (this.custtype == true) { + this.cust = true; + } + + this.logo = window.localStorage["logo"]; + this.text = window.localStorage["text"]; + this.dealerDetail(); + + var Phoneinput = document.getElementById("telephone"); + var that = this; + Phoneinput.addEventListener("countrychange", function (p) { + console.log("Inside Function"); + var countryData = $("#telephone").intlTelInput("getSelectedCountryData"); + console.log(countryData); + that.countrySelected = { + countryCode: countryData.iso2, + dialcode: countryData.dialCode, + }; }); - var timeZn = moment.tz.guess(); - if(timeZn != 'Asia/Calcutta'){ + var timeZn = moment.tz.guess(); + if (timeZn != "Asia/Calcutta") { this.timezone = timeZn; } console.log(this.timezone); + var timeZones = moment.tz.names(); + console.log(timeZones); + this.timezoneArray = []; + for (var i in timeZones) { + this.timezoneArray.push({ + viewValue: + "(GMT" + moment.tz(timeZones[i]).format("Z") + ")" + timeZones[i], + value: timeZones[i], + }); + } - var timeZones = moment.tz.names(); - console.log(timeZones); - this.timezoneArray=[]; - for (var i in timeZones) { - this.timezoneArray.push({ viewValue: "(GMT" + moment.tz(timeZones[i]).format('Z') + ")" + timeZones[i], value: timeZones[i] }); - } - + setTimeout(() => { + $("#dbselect").multipleSelect({ + width: 300, + placeholder: "Select Timezone", + filter: true, + single: true, + selectAll: false, + }); + console.log("INBDKJNDKJNDKJFNKJFBKHJbnkjh"); + }, 100); - setTimeout(() => { - $('#dbselect').multipleSelect({ - width: 300, - placeholder: 'Select Timezone', - filter: true, - single: true, - selectAll: false - }) - console.log("INBDKJNDKJNDKJFNKJFBKHJbnkjh"); - - }, 100); - - this.latLongDetail(); + this.latLongDetail(); } - dealers_info=[]; + dealers_info = []; - dealerDetail(){ + dealerDetail() { // this.dealers_info=[]; - var super_admin = ((this.superAdmin==true)||(this.superAdmin==undefined)) ? this.useridd : this.sup_admin ; - this.contactService.dealer_Info_dealer_list(super_admin) - .subscribe(res=>{ - console.log("Response=>",res); - this.dealers_info=res; - }) - - + var super_admin = + this.superAdmin == true || this.superAdmin == undefined + ? this.useridd + : this.sup_admin; + this.contactService + .dealer_Info_dealer_list(super_admin) + .subscribe((res) => { + console.log("Response=>", res); + this.dealers_info = res; + }); } - filterDealerStates(dlr) { - // console.log(dlr); if (dlr) { + const filterdealerValue: any = dlr; + this.dealerSelect = []; + this.dealerSelect = this.dealers_info.filter(function (p) { + var t = p.dealer_firstname + .toLocaleLowerCase() + .indexOf(filterdealerValue.toLocaleLowerCase()); + // this.option = this.options[i]; - const filterdealerValue:any = dlr; - this.dealerSelect=[]; - this.dealerSelect = this.dealers_info.filter(function(p){ - var t = p.dealer_firstname.toLocaleLowerCase().indexOf(filterdealerValue.toLocaleLowerCase()); - // this.option = this.options[i]; - - - return t > -1; + return t > -1; }); - - return this.dealerSelect; + + return this.dealerSelect; } - } - dealerObj:any; - dealerFinalVal(dlrr){ - - - this.dealerObj=dlrr; + dealerObj: any; + dealerFinalVal(dlrr) { + this.dealerObj = dlrr; // console.log(this.dealerObj); // this.dealerSelect = dlrr; // console.log(this.dealerSelect); - } - documentDetail:any; - imageURL:any; + documentDetail: any; + imageURL: any; documentList = [ { - "docId": "Adhar", - "docName": "Adhar Card" + docId: "Adhar", + docName: "Adhar Card", }, { - "docId": "voterCard", - "docName": "Voter Id" + docId: "voterCard", + docName: "Voter Id", }, { - "docId": "PAN", - "docName": "Pan Card" + docId: "PAN", + docName: "Pan Card", }, { - "docId": "DL", - "docName": "Driving License" + docId: "DL", + docName: "Driving License", }, { - "docId": "Nepali Citizenship", - "docName": "Nepali Citizenship" - } - + docId: "Nepali Citizenship", + docName: "Nepali Citizenship", + }, ]; - documentType(docType){ - console.log("doctypeObject=>",docType); - + documentType(docType) { + console.log("doctypeObject=>", docType); } selectedFile: File; - onFileChanged(event) { + onFileChanged(event) { this.selectedFile = event.target.files[0]; - console.log(this.selectedFile); + console.log(this.selectedFile); } onUpload(imgIndex) { console.log(imgIndex); console.log(this.imageuploadObject); const fd = new FormData(); - console.log("selected file name =>",this.selectedFile.name); - if(this.selectedFile.name == " "){ + console.log("selected file name =>", this.selectedFile.name); + if (this.selectedFile.name == " ") { swal( - 'Upload Error', - 'Please select document type before upload !!!', - 'error' - ) - }else{ - fd.append('photo',this.selectedFile,this.selectedFile.name) - console.log("imgURL=>",fd) ; - this.contactService.imageupload(fd) - .subscribe(res=>{ - console.log(res); - var resImage =''; - resImage = res['_body']; - console.log(res['_body']); - this.imageuploadObject[imgIndex].image = resImage; - console.log(this.imageuploadObject); - // console.log(res); - },err=>{ - swal( - 'Server Error', - 'Internal Server Error , plaese try after sometime !!!', - 'error' - ) - }) + "Upload Error", + "Please select document type before upload !!!", + "error" + ); + } else { + fd.append("photo", this.selectedFile, this.selectedFile.name); + console.log("imgURL=>", fd); + this.contactService.imageupload(fd).subscribe( + (res) => { + console.log(res); + var resImage = ""; + resImage = res["_body"]; + console.log(res["_body"]); + this.imageuploadObject[imgIndex].image = resImage; + console.log(this.imageuploadObject); + // console.log(res); + }, + (err) => { + swal( + "Server Error", + "Internal Server Error , plaese try after sometime !!!", + "error" + ); + } + ); } - } - - docRow:boolean=false;; - AddDocumentsField(addedRow){ - if(addedRow){ - this.docRow = true; - } - var obj={doctype:'',image:'',phone:''}; - this.imageuploadObject.push(obj); - console.log(this.imageuploadObject); - // console.log("ImageuploadObject=>",this.imageuploadObject); } - DeleteDocumentsField(index){ + docRow: boolean = false; + AddDocumentsField(addedRow) { + if (addedRow) { + this.docRow = true; + } + var obj = { doctype: "", image: "", phone: "" }; + this.imageuploadObject.push(obj); + console.log(this.imageuploadObject); + // console.log("ImageuploadObject=>",this.imageuploadObject); + } + + DeleteDocumentsField(index) { console.log(this.imageuploadObject.length); - if(this.imageuploadObject.length == 1){ + if (this.imageuploadObject.length == 1) { this.docRow = false; } this.imageuploadObject.splice(index, 1); - } - passwordtype:any= 'password'; - passwordtype_1:any= 'password'; - passwordIcon:any='visibility_off'; - passwordIcon_1:any='visibility_off'; + passwordtype: any = "password"; + passwordtype_1: any = "password"; + passwordIcon: any = "visibility_off"; + passwordIcon_1: any = "visibility_off"; - showpassword(p:any){ - console.log('inside function'); - - if((p == 'p1')&&(this.passwordtype == "password")){ - this.passwordtype = 'text'; - this.passwordIcon = 'visibility'; - return - - } - - if((p == 'p1')&&(this.passwordtype == "text")){ - this.passwordtype = 'password'; - this.passwordIcon = 'visibility_off'; + showpassword(p: any) { + console.log("inside function"); + + if (p == "p1" && this.passwordtype == "password") { + this.passwordtype = "text"; + this.passwordIcon = "visibility"; return; } - - if((p == 'p2')&&(this.passwordtype_1 == "password")){ - this.passwordtype_1 = 'text'; - this.passwordIcon_1 = 'visibility'; - return; - - } - - if((p == 'p2')&&(this.passwordtype_1 == "text")){ - this.passwordtype_1 = 'password'; - this.passwordIcon_1 = 'visibility_off'; - return; - } - - } - - latLongDetail(){ - var that =this; + if (p == "p1" && this.passwordtype == "text") { + this.passwordtype = "password"; + this.passwordIcon = "visibility_off"; + return; + } + + if (p == "p2" && this.passwordtype_1 == "password") { + this.passwordtype_1 = "text"; + this.passwordIcon_1 = "visibility"; + return; + } + + if (p == "p2" && this.passwordtype_1 == "text") { + this.passwordtype_1 = "password"; + this.passwordIcon_1 = "visibility_off"; + return; + } + } + + latLongDetail() { + var that = this; console.log("Inside Latlong Function"); - if (navigator.geolocation) { - - if(location.protocol != 'https:'){ - this.contactService.getlatLong().subscribe(res=>{ - console.log(res); - let t_latlng = new google.maps.LatLng(res.lat, res.lon); - let request = { - latLng: t_latlng - }; + if (navigator.geolocation) { + if (location.protocol != "https:") { + this.contactService.getlatLong().subscribe((res) => { + console.log(res); + let t_latlng = new google.maps.LatLng(res.lat, res.lon); + let request = { + latLng: t_latlng, + }; this.getAddress(request); - }) - }else{ - navigator.geolocation.getCurrentPosition(function(position) { - var d_lat= position.coords.latitude; - var d_lng=position.coords.longitude; + }); + } else { + navigator.geolocation.getCurrentPosition(function (position) { + var d_lat = position.coords.latitude; + var d_lng = position.coords.longitude; let t_latlng = new google.maps.LatLng(d_lat, d_lng); let request = { - latLng: t_latlng + latLng: t_latlng, }; that.getAddress(request); - }) - - }} + }); + } + } } - getAddress(request){ - let geocoder = new google.maps.Geocoder(); + getAddress(request) { + let geocoder = new google.maps.Geocoder(); geocoder.geocode(request, function (data, status) { - console.log("Inside geocoder function"); + console.log("Inside geocoder function"); var userCountry; if (status == google.maps.GeocoderStatus.OK) { if (data[0] != null) { var address_show = data[0]; - console.log('var=>' ,address_show); + console.log("var=>", address_show); for (var ac = 0; ac < data[0].address_components.length; ac++) { var component = data[0].address_components[ac]; - switch(component.types[0]) { - case 'country': - userCountry = component.short_name; - console.log(userCountry); - break; + switch (component.types[0]) { + case "country": + userCountry = component.short_name; + console.log(userCountry); + break; } - }; - - var aaa = $('#telephone').intlTelInput("setCountry",userCountry); + } + + var aaa = $("#telephone").intlTelInput("setCountry", userCountry); } else { - userCountry = 'in'; + userCountry = "in"; } + } else { + console.log("Inside Error function"); + userCountry = "in"; } - else { - console.log("Inside Error function"); - userCountry = 'in'; - } - }) + }); } } diff --git a/src/app/add-dealer/add-dealer.component.html b/src/app/add-dealer/add-dealer.component.html index e553aff..18d8176 100644 --- a/src/app/add-dealer/add-dealer.component.html +++ b/src/app/add-dealer/add-dealer.component.html @@ -74,6 +74,7 @@
+
Inventory @@ -85,7 +86,29 @@
-
+
+
+
+ * + + Normal + Kyc Approval + Tag + +
+
+ + + All + + {{ item }} + + +
+
+
{{'Upload Documents' | translate}} :