sync
This commit is contained in:
@ -28,27 +28,14 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
header.append(search_bar);
|
||||
search_bar.append('<input type="password" autocomplete="new-password" style="display: none" />');
|
||||
search_bar.append('<span style="margin-left:5px;">' + GetTextByKey("P_IPT_BEGINDATE_COLON", "Begin Date:") + '</span>');
|
||||
startdateinputcontrol = $('<input type="text" style="margin-left: 5px; width: 80px;" autocomplete="off" />').val(begindate);
|
||||
startdateinputcontrol = $('<input type="date" class="type-date" required min="1900-01-01" style="margin-left: 5px; width: 100px;" autocomplete="off" />').val(begindate);
|
||||
search_bar.append($('<span></span>').append(startdateinputcontrol));
|
||||
startdateinputcontrol.datetimepicker({
|
||||
timepicker: false,
|
||||
format: 'm/d/Y'
|
||||
});
|
||||
|
||||
search_bar.append('<span style="margin-left:10px;">' + GetTextByKey("P_IPT_ENDDATE_COLON", "End Date:") + '</span>');
|
||||
enddateinputcontrol = $('<input type="text" style="margin-left: 5px; width: 80px;" autocomplete="off" />').val(enddate);
|
||||
enddateinputcontrol = $('<input type="date" class="type-date" required min="1900-01-01" style="margin-left: 5px; width: 100px;" autocomplete="off" />').val(enddate);
|
||||
search_bar.append($('<span></span>').append(enddateinputcontrol));
|
||||
enddateinputcontrol.datetimepicker({
|
||||
timepicker: false,
|
||||
format: 'm/d/Y'
|
||||
});
|
||||
|
||||
makeinputcontrol = $('<select type="text" style="margin-left: 5px; width: 80px;" autocomplete="off" />').val(enddate);
|
||||
search_bar.append($('<span></span>').append(enddateinputcontrol));
|
||||
enddateinputcontrol.datetimepicker({
|
||||
timepicker: false,
|
||||
format: 'm/d/Y'
|
||||
});
|
||||
|
||||
|
||||
searchinputcontrol = $('<input type="text" style="margin-left:10px;" autocomplete="off" />');
|
||||
search_bar.append(searchinputcontrol);
|
||||
@ -75,20 +62,21 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
gs.refresh();
|
||||
});
|
||||
func.append(iconRefresh);
|
||||
var iconResetPivots = $('<span class="sbutton iconfilter">' + GetTextByKey("P_IPT_XXXXXX", "Reset Pivots") + '</span>').click(function () {
|
||||
var iconResetPivots = $('<span class="sbutton iconfilter">' + GetTextByKey("P_IPT_RESETPIVOTS", "Reset Pivots") + '</span>').click(function () {
|
||||
if (grid_dt && grid_dt.columns) {
|
||||
for (var i = 0; i < grid_dt.columns.length; i++) {
|
||||
if (grid_dt.columns[i].filterValues)
|
||||
grid_dt.columns[i].filterValues = null;
|
||||
}
|
||||
grid_dt.refreshGrid();
|
||||
grid_dt.reload();
|
||||
}
|
||||
});
|
||||
func.append(iconResetPivots);
|
||||
|
||||
var iconprints = $('<span class="sbutton iconprint">' + GetTextByKey("P_IPT_XXXXXX", "Print") + '</span>').click(function () {
|
||||
for (var i = 0; i < grid_dt.source.length; i++) {
|
||||
var inspect = grid_dt.source[i].Values;
|
||||
var iconprints = $('<span class="sbutton iconprint">' + GetTextByKey("P_IPT_PRINT", "Print") + '</span>').click(function () {
|
||||
var tempsource = grid_dt.source;
|
||||
for (var i = 0; i < tempsource.length; i++) {
|
||||
var inspect = tempsource[i];
|
||||
if (inspect.Selected) {
|
||||
if (navigator.userAgent.indexOf('Firefox') >= 0 ||
|
||||
navigator.userAgent.indexOf('Opera') >= 0) {
|
||||
@ -101,9 +89,10 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
});
|
||||
func.append(iconprints);
|
||||
|
||||
var icondownloads = $('<span class="sbutton icondownload">' + GetTextByKey("P_IPT_XXXXXX", "Download") + '</span>').click(function () {
|
||||
for (var i = 0; i < grid_dt.source.length; i++) {
|
||||
var inspect = grid_dt.source[i].Values;
|
||||
var icondownloads = $('<span class="sbutton icondownload">' + GetTextByKey("P_IPT_DOWNLOAD", "Download") + '</span>').click(function () {
|
||||
var tempsource = grid_dt.source;
|
||||
for (var i = 0; i < tempsource.length; i++) {
|
||||
var inspect = tempsource[i];
|
||||
if (inspect.Selected) {
|
||||
openDownloadFrame(inspect.Id);
|
||||
}
|
||||
@ -119,19 +108,14 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
|
||||
function InitGridData() {
|
||||
var div_grid = $('<div></div>');
|
||||
div_grid.css("height", $(window).height() - 185);
|
||||
div_grid.css({ "height": $(window).height() - 185, "position": "relative" });
|
||||
|
||||
grid_dt = new GridView(div_grid);
|
||||
grid_dt.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
grid_dt = createGridView(div_grid);
|
||||
var list_columns = [
|
||||
{ name: 'TemplateName', caption: GetTextByKey("P_TEMPLATE", "Template"), allowFilter: true, valueIndex: 'TemplateName', css: { 'width': 250, 'text-align': 'left' } },
|
||||
{ name: 'AssetName', caption: GetTextByKey("P_IPT_ASSETNAME", "Asset Name"), valueIndex: 'AssetName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'WorkOrderNumber', caption: GetTextByKey("P_IPT_WORKORDER", "Work Order"), valueIndex: 'WorkOrderNumber', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'CustomerName', caption: GetTextByKey("P_IPT_XXX", "Customer Name"), valueIndex: 'CustomerName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'WorkOrderNumber', caption: GetTextByKey("P_IPT_WORKORDER", "Work Order"), valueIndex: 'WorkOrderId', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'CustomerName', caption: GetTextByKey("P_IPT_CUSTOMERNAME", "Customer Name"), valueIndex: 'CustomerName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'VisibleToCustomer', caption: GetTextByKey("P_IPT_CUSTOMERVISIBLE", "Customer Visible"), valueIndex: 'VisibleToCustomer', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'VIN', caption: GetTextByKey("P_IPT_VIN", "VIN"), valueIndex: 'VIN', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'MakeName', caption: GetTextByKey("P_IPT_MAKE", "Make"), valueIndex: 'MakeName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
@ -180,8 +164,6 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
}
|
||||
|
||||
if (col.name === "TemplateName" || col.name === "AssetName") {
|
||||
col.isurl = true;
|
||||
col.sortable = false;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
_this.openReport();
|
||||
@ -196,37 +178,34 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
}
|
||||
}
|
||||
else if (col.name === "Edit") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf044";
|
||||
col.sortable = false;
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = 'edit';
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
_this.onedit();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_IPT_EDIT", 'Edit') };
|
||||
}
|
||||
else if (col.name === "Detail") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf0c9";
|
||||
col.sortable = false;
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "info-circle";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
_this.openReport();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_IPT_DETAIL", 'Detail') };
|
||||
}
|
||||
else if (col.name === "DownloadPDF") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf019";
|
||||
col.sortable = false;
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "download";
|
||||
col.visible = canExport;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
@ -239,9 +218,10 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
col.attrs = { 'title': GetTextByKey("P_IPT_DOWNLOADPDF", 'Download PDF') };
|
||||
}
|
||||
else if (col.name === "Print") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf02f";
|
||||
col.sortable = false;
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "print";
|
||||
col.visible = canExport;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
@ -259,9 +239,10 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
col.attrs = { 'title': GetTextByKey("P_IPT_PRINT", 'Print') };
|
||||
}
|
||||
else if (col.name === "ViewChangeHistory") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf06e";
|
||||
col.sortable = false;
|
||||
col.resizable = false;
|
||||
col.type = GridView.ColumnTypes.Icon;
|
||||
col.text = "history";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
_this.onViewChangeHistory();
|
||||
@ -276,41 +257,81 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
if (col.name === "AssetName" || col.name === "VIN" || col.name === "MakeName" || col.name === "ModelName" || col.name === "TypeName" || col.name === "WorkOrderNumber" || col.name === "VisibleToCustomer" || col.name === "CustomerName") {
|
||||
col.visible = !teamintelligence;
|
||||
}
|
||||
|
||||
if (!teamintelligence && AllowReassignWorkorders && col.name === "WorkOrderNumber") {
|
||||
col.allowHtml = true;
|
||||
col.filterCustom = true;
|
||||
col.filter = function (item) {
|
||||
if (item.Id === "")
|
||||
return htmldecode(item.WorkOrderNumber);
|
||||
col.type = GridView.ColumnTypes.Dropdown;
|
||||
col.filter = function (item, editing) {
|
||||
return editing ? String(item.WorkOrderId) : item.WorkOrderNumber;
|
||||
};
|
||||
|
||||
var div = $('<div class="dropdown" style="width: 185px;"></div>');
|
||||
div.dropdown(item.WorkOrders || [{ Id: -1, WorkOrderNumber: "Not Assigned" }], {
|
||||
search: false,
|
||||
textKey: 'WorkOrderNumber',
|
||||
valueKey: 'Id',
|
||||
selected: item.WorkOrderId > 0 ? item.WorkOrderId : -1,
|
||||
parent: '#content'
|
||||
}).on('select', function (_e, wo) {
|
||||
col.dropOptions = {
|
||||
search: true,
|
||||
textKey: 'WorkOrderNumber',
|
||||
valueKey: 'Id'
|
||||
};
|
||||
col.sourceCache = false;
|
||||
col.source = function (item) {
|
||||
return item.WorkOrders ??= [{ Id: -1, WorkOrderNumber: "Not Assigned" }];
|
||||
};
|
||||
col.onDropExpanded = function (item, drop) {
|
||||
if (!item.WorkOrdersLoaded) {
|
||||
item.WorkOrdersLoaded = true;
|
||||
inspectionrequest('GetAssetWorkOrders', item.AssetId, function (data) {
|
||||
if (typeof data === 'string') {
|
||||
}
|
||||
else if (data && data.length > 0) {
|
||||
var source = [
|
||||
{ Id: -1, WorkOrderNumber: "Not Assigned" }
|
||||
];
|
||||
|
||||
var sel = null;
|
||||
var exists = false;
|
||||
var selected;
|
||||
if (item.WorkOrders && item.WorkOrders.length == 1)
|
||||
sel = item.WorkOrders[0];
|
||||
else
|
||||
exists = true;
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var u = data[i];
|
||||
source.push(u);
|
||||
if (item.WorkOrderId == u.Id)
|
||||
item.WorkOrderId = selected = u.Id;
|
||||
|
||||
if (sel && (sel.Id < 0 || sel.Id == u.Id))
|
||||
exists = true;
|
||||
|
||||
}
|
||||
if (!exists) {
|
||||
source.push(sel);
|
||||
}
|
||||
|
||||
item.WorkOrders = source;
|
||||
|
||||
drop.source = source;
|
||||
drop.select(selected, true);
|
||||
}
|
||||
}, function () {
|
||||
});
|
||||
}
|
||||
};
|
||||
col.onChanged = function (item, value, old, wo) {
|
||||
if (value != old) {
|
||||
if (wo) {
|
||||
var msg1 = GetTextByKey('P_WO_AREYOUSURETHATYOUWANTTOPROCEED', 'Are you sure that you want to proceed ?');
|
||||
var msg = GetTextByKey('P_WO_YOUAREREASSIGNINGTHISWORKORDER', 'You are reassigning this work order. ') + "<br/>" + msg1;
|
||||
if (wo.Completed)
|
||||
msg = GetTextByKey('P_WO_YOUAREREASSIGNINGTHISWORKORDERTOACLOSEDWORKORDER', 'You are reassigning this Work Order to a CLOSED Work Order.') + "<br/>" + msg1;
|
||||
showConfirm(msg, GetTextByKey("P_WO_WORKORDERASSIGNMENT", 'Work Order Assignment'), function () {
|
||||
var oldwoid = item.WorkOrderId;
|
||||
item.WorkOrderId = wo.Id;
|
||||
item.WorkOrderNumber = wo.WorkOrderNumber;
|
||||
updateInspectionWorkOrder(item.Id, item.WorkOrderId, oldwoid, wo.CustomerName);
|
||||
updateInspectionWorkOrder(item.Id, value, old, wo.CustomerName);
|
||||
}, function () {
|
||||
var dropdown = div.data('dropdown');
|
||||
if (dropdown)
|
||||
dropdown.select(item.WorkOrderId > 0 ? item.WorkOrderId : -1);
|
||||
item.WorkOrderId = old;
|
||||
grid_dt?.refresh();
|
||||
});
|
||||
}
|
||||
});
|
||||
return div;
|
||||
}
|
||||
}
|
||||
};
|
||||
col.styleFilter = function () {
|
||||
return { "width": "100%", 'margin': 0 };
|
||||
}
|
||||
@ -321,13 +342,7 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = _this.openReport;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
grid_dt.onRowDblClicked = _this.openReport;
|
||||
return div_grid;
|
||||
}
|
||||
|
||||
@ -343,7 +358,7 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
gs.onedit = function () {
|
||||
var _this = this;
|
||||
var index = grid_dt.selectedIndex;
|
||||
var inspect = grid_dt.source[index].Values;
|
||||
var inspect = grid_dt.source[index];
|
||||
|
||||
|
||||
// check permissions
|
||||
@ -356,13 +371,13 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
|
||||
gs.openReport = function () {
|
||||
var index = grid_dt.selectedIndex;
|
||||
var inspect = grid_dt.source[index].Values;
|
||||
var inspect = grid_dt.source[index];
|
||||
window.open("report.aspx?rid=" + inspect.Id + "&ro=" + (ReportReadonly ? 1 : 0), "_blank");
|
||||
}
|
||||
|
||||
gs.onViewChangeHistory = function () {
|
||||
var index = grid_dt.selectedIndex;
|
||||
var inspect = grid_dt.source[index].Values;
|
||||
var inspect = grid_dt.source[index];
|
||||
window.open("InspectionChangeHistory.aspx?rid=" + inspect.Id, "_blank");
|
||||
}
|
||||
|
||||
@ -373,7 +388,7 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
return;
|
||||
}
|
||||
if (grid_dt.selectedIndex >= 0) {
|
||||
grid_dt.source[grid_dt.selectedIndex].Values.CustomerName = custname;
|
||||
grid_dt.source[grid_dt.selectedIndex].CustomerName = custname;
|
||||
grid_dt && grid_dt.reload();
|
||||
}
|
||||
|
||||
@ -398,29 +413,49 @@ define(['modules/inspects/inspect', 'modules/inspects/editinspection'], function
|
||||
} else if (j === "LastUpdatedTimeLocal") {
|
||||
r[j] = { DisplayValue: r["LastUpdatedTimeLocalStr"], Value: r[j] };
|
||||
} else if (j === "VisibleToCustomer") {
|
||||
r[j] = { DisplayValue: r["VisibleToCustomer"] ? "Yes" : "No", Value: r[j] };
|
||||
r[j] = { DisplayValue: r["VisibleToCustomer"] ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
|
||||
}
|
||||
}
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
rows.push(r);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
gs.refresh = function () {
|
||||
datacontent.empty();
|
||||
var startydate = startdateinputcontrol.val();
|
||||
var begindate = startdateinputcontrol.val();
|
||||
var enddate = enddateinputcontrol.val();
|
||||
if (begindate && !startdateinputcontrol.is(':valid')) {
|
||||
showAlert(GetTextByKey('P_COMMON_BEGINDATEISINVALID', "The begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (enddate && !enddateinputcontrol.is(':valid')) {
|
||||
showAlert(GetTextByKey('P_COMMON_ENDDATEISINVALID', "The end date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (begindate && enddate && begindate > enddate) {
|
||||
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), GetTextByKey("P_FR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
|
||||
datacontent.empty();
|
||||
var searchtxt = searchinputcontrol.val();
|
||||
searchtxt = htmlencode(searchtxt);
|
||||
var p = JSON.stringify([teamintelligence, startydate, enddate, searchtxt]);
|
||||
var p = JSON.stringify([teamintelligence, begindate, enddate, searchtxt]);
|
||||
|
||||
showloading(true);
|
||||
inspectionrequest("GetInspectItems", htmlencode(p), function (data) {
|
||||
showloading(false);
|
||||
datacontent.empty();
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (data) {
|
||||
showInspections(data);
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
return gs;
|
||||
|
Reference in New Issue
Block a user