449 lines
19 KiB
Plaintext
449 lines
19 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="SchedulerManagement.aspx.cs" Inherits="SchedulerManagement" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
|
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
|
|
<style type="text/css">
|
|
.subdialog {
|
|
width: -moz-calc(100% - 24px);
|
|
width: -webkit-calc(100% - 24px);
|
|
width: calc(100% - 24px);
|
|
}
|
|
|
|
.assetlabel {
|
|
width: 200px;
|
|
text-align: right;
|
|
padding-right: 10px;
|
|
line-height: 24px;
|
|
height: 24px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.span-caption {
|
|
position: absolute;
|
|
}
|
|
|
|
.span-bar {
|
|
position: absolute;
|
|
height: 100%;
|
|
margin: 0;
|
|
vertical-align: bottom;
|
|
}
|
|
|
|
.assetlabel {
|
|
width: 200px;
|
|
text-align: right;
|
|
padding-right: 10px;
|
|
line-height: 24px;
|
|
height: 24px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.edit-content table td.label {
|
|
width: 130px;
|
|
}
|
|
</style>
|
|
<link href="<%=GetFileUrlWithVersion("../css/panel.css")%>" rel="stylesheet" />
|
|
<script src="<%=GetFileUrlWithVersion("../js/vue.min.js")%>" type="text/javascript"></script>
|
|
<script>Vue.config.productionTip = false; Vue.config.silent = true;</script>
|
|
<script src="<%=GetFileUrlWithVersion("../js/components/datagrid.js")%>" type="text/javascript"></script>
|
|
<link href="<%=GetFileUrlWithVersion("../fic/css/datepicker.min.css")%>" rel="stylesheet" />
|
|
<script src="<%=GetFileUrlWithVersion("../fic/js/datepicker.min.js")%>"></script>
|
|
<link href="<%=GetFileUrlWithVersion("../css/spectrum.css")%>" rel="stylesheet" type="text/css" />
|
|
<script src="../js/spectrum.js?v=1" type="text/javascript"></script>
|
|
<script src="../js/jquery.datetimepicker.full.js"></script>
|
|
<script src="<%=GetFileUrlWithVersion("../js/gridlayout.js")%>" type="text/javascript"></script>
|
|
<script src="../Maintenance/js/inputdatactr.js"></script>
|
|
<script src="<%=GetFileUrlWithVersion("js/scheduler.js")%>" type="text/javascript"></script>
|
|
<script>
|
|
jobsitequery = function (method, param, callback, error, nolog) {
|
|
_network.request("JobSite/SchedulerManagement.aspx?tp=ashx", -1, method, param, callback, error, nolog);
|
|
}
|
|
var IsAdmin =<%=IsAdmin ?"true":"false"%>;
|
|
var IsReadOnly = <%=IsReadOnly ?"true":"false"%>;
|
|
var currentdate = "<%=CurrentDate %>";
|
|
var gridLayoutID = "JobSiteScheduler";
|
|
|
|
/***************************Jobsites***************************/
|
|
|
|
function showConfirmIndialog(msg, title, fok, fcancel, shownote) {
|
|
$("#dialogmask").show();
|
|
_dialog.showConfirm(msg, title, function (e, notes) {
|
|
$("#dialogmask").hide();
|
|
if (typeof fok === 'function') {
|
|
fok(e, notes);
|
|
}
|
|
}, fcancel || function () {
|
|
$("#dialogmask").hide();
|
|
}, null, null, shownote);
|
|
}
|
|
|
|
function CloseDialog() {
|
|
$('#dialog_scheduler').hideDialog();
|
|
OnRefresh();
|
|
}
|
|
|
|
function ShowDialog(type) {
|
|
showmaskbg(true);
|
|
$('#dialog_scheduler')
|
|
.attr('act', type)
|
|
.showDialogRight();
|
|
}
|
|
|
|
function OnAdd() {
|
|
execIframeFunc("init", [alljobsites], "iframescheduler");
|
|
ShowDialog("add");
|
|
}
|
|
|
|
|
|
var assetsObj;
|
|
function OnRefresh() {
|
|
var begindate = $.trim($('#txtbegindate').val());
|
|
var enddate = $.trim($('#txtenddate').val());
|
|
if (begindate && !$('#txtbegindate').is(':valid')) {
|
|
showAlert(GetTextByKey('P_COMMON_BEGINDATEISINVALID', "The begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
|
|
return;
|
|
}
|
|
if (enddate && !$('#txtenddate').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;
|
|
}
|
|
|
|
showloading(true);
|
|
|
|
var jobsites = $('#div_jobsites').dropdownVals() || [];
|
|
var regions = $('#div_region').dropdownVals() || [];
|
|
var agroups = $('#div_assetgroup').dropdownVals() || [];
|
|
var atypes = $('#div_assettypes').dropdownVals() || [];
|
|
|
|
var scheduled = $('#sel_scheduled').val()
|
|
var p = [
|
|
JSON.stringify(jobsites),
|
|
JSON.stringify(regions),
|
|
JSON.stringify(agroups),
|
|
JSON.stringify(atypes),
|
|
$.trim($('#searchinputtxt').val()),
|
|
begindate,
|
|
enddate,
|
|
scheduled
|
|
];
|
|
jobsitequery("GetAssetSchedulers", htmlencode(JSON.stringify(p)), function (data) {
|
|
showloading(false);
|
|
if (typeof (data) === "string") {
|
|
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
|
return;
|
|
}
|
|
showSchedulerData(data);
|
|
}, function (err) {
|
|
showloading(false);
|
|
});
|
|
}
|
|
|
|
function searchEnter(e) {
|
|
if (e.keyCode == 13) {
|
|
OnRefresh();
|
|
}
|
|
}
|
|
|
|
var alljobsites;
|
|
function getJobsitesAndRegions() {
|
|
jobsitequery('GetJobsitesAndRegions', '1', function (data) {
|
|
if (typeof (data) === "string") {
|
|
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
|
return;
|
|
}
|
|
|
|
alljobsites = data.Jobsites;
|
|
$("#div_jobsites").dropdownSource(data.Jobsites);
|
|
setJobsites();
|
|
|
|
$('#div_region').dropdownSource(data.Regions);
|
|
});
|
|
}
|
|
|
|
function onregioncompleted() {
|
|
if (!alljobsites) return;
|
|
var regions = $('#div_region').dropdownVals();
|
|
var jss = [...alljobsites];
|
|
if (regions && regions.length > 0)
|
|
jss = jss.filter(t => regions.indexOf(t.Tag3) >= 0);
|
|
$("#div_jobsites").dropdownSource(jss);
|
|
var seljss = $("#div_jobsites").dropdownVals();
|
|
$("#div_jobsites").dropdownSource(jss).dropdownVals(seljss);
|
|
}
|
|
|
|
function setJobsites() {
|
|
$('#dialog_addjobsite').empty();
|
|
if (alljobsites && alljobsites.length > 0) {
|
|
var ops = [];
|
|
for (var i = 0; i < alljobsites.length; i++) {
|
|
var op = $('<option></option>').prop('selected', i == 0).val(alljobsites[i].Key).text(alljobsites[i].Value).data('js', alljobsites[i]);
|
|
ops.push(op);
|
|
}
|
|
$('#dialog_addjobsite').append(ops);
|
|
}
|
|
}
|
|
|
|
var assettypes;
|
|
function getAssetTypes() {
|
|
if (assettypes)
|
|
return;
|
|
|
|
jobsitequery('GetAssetTypes', '', function (data) {
|
|
if (typeof (data) === "string") {
|
|
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
|
return;
|
|
}
|
|
assettypes = data;
|
|
|
|
var ats = [...assettypes];
|
|
ats = ats.filter(t => t.Tag1 == "1");
|
|
$("#div_assettypes").dropdownSource(ats);
|
|
});
|
|
}
|
|
|
|
|
|
var assetgroups;
|
|
function getAssetGroups() {
|
|
jobsitequery('GetAssetGroups', '', function (data) {
|
|
if (typeof (data) === "string") {
|
|
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
|
return;
|
|
}
|
|
assetgroups = data;
|
|
$("#div_assetgroup").dropdownSource(assetgroups);
|
|
});
|
|
}
|
|
|
|
function OnSorts() {
|
|
grid_dt.showSortPanel();
|
|
}
|
|
|
|
$(function () {
|
|
setPageTitle(GetTextByKey("P_JS_SCHEDULER", "Scheduler"), true);
|
|
$('.iconlayout').on('click', function (ev) {
|
|
CreateLayoutMenus(ev.target, gridLayoutID, grid_dt);
|
|
return false;
|
|
});
|
|
InitGridData();
|
|
InitJobsiteschedulerGridData();
|
|
getJobsitesAndRegions();
|
|
getAssetGroups();
|
|
getAssetTypes();
|
|
|
|
$(window).resize(function () {
|
|
$("#schedulerlist").css("height", $(window).height() - $("#schedulerlist").offset().top - 14);
|
|
grid_dt && grid_dt.resize();
|
|
|
|
}).resize();
|
|
OnRefresh();
|
|
|
|
$("#div_assettypes").css('width', 120).dropdown([], {
|
|
search: true,
|
|
multiselect: true,
|
|
allowselectall: false,
|
|
textKey: 'Value',
|
|
valueKey: 'Key'
|
|
});
|
|
|
|
$("#div_region").css('width', 120).dropdown([], {
|
|
search: true,
|
|
multiselect: true,
|
|
allowselectall: true,
|
|
textKey: 'Value',
|
|
valueKey: 'Key'
|
|
}).on('collapsed', onregioncompleted);
|
|
|
|
$("#div_jobsites").css('width', 120).dropdown([], {
|
|
search: true,
|
|
multiselect: true,
|
|
allowselectall: true,
|
|
textKey: 'Value',
|
|
valueKey: 'Key'
|
|
});
|
|
|
|
$("#div_assetgroup").css('width', 120).dropdown([], {
|
|
search: true,
|
|
multiselect: true,
|
|
allowselectall: true,
|
|
textKey: 'Value',
|
|
valueKey: 'Key'
|
|
});
|
|
|
|
$("#chkmanagetypeonly").on('change', function () {
|
|
var selectedtypes = $("#div_assettypes").dropdownVals() || [];
|
|
var ats = [...assettypes];
|
|
if ($(this).prop('checked')) {
|
|
ats = ats.filter(t => t.Tag1 == "1");
|
|
}
|
|
$("#div_assettypes").dropdownSource(ats);
|
|
$("#div_assettypes").dropdownVals(selectedtypes);
|
|
});
|
|
|
|
$('#searchinputtxt').keydown(searchEnter);
|
|
|
|
$('#dialog_managescheduler').dialog(function () {
|
|
$('#dialogmask').hide();
|
|
OnRefresh();
|
|
})
|
|
|
|
$('#dialog_addscheduler').dialog(function () {
|
|
$('#dialogmask').hide();
|
|
$('#dialogmask1').hide();
|
|
})
|
|
$('#dialog_addbegindate').datetimepicker({
|
|
timepicker: false,
|
|
format: 'm/d/Y',
|
|
enterLikeTab: false,
|
|
onSelectDate: function (v, inp) {
|
|
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
|
inp.parent().data('val', [date]);
|
|
}
|
|
})
|
|
$('#dialog_addenddate').datetimepicker({
|
|
timepicker: false,
|
|
format: 'm/d/Y',
|
|
enterLikeTab: false,
|
|
onSelectDate: function (v, inp) {
|
|
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
|
inp.parent().data('val', [date]);
|
|
}
|
|
})
|
|
});
|
|
|
|
</script>
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
|
<div id="contentctrl" style="min-width: 1540px;">
|
|
<div class="page_title" data-lgid="P_JS_SCHEDULER">Scheduler</div>
|
|
<div class="search_bar">
|
|
<input type="password" autocomplete="new-password" style="display: none" />
|
|
<span data-lgid="P_AM_BEGINDATE_COLON">Begin Date:</span>
|
|
<div>
|
|
<input id="txtbegindate" type="date" class="type-date" required min="1900-01-01" style="margin-left: 5px; width: 90px;" value="<%=BeginDate %>" autocomplete="off" />
|
|
</div>
|
|
<span data-lgid="P_AM_ENDDATE_COLON">End Date:</span>
|
|
<div>
|
|
<input id="txtenddate" type="date" class="type-date" required min="1900-01-01" style="margin-left: 5px; width: 90px;" autocomplete="off" />
|
|
</div>
|
|
<span data-lgid="P_JS_REGION_COLON">Region:</span>
|
|
<div id="div_region" style="margin-top: 1px;"></div>
|
|
<span data-lgid="P_JS_JOBSITES_COLON">Jobsites:</span>
|
|
<div id="div_jobsites" style="margin-top: 1px;"></div>
|
|
<span data-lgid="P_AM_ASSETGROUP_COLON">Asset Group:</span>
|
|
<div id="div_assetgroup" style="margin-top: 1px;"></div>
|
|
<span data-lgid="P_JS_ASSETTYPE_COLON" style="margin-left: 10px;">Asset Type:</span>
|
|
<div id="div_assettypes" style="margin-top: 1px;"></div>
|
|
<input type="checkbox" id="chkmanagetypeonly" style="margin-left: 5px;" checked="checked" />
|
|
<label for="chkmanagetypeonly" data-lgid="P_JS_MANAGEDTYPESONLY">Managed Types Only</label>
|
|
<input type="text" id="searchinputtxt" autocomplete="off" style="margin-left: 5px; width: 100px;" />
|
|
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_CM_SEARCH" style="margin-left: 5px;" />
|
|
<select id="sel_scheduled" onchange="OnRefresh();" style="margin-left: 5px; width: 160px;">
|
|
<option value="0" data-lgid="P_JS_SCHEDULEDONLY">Scheduled Only</option>
|
|
<option value="1" data-lgid="P_JS_UNSCHEDULEDONLY">Unscheduled Only</option>
|
|
<option value="-1" data-lgid="P_JS_BOTHSCHEDULEDUNSCHEDULED">Both Scheduled & Unscheduled</option>
|
|
</select>
|
|
</div>
|
|
<div class="function_title">
|
|
<%if (!IsReadOnly)
|
|
{ %>
|
|
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_JS_ADD"></span>
|
|
<%} %>
|
|
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_JS_REFRESH"></span>
|
|
<span class="sbutton iconlayout iconmenu" data-lgid="P_MR_LAYOUT">Layout</span>
|
|
<span class="sbutton iconfilter" onclick="OnSorts();" data-lgid="P_GRID_SORT">Sort</span>
|
|
</div>
|
|
<div id="schedulerlist" style="position: relative"></div>
|
|
</div>
|
|
|
|
<div id="mask_bg" style="display: none;">
|
|
<div class="loading c-spin"></div>
|
|
</div>
|
|
<div class="dialog subdialog" id="dialog_scheduler" style="display: none; border-bottom: 0; border-top: 0;">
|
|
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
|
|
<iframe id="iframescheduler" src="AddScheduler.aspx" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
|
|
<div class="maskbg" style="display: none;"></div>
|
|
</div>
|
|
|
|
<div class="dialog" id="dialog_managescheduler" style="display: none;">
|
|
<div class="dialog-title"><span class="title" data-lgid="P_MA_SELECTASSET"></span><em class="dialog-close"></em></div>
|
|
<div class="machine_filter">
|
|
<table style="width: 500px;">
|
|
<tr>
|
|
<td class="assetlabel" data-lgid="P_MA_ASSETNAME_COLON">Asset Name:</td>
|
|
<td id="dialog_assetname" style="width: 180px;"></td>
|
|
<td class="assetlabel" style="width: 100px;" data-lgid="P_IPT_ASSETTYPE_COLON">Asset Type:</td>
|
|
<td id="dialog_assettype" style="width: 180px;"></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="assetlabel" data-lgid="P_IPT_MAKE_COLON">Make:</td>
|
|
<td id="dialog_make" style="width: 180px;"></td>
|
|
<td class="assetlabel" style="width: 100px;" data-lgid="P_IPT_MODEL_COLON">Model:</td>
|
|
<td id="dialog_model" style="width: 180px;"></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="function_title" style="line-height: 24px;">
|
|
<span class="sbutton iconadd" onclick="openAddScheduler()" data-lgid="P_JS_ADD">Add</span>
|
|
<span class="sbutton icondelete" onclick="onDeleteScheduler()" data-lgid="P_JS_DELETE">Delete</span>
|
|
</div>
|
|
<div id="schedulerlist1" style="height: 360px; width: 720px;"></div>
|
|
|
|
<div class="dialog-func">
|
|
<input type="button" value="Close" data-lgid="P_JS_CANCEL" class="dialog-close" tabindex="28" />
|
|
<input type="button" onclick="onUpdateScheduler();" data-lgid="P_JS_OK" value="OK" tabindex="27" />
|
|
<div class="clear"></div>
|
|
</div>
|
|
<div id="dialogmask" class="maskbg" style="display: none;">
|
|
<div class="loading_icon icon c-spin"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="dialog" id="dialog_addscheduler" style="display: none; width: 480px;">
|
|
<div class="dialog-title"><span class="title" data-lgid="P_JS_ADDSCHEDULER"></span><em class="dialog-close"></em></div>
|
|
<div class="edit-content">
|
|
<table style="line-height: 30px; margin-top: 10px;">
|
|
<tr>
|
|
<td class="label" data-lgid="P_JS_JOBSITE_COLON"></td>
|
|
<td>
|
|
<select id="dialog_addjobsite" tabindex="1" style="height: 22px; width: 300px;"></select></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="label" data-lgid="P_JS_BEGINDATE_COLON"><span>*</span></td>
|
|
<td>
|
|
<input type="text" id="dialog_addbegindate" maxlength="200" tabindex="1" style="width: 200px;" autocomplete="off" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align: right; padding-right: 5px;" data-lgid="P_JS_ENDDATE_COLON"></td>
|
|
<td>
|
|
<input type="text" id="dialog_addenddate" maxlength="200" tabindex="1" style="width: 200px;" autocomplete="off" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="label" data-lgid="P_JS_POINTOFCONTACT_COLON">Point of Contact:</td>
|
|
<td>
|
|
<input type="text" id="dialog_pointofcontact" maxlength="100" tabindex="1" autocomplete="off" style="width: 100px;" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="label" data-lgid="P_FR_NOTES_COLON">Notes:</td>
|
|
<td>
|
|
<textarea id="dialog_addnotes" maxlength="1000" tabindex="1" style="width: 300px; height: 120px; margin-top: 5px;"></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="dialog-func">
|
|
<input type="button" value="Close" data-lgid="P_JS_CANCEL" class="dialog-close" tabindex="3" />
|
|
<input type="button" onclick="onAddScheduler();" data-lgid="P_JS_OK" value="OK" tabindex="2" />
|
|
<div class="clear"></div>
|
|
</div>
|
|
<div id="dialogmask1" class="maskbg" style="display: none;">
|
|
<div class="loading_icon icon c-spin"></div>
|
|
</div>
|
|
</div>
|
|
</asp:Content>
|