fleet-contractor/Site/Maintenance/WorkOrderPlansManagement.aspx
2024-03-26 15:56:31 +08:00

94 lines
4.3 KiB
Plaintext

<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="WorkOrderPlansManagement.aspx.cs" Inherits="WorkOrderPlansManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link rel="stylesheet" href="<%=GetFileUrlWithVersion("../css/datepicker.min.css") %>" type="text/css" />
<link rel="stylesheet" href="<%=GetFileUrlWithVersion("../js/lib/element.min.css") %>" type="text/css" />
<script src="<%=GetFileUrlWithVersion("../js/datepicker.min.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/lib/element.min.js")%>" type="text/javascript"></script>
<style type="text/css">
.label {
min-width: 100px;
font-weight: bold;
padding-right: 10px;
text-align: right;
}
</style>
<script type="text/javascript">
var scheduleItem;
function worequest(method, param, callback, error) {
_network.request("Maintenance/WorkOrderPlansManagement.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_UM_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_UM_QUERY', 'Query'));
});
}
function OnRefresh() {
showloading(true);
worequest("GetPlanConfiguration", "", function (data) {
showloading(false);
if (typeof data === 'string') {
showAlert(data, GetTextByKey('P_UM_QUERY', 'Query'));
} else {
scheduleItem.setParameters(data);
}
}, function (err) {
showloading(false);
});
}
function OnSave() {
var errors = $('.schedule-item-container').find('.validation-error');
if (errors.length > 0) {
showAlert(GetTextByKey('P_WO_INPUTISINVALID', 'The input value is invalid.'), GetTextByKey("P_WO_PLANS", 'Plans'), null, function () { $(errors[0]).focus() });
return;
}
var p = scheduleItem.getParameters();
var start = new Date(p.Schedule.StartDate);
var end = new Date(p.Schedule.EndDate);
if (start > end) {
showAlert(GetTextByKey('P_JS_ENDDATEMUSTBELATERTHANBEGINDATE1', 'End Date must be later than Begin Date. Please select another date range.'), GetTextByKey("P_WO_PLANS", 'Plans'));
return;
}
showloading(true);
worequest('UpdatePlanConfiguration', encodeURIComponent(JSON.stringify(p)), function (data) {
showloading(false);
if (data !== 'OK') {
showAlert(data, GetTextByKey('P_UM_QUERY', 'Query'));
} else {
showAlert(GetTextByKey("P_MV_SAVSUCCESSFULLY", 'Saved successfully.'), GetTextByKey("P_WO_PLANS", 'Plans'));
}
});
}
function OnExit(type) {
window.parent.CloseWOPlansDialog(type);
}
$(function () {
setPageTitle(GetTextByKey("P_WO_PLANS", 'Plans'), true);
scheduleItem = new window['lib-element'].ScheduleItem();
document.querySelector('.content_main').replaceChildren(scheduleItem.create());
OnRefresh();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_WO_PLANS">Plans</div>
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave();" data-lgid="P_SET_SAVE">Save</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_WO_REFRESH">Refresh</span>
<span class="sbutton iconexit" onclick="OnExit(0);" data-lgid="P_WO_EXIT">Exit</span>
</div>
<div class="clear"></div>
<div class="content_main content_div" style="padding: 20px; width: 600px; box-sizing: border-box"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>