sync
This commit is contained in:
@ -12,42 +12,6 @@
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.dialog-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 184px;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
line-height: 24px;
|
||||
height: 24px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.dialog-content table td input,
|
||||
.dialog-content table td textarea {
|
||||
border: 1px solid #a9a9a9;
|
||||
width: 200px;
|
||||
height: 18px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.dialog-content table td input[type="checkbox"] {
|
||||
border: none;
|
||||
width: 13px;
|
||||
}
|
||||
|
||||
.dialog-content table td input[type="radio"] {
|
||||
border: none;
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.dialog-content table td textarea {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
#dialogdatatb td {
|
||||
padding-top: 30px;
|
||||
}
|
||||
@ -156,7 +120,6 @@
|
||||
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/components/datagrid.js")%>"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../Maintenance/js/inputdatactr.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/controls.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../fic/js/utility.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/gridlayout.js")%>" type="text/javascript"></script>
|
||||
@ -168,6 +131,8 @@
|
||||
var CheckRight =<%=CheckRight ?"true":"false"%>;
|
||||
var IsReadOnly = <%=IsReadOnly ?"true":"false"%>;
|
||||
var gridLayoutID = "ManageAssets";
|
||||
var AssetListApiAddress = "<%=AssetListApiAddress%>";
|
||||
var CompanyID = "<%=CompanyID%>";
|
||||
|
||||
var machineID;
|
||||
var indexInEdit = -1;
|
||||
@ -193,7 +158,7 @@
|
||||
showmaskbg(false, true);
|
||||
showAlert(GetTextByKey('P_MA_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_MA_QUERY', 'Query'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function CloseDialog(type) {
|
||||
$('#dialog_machine1').hideDialog();
|
||||
@ -232,10 +197,10 @@
|
||||
function OnEdit() {
|
||||
indexInEdit = grid_dt.selectedIndex;
|
||||
if (indexInEdit < 0) {
|
||||
showAlert(GetTextByKey("P_MA_XXXXXX", "Please select an asset."), GetTextByKey("P_MA_EDITASSET", "Edit Asset"));
|
||||
showAlert(GetTextByKey("P_MA_SELECTANASSET", "Please select an asset."), GetTextByKey("P_MA_EDITASSET", "Edit Asset"));
|
||||
return;
|
||||
}
|
||||
var machine = grid_dt.source[indexInEdit].Values;
|
||||
var machine = grid_dt.source[indexInEdit];
|
||||
if (!machine) {
|
||||
machineID = undefined;
|
||||
return;
|
||||
@ -248,8 +213,35 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var lastContractorID = "-1";
|
||||
function OnRefresh1() {
|
||||
var CustId = CompanyID;
|
||||
if (IsDealer) {
|
||||
CustId = $('#sel_contractor').val();
|
||||
if (!CustId) return;
|
||||
}
|
||||
|
||||
showloading(true);
|
||||
var item = {
|
||||
'filter': htmlencode($.trim($('#searchinputtxt').val())),
|
||||
'hide': $('#chkShowHidden').prop("checked") ? 1 : 0,
|
||||
'attachment': $('#chkAttachment').prop("checked") ? 1 : 0
|
||||
};
|
||||
_network.apiget(AssetListApiAddress, CustId, item, function (data) {
|
||||
var assets = convertAssetObjs(data);
|
||||
|
||||
showMachines(assets);
|
||||
showloading(false);
|
||||
}, function (request, textStatus, errorThrown) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
if (AssetListApiAddress) {
|
||||
OnRefresh1();
|
||||
return;
|
||||
}
|
||||
|
||||
var contractorid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
if (IsDealer && !contractorid)
|
||||
return;
|
||||
@ -259,20 +251,65 @@
|
||||
var attachment = $('#chkAttachment').prop("checked") ? 1 : 0;
|
||||
showloading(true);
|
||||
assetrequest("GetMachinesByCompany", contractorid + String.fromCharCode(170) + showHidden + String.fromCharCode(170) + searchtxt + String.fromCharCode(170) + attachment, function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_MA_ERROR", 'Error'));
|
||||
showloading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
showMachines(data);
|
||||
var assets = convertAssetObjs(data);
|
||||
|
||||
showMachines(assets);
|
||||
showloading(false);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function convertAssetObjs(data) {
|
||||
var assets = [];
|
||||
if (data !== "") {
|
||||
var assetary = data.split(String.fromCharCode(180));
|
||||
for (var i = 0; i < assetary.length; i++) {
|
||||
var ss = assetary[i].split(String.fromCharCode(175));
|
||||
var asset = {};
|
||||
asset.ID = parseInt(ss[0]);
|
||||
asset.Name = ss[1];
|
||||
asset.Name2 = ss[2];
|
||||
asset.VIN = ss[3];
|
||||
asset.MakeID = parseInt(ss[4]);
|
||||
asset.ModelID = parseInt(ss[5]);
|
||||
asset.TypeID = parseInt(ss[6]);
|
||||
asset.MakeName = ss[7];
|
||||
asset.ModelName = ss[8];
|
||||
asset.TypeName = ss[9];
|
||||
asset.ContractorID = ss[10];
|
||||
asset.DealerID = ss[11];
|
||||
asset.MakeYear = parseInt(ss[12]);
|
||||
asset.OnRoad = ss[13] == "1" ? true : false;
|
||||
asset.Hide = ss[14] == "1" ? true : false;
|
||||
asset.TelematicsEnabled = ss[15] == "1" ? true : false;
|
||||
asset.CalampDeviceAirID = ss[16];
|
||||
asset.EngineHours = parseFloat(ss[17]);
|
||||
asset.EngineHoursDate = ss[18];
|
||||
asset.Attachment = ss[19] == "1" ? true : false;
|
||||
asset.ShareStatus = parseInt(ss[20]);
|
||||
asset.AddedTime = ss[21];
|
||||
asset.AddedLocalTime = ss[22];
|
||||
asset.Odometer = parseFloat(ss[23]);
|
||||
asset.OdometerUOM = ss[24];
|
||||
asset.OdometerDate = ss[25];
|
||||
asset.Description = ss[26];
|
||||
asset.AcquisitionType = ss[27];
|
||||
asset.PMPlans = ss[28];
|
||||
asset.AssetGroups = ss[29];
|
||||
asset.Jobsites = ss[30];
|
||||
asset.CustomStatus = parseInt(ss[31]);
|
||||
asset.Preloaded = parseInt(ss[32]) > 0 ? true : false;
|
||||
asset.AddedTimeStr = ss[33];
|
||||
asset.EngineHoursDateStr = ss[34];
|
||||
asset.EngineHoursDateTimeStr = ss[35];
|
||||
asset.OdometerDateStr = ss[36];
|
||||
assets.push(asset);
|
||||
}
|
||||
}
|
||||
return assets;
|
||||
}
|
||||
|
||||
|
||||
//admin用户 获取所有contractor
|
||||
function getContractors() {
|
||||
@ -343,7 +380,7 @@
|
||||
'Key': ContractorID,
|
||||
'Value': mid,
|
||||
};
|
||||
var machine = grid_dt.source[grid_dt.selectedIndex].Values;
|
||||
var machine = grid_dt.source[grid_dt.selectedIndex];
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append("iconFile", file);
|
||||
@ -393,8 +430,9 @@
|
||||
function DeleteMachine(mid) {
|
||||
var mids = [];
|
||||
if (!mid) {
|
||||
for (var i = 0; i < grid_dt.source.length; i++) {
|
||||
var machine = grid_dt.source[i].Values;
|
||||
var tempsource = grid_dt.source;
|
||||
for (var i = 0; i < tempsource.length; i++) {
|
||||
var machine = tempsource[i];
|
||||
if (machine.Selected && machine.ShareStatus !== 2)
|
||||
mids.push(machine.ID);
|
||||
}
|
||||
@ -403,12 +441,12 @@
|
||||
mids.push(mid);
|
||||
|
||||
if (mids.length <= 0) {
|
||||
showAlert(GetTextByKey("P_MA_XXXXXX", "Please select an asset."), GetTextByKey("P_MA_XXXXXX", "Delete Asset"));
|
||||
showAlert(GetTextByKey("P_MA_SELECTANASSET", "Please select an asset."), GetTextByKey("P_MA_DELETEASSET", "Delete Asset"));
|
||||
return;
|
||||
}
|
||||
|
||||
showConfirm(GetTextByKey("P_MA_XXXXXX", 'WARNING: This will delete the asset(s). Are you sure you want to proceed?'),
|
||||
GetTextByKey("P_MA_XXXXX", 'Delete Asset'), function (e) {
|
||||
showConfirm(GetTextByKey("P_MA_DELETEASSETSWARNING", 'WARNING: This will delete the asset(s). Are you sure you want to proceed?'),
|
||||
GetTextByKey("P_MA_DELETEASSET", 'Delete Asset'), function (e) {
|
||||
doDeleteMachine(mids);
|
||||
});
|
||||
}
|
||||
@ -425,13 +463,28 @@
|
||||
showAlert(data, GetTextByKey("P_MA_ERROR", 'Error'));
|
||||
}
|
||||
else {
|
||||
//showAlert(GetTextByKey("P_MA_XXXXXX", 'Deleted Successfully.'), GetTextByKey("P_MA_ERROR", 'Error'));
|
||||
OnRefresh();
|
||||
}
|
||||
}, function (err) {
|
||||
showmaskbg(false);
|
||||
});
|
||||
}
|
||||
function getLangAcquisitionType(text) {
|
||||
var langtext = text;
|
||||
if (text === "Rental")
|
||||
langtext = GetTextByKey("P_MA_RENTAL", "Rental");
|
||||
else if (text === "RPO")
|
||||
langtext = GetTextByKey("P_MA_PRO", "RPO");
|
||||
else if (text === "Rerent")
|
||||
langtext = GetTextByKey("P_MA_RERENT", "Rerent");
|
||||
else if (text === "Leased")
|
||||
langtext = GetTextByKey("P_MA_LEASED", "Leased");
|
||||
else if (text === "Owned - Purchase")
|
||||
langtext = GetTextByKey("P_MA_OWNEDPURCHASE", "Owned - Purchase");
|
||||
else if (text === "Owned - Lease")
|
||||
langtext = GetTextByKey("P_MA_OWNEDLEASE", "Owned - Lease");
|
||||
return langtext;
|
||||
}
|
||||
|
||||
function showMachines(data) {
|
||||
var rows = [];
|
||||
@ -447,15 +500,15 @@
|
||||
if (j === "CustomStatus") {
|
||||
var text = "";
|
||||
if (r["CustomStatus"] == 0)
|
||||
text = GetTextByKey("P_MA_XXXXXX", "In Use");
|
||||
text = GetTextByKey("P_MA_INUSE", "In Use");
|
||||
else if (r["CustomStatus"] == 1)
|
||||
text = GetTextByKey("P_MA_XXXXXX", "Available");
|
||||
text = GetTextByKey("P_MA_AVAILABLE", "Available");
|
||||
else if (r["CustomStatus"] == 2)
|
||||
text = GetTextByKey("P_MA_XXXXXX", "Standby");
|
||||
text = GetTextByKey("P_MA_STANDBY", "Standby");
|
||||
else if (r["CustomStatus"] == 10)
|
||||
text = GetTextByKey("P_MA_XXXXXX", "Down");
|
||||
text = GetTextByKey("P_MA_DOWN", "Down");
|
||||
|
||||
r[j] = { DisplayValue: text, Value: r["CustomStatus"] };
|
||||
r[j] = { DisplayValue: text, Value: text };
|
||||
}
|
||||
else if (j === "MakeYear")
|
||||
r[j] = r[j] === 0 ? "" : r[j];
|
||||
@ -463,50 +516,50 @@
|
||||
r[j] = { DisplayValue: r[j] === 0 ? "" : r[j].toLocaleString(), Value: r[j] };
|
||||
else if (j === "Odometer")
|
||||
r[j] = { DisplayValue: r[j] === 0 ? "" : (r[j].toLocaleString() + " " + r["OdometerUOM"]), Value: r[j] };
|
||||
else if (j === "AcquisitionType")
|
||||
r[j] = { DisplayValue: getLangAcquisitionType(r["AcquisitionType"]), Value: r[j] };
|
||||
else if (j === "Jobsites" || j === "PMPlans" || j === "AssetGroups")
|
||||
r[j] = (r[j] || '').split(', ');
|
||||
|
||||
}
|
||||
//r.CanEdit = !IsReadOnly && r.ShareStatus != 2
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
rows.push(r);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
grid_dt.reload(true);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
$('#btnEdit').attr("disabled", "disabled");
|
||||
|
||||
grid_dt = new GridView('#machinelist');
|
||||
grid_dt.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
grid_dt = createGridView('#machinelist');
|
||||
//grid_dt.lang.all;
|
||||
//grid_dt.lang.ok = "Apply";
|
||||
//grid_dt.lang.reset;
|
||||
var list_columns = [
|
||||
{ name: 'Selected', caption: "", valueIndex: 'Selected', alwaysshow: true, css: { 'width': 45, 'text-align': 'center' }, type: 3 },
|
||||
{ name: 'VIN', caption: GetTextByKey("P_MA_VINSN", "SN/VIN"), valueIndex: 'VIN', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Name', caption: GetTextByKey("P_MA_ASSETNAME", "Asset Name"), valueIndex: 'Name', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Name2', caption: GetTextByKey("P_MA_ASSETNAME2", "Asset Name(Custom)"), valueIndex: 'Name2', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'VIN', caption: GetTextByKey("P_MA_VINSN", "SN/VIN"), valueIndex: 'VIN', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Name', caption: GetTextByKey("P_MA_ASSETNAME", "Asset Name"), valueIndex: 'Name', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Name2', caption: GetTextByKey("P_MA_ASSETNAME2", "Asset Name(Custom)"), valueIndex: 'Name2', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Make', caption: GetTextByKey("P_MA_MAKE", "Make"), valueIndex: 'MakeName', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'Model', caption: GetTextByKey("P_MA_MODEL", "Model"), valueIndex: 'ModelName', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'MachineType', caption: GetTextByKey("P_MA_TYPE", "Asset Type"), valueIndex: 'TypeName', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'MakeYear', caption: GetTextByKey("P_MA_YEAR", "Year"), valueIndex: 'MakeYear', allowFilter: true, css: { 'width': 80, 'text-align': 'left' } },
|
||||
{ name: 'EngineHours', caption: GetTextByKey("P_MA_ENGINEHOURS", "Engine Hours"), valueIndex: 'EngineHours', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'MakeYear', caption: GetTextByKey("P_MA_YEAR", "Year"), valueIndex: 'MakeYear', allowFilter: true, css: { 'width': 80, 'text-align': 'right' } },
|
||||
{ name: 'EngineHours', caption: GetTextByKey("P_MA_ENGINEHOURS", "Engine Hours"), valueIndex: 'EngineHours', allowFilter: true, css: { 'width': 120, 'text-align': 'right' } },
|
||||
{ name: 'EngineHoursDate', caption: GetTextByKey("P_MA_ENGINEHOURSDATE", "Engine Hours Date"), valueIndex: 'EngineHoursDate', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Odometer', caption: GetTextByKey("P_MA_ODOMETER", "Odometer"), valueIndex: 'Odometer', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'Odometer', caption: GetTextByKey("P_MA_ODOMETER", "Odometer"), valueIndex: 'Odometer', allowFilter: true, css: { 'width': 120, 'text-align': 'right' } },
|
||||
{ name: 'OdometerDate', caption: GetTextByKey("P_MA_ODOMETERDATE", "Odometer Date"), valueIndex: 'OdometerDate', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Description', caption: GetTextByKey("P_MA_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'Jobsite', caption: GetTextByKey("P_MA_XXXXXX", "Jobsite"), valueIndex: 'Jobsites', css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'GpsDeviceSN', caption: GetTextByKey("P_MA_PAIREDDEVICESN", "Paired Device SN"), valueIndex: 'CalampDeviceAirID', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'AcquisitionType', caption: GetTextByKey("P_MA_XXXXXX", "AcquisitionType"), valueIndex: 'AcquisitionType', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'Description', caption: GetTextByKey("P_MA_DESCRIPTION", "Description"), valueIndex: 'Description', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'Jobsite', caption: GetTextByKey("P_MA_JOBSITE", "Jobsite"), valueIndex: 'Jobsites', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'GpsDeviceSN', caption: GetTextByKey("P_MA_PAIREDDEVICESN", "Paired Device SN"), valueIndex: 'CalampDeviceAirID', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'AcquisitionType', caption: GetTextByKey("P_MA_ACQUISITIONTYPE", "Acquisition Type"), valueIndex: 'AcquisitionType', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'AddedOn', caption: GetTextByKey("P_MA_ADDEDON", "Added On"), valueIndex: 'AddedTime', css: { 'width': 130, 'text-align': 'left' } },
|
||||
{ name: 'CustomStatus', caption: GetTextByKey("P_MA_XXXXXX", "Availability"), valueIndex: 'CustomStatus', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'PMPlan', caption: GetTextByKey("P_MA_XXXXXX", "PM Plan"), valueIndex: 'PMPlans', css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'AssetGroups', caption: GetTextByKey("P_JS_ASSETGROUP", "Asset Group"), valueIndex: 'AssetGroups', css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'CustomStatus', caption: GetTextByKey("P_MA_AVAILABILITY", "Availability"), valueIndex: 'CustomStatus', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'PMPlan', caption: GetTextByKey("P_MA_PMPLAN", "PM Plan"), valueIndex: 'PMPlans', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },
|
||||
{ name: 'AssetGroups', caption: GetTextByKey("P_JS_ASSETGROUP", "Asset Group"), valueIndex: 'AssetGroups', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },
|
||||
|
||||
{ name: 'OnRoad', caption: GetTextByKey("P_MA_ONROAD", "On-Road"), valueIndex: 'OnRoad', type: 3, allowFilter: true, css: { 'width': 90, 'text-align': 'center' } },
|
||||
{ name: 'Attachment', caption: GetTextByKey("P_MA_ATTACHMENT", "Attachment"), valueIndex: 'Attachment', type: 3, allowFilter: true, css: { 'width': 96, 'text-align': 'center' } },
|
||||
@ -516,6 +569,7 @@
|
||||
|
||||
{ name: 'UploadAssetIcon', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'DeleteAssetIcon', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'AssetHistory', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'Detail', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'DeleteAsset', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
@ -546,22 +600,23 @@
|
||||
display: e.ShareStatus === 2 ? 'none' : ''
|
||||
};
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_MA_XXXXXX", 'Select for deleteing asset') };
|
||||
col.attrs = { 'title': GetTextByKey("P_MA_SELECTFORDELETEINGASSET", 'Select for deleteing asset') };
|
||||
}
|
||||
if (IsReadOnly && (col.name === "UploadAssetIcon" || col.name === "DeleteAssetIcon"))
|
||||
continue;
|
||||
if (col.name === "Hide" || col.name === "OnRoad" || col.name === "TelematicsEnabled" || col.name === "Attachment" || col.name === "Preloaded") {
|
||||
col.onchanged = function (e) {
|
||||
e.ValueChanged = true;
|
||||
col.type = GridView.ColumnTypes.Checkbox;
|
||||
col.onChanged = function (e) {
|
||||
//e.ValueChanged = true;
|
||||
}
|
||||
col.filterSource = [{ Value: true, DisplayValue: 'Yes' }, { Value: false, DisplayValue: 'No' }];
|
||||
col.filterSource = [{ Value: true, DisplayValue: GetTextByKey('P_UTILITY_YES', 'Yes') }, { Value: false, DisplayValue: GetTextByKey('P_UTILITY_NO', 'No') }];
|
||||
col.events = {
|
||||
onchange: function () {
|
||||
if (grid_dt.selectedColumnIndex >= 0) {
|
||||
var name = grid_dt.columns[grid_dt.selectedColumnIndex].name;
|
||||
onchange: (function (c) {
|
||||
return function () {
|
||||
var name = c.name;
|
||||
ChangeAssetProperty(this, name);
|
||||
}
|
||||
}
|
||||
})(col)
|
||||
};
|
||||
//col.enabled = "CanEdit";
|
||||
if (IsReadOnly) {
|
||||
@ -570,8 +625,9 @@
|
||||
}
|
||||
else if (col.name === "UploadAssetIcon") {
|
||||
col.sortable = false;
|
||||
col.isurl = true;
|
||||
col.text = "\uf093";
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "upload";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
UpLoadMachineIcon(1, this.ID);
|
||||
@ -584,11 +640,9 @@
|
||||
}
|
||||
else if (col.name === "DeleteAssetIcon") {
|
||||
col.sortable = false;
|
||||
col.isurl = true;
|
||||
col.text = "\uf317";
|
||||
//col.filter = function (e) {
|
||||
// return e.MachineIconFileName === "" ? "" : "\uf00d";
|
||||
//}
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "file-times";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
if (this.MachineIconFileName !== "")
|
||||
@ -607,8 +661,9 @@
|
||||
}
|
||||
else if (col.name === "DeleteAsset") {
|
||||
col.sortable = false;
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "times";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
DeleteMachine(this.ID);
|
||||
@ -622,12 +677,13 @@
|
||||
display: e.ShareStatus === 2 ? 'none' : ''
|
||||
};
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_MA_XXXXXX", 'Delete Asset') };
|
||||
col.attrs = { 'title': GetTextByKey("P_MA_DELETEASSET", 'Delete Asset') };
|
||||
}
|
||||
else if (col.name === "Detail") {
|
||||
col.sortable = false;
|
||||
col.isurl = true;
|
||||
col.text = "\uf05a";
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "info-circle";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
showMachineDetail(this.ID, this.VIN);
|
||||
@ -638,17 +694,31 @@
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_MA_SHOWASSETDETAIL", 'Show Asset Detail') };
|
||||
}
|
||||
else if (col.name === "AssetHistory") {
|
||||
col.sortable = false;
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "history";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
var contractorid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
window.open("AssetHistory.aspx?cid=" + contractorid + "&aid=" + this.ID + "&isopen=1");
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_MA_SHOWASSETHISTORY", 'Show Asset History') };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
//grid_dt.columns = columns;
|
||||
//grid_dt.init();
|
||||
grid_dt.rowdblclick = OnEdit;
|
||||
grid_dt.multiSelect = false;
|
||||
grid_dt.onRowDblClicked = OnEdit;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
grid_dt.onSelectedRowChanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
machineID = rowdata.Values.ID;
|
||||
machineID = rowdata.ID;
|
||||
$('#btnDelete').removeAttr("disabled");
|
||||
$('#btnEdit').removeAttr("disabled");
|
||||
}
|
||||
@ -682,25 +752,25 @@
|
||||
CreateLayoutMenus(ev.target, gridLayoutID, grid_dt);
|
||||
return false;
|
||||
});
|
||||
editableSelectFromAsset = new $editableselect($("#dialog_fromasset"));
|
||||
editableSelectFromAsset.tabIndex(1);
|
||||
editableSelectFromAsset.setEnable(false);
|
||||
editableSelectFromAsset.change(function () {
|
||||
var asset = editableSelectFromAsset.selecteditem();
|
||||
if (!asset)
|
||||
return;
|
||||
showAssetDetail(asset.Id, 1);
|
||||
});
|
||||
//editableSelectFromAsset = new $editableselect($("#dialog_fromasset"));
|
||||
//editableSelectFromAsset.tabIndex(1);
|
||||
//editableSelectFromAsset.setEnable(false);
|
||||
//editableSelectFromAsset.change(function () {
|
||||
// var asset = editableSelectFromAsset.selecteditem();
|
||||
// if (!asset)
|
||||
// return;
|
||||
// showAssetDetail(asset.Id, 1);
|
||||
//});
|
||||
|
||||
editableSelectToAsset = new $editableselect($("#dialog_toasset"));
|
||||
editableSelectToAsset.tabIndex(1);
|
||||
editableSelectToAsset.setEnable(false);
|
||||
editableSelectToAsset.change(function () {
|
||||
var asset = editableSelectToAsset.selecteditem();
|
||||
if (!asset)
|
||||
return;
|
||||
showAssetDetail(asset.Id, 2);
|
||||
});
|
||||
//editableSelectToAsset = new $editableselect($("#dialog_toasset"));
|
||||
//editableSelectToAsset.tabIndex(1);
|
||||
//editableSelectToAsset.setEnable(false);
|
||||
//editableSelectToAsset.change(function () {
|
||||
// var asset = editableSelectToAsset.selecteditem();
|
||||
// if (!asset)
|
||||
// return;
|
||||
// showAssetDetail(asset.Id, 2);
|
||||
//});
|
||||
|
||||
|
||||
if (!CheckRight) {
|
||||
@ -837,12 +907,12 @@
|
||||
tr.append(td);
|
||||
td = $('<td></td>');
|
||||
tr.append(td);
|
||||
var sel = CreateSelect(excelcolumns, col.Id);
|
||||
var sel = CreateSelect(excelcolumns, col.Id, col.Name);
|
||||
td.append(sel);
|
||||
}
|
||||
}
|
||||
|
||||
function CreateSelect(excelcolumns, colid) {
|
||||
function CreateSelect(excelcolumns, colid, colname) {
|
||||
var sel = $('<select style="width:180px;" name="sel_import"></select>').data('id', colid);
|
||||
sel.append('<option></option>');
|
||||
if (excelcolumns && excelcolumns.length > 0) {
|
||||
@ -850,7 +920,7 @@
|
||||
var op = $('<option></option>').text(excelcolumns[i]).val(excelcolumns[i]);
|
||||
sel.append(op);
|
||||
}
|
||||
sel.val(colid);
|
||||
sel.val(colname);
|
||||
}
|
||||
return sel;
|
||||
}
|
||||
@ -866,7 +936,6 @@
|
||||
{ Id: "Model", Name: GetTextByKey("P_MA_MODEL", "Model"), Width: 120, Key: 'ModelName' },
|
||||
{ Id: "Eq.Class", Name: GetTextByKey("P_MA_EQCLASS", "Eq.Class"), Width: 120, Key: 'EQClass' },
|
||||
{ Id: "Description", Name: GetTextByKey("P_MA_DESCRIPTION", "Description"), Width: 120, Key: 'Description' },
|
||||
{ Id: "Undercarriage Replacement Interval(Hours)", Name: GetTextByKey("P_MA_URINTERVAL", "Undercarriage Replacement Interval(Hours)"), Width: 120, Key: 'UnderCarriageHours' },
|
||||
{ Id: "Acquisition Type", Name: GetTextByKey("P_MA_ACQUISITIONTYPE", "Acquisition Type"), Width: 120, Key: 'AquisitionType' },
|
||||
{ Id: "Cost Center", Name: GetTextByKey("P_MA_COSTCENTER", "Cost Center"), Width: 120, Key: 'CostCenter' },
|
||||
{ Id: "Hide/Hidden", Name: GetTextByKey("P_MA_HIDEHIDDEN", "Hide/Hidden"), Width: 120, Key: 'Hidden' },
|
||||
@ -920,7 +989,7 @@
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_import_result.canMultiSelect = false;
|
||||
grid_import_result.multiSelect = false;
|
||||
grid_import_result.columns = columns;
|
||||
grid_import_result.init();
|
||||
|
||||
@ -932,28 +1001,24 @@
|
||||
for (var j in r) {
|
||||
if (j === "MakeYear")
|
||||
r[j] = { DisplayValue: r["MakeYear"] === -1 ? "" : r["MakeYear"], Value: r[j] };
|
||||
else if (j === "UnderCarriageHours")
|
||||
r[j] = { DisplayValue: r["UnderCarriageHours"] >= 0 ? r["UnderCarriageHours"] : "", Value: r[j] };
|
||||
else if (j == "Hidden") {
|
||||
r[j] = { DisplayValue: r[j] == 1 ? "Yes" : "No", Value: r[j] };
|
||||
r[j] = { DisplayValue: r[j] == 1 ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
|
||||
} else if (j == "OnRoad") {
|
||||
r[j] = { DisplayValue: r[j] == 1 ? "Yes" : "No", Value: r[j] };
|
||||
r[j] = { DisplayValue: r[j] == 1 ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
|
||||
} else if (j == "TelematicsEnabled") {
|
||||
r[j] = { DisplayValue: r[j] == 1 ? "Yes" : "No", Value: r[j] };
|
||||
r[j] = { DisplayValue: r[j] == 1 ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
|
||||
} else if (j == "Attachment") {
|
||||
r[j] = { DisplayValue: r[j] == 1 ? "Yes" : "No", Value: r[j] };
|
||||
r[j] = { DisplayValue: r[j] == 1 ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
|
||||
} else if (j == "Preloaded") {
|
||||
r[j] = { DisplayValue: r[j] == 1 ? "Yes" : "No", Value: r[j] };
|
||||
r[j] = { DisplayValue: r[j] == 1 ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
rows.push(r);
|
||||
}
|
||||
|
||||
grid_import_result.setData(rows);
|
||||
grid_import_result.resize();
|
||||
grid_import_result.reload(true);
|
||||
|
||||
}
|
||||
var errordata;
|
||||
@ -1015,7 +1080,7 @@
|
||||
var selected = [];
|
||||
if (t == 1) {
|
||||
for (var i in grid_import_result.source) {
|
||||
selected.push(grid_import_result.source[i].Values.checked);
|
||||
selected.push(grid_import_result.source[i].checked);
|
||||
}
|
||||
grid_import_result.setData([]);
|
||||
}
|
||||
@ -1173,7 +1238,7 @@
|
||||
<span data-lgid="P_MA_CONTRACTOR_COLON">Contractor:</span>
|
||||
<select id="sel_contractor"></select></span>
|
||||
<input id="searchinputtxt" type="text" autocomplete="off" />
|
||||
<input class="search" type="button" onclick="OnRefresh();" value="Search" style="margin-left:5px;" data-lgid="P_MA_SEARCH" />
|
||||
<input class="search" type="button" onclick="OnRefresh();" value="Search" style="margin-left: 5px;" data-lgid="P_MA_SEARCH" />
|
||||
<input id="chkShowHidden" type="checkbox" onclick="OnRefresh();" style="margin-left: 20px;" /><label for="chkShowHidden" data-lgid="P_MA_SHOWHIDDEN">Show Hidden</label>
|
||||
<input id="chkAttachment" type="checkbox" onclick="OnRefresh();" checked="checked" style="margin-left: 20px;" /><label for="chkAttachment" data-lgid="P_MA_SHOWATTACHMENTS">Show Attachments</label>
|
||||
</div>
|
||||
@ -1183,25 +1248,27 @@
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_MA_REFRESH">Refresh</span>
|
||||
<%if (IsSupperAdmin && !IsDealer)
|
||||
{ %>
|
||||
<span class="sbutton icondelete" onclick="DeleteMachine();" data-lgid="P_MA_XXXXX">Delete Asset(s)</span>
|
||||
<span class="sbutton icondelete" onclick="DeleteMachine();" data-lgid="P_MA_DELETEASSETS">Delete Asset(s)</span>
|
||||
<%} %>
|
||||
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_UTILITY_EXPORTTOEXCEL">Export to Excel</span>
|
||||
<span class="sbutton iconimport" onclick="OnImport();" data-lgid="P_JS_IMPORT">Import</span>
|
||||
<span class="sbutton iconlayout iconmenu" data-lgid="P_MR_LAYOUT">Layout</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="machinelist">
|
||||
<div id="machinelist" class="fixedgrid">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
|
||||
<div class="dialog" id="dialog_machine1" style="display: none; height: 100%; border-bottom: 0; border-top: 0; z-index: 2;">
|
||||
<div id="mask_bg" style="display: none;">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
<div class="dialog" id="dialog_machine1" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
|
||||
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
|
||||
<iframe id="iframemachine" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
|
||||
<div class="maskbg" style="display: none;"></div>
|
||||
</div>
|
||||
|
||||
<div class="dialog" id="dialog_assetview" style="display: none; height: 100%; border-bottom: 0; border-top: 0; z-index: 2;">
|
||||
<div class="dialog" id="dialog_assetview" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
|
||||
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
|
||||
<iframe id="iframeassetview" src="../AssetView/SingleAssetView.aspx" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
|
||||
<div class="maskbg" style="display: none;"></div>
|
||||
|
Reference in New Issue
Block a user