921 lines
39 KiB
JavaScript
921 lines
39 KiB
JavaScript
/*================================================================================================================\
|
|
+
|
|
+ Project : GODATA-VOTA
|
|
+ Filename : GeoFence.js
|
|
+ Module Name : Geo
|
|
+ Purpose : For showing route-list and showing them on map with all the waypoints in it,
|
|
+ One can draw geofence around this route and can edit and delete them also.
|
|
+ Coded By : Pankaj Khandal
|
|
+
|
|
+================================================================================================================*/
|
|
|
|
|
|
/**
|
|
* For showing route-list and showing them on map with all the waypoints in it,
|
|
* One can draw geofence around this route and can edit and delete them also.
|
|
* @module GeoModule
|
|
*/
|
|
|
|
/**
|
|
* For showing route-list and showing them on map with all the waypoints in it,
|
|
* One can draw geofence around this route and can edit and delete them also.
|
|
* @class GeoFence
|
|
*/
|
|
|
|
//================= Global variables===============================
|
|
/**
|
|
* Global References: Initializing global stores for markers, images, icons, enable/disable bits etc.
|
|
* @for GeoFence
|
|
*/
|
|
|
|
//var GLOBAL_API_URL = 'http://localhost:1728/';
|
|
|
|
//var GLOBAL_API_URL = 'http://13.76.241.67:90/';
|
|
var GLOBAL_API_URL = 'http://i.teramatrix.in:402/';
|
|
|
|
// Initialising RESTful API URLs and making them available globally in JSON object.
|
|
var WCFRESTURL =
|
|
{
|
|
GetTransporterList: GLOBAL_API_URL + 'Api/Global?type=getTransporter',
|
|
GetDealerList: GLOBAL_API_URL + 'Api/Global?type=getDealer',
|
|
GetVehicleTypeList: GLOBAL_API_URL + 'Api/Global?type=GETVEHICLETYPE',
|
|
GetDealerRegionList: GLOBAL_API_URL + 'Api/Global?type=GETDEALERREGION',
|
|
GetVehicleChasisList: GLOBAL_API_URL + 'Api/Global?type=getVehicleChasis',
|
|
GetVehicles: GLOBAL_API_URL + 'Api/Vehicle',
|
|
GetVehicleInfo: GLOBAL_API_URL + 'Api/Vehicle?type=getVehicleInfo',
|
|
GetVehicleTotalCount: GLOBAL_API_URL + 'Api/Vehicle?type=GetVehicleTotalCount',
|
|
GetLiveTrackingByDeviceAlias: GLOBAL_API_URL + 'Api/Tracking?type=LiveTracking',
|
|
GetWebDashboardKpi: GLOBAL_API_URL + 'Api/Dashboard?UserClient=WEB_KPI',
|
|
GetWebDashboardKpiPie: GLOBAL_API_URL + 'Api/Dashboard?UserClient=WEB_PIE',
|
|
GetWebDashboardKpiLive: GLOBAL_API_URL + 'Api/Dashboard?UserClient=WEB_LIVE_KPI',
|
|
GetWebDashboardRedirectionKpi: GLOBAL_API_URL + 'Api/Dashboard?UserClient=web&type=redirection',
|
|
GetWebDashboardRedirectionKpiExcel: GLOBAL_API_URL + 'Api/Dashboard?UserClient=web&type=KPI&type1=redirection',
|
|
|
|
GetVehicleActivity: GLOBAL_API_URL + 'Api/Activity?type=getvehicleactivity',
|
|
GetVehicleNotification: GLOBAL_API_URL + 'Api/Notification?type=GETVEHICLENOTIFICATIONFORWEB',
|
|
GetVehicleStatus: GLOBAL_API_URL + 'Api/Global/?type=getintransitlist',
|
|
GetVehicleHistory: GLOBAL_API_URL + 'Api/Vehicle?type=GETVEHICLEHISTORY&category=DELIVERED',
|
|
GetVehicleHistoryExcel: GLOBAL_API_URL + 'Api/Vehicle?type=GETVEHICLEHISTORY&category=DELIVERED&download=EXCEL',
|
|
GetDriverLicenseList: GLOBAL_API_URL + 'Api/Global/?type=GETDRIVERLIST',
|
|
GetInsertDriver: GLOBAL_API_URL + 'Api/Driver?type=insertDriver',
|
|
GetInsertTransporterActivity: GLOBAL_API_URL + 'Api/Activity?type=postvehicleactivity&category=ttf',
|
|
GetRoutes: GLOBAL_API_URL + 'Api/Route',
|
|
GetRouteByRouteId: GLOBAL_API_URL + 'Api/Route?Type=getRouteById',
|
|
UpdateGeofence: GLOBAL_API_URL + 'Api/Route?Type=UPDATEGEOFENCE',
|
|
GetSlaCounterOfVehicle: GLOBAL_API_URL + 'Api/Vehicle?Sla=&Sla1=&Sla2=&Sla3=',
|
|
GetStateList: GLOBAL_API_URL + 'Api/Global/?type=getStateList',
|
|
UpdateNotification: GLOBAL_API_URL + 'Api/Notification?type=updateNotification&type1=dsd',
|
|
GetTransporterVehicleActivity: GLOBAL_API_URL + 'Api/Activity?type=GETTRANSPORTERVEHICLEACTIVITY',
|
|
GetCurrentStatusReportTotalCount: GLOBAL_API_URL + 'Api/Reports?type=GETCURRENTSTATUSDPTDLRCOUNT',
|
|
//GetCurrentStatusReport: GLOBAL_API_URL+'Api/Reports?currentStatus=dd¤tStatus1=dd¤tStatus2=dd',
|
|
GetCurrentStatusReport: GLOBAL_API_URL + 'Api/Reports?type=GETCURRENTSTATUS',
|
|
GetBillingAndHoldReportTotalCount: GLOBAL_API_URL + 'Api/Reports?type=GETTRPBILLANDHOLDCOUNT',
|
|
//GetBillingAndHoldReport: GLOBAL_API_URL+'Api/Reports?trpBillHold=dd&trpBillHold1=dd&trpBillHold2=dd&trpBillHold3=dd&trpBillHold4=dd',
|
|
GetBillingAndHoldReport: GLOBAL_API_URL + 'Api/Reports?type=GETTRPBILLHOLD',
|
|
StopStartDealerNotifications: GLOBAL_API_URL + 'Api/Activity?type=UPDATEACTIVITY&category=ssad',
|
|
GetUploadVehicleDetails: GLOBAL_API_URL + 'Api/Driver?type=UPLOADDRIVERDETAILS&type1=tt',
|
|
GetNonOperationslVehicleStatusReport: GLOBAL_API_URL + 'Api/Reports?type=GETVEHICLESTATUSREPORT',
|
|
GetNonOperationslVehicleStatusReportTotalCount: GLOBAL_API_URL + 'Api/Reports?type=GETVEHICLESTATUSREPORTCOUNT',
|
|
|
|
GetOBLSalesFormatReport: GLOBAL_API_URL + 'api/Reports?type=GETOBLSALESFORMATREPORT',
|
|
GetOBLFormatReport: GLOBAL_API_URL + 'api/Reports?type=GETOBLFORMATREPORT',
|
|
GetOBLAgeingRegionReport: GLOBAL_API_URL + 'api/Reports?type=GETOBLAGINGREGIONREPORT',
|
|
GetOBLAgeingInDaysReport: GLOBAL_API_URL + 'api/Reports?type=GETOBLAGINGINDAYSREPORT',
|
|
GetOblOblReport: GLOBAL_API_URL + 'api/Reports?type=GETOBL_OBLREPORT',
|
|
GetOblDepotWiseSummaryReport: GLOBAL_API_URL + 'api/Reports?type=GETOBLDEPOTWISESUMMARY',
|
|
GetOBL_OBLDashboard: GLOBAL_API_URL + 'api/Reports?type=GETOBL_OBLDASHBOARD',
|
|
GetOBL_OBLTransaction: GLOBAL_API_URL + 'api/Reports?type=GETOBL_OBLTRANSACTION',
|
|
GetOBL_OBLSummary: GLOBAL_API_URL + 'api/Reports?type=GETOBL_OBLSUMMARY',
|
|
Get_OBL_Summary_YTD: GLOBAL_API_URL + 'api/Reports?type=GET_OBL_SUMMARY_YTD',
|
|
|
|
GetOBLSalesFormatReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBLSALESFORMATREPORT&download=EXCEL',
|
|
GetOBLFormatReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBLFORMATREPORT&download=EXCEL',
|
|
GetOBLAgeingRegionReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBLAGINGREGIONREPORT&download=EXCEL',
|
|
GetOBLAgeingInDaysReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBLAGINGINDAYSREPORT&download=EXCEL',
|
|
GetOblOblReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBL_OBLREPORT&download=EXCEL',
|
|
GetOblDepotWiseSummaryReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBLDEPOTWISESUMMARY&download=EXCEL',
|
|
GetOBL_OBLDashboardExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBL_OBLDASHBOARD&download=EXCEL',
|
|
GetOBL_OBLTransactionExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBL_OBLTRANSACTION&download=EXCEL',
|
|
GetOBL_OBLSummaryExcel: GLOBAL_API_URL + 'Api/Reports?type=GETOBL_OBLSUMMARY&download=EXCEL',
|
|
GetOBL_OBLSummary_YTD_Excel: GLOBAL_API_URL + 'Api/Reports?type=GET_OBL_SUMMARY_YTD&download=EXCEL',
|
|
|
|
GetNonOperationslVehicleStatusReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETVEHICLESTATUS&download=EXCEL',
|
|
GetCurrentStatusReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETCURRENTSTATUS&download=EXCEL',
|
|
GetBillingAndHoldReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GETTRPBILLHOLD&download=EXCEL',
|
|
GETSALESANDMANAGEMENTREPORTExcel: GLOBAL_API_URL + 'Api/Reports?type=GETSALESANDMANAGEMENTREPORT&download=EXCEL',
|
|
|
|
GetFuelDateRanges: GLOBAL_API_URL + 'Api/Global?type=GETFUELLIST',
|
|
GetDistanceDateRanges: GLOBAL_API_URL + 'Api/Global?type=GETLOCATIONLIST',
|
|
|
|
InsertUpdateFuel: GLOBAL_API_URL + 'Api/Master',
|
|
InsertUpdateDistance: GLOBAL_API_URL + 'Api/Master?type=fuel&location=ll',
|
|
|
|
GetFuel: GLOBAL_API_URL + 'Api/Master?type=fuel',
|
|
GetDistance: GLOBAL_API_URL + 'Api/Master?type=location',
|
|
|
|
GetCityList: GLOBAL_API_URL + 'Api/Global?type=GETCITYLIST',
|
|
GetDealerCityList: GLOBAL_API_URL + 'Api/Global?type=GETDEALERCITYLIST',
|
|
GetFuelConsolidatedReport: GLOBAL_API_URL + 'Api/Master?type=fuel',
|
|
GetDistanceConsolidatedReport: GLOBAL_API_URL + 'Api/Master?type=location',
|
|
ExportFuelConsolidatedReport: GLOBAL_API_URL + 'Api/Master?type=fuel&download=new&temp=kkk',
|
|
ExportDistanceConsolidatedReport: GLOBAL_API_URL + 'Api/Master?type=location&download=new&temp=kkk',
|
|
|
|
GetOtpNotificationsList: GLOBAL_API_URL + 'Api/Authorization?type=fg&type1=dd',
|
|
|
|
GetYardInfo: GLOBAL_API_URL + 'Api/Vehicle?loc=ll&loc1=ll&loc2=ll&loc3=ll&loc4=ll',
|
|
|
|
GetModelListByVehicleType: GLOBAL_API_URL + 'Api/Global?type=GETMODELSLISTBYVEHICLE',
|
|
GetTransporterPerformanceReport: GLOBAL_API_URL + 'Api/Reports?category=performance&transPerformannce1=dd&transPerformannce2=dd&transPerformannce3=dd&transPerformannce4=dd&transPerformannce5=dd',
|
|
GetTransporterPerformanceGEOReport: GLOBAL_API_URL + 'api/Reports?type=GET_TRANSPORTERPERFORMANCE_GEO_REPORT',
|
|
GetTransporterPerformanceReportCount: GLOBAL_API_URL + 'api/Reports?type=GET_TRANSPORTERPERFORMANCE_REPORT_COUNT',
|
|
GetTransporterPerformanceReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GET_TRANSPORTERPERFORMANCEREPORT&download=EXCEL',
|
|
|
|
GetTransporterBilling: GLOBAL_API_URL + 'Api/BillProcess?type=Bill',
|
|
GetVehicleChasisListByTransporterNotSavedNotSubmit: GLOBAL_API_URL + 'Api/Global?type=GETCHASSISNOLISTTRANSPORTERNOTSAVEDSUBMIT',
|
|
|
|
CheckBillValidity: GLOBAL_API_URL + 'Api/BillProcess?type=CHECKKBILLNO&type1=BillNo&type2&type3=ChkBillNo&type4=tt',
|
|
GetSavedBills: GLOBAL_API_URL + 'Api/BillProcess?type=SAVEDBILLNO&type1=BillNo',
|
|
InsertUpdateBilling: GLOBAL_API_URL + 'Api/BillProcess',
|
|
GetSentToOblBills: GLOBAL_API_URL + 'Api/BillProcess?type=GETBILLINFO&type1=tt&type2=tt&type3=tt',
|
|
ExportSavedBilling: GLOBAL_API_URL + 'Api/BillProcess?type=GETBILLPROCESSREPORT&type1=tt&type2=tt',
|
|
GetOtherRatesByLocation: GLOBAL_API_URL + 'Api/BillProcess?type=GETBILLINFOMASTERDETAIL&type1=master&type2=tt&type3=tt&type4=tt&type5=tt&type6=tt',
|
|
|
|
GetEscalationEventTypeList: GLOBAL_API_URL + 'Api/Escalation',
|
|
InserEscalationMatrix: GLOBAL_API_URL + 'Api/Escalation?type=dfs&type1=sd',
|
|
GetManagerLevelListRoleWise: GLOBAL_API_URL + 'Api/Escalation?level=ee',
|
|
EscalationMatrixExcel: GLOBAL_API_URL + 'Api/Escalation?type=Escalation&type1=sd&type2=sd',
|
|
|
|
GetOpenTicket: GLOBAL_API_URL + 'Api/Ticketing?type=GETOPENTICKETLIST',
|
|
GetOpenTicketRoleWise: GLOBAL_API_URL + 'Api/Ticketing?type=GETOPENTICKETROLEWISE&type1=hh&type2=hh',
|
|
GetCloseTicket: GLOBAL_API_URL + 'Api/Ticketing?type=GETCLOSETICKETLIST',
|
|
GetCloseTicketRoleWise: GLOBAL_API_URL + 'Api/Ticketing?type=GETCLOSETICKETROLEWISE&type1=hh&type2=hh',
|
|
GetOpenTicketActivity: GLOBAL_API_URL + 'Api/Ticketing?type=GETOPENTICKETACTIVITY&type1=kkk',
|
|
GetCloseTicketActivity: GLOBAL_API_URL + 'Api/Ticketing?type=GETCLOSETICKETACTIVITY&type1=kkk',
|
|
GetUpdateTicketDetails: GLOBAL_API_URL + 'Api/Ticketing?type=UPDATEtICKETDETAIL&type1=kkk&type2=gghr&type3=aaa',
|
|
GetTicketQueryList: GLOBAL_API_URL + 'Api/Ticketing',
|
|
InsertTicket: GLOBAL_API_URL + 'Api/Ticketing?type=INSERTTICKETDETAIL&type1=gdf&type2=gdffd&type3=gdfdd',
|
|
GetResultOfTicket: GLOBAL_API_URL + 'Api/Ticketing?type=GETANSWER&type1=gdf&type2=gdffd&type3=gdfdd&type4=gdfdd',
|
|
|
|
GetApprovedOblBills: GLOBAL_API_URL + 'Api/BillProcess?type=GETBILLINFO&type1=3&type2=tt&type3=tt',
|
|
GetRejectedOblBills: GLOBAL_API_URL + 'Api/BillProcess?type=GETBILLINFO&type1=2&type2=tt&type3=tt',
|
|
GetModelList: GLOBAL_API_URL + 'Api/Global?type=GETMODELLIST',
|
|
FromLocationList: GLOBAL_API_URL + 'Api/Global?type=GETFROMLOCATION',
|
|
GetDetailsAcceptedAndRejested: GLOBAL_API_URL + 'Api/BillProcess?type=UPDATEBILLNOBYOBL&type1=UPDATEBILLNOBYOBL&type2=kkk&type3=AGGGA&type4=OBL&type5=nEW',
|
|
InsertUpdateBunchNumber: GLOBAL_API_URL + 'Api/BunchNumber',
|
|
GetBunchNumber: GLOBAL_API_URL + 'Api/BunchNumber?type',
|
|
AssignDriverByTransporter: GLOBAL_API_URL + 'Api/Activity?type=DRIVERASSIGNMENT&category=ttf',
|
|
|
|
|
|
GetSlaImprovementReport: GLOBAL_API_URL + 'Api/Reports?category=improvement&transPerformannce1=dd&transPerformannce2=dd&transPerformannce3=dd&transPerformannce4=dd&transPerformannce5=dd',
|
|
GetSlaImprovementReportCount: GLOBAL_API_URL + 'api/Reports?type=GET_SLA_IMPROVEMENT_REPORT_COUNT',
|
|
GetSlaImprovementReportChart: GLOBAL_API_URL + 'Api/Reports?type=GETSLAIMPROVEMENTLINEGRAPH&linegraph1=uu',
|
|
GetSlaImprovementReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GET_SLA_IMPROVEMENT_REPORT&download=EXCEL',
|
|
|
|
|
|
GetTopDealersDeliveryReport: GLOBAL_API_URL + 'Api/ReportsDealer',
|
|
GetTopDealersDeliveryReportCount: GLOBAL_API_URL + 'api/Reports?type=GETCOUNTOFTOPTENDEALERPERFORMANCE',
|
|
GetTopDealersDeliveryReportExcel: GLOBAL_API_URL + 'Api/Reports?type=GET_TOP_TEN_DEALER_PERFORMANCE_EXCELREPORT&download=EXCEL',
|
|
GetTopDealersDeliveryReportChart: GLOBAL_API_URL + 'Api/Reports?type=GETTOPTENDEALERLINEGRAPH&dealerlinegraph1=uu',
|
|
|
|
|
|
GetRegionWiseAgeingVehicle: GLOBAL_API_URL + 'Api/Reports?type=GETREGIONWISEAGEINGVEHICLEDRILLDOWN&drilldown1&drilldown2',
|
|
GetRegionWiseAgeingStock: GLOBAL_API_URL + 'Api/Reports?type=GETREGIONWISEAGEINGSTOCKDRILLDOWN&drilldown1&drilldown2',
|
|
GetSegmentOrientedAgeing: GLOBAL_API_URL + 'Api/Reports?type=GETSEGMENTORIENTEDAGEINGDRILLDOWN&drilldown1&drilldown2',
|
|
GetSegmentAndDayWiseAgeing: GLOBAL_API_URL + 'Api/Reports?type=GETSEGMENTANDDAYWISEAGEINGDRILLDOWN&drilldown1&drilldown2',
|
|
GetRegionAndDayWiseAgeingVehicle: GLOBAL_API_URL + 'Api/Reports?type=GETREGIONANDDAYWISEAGEINGDRILLDOWN&drilldown1&drilldown2',
|
|
GetDepotWiseStockSummary: GLOBAL_API_URL + 'Api/Reports?type=GETDEPOTWISESTOCKSUMMARYDRILLDOWN&drilldown1&drilldown2',
|
|
GetStockAgeingReport: GLOBAL_API_URL + 'Api/Reports?type=GETSTOCKAGEINGREPORTDRILLDOWN&drilldown1&drilldown2',
|
|
GetMasterDealerList: GLOBAL_API_URL + 'Api/Master',
|
|
GetTopDealerList: GLOBAL_API_URL + 'Api/Master?toptendealer',
|
|
DeleteDealer: GLOBAL_API_URL + 'Api/Master?type=DELETEDEALER&topdealer',
|
|
InsertDealer: GLOBAL_API_URL + 'Api/Master?type=INSERTTOPDEALER&topdealer',
|
|
|
|
DeviceInventoryAndManagement: GLOBAL_API_URL + 'Api/DeviceMaster',
|
|
|
|
GetVehiclesForDeviceAllocation: GLOBAL_API_URL + 'Api/Device?type=GETVEHICLES&vehicles',
|
|
GetDevicesForDeviceAllocation: GLOBAL_API_URL + 'Api/Device?type=GETACTIVEDEVICES',
|
|
GetVehiclesForDeviceComplete: GLOBAL_API_URL + 'Api/Device?type=GETDELIVEREDVEHICLES&vehicles',
|
|
AllocateDevices: GLOBAL_API_URL + 'Api/Device?type=ALLOCATEDEVICE',
|
|
DeAllocateDevices: GLOBAL_API_URL + 'Api/Device?type=DEALLOCATEDEVICE',
|
|
GetDealerListForSecretLogin: GLOBAL_API_URL + 'Api/VECVMember',
|
|
|
|
GetLastPollingDate: GLOBAL_API_URL + 'Api/reports?type=GETLASTPOLLINGREPORT',
|
|
GetDispatchedDeliveredVehicle: GLOBAL_API_URL + 'Api/reports?type=GETDISPATCHEDDELIVEREDREPORT',
|
|
GetDisputedVehicleDetail: GLOBAL_API_URL + 'Api/reports?type=GETDISPUTEDVEHICLEREPORT',
|
|
GetTransporterActivity: GLOBAL_API_URL + 'Api/reports',
|
|
|
|
GETSRNREPORT: GLOBAL_API_URL + 'Api/reports?type=GETSRNREPORT',
|
|
GETSALESANDMANAGEMENTREPORT: GLOBAL_API_URL + 'Api/reports?type=GETSALESANDMANAGEMENTREPORT',
|
|
GETSALESANDMANAGEMENTREPORTSLADETAIL: GLOBAL_API_URL + 'Api/reports?type=GETSALESANDMANAGEMENTREPORTSLA',
|
|
GETSALESANDMANAGEMENTREPORTSLASUMMARY: GLOBAL_API_URL + 'Api/reports?type=GETSALESANDMANAGEMENTREPORTSLASUMMARY',
|
|
GETSALESANDMANAGEMENTREPORTEXCELDOWNLOAD: GLOBAL_API_URL + 'Api/reports?type=GETSALESANDMANAGEMENTREPORT&download=EXCEL',
|
|
|
|
GetCityListStateIdWise: GLOBAL_API_URL + 'Api/Global?type=GETCITYLISTSTATEIDWISE',
|
|
GetOrganizationList: GLOBAL_API_URL + 'Api/Global?type=GETORGANIZATIONLIST',
|
|
GetSetAddDeleteDealer: GLOBAL_API_URL + 'Api/Dealer'
|
|
};
|
|
// Positioning-Tool Error/Warning/Suceess Message-Store.
|
|
var GEOFENCE_MSG =
|
|
{
|
|
geofence_update_success: 'SUCCESS: Geofence for current selection is updated successfully.',
|
|
geofence_delete_confirmation: 'WARNING: Press OK to delete the geofence.',
|
|
geofence_save_success: 'SUCCESS: Geofence for current selection is updated successfully.',
|
|
}
|
|
//====================================================== end ===============================================//
|
|
|
|
///**
|
|
//* To get dynamic api url.
|
|
//*/
|
|
//function getDynamicApiUrl(arrParam, objUrl) {
|
|
|
|
|
|
|
|
// var url = GLOBAL_API_URL + 'Api/DeviceMaster?type=UPLOADDEVICEDETAILS&userId=' + arrParam[0] + '&status=';
|
|
// return url;
|
|
//}
|
|
|
|
//var WCFRESTURL_DYNAMIC = {
|
|
// UploadDeveiceDetailsMaster: GLOBAL_API_URL + 'Api/DeviceMaster?type=UPLOADDEVICEDETAILS&userId=' + arrParam[0] + '&status='
|
|
//};
|
|
var map = null, // global map object
|
|
srcMarkerImgPath = "../../Scripts/map_api/icons/red_s.png", // source marker image
|
|
geofencePointImgPath = "../../Scripts/map_api/icons/red_circle.png", // geo fence point marker image
|
|
destMarkerImgPath = "../../Scripts/map_api/icons/red_d.png", // destination marker image
|
|
geofenceBrushImagePath = "../../Scripts/map_api/icons/pencilsmall.png", // geo fence brush image
|
|
defaultLat = 22.719569, // indore lat
|
|
defaultLng = 75.857726, // indore lng
|
|
defaultZoom = 8; // degault zoom level
|
|
|
|
// Initializing all the global selectors
|
|
var $grid_routeList = $('#grid_routeList'), // selector: route list grid
|
|
$btn_connect = $('#btn_connect'), // button: connect first-last point
|
|
$btn_saveGeoFence = $('#btn_saveGeoFence'), // button: save geo fence
|
|
$createGeoFence = $('#btn_add_geofence'), // button: create geo fence
|
|
$btn_updateGeoFence = $('#btn_updateGeoFence'), // button: update geo fence
|
|
$btn_add_geofence = $('#btn_add_geofence'), // button: add geo fence
|
|
$btn_deleteGeoFence = $('#btn_deleteGeoFence'), // button: delete geo fence
|
|
$divLoadingElement = $('#divLoadingElement'); // div selector: loading element
|
|
|
|
var MARKERS = [], // to store markers object
|
|
GEOFENCE_MARKERS = [], // to store geofence markers
|
|
POLYLINES = [], // to store polylines
|
|
directionService = null, // to store direction service object
|
|
latlngbounds, // to store lat-long bounds object
|
|
GEOFENCE_POINTS = [], // initialize an array where we store latitude and longitude pair
|
|
UPDATED_GEOFENCE_POINTS = [], // initialize an array where we store latitude and longitude pair
|
|
GEOFENCE_POSITIONS = [], // initialize an array where we store latitude and longitude pair
|
|
count = 0, // initialize the geofence points count
|
|
enableDrawGeoFence = true, // to enable drawing geo fence
|
|
enableGeoFenceCreation = false, // enable geo fence craetion
|
|
enable_map_mousemove_geofence_brush = false, // enable geo fence brush
|
|
ROUTE_ID = ''; // to store route id
|
|
//=================================================================
|
|
|
|
|
|
/*================================================Map Function=============================================*/
|
|
/**
|
|
* To plot van reachable point at new position and draw its path with distance check from the van
|
|
* @method dragEndHandlerForVanReachablePoint
|
|
* @param {Object} marker reachbale point marker object on map
|
|
* @for GeoFence
|
|
*/
|
|
function dragEndHandlerForGeofencePoint(marker) {
|
|
// show update geo fence button
|
|
$btn_updateGeoFence.show();
|
|
// hide save geo fence button
|
|
$btn_saveGeoFence.hide();
|
|
|
|
// getting id of marker
|
|
var markerId = marker.id;
|
|
// getting marker's latitude
|
|
var newLat = marker.position.lat();
|
|
// getting marker's longitude
|
|
var newLng = marker.position.lng();
|
|
|
|
// storing geofence points into the json object that we want to send to the server
|
|
UPDATED_GEOFENCE_POINTS = GEOFENCE_POINTS;
|
|
// updating the lat-long of the dragged markers to the respective JSON
|
|
$.each(GEOFENCE_POINTS, function (key, val) {
|
|
if (parseInt(key, 10) == parseInt(markerId, 10)) {
|
|
UPDATED_GEOFENCE_POINTS[key].lat = newLat;
|
|
UPDATED_GEOFENCE_POINTS[key].lng = newLng;
|
|
|
|
}
|
|
});
|
|
// delete polylines from the map
|
|
DeletePolyLines();
|
|
// and create new updated polylines
|
|
var polyline = drawPolyline(UPDATED_GEOFENCE_POINTS);
|
|
// restoring polyines
|
|
POLYLINES.push(polyline);
|
|
}
|
|
|
|
|
|
/**
|
|
* To put a marker on map with supplied information.
|
|
* @method putMarkerOnMap
|
|
* @param {Object} map map object
|
|
* @param {String} markerInfoWindowContent info-window html string
|
|
* @param {Object} markerLat marker's lat
|
|
* @param {Object} markerLong marker's long
|
|
* @param {Object} markerTitle marker's title
|
|
* @param {Object} markerId marker's id
|
|
* @param {Object} markerImage marker's icon image
|
|
* @param {Object} isDraggable true if marker is draggable
|
|
* @param {Object} setMapCenter true if marker click will center the map
|
|
* @param {Object} openInfoWindow true if info window should open
|
|
* @class GeoFence
|
|
*/
|
|
function putMarkerOnMap(map, markerInfoWindowContent, markerLat, markerLong, markerTitle, markerId, markerImage, isDraggable, setMapCenter, openInfoWindow, openInfoWindowByDefault) {
|
|
var markerLatlng = new google.maps.LatLng(markerLat, markerLong); // creating marker's object
|
|
var infowindow = new google.maps.InfoWindow({ content: markerInfoWindowContent }); // setting info window conent
|
|
|
|
// craeting marker's object with proper info
|
|
var marker = new google.maps.Marker({
|
|
position: markerLatlng,
|
|
map: map,
|
|
title: markerTitle,
|
|
icon: markerImage,
|
|
draggable: isDraggable,
|
|
id: markerId
|
|
});
|
|
// click handler for marker when marker is cicked
|
|
google.maps.event.addListener(marker, 'click', function () {
|
|
if (openInfoWindow) {
|
|
infowindow.open(map, marker);
|
|
} // setting info window should open
|
|
if (setMapCenter) { map.setCenter(markerLatlng); } // setting center on map when marker is clicked
|
|
});
|
|
// dragend handler for marker when marker is dragged
|
|
google.maps.event.addListener(marker, 'dragend', function () {
|
|
dragEndHandlerForGeofencePoint(marker);
|
|
});
|
|
// open info window by default
|
|
if (openInfoWindowByDefault) {
|
|
infowindow.open(map, marker);
|
|
}
|
|
return marker;
|
|
}
|
|
|
|
/**
|
|
* To draw a polyline on map considting all the coordinates
|
|
* @method putMarkerOnMap
|
|
* @param {Array} coordinates polyline lat-long ordered array
|
|
* @for GeoFence
|
|
*/
|
|
function drawPolyline(coordinates) {
|
|
var polyline = new google.maps.Polyline({
|
|
path: coordinates,
|
|
geodesic: true,
|
|
strokeColor: '#FF0000',
|
|
strokeOpacity: 1.0,
|
|
strokeWeight: 2
|
|
});
|
|
polyline.setMap(map);
|
|
return polyline;
|
|
}
|
|
|
|
/**
|
|
* To draw path between two points and setting am routeId for the same.
|
|
* @method drawPath
|
|
* @param {Object} sourcePoint source lat-long
|
|
* @param {Object} destinationPoint destination lat-long
|
|
* @param {Object} routeId route-id
|
|
* @for GeoFence
|
|
*/
|
|
function drawPath(sourcePoint, destinationPoint, waypoints, routeId) {
|
|
directionsRenderer.setMap(map); // setting this direction renderer on map
|
|
|
|
// creating path request
|
|
var request = {
|
|
origin: sourcePoint,
|
|
destination: destinationPoint,
|
|
waypoints: waypoints,
|
|
optimizeWaypoints: true,
|
|
travelMode: google.maps.TravelMode.DRIVING
|
|
};
|
|
// Route the directions and pass the response to a
|
|
// function to create markers for each step.
|
|
directionService.route(request, function (response, status) {
|
|
if (status == google.maps.DirectionsStatus.OK) {
|
|
directionsRenderer.setDirections(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
//----------- Geo Fence funcions -------------------------------
|
|
/**
|
|
* To delete geo fence for current route
|
|
* @method deleteGeoFence
|
|
* @for GeoFence
|
|
*/
|
|
function deleteGeoFence() {
|
|
var r = confirm(GEOFENCE_MSG['geofence_delete_confirmation'])
|
|
if (r == true) {
|
|
// Delete Geo fence
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.UpdateGeofence,
|
|
data: { RouteId: ROUTE_ID, OperationType: 'DELETE' },
|
|
dataType: "json",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
beforeSend: function (xhr) {
|
|
xhr.setRequestHeader('Authorization', getCookie('token'));
|
|
},
|
|
success: function (data) {
|
|
DeleteGeofenceMarkers();
|
|
DeletePolyLines();
|
|
count = 0;
|
|
enableDrawGeoFence = true;
|
|
enableGeoFenceCreation = false;
|
|
GEOFENCE_POINTS = [];
|
|
GEOFENCE_POSITIONS = [];
|
|
jAlert(GEOFENCE_MSG['geofence_update_success'], 'Message', 'Success_img');
|
|
},
|
|
complete: function () {
|
|
$btn_deleteGeoFence.hide();
|
|
$btn_add_geofence.show();
|
|
$btn_updateGeoFence.hide();
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
console.log(jqXHR);
|
|
}
|
|
});
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* To update geo fence for current route
|
|
* @method updateGeoFence
|
|
* @for GeoFence
|
|
*/
|
|
function updateGeoFence() {
|
|
var geoFence = JSON.stringify(UPDATED_GEOFENCE_POINTS); // serializing the JSON before sending to the server
|
|
// Insert Geo fence
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.UpdateGeofence,
|
|
data: { RouteId: ROUTE_ID, OperationType: 'UPDATE', Geofence: geoFence },
|
|
dataType: "json",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
beforeSend: function (xhr) {
|
|
xhr.setRequestHeader('Authorization', getCookie('token'));
|
|
},
|
|
success: function (data) {
|
|
$btn_saveGeoFence.hide();
|
|
$btn_updateGeoFence.hide();
|
|
$btn_deleteGeoFence.show();
|
|
jAlert(GEOFENCE_MSG['geofence_update_success'], 'Message', 'Success_img');
|
|
},
|
|
complete: function () {
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
console.log(jqXHR);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* To save geo fence for current route
|
|
* @method saveGeoFence
|
|
* @for GeoFence
|
|
*/
|
|
function saveGeoFence() {
|
|
var geoFence = JSON.stringify(GEOFENCE_POINTS); // serializing the JSON before sending to the server
|
|
// Insert Geo fence
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.UpdateGeofence,
|
|
data: { RouteId: ROUTE_ID, OperationType: 'UPDATE', Geofence: geoFence },
|
|
dataType: "json",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
beforeSend: function (xhr) {
|
|
xhr.setRequestHeader('Authorization', getCookie('token'));
|
|
},
|
|
success: function (data) {
|
|
$btn_saveGeoFence.hide();
|
|
$btn_deleteGeoFence.show();
|
|
jAlert(GEOFENCE_MSG['geofence_save_success'], 'Message', 'Success_img');
|
|
},
|
|
complete: function () {
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
console.log(jqXHR);
|
|
}
|
|
});
|
|
}
|
|
//------------------------------------------------------------
|
|
|
|
//----------------DELETE MAP Objects-------------------------
|
|
/**
|
|
* To delete markers from the map
|
|
* @method DeleteMarkers
|
|
* @for GeoFence
|
|
*/
|
|
function DeleteMarkers() {
|
|
//Loop through all the markers and remove
|
|
for (var i = 0; i < MARKERS.length; i++) {
|
|
MARKERS[i].setMap(null);
|
|
}
|
|
MARKERS = [];
|
|
};
|
|
|
|
/**
|
|
* To delete geofence markers from the map
|
|
* @method DeleteMarkers
|
|
* @for GeoFence
|
|
*/
|
|
function DeleteGeofenceMarkers() {
|
|
//Loop through all the markers and remove
|
|
for (var i = 0; i < GEOFENCE_MARKERS.length; i++) {
|
|
GEOFENCE_MARKERS[i].setMap(null);
|
|
}
|
|
GEOFENCE_MARKERS = [];
|
|
};
|
|
|
|
/**
|
|
* To delete polylines from the map
|
|
* @method DeletePolyLines
|
|
* @for GeoFence
|
|
*/
|
|
function DeletePolyLines() {
|
|
//Loop through all the polylines and remove
|
|
for (var i = 0; i < POLYLINES.length; i++) {
|
|
POLYLINES[i].setMap(null);
|
|
}
|
|
POLYLINES = [];
|
|
}
|
|
|
|
/**
|
|
* To delete a route based on the id
|
|
* @method deleteRoute
|
|
* @for GeoFence
|
|
*/
|
|
function deleteRoute() {
|
|
// removing any path from map which is designed by direction renderer
|
|
directionsRenderer.setMap(null);
|
|
}
|
|
|
|
/**
|
|
* To clear all the object from map
|
|
* @method deleteRoute
|
|
* @for GeoFence
|
|
*/
|
|
function ClearMap() {
|
|
DeleteMarkers();
|
|
DeleteGeofenceMarkers();
|
|
DeletePolyLines();
|
|
deleteRoute();
|
|
}
|
|
|
|
/**
|
|
* To reset map to the init state
|
|
* @method resetMap
|
|
* @for GeoFence
|
|
*/
|
|
function resetMap() {
|
|
ClearMap();
|
|
|
|
count = 0;
|
|
|
|
enableDrawGeoFence = true;
|
|
enableGeoFenceCreation = false;
|
|
enable_map_mousemove_geofence_brush = false
|
|
|
|
GEOFENCE_POINTS = [];
|
|
GEOFENCE_POSITIONS = [];
|
|
GEOFENCE_MARKERS = [];
|
|
POLYLINES = [];
|
|
|
|
ROUTE_ID = '';
|
|
|
|
$btn_connect.hide();
|
|
$btn_saveGeoFence.hide();
|
|
$btn_updateGeoFence.hide();
|
|
$createGeoFence.hide();
|
|
$btn_deleteGeoFence.hide();
|
|
|
|
// Creating Lat-Long bounds instance to fit all the markers on the map
|
|
latlngbounds = new google.maps.LatLngBounds();
|
|
}
|
|
//----------------------------------------------
|
|
|
|
|
|
/**
|
|
* To initialize map and required services.
|
|
* @method initMap
|
|
* @for GeoFence
|
|
*/
|
|
function initMap() {
|
|
|
|
//Initialize the Direction Service
|
|
directionService = new google.maps.DirectionsService();
|
|
|
|
// Creating Lat-Long bounds instance to fit all the markers on the map
|
|
latlngbounds = new google.maps.LatLngBounds();
|
|
|
|
// setting the renderer opting
|
|
var rendererOptions = {
|
|
preserveViewport: true,
|
|
suppressMarkers: true,
|
|
polylineOptions: { strokeColor: "#1b3f94" }
|
|
};
|
|
directionsRenderer = new google.maps.DirectionsRenderer(rendererOptions); // creating direction renderer object
|
|
|
|
// Create a map object and specify the DOM element for display.
|
|
map = new google.maps.Map(document.getElementById('map'), {
|
|
center: { lat: parseFloat(defaultLat), lng: parseFloat(defaultLng) },
|
|
scrollwheel: true,
|
|
zoom: parseInt(defaultZoom, 10)
|
|
});
|
|
|
|
// Listen Click Event to draw Polygon
|
|
google.maps.event.addListener(map, 'click', function (event) {
|
|
if (enableGeoFenceCreation && enableDrawGeoFence) {
|
|
$btn_connect.show();
|
|
|
|
var obj = new Object();
|
|
obj.lat = event.latLng.lat();
|
|
obj.lng = event.latLng.lng();
|
|
GEOFENCE_POINTS[count] = obj;
|
|
|
|
GEOFENCE_POSITIONS[count] = event.latLng;
|
|
var polyline = drawPolyline(GEOFENCE_POSITIONS);
|
|
POLYLINES.push(polyline);
|
|
|
|
var point = putMarkerOnMap(map, '', obj.lat, obj.lng, '', count, geofencePointImgPath, true, false, false, false);
|
|
GEOFENCE_MARKERS.push(point);
|
|
|
|
count++;
|
|
}
|
|
});
|
|
|
|
google.maps.event.addListener(map, 'mousemove', function (event) {
|
|
if (!enable_map_mousemove_geofence_brush) {
|
|
map.setOptions({ draggableCursor: '' });
|
|
}
|
|
if (enable_map_mousemove_geofence_brush) {
|
|
map.setOptions({ draggableCursor: "url(" + geofenceBrushImagePath + "), auto" })
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
/**
|
|
* To connect first and last point of geo fence
|
|
* @method connectPoints
|
|
* @for GeoFence
|
|
*/
|
|
function connectPoints() {
|
|
var point_add = []; // initialize an array
|
|
var start = GEOFENCE_POSITIONS[0]; // storing start point
|
|
var end = GEOFENCE_POSITIONS[(GEOFENCE_POSITIONS.length - 1)]; // storing end point
|
|
// pushing start and end point to an array
|
|
point_add.push(start);
|
|
point_add.push(end);
|
|
var polyline = drawPolyline(point_add); // function to join points
|
|
POLYLINES.push(polyline);
|
|
|
|
GEOFENCE_POINTS.push(GEOFENCE_POINTS[0]);
|
|
|
|
$btn_connect.hide();
|
|
enableDrawGeoFence = false;
|
|
enable_map_mousemove_geofence_brush = false;
|
|
$btn_saveGeoFence.show();
|
|
|
|
}
|
|
|
|
/**
|
|
* To enabling geo fence creation
|
|
* @method createGeoFenceEnable
|
|
* @for GeoFence
|
|
*/
|
|
function createGeoFenceEnable() {
|
|
$btn_add_geofence.hide();
|
|
|
|
enableGeoFenceCreation = true;
|
|
enable_map_mousemove_geofence_brush = true;
|
|
}
|
|
|
|
/**
|
|
* To plot optimal route and draw its geo fence if exists
|
|
* @method drawRouteAndGeofence
|
|
* @param {String} routeId route Id
|
|
* @for GeoFence
|
|
*/
|
|
function drawRouteAndGeofence(routeId) {
|
|
resetMap();
|
|
|
|
ROUTE_ID = routeId;
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.GetRouteByRouteId,
|
|
data: { RouteId: ROUTE_ID },
|
|
dataType: "json",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
beforeSend: function (xhr) {
|
|
xhr.setRequestHeader('Authorization', getCookie('token'));
|
|
},
|
|
success: function (data) {
|
|
//------- creating Route Object and storing that globally-------------------
|
|
if (data.routeAndGeofence.dealerLattitude != '') {
|
|
var srcMarker = putMarkerOnMap(map, '', data.routeAndGeofence.sourceLattitude, data.routeAndGeofence.sourceLongitude, '', 'src' + ROUTE_ID, srcMarkerImgPath, false, true, false, false);
|
|
MARKERS.push(srcMarker);
|
|
|
|
$('#dealer_name').html(data.routeAndGeofence.dealerName);
|
|
$('#dealer_id').html(data.routeAndGeofence.dealerId);
|
|
$('#dealer_contact').html(data.routeAndGeofence.dealerContact);
|
|
$('#dealer_address').html(data.routeAndGeofence.dealerAddress);
|
|
$infoWindowClone = $('#infoWindow').clone();
|
|
var destInfoWindow = $infoWindowClone.css('display', 'block').html();
|
|
var destMarker = putMarkerOnMap(map, destInfoWindow, data.routeAndGeofence.dealerLattitude, data.routeAndGeofence.dealerLongitude, '', 'dest' + ROUTE_ID, destMarkerImgPath, false, true, true, false);
|
|
MARKERS.push(destMarker);
|
|
|
|
src = new google.maps.LatLng(data.routeAndGeofence.sourceLattitude, data.routeAndGeofence.sourceLongitude);
|
|
dest = new google.maps.LatLng(data.routeAndGeofence.dealerLattitude, data.routeAndGeofence.dealerLongitude);
|
|
// creating waypoints
|
|
var waypoints = [];
|
|
if (data.routeAndGeofence.routePath != null) {
|
|
$.each(data.routeAndGeofence.routePath, function (key, val) {
|
|
waypoints.push({
|
|
location: new google.maps.LatLng(val.lat, val.lng),
|
|
stopover: true
|
|
});
|
|
});
|
|
}
|
|
drawPath(src, dest, waypoints, ROUTE_ID);
|
|
|
|
latlngbounds.extend(src); // extending lat-long object
|
|
latlngbounds.extend(dest); // extending lat-long object
|
|
}
|
|
//--------------------------------------------------------------------------
|
|
|
|
//---------Draw Geofence if available-----------------------
|
|
if ((data.routeAndGeofence.geofence != null) && (data.routeAndGeofence.geofence.length > 0)) {
|
|
var polyline = drawPolyline(data.routeAndGeofence.geofence);
|
|
POLYLINES.push(polyline);
|
|
|
|
// Place markers for geofence points
|
|
GEOFENCE_POINTS = data.routeAndGeofence.geofence;
|
|
$.each(GEOFENCE_POINTS, function (key, val) {
|
|
if (parseInt(key, 10) != (GEOFENCE_POINTS.length - 1)) {
|
|
var latlng = new google.maps.LatLng(val.lat, val.lng);
|
|
latlngbounds.extend(latlng); // extending lat-long object
|
|
|
|
var point = putMarkerOnMap(map, '', val.lat, val.lng, '', key, geofencePointImgPath, true, false, false, false);
|
|
GEOFENCE_MARKERS.push(point);
|
|
}
|
|
});
|
|
GEOFENCE_POINTS[GEOFENCE_POINTS.length - 1] = GEOFENCE_POINTS[0];
|
|
$btn_deleteGeoFence.show();
|
|
}
|
|
else {
|
|
$createGeoFence.show();
|
|
}
|
|
//----------------------------------------------------------
|
|
},
|
|
complete: function () {
|
|
// Fitting all the markers on map area present on screen
|
|
map.fitBounds(latlngbounds);
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
console.log(jqXHR);
|
|
}
|
|
});
|
|
}
|
|
/*=========================================================================================================*/
|
|
|
|
|
|
/*==============================Routes Kendo Grid=================================*/
|
|
/**
|
|
* To load all the routes in kendo grid
|
|
* @method getRoutes
|
|
* @for GeoFence
|
|
*/
|
|
function getRoutes() {
|
|
|
|
//-------------------------Routes List Grid-----------------------------------------
|
|
var routeId = "routeId",
|
|
routeName = "routeName",
|
|
dealerId = 'dealerId',
|
|
dealerName = 'dealerName';
|
|
|
|
// making grid div empty and then binding new grid to it
|
|
$grid_routeList.empty().kendoGrid({
|
|
dataSource: {
|
|
transport: {
|
|
read: {
|
|
type: "GET",
|
|
url: WCFRESTURL.GetRoutes,
|
|
dataType: "json",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
data: {},
|
|
complete: function (data) {
|
|
var objCount = JSON.parse(data.responseText);
|
|
if (objCount == 0) {
|
|
$grid_routeList.empty();
|
|
$grid_routeList.html('<div class="alert alert-danger text-center" role="alert"><h5>No Data available!</h5></div>')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
schema: {
|
|
model: {
|
|
fields: {
|
|
//routeId: { type: "string" },
|
|
routeName: { type: "string" },
|
|
dealerId: { type: "string" },
|
|
dealerName: { type: "string" }
|
|
},
|
|
}
|
|
//total: function () { return maxPage; }
|
|
},
|
|
pageSize: 20,
|
|
serverPaging: false,
|
|
change: function (data) {
|
|
//console.log(data);
|
|
},
|
|
error: function (e) {
|
|
$grid_routeList.empty();
|
|
$grid_routeList.html('<div class="alert alert-danger text-center" role="alert"><h5>No Data available!</h5></div>')
|
|
}
|
|
//serverFiltering: true,
|
|
//serverSorting: true
|
|
},
|
|
//height: 500,
|
|
filterable: true,
|
|
sortable: true,
|
|
selectable: true,
|
|
resizable: true,
|
|
//scrollable: {
|
|
// virtual: true
|
|
//},
|
|
pageable: {
|
|
//refresh: true,
|
|
//pageSizes: true,
|
|
buttonCount: 2
|
|
},
|
|
columns: [
|
|
//{ field: "routeId", title: "Route Id" },
|
|
{ field: "routeName", title: "Route Name" },
|
|
{ field: "dealerId", title: "Dealer Id" },
|
|
{ field: "dealerName", title: "Dealer Name" }
|
|
],
|
|
change: function (e) {
|
|
var selected = this.dataItem(this.select()),
|
|
_routeId = selected.routeId,
|
|
_dealerId = selected.dealerId;
|
|
|
|
// drawing route
|
|
drawRouteAndGeofence(_routeId);
|
|
},
|
|
dataBound: function (e) {
|
|
},
|
|
dataBinding: ''
|
|
});
|
|
//--------------------------------------------------------------------------
|
|
}
|
|
/*=========================================================================*/
|
|
|
|
|
|
/**
|
|
* To be called when DOM is ready
|
|
* @event document.ready
|
|
* @for GeoFence
|
|
*/
|
|
$(document).ready(function () {
|
|
// hiding all the buttons
|
|
$btn_connect.hide();
|
|
$btn_saveGeoFence.hide();
|
|
$createGeoFence.hide();
|
|
$btn_updateGeoFence.hide();
|
|
$btn_deleteGeoFence.hide();
|
|
|
|
initMap();
|
|
//$("#map").css({ "position": "inherit", "overflow": "auto" });
|
|
|
|
|
|
|
|
getRoutes();
|
|
|
|
// initializing map
|
|
|
|
// getting routes
|
|
|
|
});
|
|
function getCookie(cname) {
|
|
var name = cname + "=";
|
|
var ca = document.cookie.split(';');
|
|
for (var i = 0; i < ca.length; i++) {
|
|
var c = ca[i];
|
|
while (c.charAt(0) == ' ') c = c.substring(1);
|
|
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
|
|
}
|
|
return "";
|
|
} |