EOS/Scripts/out/files/Inventory_manageVechile.js.html
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

485 lines
18 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Inventory\manageVechile.js</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="../assets/css/logo.png" title=""></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: </em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/CallFeedbackRating.html">CallFeedbackRating</a></li>
<li><a href="../classes/CloseTicketReport.html">CloseTicketReport</a></li>
<li><a href="../classes/ConsolidatedReport.html">ConsolidatedReport</a></li>
<li><a href="../classes/CustomerReport.html">CustomerReport</a></li>
<li><a href="../classes/DealerWiseCallDetails.html">DealerWiseCallDetails</a></li>
<li><a href="../classes/DeclinedCalls.html">DeclinedCalls</a></li>
<li><a href="../classes/DropDownData.html">DropDownData</a></li>
<li><a href="../classes/EicherPromise.html">EicherPromise</a></li>
<li><a href="../classes/EosCallCount.html">EosCallCount</a></li>
<li><a href="../classes/GeoAnalysis.html">GeoAnalysis</a></li>
<li><a href="../classes/HdBusLmdContrCallFeedbackRatingibution.html">HdBusLmdContrCallFeedbackRatingibution</a></li>
<li><a href="../classes/HdBusLmdContribution.html">HdBusLmdContribution</a></li>
<li><a href="../classes/HistoryTracking.html">HistoryTracking</a></li>
<li><a href="../classes/LiveTracking.html">LiveTracking</a></li>
<li><a href="../classes/ManageEscalation.html">ManageEscalation</a></li>
<li><a href="../classes/ManageFleet.html">ManageFleet</a></li>
<li><a href="../classes/ManageFleet_Detail.html">ManageFleet_Detail</a></li>
<li><a href="../classes/ManageFleet_details.html">ManageFleet_details</a></li>
<li><a href="../classes/ManageOwner.html">ManageOwner</a></li>
<li><a href="../classes/ManageReason.html">ManageReason</a></li>
<li><a href="../classes/ManageVechile.html">ManageVechile</a></li>
<li><a href="../classes/ManageVehicle.html">ManageVehicle</a></li>
<li><a href="../classes/NonVecvUserManagement.html">NonVecvUserManagement</a></li>
<li><a href="../classes/Notifications.html">Notifications</a></li>
<li><a href="../classes/OpenTicketReport.html">OpenTicketReport</a></li>
<li><a href="../classes/OrganizationChart.html">OrganizationChart</a></li>
<li><a href="../classes/PositioningTool.html">PositioningTool</a></li>
<li><a href="../classes/PositioningTool_Report.html">PositioningTool_Report</a></li>
<li><a href="../classes/ReasonForClosure.html">ReasonForClosure</a></li>
<li><a href="../classes/Report.html">Report</a></li>
<li><a href="../classes/ShowDealerMap.html">ShowDealerMap</a></li>
<li><a href="../classes/TicketAdministration.html">TicketAdministration</a></li>
<li><a href="../classes/TicketAdministration_FullDetail.html">TicketAdministration_FullDetail</a></li>
<li><a href="../classes/TicketFeedback.html">TicketFeedback</a></li>
<li><a href="../classes/TicketForDealer.html">TicketForDealer</a></li>
<li><a href="../classes/TicketForDealer_FullDetails.html">TicketForDealer_FullDetails</a></li>
<li><a href="../classes/TicketReassign.html">TicketReassign</a></li>
<li><a href="../classes/TileDashboard.html">TileDashboard</a></li>
<li><a href="../classes/TimeSlotClosure.html">TimeSlotClosure</a></li>
<li><a href="../classes/TollFreeAndOpportunityLoss.html">TollFreeAndOpportunityLoss</a></li>
<li><a href="../classes/VanCoverageDesigner.html">VanCoverageDesigner</a></li>
<li><a href="../classes/VecvUserManagement.html">VecvUserManagement</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="../modules/Dashboard.html">Dashboard</a></li>
<li><a href="../modules/DropDownData.html">DropDownData</a></li>
<li><a href="../modules/Geo.html">Geo</a></li>
<li><a href="../modules/Inventory.html">Inventory</a></li>
<li><a href="../modules/Notifications.html">Notifications</a></li>
<li><a href="../modules/ReportModule.html">ReportModule</a></li>
<li><a href="../modules/Ticket.html">Ticket</a></li>
<li><a href="../modules/TrackingModule.html">TrackingModule</a></li>
<li><a href="../modules/UserManagement.html">UserManagement</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: Inventory\manageVechile.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
/*================================================================================================================\
+
+ Project : GODATA Eicher
+ Filename : ManageVechile.js
+ Module Name : Inventory Module
+ Purpose : Manage Vechile Curd.
+ Coded By : Gourav Jhangikhel
+
+================================================================================================================*/
/**
* This Module manage Vechile.
* @module Inventory
*/
/**
* This class contains functions related to show Vechile details and manage CURD.
* @class ManageVechile
* @constructor
*/
var activeRequest, activeRequest_Edit, xhr_exportReport, activeRequest_service, activeRequest_dataSource;
var activeRequest_Organization, Action;
// ========================== Common function ===================================================================
/**
* Add kendow window to given Div id.
* @method addKendoWindowToDiv
* @param divId : id on which kendow wondow will add.
* @param titletext: Title text on window/popup.
* @for ManageVechile
*/
function addKendoWindowToDiv(divId, titleText, width, left) {
$(divId).kendoWindow({
width: width,
title: titleText,
modal: true,
resizable: false,
draggable: true,
position: {
top: 180,
left: left
}
});
}
function SetKendoWindowTitle(divId, titleText) {
var dialog = $(divId).data(&quot;kendoWindow&quot;);
dialog.title(titleText);
}
/**
* Close the kendo window.
* @method closeWindow
* @param divId : Id which we want to close kendo window.
* @for ManageVechile
*/
function closeWindow(divId) {
$(divId).data(&quot;kendoWindow&quot;).close();
}
// ========================== End of Common function ===================================================================
//================= Vehicles Details ==============================================================================
/**
* Fired when data bound to grid Vechile.
* @method onRowBoundVechile
* @for ManageVechile
*/
function onRowBoundVechile(e) {
// Add Edit and delete icon.
$(&#x27;.k-grid-Edit&#x27;).text(&quot;&quot;).removeClass(&quot;k-button k-button-icontext&quot;).html(&quot;&lt;span class=&#x27;k-icon k-edit&#x27;&gt;&lt;/span&gt;&quot;);
$(&#x27;.k-grid-Delete&#x27;).text(&quot;&quot;).removeClass(&quot;k-button k-button-icontext&quot;).html(&quot;&lt;span class=&#x27;k-icon k-delete&#x27;&gt;&lt;/span&gt;&quot;);
// called common file function to show title on mouse hover.
addTitleAttribute();
// show no data available message when grid has no data.
displayNoResult(e)
}
/**
* Show Vechile details to grid.
* @method showVechileDetails
* @for ManageVechile
*/
function showVechileDetails() {
$.post(&quot;/Inventory/Vehicle_Detail&quot;, null, function (data) {
$(&quot;#divVechicleDetails&quot;).html(data);
});
}
// ========================== Create Vechile ======================================================================
/**
* This function create a popup for Create Vechile.
* @method createVechile
* @for ManageVechile
*/
function createVehicle() {
// Ajax request
if (activeRequest &amp;&amp; activeRequest.readystate != 4) {
activeRequest.abort();
}
activeRequest = $.ajax({
type: &quot;POST&quot;,
url: &quot;/Inventory/AddOrEditVehicle&quot;,
success: function (data) {
$(&quot;#divCreateVechicle&quot;).html(&#x27;&#x27;);
$(&quot;#divCreateVechicle&quot;).html(&#x27;&#x27;);
$(&quot;#divCreateVechicle&quot;).html(data);
//$(&quot;#VehicleTypeTagging&quot;).hide();
//open form in new dialog box
$(&quot;#divCreateVechicle&quot;).data(&quot;kendoWindow&quot;).open();
$(&quot;#btnCrt&quot;).prop(&#x27;value&#x27;, &#x27;Create&#x27;);
SetKendoWindowTitle(&quot;#divCreateVechicle&quot;, &quot;Create Vehicle Model&quot;);
$(&quot;#VehicleTypeId&quot;).attr(&#x27;readonly&#x27;, false);
$(&quot;#Action&quot;).val(Action);
},
error: function (data) {
console.log(data);
}
});
}
/**
* This function create a popup for Edit Or Update Vechile.
* @method editVechile
* @for ManageVechile
*/
function editVehicle(e) {
// Get selected row
var dataItem = this.dataItem($(e.currentTarget).closest(&quot;tr&quot;));
// Create Vechile model
oVehicle = {};
oVehicle.VehicleTypeId = dataItem.VehicleTypeId;
oVehicle.VehicleTypeName = dataItem.VehicleTypeName;
oVehicle.VehicleTypeTagging = dataItem.VehicleTypeTagging;
//// Ajax request for edit ; if exist then kill it.
if (activeRequest_Edit &amp;&amp; activeRequest_Edit.readystate != 4) {
activeRequest_Edit.abort();
}
activeRequest_Edit = $.ajax({
type: &quot;GET&quot;,
url: &quot;/Inventory/AddOrEditVehicle&quot;,
data: oVehicle,
success: function (data) {
$(&quot;#divCreateVechicle&quot;).html(&#x27;&#x27;);
$(&quot;#divCreateVechicle&quot;).html(data);
//open form in new dialog box
$(&quot;#divCreateVechicle&quot;).data(&quot;kendoWindow&quot;).open();
$(&quot;#btnCrt&quot;).prop(&#x27;value&#x27;, &#x27;Update&#x27;);
//$(&#x27;#ddVehicleTypeTagging&#x27;).hide();
//$(&#x27;#VehicleTypeTagging&#x27;).show();
SetKendoWindowTitle(&quot;#divCreateVechicle&quot;, &quot;Edit Vehicle Model&quot;);
$(&quot;#VehicleTypeId&quot;).attr(&#x27;readonly&#x27;, true);
},
error: function (data) {
console.log(data);
}
});
// Create Vehicle model
}
/**
* Delete Vechile entry.
* @method deleteVechile
* @for ManageVechile
*/
function deleteVehicle(e) {
// get row data on which click event fired
var dataItem = this.dataItem($(e.currentTarget).closest(&quot;tr&quot;));
// Create Vechile model
oVehicle = {};
oVehicle.VehicleTypeId = dataItem.VehicleTypeId;
oVehicle.VehicleTypeName = dataItem.VehicleTypeName;
oVehicle.VehicleTypeTagging = dataItem.VehicleTypeTagging;
oVehicle.IsDeleted = true;
oVehicle.Operation = &quot;update&quot;;
//jConfirm(&#x27;Are you sure that you want to delete the Vehicle model &lt;b&gt; &#x27; + oVehicle.VehicleTypeId + &#x27;&lt;/b&gt; of Product Variant &lt;b&gt; &#x27; + oVehicle.VehicleTypeTagging + &#x27;&lt;/b&gt; ?&#x27;, &#x27;Delete&#x27;, function (result) {
jConfirm(MANAGE_FLEET_MESSAGES.confirmDeleteVModel + &#x27; &lt;b&gt; &#x27; + oVehicle.VehicleTypeId + &#x27;&lt;/b&gt; of Product Variant &lt;b&gt; &#x27; + oVehicle.VehicleTypeTagging + &#x27;&lt;/b&gt; ?&#x27;, &#x27;Delete&#x27;, function (result) {
//again check whether user input is true
if (result) {
//send ajax request to controller to delete connected device entry.
$.ajax({
type: &quot;POST&quot;,
url: &quot;/Inventory/InsertVehicleModel/&quot;,
data: oVehicle,
success: function (data) {
if (data.success == true) {
var grid = $(&quot;#gridVechile&quot;).data(&quot;kendoGrid&quot;);
grid.removeRow(grid.tbody.find(&quot;tr&quot;)[$(e.currentTarget).closest(&quot;tr&quot;).index()]);
//jAlert(&#x27;Vehicle Model deleted successfully!!&#x27;, &#x27;Message&#x27;);
jAlert(MANAGE_VEHICLE_MESSAGES.deleteVModelSuccess, &#x27;Message&#x27;);
}
else {
//alert box to show unsuccess deletion message
//jAlert(&#x27;Deletion is unsuccessful!!&#x27;, &#x27;Message&#x27;);
jAlert(MANAGE_VEHICLE_MESSAGES.deleteVModelFail, &#x27;Message&#x27;);
}
},
error: function (data) {
console.log(data);
}
});
}
});
}
/**
* Called when submit button clicked on Create Vehicle and Edit Vehicle form.
* and Validate Vehicle form.
* @method onBeginCreateVehicle
* @for ManageVehicle
*/
function onBeginCreateVehicle() {
var VehicleTypeId = $(&quot;#VehicleTypeId&quot;).val();
var VehicleTypeTagging = $(&#x27;#ddVehicleTypeTagging :selected&#x27;).val();
var returnResult = true;
var VehicleTypeName = $(&quot;#VehicleTypeName&quot;).val();
$(&quot;#spanVehicleTypeId&quot;).hide();
$(&quot;#spanVehicleTypeTagging&quot;).hide();
$(&quot;#spanVehicleTypeName&quot;).hide();
if (VehicleTypeId == &quot;&quot;) {
$(&quot;#spanVehicleTypeId&quot;).show();
returnResult = false;
}
else if (typeof VehicleTypeTagging == &quot;undefined&quot; || VehicleTypeTagging == &quot;&quot;) {
$(&quot;#spanVehicleTypeTagging&quot;).show();
returnResult = false;
}
else if (typeof VehicleTypeName == &quot;&quot;) {
$(&quot;#spanVehicleTypeName&quot;).show();
returnResult = false;
}
return returnResult;
}
/**
* Called when Vehicle added successfully.
* In case of success close popup otherwise show error message.
* @method onSuccessVehicle
* @for ManageVehicle
*/
function onSuccessVehicle(result) {
if (result.success) {
// close popup for create Vehicle
closeWindow(&quot;#divCreateVechicle&quot;);
// show updated Vehicle details
showVechileDetails();
}
jAlert(result.message, &#x27;message&#x27;);
}
//========================== document ready=======================
/**
* To do some initial functionality on page when Document is ready.
* @event document.ready
* @for ManageVehicle
*/
$(document).ready(function () {
addKendoWindowToDiv(&quot;#divCreateVechicle&quot;, &quot;Create Vehicle Model&quot;, &quot;683px&quot;, 422);
});
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>