EOS/Views/Tracking/LiveTracking.cshtml
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

2884 lines
110 KiB
Plaintext

@{
ViewBag.Title = System.Configuration.ConfigurationManager.AppSettings["Title"] + " | " + System.Configuration.ConfigurationManager.AppSettings["TitleLiveTracking"];
Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
var mapApiKey = System.Configuration.ConfigurationManager.AppSettings["GoogleId"];
//(mapApiKey);
var src1 = "https://maps.googleapis.com/maps/api/js?v=3&libraries=places&key=" + mapApiKey;
}
<script id="scriptMapApi" type="text/javascript" src='@src1'></script>
<div id="div_load">
<img src="~/Content/images/13.gif" style="display: block; position: absolute; top: 44%; left: 48%;" />
</div>
<script type="text/javascript">
$("#div_load").show(); // Showing loading
</script>
<div id="dvLiveTracking">
<div class="size40 sizeP40 left">
<div class="window">
<div class="titlebar">
<div class="title">
EOS Team List
</div>
</div>
<div class="innerWindow">
<div class="menubar">
<div class="searchBox" title="Quick Search">
<div class="inputBox">
<input type="text" id="txtSearch" />
</div>
<div class="sIcon">
<img alt="" src="@Url.Content("~/Content/images/search-icon.png")" />
</div>
</div>
</div>
<div class="content withmenubar">
<div class="listBox" data-bind="visible: $root.employees().length>0">
<table id="tableDevices" cellpadding="0" cellspacing="0" width="100%" class="OpenTicketTbl">
<thead>
<tr class="">
<th style="text-align: left;">S.No.</th>
<th class="" style="text-align: left;">EOS Team</th>
<th class="" style="text-align: left;">License No.</th>
<th class="" style="text-align: left;">Region</th>
<th style="text-align: left;">Mobile No.</th>
<th class="" style="text-indent: 0; text-align: left;">Van Reg. No.</th>
<th style="text-align: left;">Status</th>
<th style="text-align: left;" id="batteryColumn">Battery</th>
<th style="text-align: left;">Van Inactive Hours</th>
@if (HttpContext.Current.Session["UserRole"].ToString().ToLower().Trim() == "dealer")
{
<th style="text-align: left;">Action</th>
}
</tr>
</thead>
<tbody data-bind="foreach: employees">
<tr data-bind="attr:{ id:$data.ServiceEngineerDeviceAlias }, css: { activeListTr: $data == $root.chosenEmployee() },click: $root.showEmployeeDetail">
<td>
<label class="handMouse" data-bind="text : $index() + 1">
</label>
</td>
<td>
<label class="handMouse">
<label data-bind="text: DealerDealerName"></label>
(<label data-bind="text: ServiceEngineerName"></label>)
</label>
</td>
<td>
<label class="handMouse" data-bind="text: ServiceEngineerApplicationLicenseKey">
</label>
</td>
<td>
<label class="handMouse" data-bind="text: OrganizationName">
</label>
</td>
<td>
<label class="handMouse" data-bind="text: ServiceEngineerContactNumber">
</label>
</td>
<td>
<label class="handMouse" data-bind="text: VanRegistrationNumber">
</label>
</td>
<td>
<span class="green-circle handMouse" data-bind="visible: IsConnected" title="Connected"></span>
<span class="red-circle handMouse" data-bind="visible:!IsConnected" title="Not connected"></span>
</td>
<td data-bind="visible: UserId!='dealer'">
<!-- <meter class="mid fleft batteryCell battery_status_full" max="100" data-bind="attr: { value: BatteryStatus, title: BatteryStatus+'%'}"></meter>-->
<div data-bind="visible: BatteryStatus <= 40">
<div class="meter red">
<label data-bind="text: BatteryStatus+'%'" style="position: absolute; color: #000; top: 8px; z-index: 9999; left: 0; width: 100%; text-align: center;"></label>
<span class="" max="100" data-bind="style: { width: BatteryStatus+'%' }"></span>
</div>
</div>
<div data-bind="visible: BatteryStatus > 40">
<div class="meter">
<label data-bind="text: BatteryStatus+'%'" style="position: absolute; top: 8px; z-index: 9999; left: 0; width: 100%; text-align: center;"></label>
<span class="" max="100" data-bind="style: { width: BatteryStatus+'%' }"></span>
</div>
</div>
<div class="fleft batteryPoint"></div>
<div class="clear"></div>
</td>
<td>
<label class="handMouse" onclick="" data-bind="text: van_working_hours">
</label>
</td>
@if (HttpContext.Current.Session["UserRole"].ToString().ToLower().Trim() == "dealer")
{
<td>
<label class="handMouse" data-bind="click: $root.saveWorkingHours.bind($data,VanId, van_start_working_hours, van_end_working_hours)">
<img src="~/Content/images/action.png" />
</label>
</td>
}
</tr>
</tbody>
</table>
</div>
<!-- no data message -->
<div id="nodata_msg" class="no_data no_dataLeftPanel" style="top: 0%;">
<span>
<p class="fs16">Please select filters and press Apply button to view report.</p>
</span>
</div>
<div id="divNoDataFound" class="no_data no_dataLeftPanel" style="display: none">
<span>
<p class="fs16">No data available on selected filter !!!</p>
<p>Please select different filter.</p>
</span>
</div>
<!-- End of no data message -->
</div>
</div>
</div>
</div>
<div class="size60 sizeP60 right">
<div class="window">
<div class="titlebar">
<div class="title">
Device on Map
</div>
<div class="menubar" style="top: 23px !important">
<div class="datalist_wrp">
<div class="fleft">
<label>State</label>
<input id="stateCombobox" style="width: 150px;" placeholder="Select State..." />
</div>
<div class="fleft" style="margin-left: 10px; margin-right: 10px;">
<label>City</label>
<input id="cityCombobox" style="width: 150px;" placeholder="Select City..." />
</div>
<div class="fleft">
<label>Dealers</label>
<input id="dealerCombobox" style="width: 150px;" placeholder="Select Dealer..." />
</div>
<input type="submit" id="btnApply" data-bind="click: $root.getAllEmployees" value="Apply" class="button_blue fleft" style="width: auto; /*padding: 0px 11px 2px 5px; */ height: 23px; overflow: hidden; margin-top: 1px; text-transform: inherit; margin-right: 5px; margin-left: 15px; line-height: 7px; font-family: Verdana;" />
<div class="excelIcon fright" title="Download As Excel" data-bind="click: $root.exportReport" style="display: block"></div>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="divDetail" class="innerWindow" style="top: 62px !important;">
<div id="divMapContainer" class="content">
</div>
</div>
</div>
</div>
<div id="divDetails" style="display: none;">
<div class="">
<div class="">
<h2 class="EngName_heading">
<div class="fleft" data-bind="text: ServiceEngineerName"></div>
<div class="fright"><i>Last Online Time</i> :<label data-bind="text: Message"></label></div>
<div class="clear"></div>
</h2>
<div style="width: 467px; overflow: auto;">
<table class="InfoWindowTbl" width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="">
<span>Organization Name</span>
</td>
<td data-bind="text: OrganizationName"></td>
<td>
<span>EOS Team Member</span>
</td>
<td data-bind="text: ServiceEngineerName"></td>
<td>
<span>VAN Registration No.</span>
</td>
<td data-bind="text: VanRegistrationNumber"></td>
</tr>
<tr>
<td>
<span>Dealer Name</span>
</td>
<td data-bind="text: DealerDealerName"></td>
<td>
<span>Mobile No.</span>
</td>
<td data-bind="text: ServiceEngineerContactNumber"></td>
<td>
<span>IMEI</span>
</td>
<td data-bind="text: ServiceEngineerImeiNumber"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="divShowDealerLocation" style="display: none; /*min-height: 150px; height: auto; */">
</div>
</div>
</div>
<div id="dvscvcrm" class="">
<div class="window">
<div class="titlebar">
<div class="menubar" style="top: 35px !important;width: 50%;margin: 0 auto;">
<div class="title">
Enter Deatils :
</div>
</div>
</div>
<div class="datalist_wrp" style="margin-top: 71px;margin: 70px auto 0;">
<table style="margin-left: 218px;" class="OpenTicketTbl">
<tr>
<thead>
<th>Customer Name :</th>
<th>Customer Mobile Number</th>
<th>Address of Customer</th>
<th>Quantity</th>
<th>Existing User of SCV</th>
<th id="thoem">OEM Name</th>
<th>Action</th></thead>
<tr>
<td>
<input id="txtCustomername" class="controls" type="text" placeholder="Customer Name">
</td>
<td>
<input id="txtMobileNo" class="controls" type="text" placeholder="Customer Mobile Number">
</td>
<td>
<input id="txtAddress" class="controls" type="text" placeholder="Address of Customer">
</td>
<td>
<input id="txtQuantity" class="controls" type="text" placeholder="Quantity">
</td>
<td>
<input id="rdoYesOEm" type="radio" checked name="EOm" style="height: 16px; margin-left: -43px; margin-top: 4px;" value="Yes" onclick="iseom();" />
<label labelfor="rdoYesOEm" style="margin-left: -54px;">
Yes
</label>
<input id="rdoNoOEm" type="radio" name="EOm" style="height: 16px; margin-left:-42px;" value="No" onclick="iseom();" />
<label labelfor="rdoNoOEm" style="height: 16px; margin-left:-56px;">No</label>
</td>
<td id="tdEomName">
<input id="txtOeNname" class="controls" type="text" placeholder="OEM Name">
</td>
<td>
<div style="margin-left: 183px; margin: 0 auto; "> <input type="submit" id="btnSCV" onclick="saveSCvDeatils();" value="Submit" class="button_blue fleft" style="width: auto; /*padding: 0px 11px 2px 5px; */ height: 23px; overflow: hidden; margin-top: 0px; text-transform: inherit; margin-right: 0px; margin-left: 0px; line-height: 7px; font-family: Verdana;" /></div>
</td>
</tr>
</table>
<div class="clear"></div>
</div>
</div>
</div>
@*<div id="dvServiceStation" class="">
<div class="window">
<div class="titlebar">
<div class="menubar" style="top: 35px !important;width: 50%;margin: 0 auto;">
<div class="title">
Search nearby service station :
</div>
</div>
</div>
<div id="dvlDealerNameSearch" style="display: block; width: 50%; margin-right: auto; margin-bottom: 0px; margin-left: auto; margin-top: 12px !important;">
<input id="txtRegNo" class="controls" type="text" style="margin-top:68px;" placeholder="Reg No">
</div>
<div style="margin-left: 183px; width: 50%; margin: 0 auto; margin-top: 19px;"> <input type="submit" id="btsearchstation" onclick="showservicestation();" value="Submit" class="button_blue fleft" style="width: auto; /*padding: 0px 11px 2px 5px; */ height: 23px; overflow: hidden; margin-top: 0px; text-transform: inherit; margin-right: 0px; margin-left: 0px; line-height: 7px; font-family: Verdana;" /></div>
</div>
</div>*@
<div id="dvAccidental" class="">
<div class="window">
<div class="titlebar">
<div class="menubar" style="top: 35px !important;width: 50%;margin: 0 auto;">
<div class="title">
Enter Deatils :
</div>
</div>
</div>
<div class="datalist_wrp" style="margin-top: 71px;margin: 70px auto 0;">
<table style="margin-left: 218px;" class="OpenTicketTbl">
<tr>
<thead>
<th>Customer Name :</th>
<th>Customer Mobile Number</th>
<th>Vehicle Location</th>
<th>Registration Number</th>
<th>Ambulance Support Required</th>
<th>Dealer Support Required</th>
<th id="thDealename"> Dealer Connect</th>
<th>Action</th></thead>
<tr>
<td>
<input id="txtAccidentalCustomername" class="controls" type="text" placeholder="Customer Name">
</td>
<td>
<input id="txtAccidentalMobileNo" class="controls" type="text" placeholder="Customer Mobile Number">
</td>
<td>
<input id="txtAccidentalAddress" class="controls" type="text" placeholder="Address of Customer">
</td>
<td>
<input id="txtRegnoAccidental" class="controls" type="text" placeholder="Registration Number">
</td>
<td style="white-space:nowrap;">
<input id="rdoYesAcidental" type="radio" checked name="Accidental" style="width:auto;" value="Yes" />
<label labelfor="rdoYesAcidental">
Yes
</label>
<input id="rdoNoAcidental" type="radio" name="Accidental" style="width:auto;" value="No" />
<label labelfor="rdoNoAcidental">No</label>
</td>
<td style="white-space:nowrap;">
<input id="rdoYesDealerSip" type="radio" checked name="DealerShip" style="width:auto;" value="Yes" onclick="isdealerconnect();" />
<label labelfor="rdoYesDealerSip">
Yes
</label>
<input id="rdoNoDealerSip" type="radio" name="DealerShip" style="width:auto;" value="No" onclick="isdealerconnect();" />
<label labelfor="rdoNoDealerSip">No</label>
</td>
<td id="tdDealename">
<select id="ddlDealerAccidental" onchange="setdealerval();">
</select>
<input id="txtdealerconnect" class="controls" style="display:none;" type="text" placeholder="Dealer ">
</td>
<td>
<div style="margin-left: 183px; margin: 0 auto; "> <input type="submit" id="btnSCV" onclick="saveAccidentalDeatils();" value="Submit" class="button_blue fleft" style="width: auto; /*padding: 0px 11px 2px 5px; */ height: 23px; overflow: hidden; margin-top: 0px; text-transform: inherit; margin-right: 0px; margin-left: 0px; line-height: 7px; font-family: Verdana;" /></div>
</td>
</tr>
</table>
<div class="clear"></div>
</div>
</div>
</div>
<div id="dvdealerList" class="">
<div class="window">
<div class="titlebar">
<div class="menubar" style="top: 35px !important;width: 50%;margin: 0 auto;">
<div class="title">
Search Active Van By :
</div>
</div>
</div>
<div class="datalist_wrp" style="margin-top: 71px;width: 50%;margin: 70px auto 0;">
<div class="fleft">
<input id="rdoYes" type="radio" name="gender" style="height: 16px; margin-left: -54px; margin-top: 2px;" value="Yes" onclick="getDealerListByName();" />
<label labelfor="rdoYes" style="margin-left: -45px;">
Dealer Name
</label>
<input id="rdoNo" type="radio" name="gender" style="height: 16px; margin-left:-45px;" value="No" onclick="getDealerListBy1sCode();" />
<label labelfor="rdoNo" style="height: 16px; margin-left:-43px;">1SCode</label>
</div>
<div class="clear"></div>
</div>
<div id="dvlDealer" style="display: block; width: 50%; margin-right: auto; margin-bottom: 0px; margin-left: auto; margin-top: 12px !important;">
<input id="DealerIdCombobox" style="width: 150px; display: none;" placeholder="Select 1SCode..." data-role="combobox" aria-disabled="false" aria-readonly="false">
</div>
<div id="dvlDealerName" style="display: block; width: 50%; margin-right: auto; margin-bottom: 0px; margin-left: auto; margin-top: 12px !important;">
<input id="DealerNameCombobox" style="width: 150px; display: none;" placeholder="Select Dealership Name..." data-role="combobox" aria-disabled="false" aria-readonly="false">
</div>
<div style="width: 50%;margin: 0 auto;margin-top: 15px;"> <input type="submit" id="btnApplySearch" onclick="showvanreassign();" value="Submit" class="button_blue fleft" style="width: auto; /*padding: 0px 11px 2px 5px; */ height: 23px; overflow: hidden; margin-top: 0px; text-transform: inherit; margin-right: 0px; margin-left: 0px; line-height: 7px; font-family: Verdana;" /></div>
<div id="trid"></div>
</div>
<div id="dvLivevansearch" style="display:none;clear: both;position: absolute;margin-top: 200px;margin-left: 9px;width: 100%;height: 800px;overflow-x: scroll;overflow-y: scroll;">
<div class="">
<div class="window">
<div class="titlebar">
<div class="title">
EOS Team List
</div>
</div>
<div class="innerWindow">
<div class="content withmenubar">
<div class="listBox" data-bind="visible: $root.employees().length>0">
<table id="tableDevices" cellpadding="0" cellspacing="0" width="100%" class="OpenTicketTbl" style="overflow: scroll;width: 100%;">
<thead>
<tr class="">
<th style="text-align: left;">S.No.</th>
<th class="" style="text-align: left;">Dealership Name</th>
<th style="text-align: left;"> EOS Team Member Name</th>
<th style="text-align: left;">EOS VAN Registration Number</th>
<th style="text-align: left;"> EOS Mobile Number</th>
<th style="text-align: left;"> Online/Offline Status</th>
<th style="text-align: left;">License Key</th>
@*<th style="text-align: left;">Last Online Location or Coordinates</th>*@
</tr>
</thead>
<tbody id="tvansearh">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="dvdealersearchList" class="">
<div class="window">
<div class="titlebar">
<div class="menubar" style="top: 35px !important;width: 50%;margin: 0 auto;">
<div class="title" id="dvtitleDealer">
Search nearby dealership :
</div>
</div>
</div>
<div class="datalist_wrp" style="margin-top: 71px;margin: 70px auto 0;" id="dvDealerCombo">
<div id="dvlDealerNamecombo" style="display: block; width: 50%; margin-right: auto; margin-bottom: 0px; margin-left: auto; margin-top: 12px !important;">
<input id="fueltypeCombobox" style="width: 150px; display: block;" placeholder="Select Fuel Type..." data-role="combobox" aria-disabled="false" aria-readonly="false">
</div>
<div class="clear"></div>
</div>
<div id="dvlDealerNameSearch" style="display: block; width: 50%; margin-right: auto; margin-bottom: 0px; margin-left: auto; margin-top: 12px !important;">
<div class="sugList-holder" id="sugList-holder">
<ul id="sugList" class="sugList"></ul>
<input id="searchLocationTool" class="controls" type="text" style="position: fixed;margin-left:-213px; " placeholder="Search Breakdown Address" oninput="getlatlong();">
</div>
</div>
<div style="margin-left: 183px; width: 50%; margin: 0 auto; margin-top: 100px;"> <input type="submit" id="btnApplySearchdealer" onclick="showdealers();" value="Submit" class="button_blue fleft" style="width: auto; /*padding: 0px 11px 2px 5px; */ height: 23px; overflow: hidden; margin-top: 0px; text-transform: inherit; margin-right: 0px; margin-left: 0px; line-height: 7px; font-family: Verdana;" /></div>
<div id="dvlServicecombo" style="clear: both; display: none; width: 50%; margin-right: auto; margin-bottom: 0px; margin-left: auto; margin-top: 12px !important;">
<input id="seviceCombobox" style="width: 150px; display: block;" onchange="setScript();" placeholder="Select Fuel Type..." data-role="combobox" aria-disabled="false" aria-readonly="false">
</div>
<div>
<div class="box" id='dvHindi' style="display:none;">
आपकी लोकेशन से नजदीकी चार्जिंग स्टेशन <span id="spnlocactionHindi"></span>है, जो आपके द्वारे बताई गई लोकेशन से लगभग <span id="spnDistanceHindi"></span> पर है, साथ ही साथ हम आपको एक SMS भी भेज रहे हैं जिसमें आपको चार्जिंग स्टेशन की जानकारी और लोकेशन लिंक प्राप्त होगा, उस लोकेशन लिंक पर क्लिक करके आप आसानी से चार्जिंग स्टेशन तक पहुंच सकते हैं।''
</div>
<div class="box" id="dvEnglish" style="display:none;">
The nearest charging station from your location is <span id="spnlocactionEnglish"></span>, which is approximately <span id="spnDistanceEnglish"></span>from the location provided by you. We are also sending you a SMS in which you will get the information about the charging station and the location link. By clicking on that location link, you can easily reach at charging station.
</div>
<div class="box" id="dvTamil" style="display:none;">
உங்கள் இடத்தில் இருந்து அருகிலுள்ள சார்ஜிங் நிலையம் <span id="spnlocactionTamil"></span> ஆகும், இது நீங்கள் வழங்கிய இடத்தில் இருந்து சுமார் <span id="spnDistanceTamil"></span> தூரத்தில் உள்ளது. அதற்கான தகவல்களும், அதன் இடக் கண்ணோட்டத்துடன் ஒரு SMS நாங்கள் அனுப்பி விடுகின்றோம். அந்த இடக் கண்ணோட்டத்தை கிளிக் செய்து, நீங்கள் எளிதாக சார்ஜிங் நிலையத்திற்கு செல்ல முடியும்."
</div>
<div class="box" id="dvTelugu" style="display:none;">
మీ ప్రదేశం నుండి సమీపంలో ఉన్న చార్జింగ్ స్టేషన్ <span id="spnlocactionTelugu"></span> అయి ఉంటుంది, ఇది మీరు ఇచ్చిన ప్రదేశం నుండి సుమారు <span id="spnDistanceTelugu"></span> దూరంలో ఉంది. మేము మీకు చార్జింగ్ స్టేషన్ మరియు దాని స్థానం లింక్ గురించి సమాచారం కలిగిన ఒక SMS పంపిస్తున్నాము. ఆ లింక్‌పై క్లిక్ చేయడం ద్వారా మీరు సులభంగా చార్జింగ్ స్టేషన్‌కు చేరుకోవచ్చు."
</div>
<div class="box" id="dvKannada" style="display:none;">
ನಿಮ್ಮ ಸ್ಥಳದಿಂದ ಸಮೀಪದ ಚಾರ್ಜಿಂಗ್ ಸ್ಟೇಷನ್ <span id="spnlocactionKannada"></span> ಆಗಿದ್ದು, ಇದು ನೀವು ನೀಡಿದ ಸ್ಥಳದಿಂದ ಸುಮಾರು <span id="spnDistanceKannada"></span> ದೂರದಲ್ಲಿದೆ. ಅದರ ಬಗ್ಗೆ ಮಾಹಿತಿಯೊಂದಿಗೆ, ಮತ್ತು ಸ್ಥಳ ಲಿಂಕ್‌ನ್ನು ಒಳಗೊಂಡ SMS ಅನ್ನು ನಾವು ನಿಮಗೆ ಕಳುಹಿಸುತ್ತಿದ್ದೇವೆ. ಆ ಲಿಂಕ್‌ನ ಮೇಲೆ ಕ್ಲಿಕ್ ಮಾಡುವ ಮೂಲಕ ನೀವು ಸುಲಭವಾಗಿ ಚಾರ್ಜಿಂಗ್ ಸ್ಟೇಷನ್‌ಗೆ ತಲುಪಬಹುದು."
</div>
<div class="box" id="dvMalyalam" style="display:none;">
നിങ്ങളുടെ സ്ഥലത്ത് നിന്നുള്ള ഏറ്റവും അടുത്ത ചാർജിംഗ് സ്റ്റേഷൻ <span id="spnlocactionMalyalam"></span> ആണ്, ഇത് നിങ്ങൾ നൽകിയ സ്ഥലത്തിൽ നിന്ന് ഏകദേശം <span id="spnDistanceMalyalam"></span> ദൂരത്തിൽ സ്ഥിതിചെയ്യുന്നു. ചാർജിംഗ് സ്റ്റേഷന്റെ വിവരങ്ങളും അതിന്റെ സ്ഥലം ലിങ്ക്‌ഉം ഉൾപ്പെട്ട ഒരു SMS ഞങ്ങൾ നിങ്ങൾക്ക് അയച്ചുകൊടുക്കുന്നു. ആ ലിങ്ക് ക്ലിക്കുചെയ്ത്, നിങ്ങൾ എളുപ്പത്തിൽ ചാർജിംഗ് സ്റ്റേഷനിലേക്ക് എത്തിക്കാൻ കഴിയും."
</div>
</div>
</div>
<div id="dvLivedealervansearch" style="display:none;clear: both;position: absolute;margin-top: 250px;margin-left: 9px;width: 100%;height: 800px;overflow-x: scroll;overflow-y: scroll;">
<div class="" id="dvlistdetails">
<div class="window">
<div class="titlebar">
<div class="title">
Dealer List
</div>
</div>
<div class="innerWindow">
<div class="content withmenubar">
<div id="dvdealerclass" class="listBox" style="overflow: scroll;height: 350px; margin: 0 auto;" data-bind="visible: $root.employees().length>0">
<table id="tableDevices" cellpadding="0" cellspacing="0" class="OpenTicketTbl" style="overflow: scroll;">
<thead>
<tr class="">
<th style="text-align: left;">S.No.</th>
<th class="" style="text-align: left;">Dealership Name</th>
<th style="text-align: left;">S code</th>
<th style="text-align: left;">City</th>
<th style="text-align: left;"> State</th>
<th style="text-align: left;"> Distance (in KM)</th>
<th style="text-align: left;">Dealership Escalation Matrix</th>
@*<th style="text-align: left;">Last Online Location or Coordinates</th>*@
</tr>
</thead>
<tbody id="tvansearhDealer">
</tbody>
</table>
</div>
<div id="divCreateDealer" style="display: block; /*min-height: 150px; height: auto; */">
</div>
</div>
</div>
</div>
</div>
<div class="" id="dvlisservicesttation">
<div class="window">
<div class="titlebar">
<div class="title">
Dealer List
</div>
</div>
<div class="innerWindow">
<div class="content withmenubar">
<div id="dvdealerclassstation" class="listBox" style="overflow: scroll;height: 350px; margin: 0 auto;" data-bind="visible: $root.employees().length>0">
<table id="tableDevicesstation" cellpadding="0" cellspacing="0" class="OpenTicketTbl" style="overflow: scroll;">
<thead>
<tr class="">
<th style="text-align: left;">S.No.</th>
<th class="" style="text-align: left;">Charging Station Name</th>
<th style="text-align: left;">Address</th>
<th style="text-align: left;">City</th>
<th style="text-align: left;"> State</th>
<th style="text-align: left;"> Distance (in KM)</th>
<th style="text-align: left;">Send SMS</th>
</tr>
</thead>
<tbody id="tvansearhserviceStation">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="dvEpsSales" class="">
<div class="window">
<div class="titlebar">
<div class="menubar" style="top: 35px !important;width: 50%;margin: 0 auto;">
<div class="title">
EPS Sales Lead :
</div>
</div>
</div>
<div class="datalist_wrp" style="margin-top: 71px;margin: 70px auto 0;">
<table style="margin-left: 218px;" class="OpenTicketTbl">
<tr>
<thead>
<th>Customer Name :</th>
<th>Customer Mobile Number</th>
<th>Location</th>
<th>Quantity</th>
<th>Product Type</th>
<th>Action</th></thead>
<tr>
<td>
<input id="txtEPSSalesCustomername" class="controls" type="text" placeholder="Customer Name">
</td>
<td>
<input id="txtEPSSalesMobileNo" class="controls" type="text" placeholder="Customer Mobile Number">
</td>
<td>
<input id="txtEPSSalesAddress" class="controls" type="text" placeholder="Address of Customer">
</td>
<td>
<input id="txtEPSQuantity" class="controls" type="text" placeholder="Quantity">
</td>
<td>
<select id="ddlEPSProductType">
<option id="--select--">Select</option>
<option id="Harvester">Harvester</option>
<option id="GENSET">GENSET</option>
<option id="Industrial">Industrial</option>
<option id="Axles">Axles</option>
<option id="NE">NE</option>
</select>
</td>
<td>
<div style="margin-left: 183px; margin: 0 auto; "> <input type="submit" id="btnSCV" onclick="EPSSalesDetails();" value="Submit" class="button_blue fleft" style="width: auto; /*padding: 0px 11px 2px 5px; */ height: 23px; overflow: hidden; margin-top: 0px; text-transform: inherit; margin-right: 0px; margin-left: 0px; line-height: 7px; font-family: Verdana;" /></div>
</td>
</tr>
</table>
<div class="clear"></div>
</div>
</div>
</div>
<div class="clear"></div>
@*<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>*@
@*<link href="@Url.Content("~/Content/css/page-layout.css")" rel="stylesheet" type="text/css" />*@
@*<script type="text/javascript" src="@Url.Content("~/Scripts/map_api/ccplGoogleMap.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/map_api/ccplMapAPI.js")"></script>*@
<script src="@Url.Content("~/Scripts/knockout-2.2.0.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Tracking/LiveTracking.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Shared/common.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/kendo.all.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/kendo/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/kendo.default.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Scripts/kendo/2013.3.1324/kendo.aspnetmvc.js")" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="~/Scripts/loader.js"></script>
<script type="text/javascript" src="~/Scripts/bootstrap.min.js"></script>
@*<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>*@
<script type="text/javascript">
var largearr = [];
var securityToken = '@ViewBag.SecurityToken';
var UtcMinutes = '@ViewBag.UtcMinutes';
var userId = '@ViewBag.Userid';
var userRole = '@ViewBag.UserRole';
var searchBox = null;
var ccplMap = null;
var marker;
var distanceval = [];
var placeLocationMarkerArray = [];
var breakdownLocationLatLng = "";
var displayDisplay = ""; //route direction display
var displayHighway = "";
var _copyResulEls = [];
var ctrName = 0;
var isservicestation = 'f';
var isepssaleslead = 'f';
function SetKendoWindowTitle(divId, titleText) {
var dialog = $(divId).data("kendoWindow");
dialog.title(titleText);
}
function loadDealerList() {
var ctr = 0;
$.ajax({
type: "GET",
url: "http://eos.eicher.in:8181/Api/NewDashboard?dealer=dealer&dealer1=dealer1",
success: function (data) {
html = "";
var keyVar;
var html1 = "";
for (keyVar in data) {
if (data.hasOwnProperty(keyVar)) {
ctr = ctr + 1;
var strvval = data[keyVar].DealerId + "/" + data[keyVar].DealerName;
html += '<option value="' + strvval + '">' + strvval + '</option>';
}
}
$('#ddlDealer').append(html);
},
complete: function () {
},
error: function (data) {
// console.log(data);
}
});
}
function setdealerval() {
var ddlDealerval = $('#ddlDealerAccidental').val();
$('#txtdealerconnect').val(ddlDealerval);
}
function closeWindow(divId) {
if (divId == "divShowDealerLocation") {
$('#searchLocationTool').html('');
}
$(divId).data("kendoWindow").close();
}
function addKendoWindowToDiv(divId, titleText, width, left) {
$(divId).kendoWindow({
width: width,
title: titleText,
modal: true,
resizable: false,
draggable: true,
position: {
top: 95,
left: left
}
});
}
/// for dealer search by location
function showdealers() {
if (isservicestation == 't') {
var diskm = "";
var disval = "";
var sumLengt = "0.0";
var latlong = breakdownLocationLatLng;
var lat = latlong.lat();
var lng = latlong.lng();
var apiUrl = url + "Api/ServiceStation";
$.ajax({
type: "Post",
url: url + "Api/ServiceStation",
dataType: "json",
data: { Token: "teramatrix", lattitude: lat, longitude: lng },
success: function (dataRes) {
if (dataRes.length > 0) {
// vanDealerLatLngArr.length = 0;
for (var counter = 0; counter < dataRes.length; counter++) {
console.log(dataRes[counter].longitude);
var url = "https://router.hereapi.com/v8/routes?transportMode=car&routingMode=short&avoid[features]=ferry&"
url += "origin=" + dataRes[counter].lattitude + "," + dataRes[counter].longitude + "&destination=" + lat + "," + lng + "&return=polyline,summary&apikey=DW3-YCFFZtJzlAQpTfVPoXADcZpEeZe3t8h6ganVsqo";
// console.log(url);
var request = GetDataHerefromAPI("get", url);
if (request) {
request.onload = function (data) {
var res = JSON.parse(data.target.response);
var response = (res.routes[0].sections[0]);
var summary = response.summary;
distanceval = (summary.length/1000);
if (distanceval < 100) {
distanceval = (summary.length / 1000).toFixed(2);
distanceval = (Math.round(distanceval * 10) / 10).toFixed(1);
}
else {
distanceval = (summary.length / 1000);
distanceval = Math.round(distanceval);
}
disval = distanceval + ' km';
sumLengt = summary.length;
// var idval = 'txt' + dataRes[counter].DealerSCode;
// var durationval = { text: ressummary.slice(ressummary.indexOf("time") + 6, ressummary.indexOf("</span>.")), value: traffictimeval }
trString += '<tr data-distance="' + disval + '" data-name="' + dataRes[counter].name + '" ><td' + cnt + ' inset;" >*</td><td>' + dataRes[counter].name + '</td><td>' + dataRes[counter].address + '</td><td>' + dataRes[counter].city + '</td><td>' + dataRes[counter].state + '</td ><td>' + disval + '</td >';
trString += '<td><input data-managername="' + dataRes[counter].name + '" data-lattitude="' + dataRes[counter].lattitude + '" data-longitude="' + dataRes[counter].longitude + '" type="button" class="button_blue fleft" style="width:auto;" onclick="getsmsbox(this);" value="Send SMS"></td>';
cnt++;
if (data.length = 20) {
isbind = 2;
}
}
request.send();
}
}
}
},
complete: function () {
if (isbind == 2) {
issorted = 2;
loadSercieScrpit();
setTimeout(function () {
var distance = $("#tvansearhserviceStation tr:first").attr("data-distance");
var name = $("#tvansearhserviceStation tr:first").attr("data-name");
var table = $("#tvansearhserviceStation");
var rows = table.find("tr").toArray().sort(function (a, b) {
var valA = parseFloat($(a).attr("data-distance"));
var valB = parseFloat($(b).attr("data-distance"));
return valA - valB; // Sort numerically
});
table.append(rows);
$("#spnDistanceHindi").html(distance);
$("#spnlocactionHindi").html(name);
$("#dvHindi").show();
$("#dvEnglish").hide();
$("#dvTelugu").hide();
$("#dvTamil").hide();
$("#dvKannada").hide();
$("#dvMalyalam").hide();
}, 1000);
$('#dvLivedealervansearch').show();
$('#tvansearhserviceStation').html(trString);
// $('#dvLivedealervansearch').hide();
$('#dvlisservicesttation').show();
$('#dvdealerclass').hide();
$('#dvlServicecombo').show();
$('#dvdealerclassstation').show();
}
if (issorted == 2) {
var $locations = $("#tvansearhserviceStation");
// Sort the list items by their data-distance attribute
var sortedItems = $locations.children("tr").sort(function (a, b) {
return $(a).data("distance") - $(b).data("distance");
});
// Append the sorted items back to the list
// Get only the top 15 rows
var top15Items = sortedItems.slice(0, 15);
// Clear existing rows and append the top 15 sorted rows
$locations.empty().append(top15Items);
// $locations.append(sortedItems);
// Add or update serial numbers
sortedItems.each(function (index, row) {
// Find or create the serial number cell
var $serialCell = $(row).find(".serial-number");
if ($serialCell.length === 0) {
// Add a new serial number cell at the start of the row
$(row).prepend(`<td class="serial-number">${index + 1}</td>`);
} else {
// Update the existing serial number cell
$serialCell.text(index + 1);
}
});
}
},
error: function (data) {
}
});
}
else {
_copyResulEls = [];
var vanDealer1scode, vanDealerLat, vanDealerLng, vanDealerCity, vanDealerName, vanDealerState;
var latlong = breakdownLocationLatLng; //"23.22978,69.76077";
var cnt = 1;
var issorted = 1;
var isbind = 1;
$('#tvansearhDealer').html('');
var lat = latlong.lat();
var lng = latlong.lng();
var distanceval = "";
var durationval = "";
var trString = "";
var fueltype = $("#fueltypeCombobox").val();
var apiUrl = url + "Api/GetAllVan";
$.ajax({
url: apiUrl,
type: 'POST',
data: { Fuel_type: fueltype, Token: securityToken, DealerVanLattitude: lat, DealerVanLongitude: lng },
success: function (dataRes) {
if (dataRes.length > 0) {
// vanDealerLatLngArr.length = 0;
for (var counter = 0; counter < dataRes.length; counter++) {
var url = "https://router.hereapi.com/v8/routes?transportMode=car&routingMode=short&avoid[features]=ferry&"
url += "origin=" + dataRes[counter].DealerVanLattitude + "," + dataRes[counter].DealerVanLongitude + "&destination=" + lat + "," + lng + "&return=polyline,summary&apikey=DW3-YCFFZtJzlAQpTfVPoXADcZpEeZe3t8h6ganVsqo";
// console.log(url);
var request = GetDataHerefromAPI("get", url);
if (request) {
request.onload = function (data) {
var res = JSON.parse(data.target.response);
var response = (res.routes[0].sections[0]);
var summary = response.summary;
distanceval = (summary.length / 1000);
if (distanceval < 100) {
distanceval = (summary.length / 1000).toFixed(2);
distanceval = (Math.round(distanceval * 10) / 10).toFixed(1);
}
else {
distanceval = (summary.length / 1000);
distanceval = Math.round(distanceval);
}
var diskm = (summary.length / 1000);
var disval = distanceval + ' km';
var idval = 'txt' + dataRes[counter].DealerSCode;
// var durationval = { text: ressummary.slice(ressummary.indexOf("time") + 6, ressummary.indexOf("</span>.")), value: traffictimeval }
trString += '<tr data-distance="' + summary.length + '" id="' + dataRes[counter].DealerSCode + '" ><td' + cnt + ' inset;" >*</td><td>' + dataRes[counter].DealerVanName + '</td><td>' + dataRes[counter].DealerSCode + '</td><td>' + dataRes[counter].DealerVanCity + '</td><td>' + dataRes[counter].DealerVanState + '</td ><td>' + disval + '</td >';
trString += '<td><input type="button" class="button_blue fleft" style="width:auto;" ' +
'data-DealerVanName="' + dataRes[counter].DealerVanName + '" ' +
'data-dealerid="' + dataRes[counter].DealerSCode + '" ' +
'value="Click here" ' +
'onclick="getescalation(this)" ' +
'id="' + idval + '" />' +
'</td></tr >';
cnt++;
if (data.length = 20) {
isbind = 2;
}
}
request.send();
}
}
}
},
complete: function () {
if (isbind == 2) {
issorted = 2;
$('#tvansearhDealer').html(trString);
$('#dvLivedealervansearch').show();
$('#dvdealerclass').show();
$('#dvlisservicesttation').hide();
$('#dvlServicecombo').hide();
}
if (issorted == 2) {
var $locations = $("#tvansearhDealer");
// Sort the list items by their data-distance attribute
var sortedItems = $locations.children("tr").sort(function (a, b) {
return $(a).data("distance") - $(b).data("distance");
});
// Append the sorted items back to the list
// Get only the top 15 rows
var top15Items = sortedItems.slice(0, 15);
// Clear existing rows and append the top 15 sorted rows
$locations.empty().append(top15Items);
// $locations.append(sortedItems);
// Add or update serial numbers
sortedItems.each(function (index, row) {
// Find or create the serial number cell
var $serialCell = $(row).find(".serial-number");
if ($serialCell.length === 0) {
// Add a new serial number cell at the start of the row
$(row).prepend(`<td class="serial-number">${index + 1}</td>`);
} else {
// Update the existing serial number cell
$serialCell.text(index + 1);
}
});
}
},
error: function (data) {
}
});
}
}
function _createVanDealerSortedListForVanDealerWise(trindex) {
var cnt = 1;
//Sort our Array according to the duration values in ascending order. [See: https ://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort for more reference]
_copyResulEls.sort(function (a, b) {
var reg = new RegExp('^[0-9]+$');
if (a.status == "OK" && b.status == "OK") {
var k1 = a.distance.value;
var k2 = b.distance.value;
if (reg.test(k1) == true && reg.test(k2) == true) {
if (k1 > k2) {
return 1;
} else {
return -1;
}
}
}
else {
return -1;
}
return 0;
});
// $("#tableVansDealers_reassign").html('');
//var to hold table String to show in dialog-form
var trString = '';
//Loop through of array length of copyResulEls
for (var i = 0; i <10; i++) {
//if i===0, add html for table.
if (_copyResulEls[i].status == "OK") {
//add each row
trString += '<tr id="' + _copyResulEls[i].scode + '" ><td' + cnt + ' inset;" >*</td><td>' + cnt + '</td><td>' + _copyResulEls[i].name + '</td><td>' + _copyResulEls[i].scode + '</td><td>' + _copyResulEls[i].city + '</td><td>' + _copyResulEls[i].state + '</td><td>' + _copyResulEls[i].distance + '</td ><td><button class="button_blue" value="Assign" id="btnrevan' + _copyResulEls[i].vanDealerID + '" value="' + _copyResulEls[i].vanDealer1scode + '" style="width:auto;" onclick="showEscalation(this);" >show</button></td></tr>';
cnt++;
}
}
setTimeout(function () {
// _createVanDealerSortedListForVan(id);
$('#tvansearhDealer').html(trString);
$('#dvLivedealervansearch').show();
$('#dvdealerclass').show();
}, 200);
}
function GetDataHerefromAPI(method, url) {
var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
if ("withCredentials" in xhr) {
xhr.open(method, url, false);
} else if (typeof XDomainRequest != "undefined") {
xhr = new XDomainRequest();
xhr.open(method, url);
} else {
xhr = null;
}
return xhr;
}
/// for google text search
function initMap(id) {
var mapOptions = {
center: new google.maps.LatLng(defaultLat, defaultLng),
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var bermudaTriangle = new google.maps.Polygon({
paths: largearr,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 3,
fillColor: '#FF0000',
fillOpacity: 0.35
});
//initialize map
ccplMap = new google.maps.Map(document.getElementById(id), mapOptions);
//bermudaTriangle.setMap(ccplMap);
//initialize geo coder to get address from lat lng
geoCoder = new google.maps.Geocoder();
}
//initialize infowindow
var infowindow = new google.maps.InfoWindow({
size: new google.maps.Size(50, 50)
});
function iseom() {
if (document.getElementById('rdoYesOEm').checked) {
$("#tdEomName").show();
$("#thoem").show();
}
else {
$("#tdEomName").hide();
$("#thoem").hide();
}
}
function isdealerconnect() {
if (document.getElementById('rdoYesDealerSip').checked) {
$("#tdDealename").show();
$("#thDealename").show();
}
else {
$("#tdDealename").hide();
$("#thDealename").hide();
}
}
var iserror="";
function saveSCvDeatils() {
var apiUrl = url + "Api/TitanDealer?svcdetails=yes&assignvan=yes&type=yes&dealerlist=yes";
var name = $("#txtCustomername").val();
var no = $("#txtMobileNo").val();
var address = $("#txtAddress").val();
var quantity = $("#txtQuantity").val();
var oemname = $("#txtOeNname").val(); var isovm = "";
if (name == "") {
jAlert("Please Enter Name", 'Message');
iserror =2;
return false;
}
else{
if (!/^[a-zA-Z\s]+$/.test(name)) {
jAlert("Please Enter Correct Name", 'Message');
iserror =2;
return false;
}
// Optional: Check for minimum length
else if (name.length < 2) {
jAlert("Please Enter Correct Name", 'Message');
iserror =2;
return false;
}
}
var mobno = $('#txtMobileNo').val();
if ($('#txtMobileNo').val() == "") { //check if warrenty is selected or not
jAlert("Please enter 10 digit mobile number", 'Message');
iserror=2;
return false;
}
else {
var filter = /^\d*(?:\.\d{1,2})?$/;
if (filter.test(mobno)) {
if (mobno.length == 10) {
iserror=1;
} else {
jAlert("Please enter 10 digit mobile number", 'Message');
iserror=2;
return false;
}
}
else {
jAlert("Please enter 10 digit mobile number", 'Message');
iserror=2;
return false;
}
}
if (address == "") {
jAlert("Please Enter Address", 'Message');
iserror =2;
return false;
}
if (quantity == "") { //check if warrenty is selected or not
jAlert("Please enter quantity", 'Message');
iserror=2;
return false;
}
else {
var filter = /^\d*(?:\.\d{1,2})?$/;
if (filter.test(quantity)) {
if(quantity > 0){
}
else{
jAlert("Please enter more than 0 value", 'Message');
iserror=2;
return false;
}
}
else {
jAlert("Please enter digit", 'Message');
iserror=2;
return false;
}
}
if (document.getElementById('rdoYesOEm').checked) {
if (oemname == "") {
jAlert("Please Enter OEM Name", 'Message');
iserror =2;
return false;
}
else{
if (!/^[a-zA-Z\s]+$/.test(name)) {
jAlert("Please Enter Correct Name", 'Message');
iserror =2;
return false;
}
// Optional: Check for minimum length
else if (name.length < 2) {
jAlert("Please Enter Correct Name", 'Message');
iserror =2;
return false;
}
}
}
if (document.getElementById('rdoYesOEm').checked) {
isovm = 'yes';
}
else {
isovm = 'no';
}
if(iserror ==1){
$.ajax({
type: "POST",
url: apiUrl,
data: { Token: SecurityToken, CustomerName: name, CustomerNumber: no, Address: address, oemName: oemname, isoem: isovm, CreatedBy: userId ,Quantity: quantity},
dataType: "json",
success: function (data) {
if (data == "success") {
jAlert("Saved Details Successfully", 'Message');
$("#txtCustomername").val('');
$("#txtMobileNo").val('');
$("#txtAddress").val('');
$("#txtOeNname").val('');
$("#txtQuantity").val('');
}
}
});
}
}
var isdealersupport = "";
var isaccidental = "";
function EPSSalesDetails() {
var apiUrl = url + "Api/EPS";
var name = $("#txtEPSSalesCustomername").val();
var no = $("#txtEPSSalesMobileNo").val();
var address = $("#txtEPSSalesAddress").val();
var qunttity = $("#txtEPSQuantity").val();
var prodType = $("#ddlEPSProductType").val();
if (name == "") {
jAlert("Please Enter Name", 'Message');
iserror = 2;
return false;
}
else {
if (!/^[a-zA-Z\s]+$/.test(name)) {
jAlert("Please Enter Correct Name", 'Message');
iserror = 2;
return false;
}
// Optional: Check for minimum length
else if (name.length < 2) {
jAlert("Please Enter Correct Name", 'Message');
iserror = 2;
return false;
}
}
var mobno = $('#txtEPSSalesMobileNo').val();
if ($('#txtEPSSalesMobileNo').val() == "") { //check if warrenty is selected or not
jAlert("Please enter 10 digit mobile number", 'Message');
iserror = 2;
return false;
}
else {
var filter = /^\d*(?:\.\d{1,2})?$/;
if (filter.test(no)) {
if (mobno.length == 10) {
iserror = 1;
} else {
jAlert("Please enter 10 digit mobile number", 'Message');
iserror = 2;
return false;
}
}
else {
jAlert("Please enter 10 digit mobile number", 'Message');
iserror = 2;
return false;
}
}
if (address == "") {
jAlert("Please Enter Address", 'Message');
iserror = 2;
return false;
}
if (qunttity == "") {
jAlert("Please Enter Quantity", 'Message');
iserror = 2;
return false;
}
if (prodType == "" || prodType == "--select--") {
jAlert("Please Select Product Typw", 'Message');
iserror = 2;
return false;
}
if (iserror == 1) {
$.ajax({
type: "POST",
url: apiUrl,
data: { Token: SecurityToken, CustomerName: name, Qunatity: qunttity, CustomerNumber: no, Location: address, ProductType: prodType,CreatedBy: userId },
dataType: "json",
success: function (data) {
if (data == "success") {
jAlert("Saved Details Successfully", 'Message');
$("#txtEPSSalesCustomername").val('');
$("#txtEPSSalesMobileNo").val('');
$("#txtEPSSalesAddress").val('');
$("#txtEPSQuantity").val('');
$("#ddlEPSProductType").val('--select--');
}
}
});
}
}
function saveAccidentalDeatils() {
var apiUrl = url + "Api/TitanDealer?accidentaldetails=yes&svcdetails=yes&assignvan=yes&type=yes&dealerlist=yes";
var name = $("#txtAccidentalCustomername").val();
var no = $("#txtAccidentalMobileNo").val();
var address = $("#txtAccidentalAddress").val();
var regno = $("#txtRegnoAccidental").val();
var dealerconnect = $("#txtdealerconnect").val();
if (name == "") {
jAlert("Please Enter Name", 'Message');
iserror = 2;
return false;
}
else {
if (!/^[a-zA-Z\s]+$/.test(name)) {
jAlert("Please Enter Correct Name", 'Message');
iserror = 2;
return false;
}
// Optional: Check for minimum length
else if (name.length < 2) {
jAlert("Please Enter Correct Name", 'Message');
iserror = 2;
return false;
}
}
var mobno = $('#txtAccidentalMobileNo').val();
if ($('#txtAccidentalMobileNo').val() == "") { //check if warrenty is selected or not
jAlert("Please enter 10 digit mobile number", 'Message');
iserror = 2;
return false;
}
else {
var filter = /^\d*(?:\.\d{1,2})?$/;
if (filter.test(no)) {
if (mobno.length == 10) {
iserror = 1;
} else {
jAlert("Please enter 10 digit mobile number", 'Message');
iserror = 2;
return false;
}
}
else {
jAlert("Please enter 10 digit mobile number", 'Message');
iserror = 2;
return false;
}
}
if (address == "") {
jAlert("Please Enter Address", 'Message');
iserror = 2;
return false;
}
if (regno == "") {
jAlert("Please Enter Registration Number", 'Message');
iserror = 2;
return false;
}
if (document.getElementById('rdoYesDealerSip').checked) {
if (dealerconnect == "") {
jAlert("Please Select Dealer", 'Message');
iserror = 2;
return false;
}
isdealersupport = 'yes';
}
else {
isdealersupport = 'no';
}
if (document.getElementById('rdoYesAcidental').checked) {
isaccidental = 'yes';
}
else {
isaccidental = 'no';
}
if (iserror == 1) {
$.ajax({
type: "POST",
url: apiUrl,
data: { Token: SecurityToken, CustomerName: name, Registration_number: regno, CustomerNumber: no, Location: address, Dealer_Connect: dealerconnect, isabulancesupportrequired: isaccidental, isdealersupportrequired: isdealersupport, CreatedBy: userId},
dataType: "json",
success: function (data) {
if (data == "success") {
jAlert("Saved Details Successfully", 'Message');
$("#txtAccidentalMobileNo").val('');
$("#txtAccidentalCustomername").val('');
$("#txtAccidentalAddress").val('');
$("#txtdealerconnect").val('');
$("#txtRegnoAccidental").val('');
}
}
});
}
}
function getlatlong() {
var latlong = $("#searchLocationTool").val();
var splits = latlong.split(",");
var lat = splits[0];
var lng = splits[1];
var pattern = new RegExp('^-?([1-8]?[1-9]|[1-9]0)\\.{1}\\d{1,6}');
if (pattern.test(lat) && pattern.test(lng)) {
var latlng = new google.maps.LatLng(lat, lng);
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var address = (results[0].formatted_address);
marker = new google.maps.Marker({
position: latlng,
map: ccplMap
});
breakdownLocationLatLng = latlng;
$("#searchLocationTool").val(address);
ccplMap.setZoom(15);
ccplMap.panTo(marker.position);
}
else {
alert(status);
}
})
}
}
// place the marker by suggestion.
function drawMarker(placeId, selectedLoc) {
$("#searchLocationTool").val(selectedLoc.split('_').join(' '));
//infoWindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(ccplMap);
service.getDetails({
placeId: placeId,
fields: ["name", "address_component", "formatted_address", "geometry.location"]
}, function (result, status) {
if (status != google.maps.places.PlacesServiceStatus.OK) {
alert(status);
return;
}
// removePlaceLocationMarkerArray();
//remove direction path amd markers
if (displayDisplay) {
//Remove previous markers
removeTicketDetailsMarkerArray();
//Remove direction display
displayDisplay.setMap(null);
}
//remove breakdown location marker
if (marker) {
marker.setMap(null);
marker = "";
}
// Address cration
var bounds = new google.maps.LatLngBounds();
// Create a marker for each place.
var markerLocation = new google.maps.Marker({
map: ccplMap,
place: {
placeId: placeId,
location: result.geometry.location
},
title: result.formatted_address,
// position: places[0].geometry.location
});
breakdownLocationLatLng = markerLocation.place.location;
placeLocationMarkerArray.push(markerLocation);
bounds.extend(result.geometry.location);
ccplMap.fitBounds(bounds);
$("#sugList").html("").css('visibility', 'hidden');
});
}
// created google search box by google prediction api
function onGoogleSearch() {
// reset search box and sugesstion list div
// $("#sugList-holder").css('visibility', 'hidden');
$("#sugList").html("");
console.log('aa');
// function on search box.
$("#searchLocationTool").keydown(function (e) {
// up key
if (e.keyCode == 38) {
var currEle = $('#sugList li.key-highlight');
$(currEle).removeClass("key-highlight");
if ($(currEle).index() < 1) {
$('#sugList li:last').addClass("key-highlight");
}
else {
$(currEle).prev().addClass("key-highlight");
}
}
// down key
else if (e.keyCode == 40) {
var currEle = $('#sugList li.key-highlight');
$(currEle).removeClass("key-highlight");
if ($(currEle).index() > 3) {
$('#sugList li:first').addClass("key-highlight");
}
else {
$(currEle).next().addClass("key-highlight");
}
}
// enter key
else if (e.keyCode == 13) {
var currEle = $('#sugList li.key-highlight')[0];
var placeId = $(currEle).attr("placeid");
var selLoc = $(currEle).attr("location");
drawMarker(placeId, selLoc);
$("#sugList").html("");
}
else {
var displaySuggestions = function (predictions, status) {
if (status != google.maps.places.PlacesServiceStatus.OK) {
return;
}
predictions.forEach(function (prediction) {
var loc = prediction.description.split(' ').join('_');
var str = '<li class="list-item" location=' + loc + ' placeid=' + prediction.place_id + ' onclick= drawMarker("' + prediction.place_id + '","' + loc + '")> <i></i> &nbsp;' + prediction.description + '</li>';
$('#sugList').append(str);
});
$("#sugList").css('visibility', 'visible');
$("#sugList li:first").addClass("key-highlight");
};
var stxt = $("#searchLocationTool").val();
if (stxt.length <= 1) {
//$("#sugList-holder").css('visibility', 'hidden');
$("#sugList").html("");
}
if (stxt.length > 1) {
if (stxt.length % 2 == 0) {
$("#sugList").html("");
var service = new google.maps.places.AutocompleteService();
service.getQueryPredictions({
input: stxt
// types: address
}, displaySuggestions);
}
}
}
});
}
//function calling on document ready
$(document).ready(function () {
var parentElement = document.getElementById("dvlDealerName");
loadfuelType();
// Get the first child of the parent
var firstChild = parentElement.firstElementChild;
// Set a new class and width for the first child
if (firstChild) {
firstChild.classList.add("new-class"); // Add a new class (optional)
firstChild.style.width = "300px"; // Set the desired width
}
var parentElement = document.getElementById("dvlDealerNamecombo");
loadfuelType();
// Get the first child of the parent
var firstChild = parentElement.firstElementChild;
// Set a new class and width for the first child
if (firstChild) {
firstChild.classList.add("new-class"); // Add a new class (optional)
firstChild.style.width = "300px"; // Set the desired width
}
loaddealerIdChoices();
loaddealerNameChoices();
loadfuelType();
loaddealerIdAccidentalChoices();
// loadVehicleType();
var islive = 'f';
var params = new URL(document.location.toString()).searchParams;
var name = params.get("dealervans");
var scvcrm = params.get("scvcrm");
var dealersearch = params.get("dealersearch");
var accidentalsearch = params.get("accidental");
var servicestation = params.get("servicestation");
var epssaleslead = params.get("epssaleslead");
if (accidentalsearch == 'yes') {
islive = 't';
$('#dvdealerList').hide();
$('#dvLiveTracking').hide();
$('#dvdealersearchList').hide();
$('#dvlDealer').hide();
$('#dvlDealerName').hide();
$('#dvEpsSales').hide();
$('#dvscvcrm').hide();
$('#dvAccidental').show();
loadDealerList();
loadDealerListAll();
}
if (servicestation == 'yes') {
islive = 't';
isservicestation = 't';
$('#dvtitleDealer').html('Search Nearest Charging Station :');
$('#dvlDealerNamecombo').hide();
$('#dvdealerList').hide();
$('#dvLiveTracking').hide();
$('#dvEpsSales').hide();
$("#searchLocationTool").attr("placeholder", "Search Location");
$('#dvdealersearchList').show();
$('#dvAccidental').hide();
setTimeout(function () {
initMap("divMapContainer");
}, 1);
setTimeout(function () {
//$("#dvdashboard").show();
onGoogleSearch();
}, 1000);
}
if (scvcrm == 'yes') {
islive = 't';
$('#dvdealerList').hide();
$('#dvLiveTracking').hide();
$('#dvdealersearchList').hide();
$('#dvlDealer').hide();
$('#dvlDealerName').hide();
$('#dvscvcrm').show();
$('#dvAccidental').hide();
$('#dvEpsSales').hide();
}
if (name == 'yes') {
islive = 't';
$('#dvdealerList').show();
$('#dvLiveTracking').hide();
$('#dvdealersearchList').hide();
$('#dvlDealer').hide();
$('#dvlDealerName').hide();
$('#dvscvcrm').hide();
$('#dvAccidental').hide();
$('#dvEpsSales').hide();
}
if (epssaleslead == 'yes') {
islive = 't';
$('#dvdealerList').hide();
$('#dvLiveTracking').hide();
$('#dvdealersearchList').hide();
$('#dvlDealer').hide();
$('#dvlDealerName').hide();
$('#dvscvcrm').hide();
$('#dvAccidental').hide();
$('#dvEpsSales').show();
}
if (dealersearch == 'yes') {
islive = 't';
$('#dvdealerList').hide();
$('#dvLiveTracking').hide();
$('#dvscvcrm').hide();
$('#dvdealersearchList').show();
$('#dvAccidental').hide();
$('#dvEpsSales').hide();
setTimeout(function () {
initMap("divMapContainer");
}, 1);
setTimeout(function () {
//$("#dvdashboard").show();
onGoogleSearch();
}, 1000);
}
if (islive == 'f'){
$('#dvdealerList').hide();
$('#dvLiveTracking').show();
$('#dvdealersearchList').hide();
$('#dvAccidental').hide();
$('#dvscvcrm').hide();
$('#dvEpsSales').hide();
ko.applyBindings(new LiveTrackingModel());
}
$("#showPopup").click(function () {
$("#popupContainer").fadeIn();
$("#overlay").fadeIn();
});
// Close popup and overlay
$("#closePopup, #overlay").click(function () {
$("#popupContainer").fadeOut();
$("#overlay").fadeOut();
});
});
function loadDealerListAll() {
var ctr = 0;
$.ajax({
type: "GET",
url: url + "Api/NewDashboard?dealer=dealer&dealer1=dealer1",
//url: "http://eos.eicher.in:8181/Api/NewDashboard?dealer=dealer&dealer1=dealer1",
success: function (data) {
// Empty the existing dropdown (in case a MultiSelect instance was initialized)
if ($("#ddlDealerAccidental").data("kendoComboBox") != undefined) {
var comboBox = $("#ddlDealerAccidental").data("kendoComboBox");
comboBox.destroy(); // Destroy any existing ComboBox instance
}
var html = ""; // Initialize the HTML string for the options
var keyVar;
for (keyVar in data) {
if (data.hasOwnProperty(keyVar)) {
ctr = ctr + 1;
// Creating options where text shows DealerName and DealerId is used as the value
html += '<option value="' + data[keyVar].DealerId + '">' + data[keyVar].DealerId + ' / ' + data[keyVar].DealerName + '</option>';
}
}
// Append the options to the dropdown
$('#ddlDealerAccidental').append(html);
// Initialize Kendo ComboBox (single select)
$("#ddlDealerAccidental").kendoComboBox({
dataTextField: "text", // Text field that will display (combined DealerName / DealerId)
dataValueField: "value", // The field used for the value (DealerId)
dataSource: $.map(data, function (item) {
return {
text: item.DealerId + ' / ' + item.DealerName, // Display both DealerName and DealerId
value: item.DealerId + ' / ' + item.DealerName // Store DealerId as value
};
}),
filter: "contains", // Enable substring filtering
index: 0 // Optionally set default selected item (first item)
});
},
complete: function () {
// You can optionally call another function after the ComboBox is initialized
// loadRegionList();
},
error: function (data) {
// Handle errors if necessary
console.error(data);
}
});
}
function showvanreassign(id) {
id = '1S5035';
$('#dvLivevansearch').show();
if ($('#rdoYes').is(':checked')) {
id =$("#DealerNameCombobox").val();// $(DealerNameCombobox).data("kendoComboBox").val();//$('#ddlDealerName option:selected').val();
} else {
id =$("#DealerIdCombobox").val();// $('#DealerIdCombobox option:selected').val();
}
var trString = "";
var _trString = "";
// var dealerscode = $this.value;
$.ajax({
type: "POST",
url: url + "Api/CogentAPI?getvans=ss",
// data: { StateName: state1, limit: prdvariant, StateName2: state2, DealerSCode: dealercode, Token: securityToken, UserId: userId },
data: { StateName: "", limit: 100, StateName2: "", DealerSCode: id, Fuel_type: "diesel,cng", Token: securityToken, UserId: userId },
success: function (data) {
var cnt=1;
if (data.length > 0) {
console.log(data); // $("#div_loading").show();
for (keyVar in data) {
if (data.hasOwnProperty(keyVar)) {
var vanRemainingTime = data[keyVar].RemainingTime;
var deviceStatus = data[keyVar].DeviceStatus;
var updatedDeviceStatus = "";
var backgroundColor = "red";
var type = "van";
//check if device is connected or not
if ((deviceStatus == "True") && (type == "van")) {
updatedDeviceStatus = "green-circle";
}
else if ((deviceStatus == "False") && (type == "van")) {
updatedDeviceStatus = "red-circle";
} else {
updatedDeviceStatus = "";
}
if (vanRemainingTime == "0") {
backgroundColor = "green";
backgroundColor='<span class="green-circle handMouse title=" Connected"></span>';
}
else {
backgroundColor = "red";
backgroundColor = '<span class="red-circle handMouse" title="Not connected"></span>';
}
_trString += '<tr id="' + data[keyVar].DealerVanId + '" ><td >' + cnt + '</td><td>' + data[keyVar].DealerVanName + '</td><td>' + data[keyVar].DealerVanLattitude + '</td><td>' + data[keyVar].DealerVanLongitude + '</td> <td><span>' + data[keyVar].DealerOrVanContactNo + '</span></td><td>' + backgroundColor + '</td><td>' + data[keyVar].DealerVanCity+'</td>';
// _trString +=
cnt ++;
//<td>' + remainingTime + '</td><td><span class="' + deviceStatus + '"</span></td></tr > ';
// < td > ' + _copyResulEls[i].remainingTime + '</td ><td><span class="' + _copyResulEls[i].deviceStatus + '"</span></td>
if (keyVar === data.length) {
_trString += '</tbody></table>';
}
}
}
}
else {
alert("No Active Van");
}
setTimeout(function () {
// _createVanDealerSortedListForVan(id);
$('#tvansearh').html(_trString)
}, 1000);
},
complete: function () {
// $("#div_loading").hide();
},
error: function (data) {
}
});
}
var ctrName = 0;
function loaddealerIdAccidentalChoices() {
utcMinutes = parseInt(UtcMinutes, 10);
UserId = userId;
$.ajax({
type: "GET",
url: url + "/Api/NewDashboard?dealer=dealer&dealer1=dealer1",
dataType: "json",
success: function (data) {
console.log(data);
$("#DealerIdAccidentalCombobox").kendoComboBox({
dataTextField: "DealerName", // Display field (we will modify this in the template)
dataValueField: "DealerId", // Value field (DealerId will be stored)
filter: "contains", // Enables filtering by substring
dataSource: data, // The data source (array of dealers)
// template: "#= DealerName # / #= DealerId #",
change: function () {
// loading cities according to state id
// loadCityChoices($("#DealerIdCombobox").val());
//loadDealerChoices($("#DealerIdCombobox").data("kendoComboBox").text(), $("#cityCombobox").data("kendoComboBox").text());
}
});
},
complete: function () {
//$("#stateCombobox").data('kendoComboBox').select(0);
},
error: function (jqXHR, textStatus, errorThrown) {
}
});
}
function loaddealerIdChoices() {
utcMinutes = parseInt(UtcMinutes, 10);
UserId = userId;
$.ajax({
type: "GET",
url: url + "/Api/NewDashboard?dealer=dealer&dealer1=dealer1",
dataType: "json",
success: function (data) {
$("#DealerIdCombobox").kendoComboBox({
dataTextField: "DealerId",
dataValueField: "DealerId",
filter: "contains",
dataSource: data,
change: function () {
// loading cities according to state id
// loadCityChoices($("#DealerIdCombobox").val());
//loadDealerChoices($("#DealerIdCombobox").data("kendoComboBox").text(), $("#cityCombobox").data("kendoComboBox").text());
}
});
},
complete: function () {
//$("#stateCombobox").data('kendoComboBox').select(0);
},
error: function (jqXHR, textStatus, errorThrown) {
}
});
}
function loaddealerNameChoices() {
utcMinutes = parseInt(UtcMinutes, 10);
UserId = userId;
$.ajax({
type: "GET",
url: url + "/Api/NewDashboard?dealer=dealer&dealer1=dealer1",
dataType: "json",
success: function (data) {
$("#DealerNameCombobox").kendoComboBox({
dataTextField: "DealerName",
dataValueField: "DealerId",
filter: "contains",
dataSource: data,
change: function () {
// loading cities according to state id
// loadCityChoices($("#DealerIdCombobox").val());
//loadDealerChoices($("#DealerIdCombobox").data("kendoComboBox").text(), $("#cityCombobox").data("kendoComboBox").text());
}
});
},
complete: function () {
//$("#stateCombobox").data('kendoComboBox').select(0);
},
error: function (jqXHR, textStatus, errorThrown) {
}
});
}
function loadfuelType() {
var fueltype = [];
var fueltype = [];
fueltype.push({
productId: "Diesel/CNG",
productAlias: "Diesel/CNG"
});
fueltype.push({
productId: "Electric",
productAlias: "Electric"
});
// fueltype.push({
// productId: "Diesel/CNG/Electric",
// productAlias: "Diesel/CNG/Electric"
//});
$("#fueltypeCombobox").kendoComboBox({
dataTextField: "productId",
dataValueField: "productAlias",
filter: "contains",
dataSource: fueltype
});
}
function loadSercieScrpit() {
var fueltype = [];
fueltype.push({
productId: "Hindi",
productAlias: "Hindi"
});
fueltype.push({
productId: "English",
productAlias: "English"
});
fueltype.push({
productId: "Tamil",
productAlias: "Tamil"
});
fueltype.push({
productId: "Telugu",
productAlias: "Telugu"
});
fueltype.push({
productId: "Kannada",
productAlias: "Kannada"
});
fueltype.push({
productId: "Malyalam",
productAlias: "Malyalam"
});
// fueltype.push({
// productId: "Diesel/CNG/Electric",
// productAlias: "Diesel/CNG/Electric"
//});
$("#seviceCombobox").kendoComboBox({
dataTextField: "productId",
dataValueField: "productAlias",
filter: "contains",
value: "Hindi",
dataSource: fueltype
});
}
function setScript() {
var ddlval = $("#seviceCombobox").val();
var distance = $("#tvansearhserviceStation tr:first").attr("data-distance");
var name= $("#tvansearhserviceStation tr:first").attr("data-name");
if (ddlval == "Hindi") {
$("#spnDistanceHindi").html(distance);
$("#spnlocactionHindi").html(name);
$("#dvHindi").show();
$("#dvEnglish").hide();
$("#dvTelugu").hide();
$("#dvTamil").hide();
$("#dvKannada").hide();
$("#dvMalyalam").hide();
}
if (ddlval == "English") {
$("#spnDistanceEnglish").html(distance);
$("#spnlocactionEnglish").html(name);
$("#dvEnglish").show();
$("#dvHindi").hide();
$("#dvTelugu").hide();
$("#dvTamil").hide();
$("#dvKannada").hide();
$("#dvMalyalam").hide();
}
if (ddlval == "Tamil") {
$("#dvTamil").show();
$("#dvHindi").hide();
$("#dvEnglish").hide();
$("#dvTelugu").hide();
$("#spnDistanceTamil").html(distance);
$("#spnlocactionTamil").html(name);
$("#dvKannada").hide();
$("#dvMalyalam").hide();
}
if (ddlval == "Telugu") {
$("#dvTelugu").show();
$("#dvHindi").hide();
$("#dvEnglish").hide();
$("#spnDistanceTelugu").html(distance);
$("#spnlocactionTelugu").html(name);
$("#dvTamil").hide();
$("#dvKannada").hide();
$("#dvMalyalam").hide();
}
if (ddlval == "Kannada") {
$("#spnDistanceKannada").html(distance);
$("#spnlocactionKannada").html(name);
$("#dvKannada").show();
$("#dvHindi").hide();
$("#dvEnglish").hide();
$("#dvTelugu").hide();
$("#dvTamil").hide();
$("#dvMalyalam").hide();
}
if (ddlval == "Malyalam") {
$("#dvMalyalam").show();
$("#dvHindi").hide();
$("#dvEnglish").hide();
$("#dvTelugu").hide();
$("#dvTamil").hide();
$("#dvKannada").hide();
$("#spnDistanceMalyalam").html(distance);
$("#spnlocactionMalyalam").html(name);
}
//dvHindi
}
function loadVehicleType() {
var fueltype = [];
fueltype.push({
productId: "HD",
productAlias: "HD"
});
fueltype.push({
productId: "BUS",
productAlias: "BUS"
});
fueltype.push({
productId: "LMD",
productAlias: "LMD"
});
// fueltype.push({
// productId: "Diesel/CNG/Electric",
// productAlias: "Diesel/CNG/Electric"
//});
$("#VehicleTypeCombobox").kendoComboBox({
dataTextField: "productId",
dataValueField: "productAlias",
filter: "contains",
dataSource: fueltype
});
}
function getDealerListBy1sCode() {
$("#dvlDealerName").hide();
$("#dvlDealer").show();
$("#btnApplySearch").show();}
function getDealerListByName() {
$("#dvlDealer").hide();
$("#dvlDealerName").show();
$("#btnApplySearch").show();
}
function getsmsbox(button) {
var managername = button.dataset.managername;
var lat = button.dataset.lattitude;
var lng = button.dataset.longitude;
var html = "";
$("#divCreateDealer").html('');
$("#divCreateDealer").html('');
addKendoWindowToDiv("#divCreateDealer", "SMS detail", "833px", 385);
//open form in new dialog box
$("#divCreateDealer").parent().addClass("responsive_popup"); //addClass for respond the menu
$("#divCreateDealer").parent().addClass("k-window2");
html += "<tr>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\"> <input type=\"text\" id=\"txtservicesms\" /></td >";
html += '<td class="tableCellinfo" style="width: 30% !important; background: none!important;">' +
'<input type="button" ' +
'class="bluebuttonmsg" ' +
'data-ManagerName="' + managername + '" ' +
'data-latitude="' + lat + '" ' +
'data-longitude="' + lng + '" ' +
'value="Send SMS" ' +
'onclick="sendsmsservicestation(this)" </td > ';
html += "</tr></thead >";
$("#divCreateDealer").html(html);
SetKendoWindowTitle("#divCreateDealer", "Enter Mobile Number");
//open form in new dialog box
$("#divCreateDealer").data("kendoWindow").open();
openKendoWindowInCenter("#divCreateDealer");
}
var did = "";
function getescalation(button) {
var dealerId = button.dataset.dealerid; // Correct access for data-dealerid
var dealerVanName = button.dataset.dealervanname; // Correct access for data-dealervanname
did = button.dataset.dealerid;
// var dealer_id = $this.value;
//var vehicle_tagging = $("#VehicleTypeCombobox").val();
var pvariant = $("#fueltypeCombobox").val();
$.ajax({
type: "POST",
url: url + "Api/GetAllVan?operation=getescalationlevels",
data: { DelerId: dealerId, token: "teramatrix", ProductVariant: pvariant },
success: function (data) {
console.log(data);
$("#divCreateDealer").html('');
$("#divCreateDealer").html('');
var html = "<table cellpadding=\"0\" cellspacing=\"0\" class=\"OpenTicketTbl\" style=\"overflow: scroll;\">";
html += "<thead> <tr class=\"\"><th style=\"text-align: left;\">S.No.</th>";
html += "<th style =\"text-align: left;\">Manager Name</th>";
html += "<th style =\"text-align: left;\">Designation</th>";
html += "<th =\"text-align: left;\"> Conatct Number</th>";
html += "<th style=\"text-align: left;\"> Enter Number</th><th style=\"text-align: left;\">Send SMS</th>";
var cnt = 1;
if (data.EscalationLevelList.length > 0) {
addKendoWindowToDiv("#divCreateDealer", "Dealership detail", "833px", 385);
//open form in new dialog box
$("#divCreateDealer").parent().addClass("responsive_popup"); //addClass for respond the menu
$("#divCreateDealer").parent().addClass("k-window2");
for (var count = 0; count < data.EscalationLevelList.length; count++) {
var txtid = "txt" + cnt;
if (data.EscalationLevelList[count].ManagerLevel == "WM" || data.EscalationLevelList[count].ManagerLevel == "EOS Site Incharge") {
html += "<tr><td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + cnt + "</td>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerName + "</td>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerLevel + "</td>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerPhoneNo + "</td>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\"> <input type=\"text\" id=" + txtid + " /></td >";
html += '<td class="tableCellinfo" style="width: 30% !important; background: none!important;">' +
'<input type="button" ' +
'class="bluebuttonmsg" ' +
'data-ManagerPhoneNo="' + data.EscalationLevelList[count].ManagerPhoneNo + '" ' +
'data-ManagerName="' + data.EscalationLevelList[count].ManagerName + '" ' +
'data-DealerName="' + dealerVanName + '" ' +
'value="Send SMS" ' +
'onclick="sendsms(this)" ' +
'id="' + cnt + '" />' +
'</td>';
}
else {
html += "<tr><td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + cnt + "</td>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerLevel + "</td>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerName + "</td>";
html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerPhoneNo + "</td>";
/* html += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\"> <input type=\"text\" id=" + txtid + " /></td >";
html += '<td class="tableCellinfo" style="width: 30% !important; background: none!important;">' +
'<input type="button" ' +
'class="bluebuttonmsg" ' +
'data-ManagerPhoneNo="' + data.EscalationLevelList[count].ManagerPhoneNo + '" ' +
'data-ManagerName="' + data.EscalationLevelList[count].ManagerName + '" ' +
'data-DealerName="' + dealerVanName + '" ' +
'value="Send SMS" ' +
'onclick="sendsms(this)" ' +
'id="' + cnt + '" />' +
'</td>';*/
}
cnt++;
}
html += "</tr></thead >";
$("#divCreateDealer").html(html);
SetKendoWindowTitle("#divCreateDealer", "Escalation Details");
//open form in new dialog box
$("#divCreateDealer").data("kendoWindow").open();
openKendoWindowInCenter("#divCreateDealer");
}
else{
jAlert("no escalation", 'Message');
}
}
});
}
function showservicestation() {
var regno = $('#txtRegNo').val();
if (regno == "") { //check if warrenty is selected or not
jAlert("Please enter registration number", 'Message');
return false;
}
else {
$.ajax({
type: "Post",
url: url + "Api/ServiceStation",
dataType: "json",
data: { Token: "teramatrix", VehicleRegistrationNumber: regno },
success: function (data) {
console.log();
var hereUrl = "https://revgeocode.search.hereapi.com/v1/revgeocode?at=" + data.latitude + "," + data.longitude + "&lang=en-US&apiKey=DW3-YCFFZtJzlAQpTfVPoXADcZpEeZe3t8h6ganVsqo";
console.log(hereUrl);
$.ajax({
type: "Get",
url: hereUrl,
success: function (data) {
$.ajax({
type: "GET",
url: url + "Api/ServiceStation?at=GetVansDealersbyStates",
data: { StateName: data.items[0].address.state },
success: function (data) {
}
});
}
});
}
});
}
}
function sendsmsservicestation(button) {
var mob = $('#txtservicesms').val();
var managerName = button.dataset.managername;
var lat = button.dataset.latitude;
var lng = button.dataset.longitude;
if (mob == "") { //check if warrenty is selected or not
jAlert("Please enter 10 digit mobile number", 'Message');
return false;
}
else {
var filter = /^\d*(?:\.\d{1,2})?$/;
if (filter.test(mob)) {
if (mob.length == 10) {
var apiUrl = url + "Api/GetAllVan?sendservicelocation=yes&send=yes&sendmessage=true";
// var apiUrl = url + "Api/LiveTabTracking?vanlatlng=s",
$.ajax({
type: "POST",
url: apiUrl,
data: { Token: securityToken, name: managerName, MobileNumber: mob, lattitude: lat, longitude: lng },
dataType: "json",
success: function (data) {
jAlert("SMS send Successfully", 'Message');
closeWindow('#divCreateDealer');
}
});
}
else {
jAlert("Please enter 10 digit mobile number", 'Message');
return false;
}
}
else {
jAlert("Please enter 10 digit mobile number", 'Message');
return false;
}
}
}
function sendsms(button) {
////console.log(button.id);
var dealer_id = button.id;
var managerName = button.dataset.managername;
var managerPhoneNo = button.dataset.managerphoneno;
var DealerName = button.dataset.dealername;
var mob = $('#txt' + dealer_id).val();
if (mob == "") { //check if warrenty is selected or not
jAlert("Please enter 10 digit mobile number", 'Message');
return false;
}
else if (mob != "") {
var filter = /^\d*(?:\.\d{1,2})?$/;
if (filter.test(mob)) {
if (mob.length == 10) {
$.ajax({
type: "POST",
url: url + "Api/GetAllVan?send=yes&sendmessage=true",
data: { DelerId: did, token: "teramatrix", MobileNumber: mob, DealerName: DealerName, ManagerName: managerName, ManagerNo: managerPhoneNo },
success: function (data) {
$('#txt' + dealer_id).val('');
jAlert("SMS send successfully", 'Message');
}
});
} else {
jAlert("Please enter 10 digit mobile number", 'Message');
return false;
}
}
else {
jAlert("Please enter 10 digit mobile number", 'Message');
return false;
}
}
}
</script>
<style type="text/css">
/*=================Progress Bar===============*/
/* Firefox */
progress.low::-moz-progress-bar { /*background-image: -moz-linear-gradient( center bottom, red 37%, rgb(84,240,84) 69% );*/ /*background:#d9534f;*/
}
/*progress.mid::-moz-progress-bar {
background:#f0ad4e;
}
progress.battery_status_full::-moz-progress-bar {
background:#5cb85c;
}*/
/* Chrome */
/*progress.low[role]:after {
background-image: none;
}*/
progress.low::-webkit-progress-bar { /*background:#d9534f;*/ /*background-image: -webkit-linear-gradient( center bottom, red 37%, rgb(84,240,84) 69% );*/ /*background-image: linear-gradient( center bottom, red 37%, rgb(84,240,84) 69% );*/
}
/*progress.mid::-webkit-progress-bar {
background:#f0ad4e;
}
progress.battery_status_full::-webkit-progress-bar {
background:#f0ad4e;
}*/
/*=============================================*/
.displayNone {
display: none;
}
.displayBlock {
display: block;
}
.content {
overflow: auto;
}
.tableCelltitle th {
background: #ee2e22;
color: #fff;
font-weight: normal;
background: url("/Content/css/images/infowindow_head-bg.png") repeat-x left top;
height: 29px;
}
.ldSection tr:nth-child(even) {
background: #f9f9f9;
}
.ldSection td { /*line-height: 28px;*/
height: 42px;
font-family: Arial;
}
.themeTable td { /*width:10% !important;*/
}
.datalist_wrp {
color: rgb(112, 113, 115);
}
.datalist_wrp label {
line-height: 26px;
margin: 0 4px;
font-size: 12px;
}
.datalist_wrp input {
margin: 1px 0px;
height: 21px;
width: 123px;
margin-left: 5px;
font-family: arial;
font-size: 11px;
}
.datalist_wrp input:focus {
box-shadow: 1px 1px 9px #eee inset;
}
#tableDevices td:last-child {
text-align: center;
padding-right: 0; /*padding-left: 3%;*/
}
</style>
<style>
.batteryPoint {
height: 15px !important;
}
.meter {
height: 30px;
width: 87%;
border: 1px #B0B0B0 solid;
overflow: hidden;
position: relative;
margin: auto;
float: left; /* background: #555; */
-moz-border-radius: 25px;
-webkit-border-radius: 0px; /* border-radius: 25px; */ /* padding: 10px; */ /* -webkit-box-shadow: inset 0 -1px 1px rgba(255,255,255,0.3); */
-moz-box-shadow: inset 0 -1px 1px rgba(255,255,255,0.3); /* box-shadow: inset 0 -1px 1px rgba(255,255,255,0.3); */
}
.meter > span {
display: block;
height: 30px;
padding: 0px;
float: left;
background-color: rgb(43,194,83);
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, rgb(43,194,83)), color-stop(1, rgb(84,240,84)) );
background-image: -moz-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% );
-webkit-box-shadow: inset 0 2px 9px rgba(255,255,255,0.3), inset 0 -2px 6px rgba(0,0,0,0.4);
-moz-box-shadow: inset 0 2px 9px rgba(255,255,255,0.3), inset 0 -2px 6px rgba(0,0,0,0.4);
box-shadow: inset 0 2px 9px rgba(255,255,255,0.3), inset 0 -2px 6px rgba(0,0,0,0.4);
position: relative;
overflow: hidden;
line-height: 32px;
font-size: 10px;
color: #505050 !important;
text-align: center;
padding: 0px !important;
max-width: 100%;
}
.meter > span:after, .animate > span > span {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-image: -webkit-gradient(linear, 0 0, 100% 100%,color-stop(.25, rgba(255, 255, 255, .2)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.75, rgba(255, 255, 255, .2)), color-stop(.75, transparent), to(transparent) );
background-image: -moz-linear-gradient( -45deg, rgba(255, 255, 255, .2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%, transparent 75%,transparent );
z-index: 1;
-webkit-background-size: 50px 50px;
-moz-background-size: 50px 50px;
background-size: 50px 50px;
-webkit-animation: move 2s linear infinite;
-moz-animation: move 2s linear infinite;
overflow: hidden;
}
.animate > span:after {
display: none;
}
.orange > span {
background-color: #f1a165;
background-image: -moz-linear-gradient(top, #f1a165, #f36d0a);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #f1a165),color-stop(1, #f36d0a));
background-image: -webkit-linear-gradient(#f1a165, #f36d0a);
}
.red > span {
background-color: #f0a3a3;
background-image: -moz-linear-gradient(top, #f0a3a3, #f42323);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #f0a3a3),color-stop(1, #f42323));
background-image: -webkit-linear-gradient(#f0a3a3, #f42323);
color: #000 !important;
}
.nostripes > span > span, .nostripes > span:after {
-webkit-animation: none;
-moz-animation: none;
background-image: none;
}
#searchLocationTool {
background-color: #fff;
font-family: 'Hermes_FB';
font-size: 13px;
font-weight: 300;
margin-left: -200px;
padding: 1 11px 0 13px;
text-overflow: ellipsis;
width: 100%;
max-width: 400px;
position: absolute !important;
left: 50% !important;
}
.sugList-holder {
position: relative;
z-index: 1;
margin: auto;
width: 425px;
}
.sugList {
width: 99%;
background: #fff;
position: absolute;
left: -106px;
top: 24px;
padding: 0px;
}
.bluebuttonmsg {
color: #FFFFFF;
background: #1b3f94 !important;
/* padding-top: 5px; */
/* padding-bottom: 7px; */
text-align: center;
/*padding-right: 11px;*/
text-transform: Uppercase;
font-family: Verdana;
/*font-family: Hermes_FB;*/
font-size: 11px;
/* margin: 10px 2px; */
cursor: pointer;
/*font-weight: bold;*/
/* width: 114px; */
text-indent: 0;
/* padding-left: 9px; */
/* padding-right: 9px; */
overflow: hidden;
min-width: 64px;
}
.sugList li {
padding: 6px 10px;
border-top: 1px #e6e1e1 solid;
font-size: 12px;
}
.sugList li i {
position: relative;
width: 15px;
height: 27px;
background: transparent url('../../content/css/images/tracking.png');
background-repeat: no-repeat;
background-position: -1px 1px;
opacity: 0.5;
float: left;
margin-right: 7px;
}
.sugList li:hover, .sugList li.key-highlight {
background: #efecec;
}
.sugList li:hover i, .sugList li.key-highlight i {
opacity: 1;
background-color: transparent;
}
#popupContainer {
display: none; /* Hidden by default */
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400px;
padding: 20px;
background-color: white;
border: 2px solid #ccc;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 1000;
}
/* Background overlay */
#overlay {
display: none; /* Hidden by default */
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
}
/* Close button */
.close-btn {
display: block;
text-align: right;
font-size: 16px;
margin-bottom: 10px;
}
.close-btn a {
text-decoration: none;
color: #ff0000;
}
.box {
border: 2px solid #333; /* Adds a border */
padding: 20px; /* Adds space inside */
width: 1000px; /* Sets width */
height: auto; /* Adjusts height */
background-color: #f9f9f9; /* Light background */
margin-left: 220px;
margin-top: 7px;
}
</style>