This commit is contained in:
2023-04-28 12:22:26 +08:00
parent 88e0a25ecd
commit c9723008af
1047 changed files with 443540 additions and 1 deletions

2272
Site/JobSite/AddJobSite.aspx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
using DocumentFormat.OpenXml.Wordprocessing;
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class AddJobSite : JobSitesBasePage
{
public string CurrentDate = "";
protected void Page_Load(object sender, EventArgs e)
{
string tp = Request.Params["tp"];
if (string.Compare(tp, "ashx", true) == 0)
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
bool license = SystemParams.HasLicense("JobSites");
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES);
if (!license || !permission)
RedirectToEntryPage();
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
CurrentDate = userlocaldate.ToShortDateString();
}
}

View File

@ -0,0 +1,392 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Security/Security.master" AutoEventWireup="true" CodeFile="AddJobsiteLimit.aspx.cs" Inherits="AddCurfew" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.edit-content table {
border-collapse: collapse;
width: 100%;
}
.edit-content table td.label {
width: 200px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: top;
}
.edit-content table td input,
.edit-content table td textarea {
border: 1px solid #a9a9a9;
width: 320px;
height: 18px;
padding: 1px;
}
.edit-content table td input[type="checkbox"] {
border: none;
height: 13px;
}
.edit-content table td textarea {
height: 150px;
resize: none;
width: 600px;
/*max-width: 200px;*/
}
.a {
text-decoration: none;
color: #2140fb;
}
.subtitle {
margin: 20px 40px 5px 0px;
font-size: 16px;
color: gray;
}
.subtitle span {
margin-left: 10px;
}
.subtitle hr {
background-color: #d8d8d8;
border: none;
height: 1px;
}
.machinetd {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.timespan {
margin-left: 16px;
margin-right: 8px;
}
.div_filter .dropdown {
width: 322px;
margin: 2px 0 0 0px;
}
.div_panel {
min-width: 322px;
}
</style>
<script src="<%=GetFileUrlWithVersion("../js/controls.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var IsDealer = <%=IsDealer ?"true":"false"%>;
var contractorid;
var machinetypes;
var editmultiselect_type;
var assettypeparam;
jobsitelimitquery = function (method, param, callback, error, nolog) {
_network.request("JobSite/AddJobsiteLimit.aspx", -1, method, param, callback, error || function (e) {
showAlert(GetTextByKey("P_M3_FAILEDTOLOADDATA", 'Failed to load data: {0}').replace('{0}', e.statusText), GetTextByKey("P_M3_SCHEDULEASSETS", 'Schedule Assets'));
});
}
function devicerequest(method, param, callback, error) {
_network.request("MachineDeviceManagement/ManageMachines.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_M3_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_M3_QUERY', 'Query'));
});
}
function trim_str(s) {
if (s == null)
return "";
else
return s.replace(/(^\s*)|(\s*$)/g, "");
}
function OnAdd() {
jlid = undefined;
$('#dialog_jobsite').val('');
$('#dialog_active').prop('checked', true);
$('#dialog_starttimehour').val('00');
$('#dialog_starttimeminute').val('00');
$('#dialog_endtimehour').val('00');
$('#dialog_endtimeminute').val('00');
$('#dialog_mintrucks').val('');
$('#dialog_maxtrucks').val('');
if (editmultiselect_type)
editmultiselect_type.setValues([]);
$('#dialog_notes').val('');
}
function OnEdit() {
$('#dialog_jobsite').val(jobsitelimit.JobSiteID);
$('#dialog_active').prop('checked', jobsitelimit.Active.Value);
var st = jobsitelimit.StartTime.split(':');
$('#dialog_starttimehour').val(st[0]);
$('#dialog_starttimeminute').val(st[1]);
var et = jobsitelimit.EndTime.split(':');
$('#dialog_endtimehour').val(et[0]);
$('#dialog_endtimeminute').val(et[1]);
$('#dialog_mintrucks').val(jobsitelimit.MinTrucks);
$('#dialog_maxtrucks').val(jobsitelimit.MaxTrucks);
var types = [];
types = jobsitelimit.AssetTypes.split(',');
if (assettypeparam)
editmultiselect_type.setValues(types);
$('#dialog_notes').val(jobsitelimit.Notes);
}
var IsPositiveInteger = /^[0-9]\d*$/;
function OnSave(exit) {
var start_hour = $('#dialog_starttimehour').val();
var start_minute = $('#dialog_starttimeminute').val();
var end_hour = $('#dialog_endtimehour').val();
var end_minute = $('#dialog_endtimeminute').val();
var typeary = [];
if (assettypeparam)
typeary = assettypeparam.selectedvalue;
var assettypes = typeary.join(',');
var item = {
'JobSiteID': $('#dialog_jobsite').val(),
'Active': $('#dialog_active').prop('checked'),
'StartTime': start_hour + ":" + start_minute,
'EndTime': end_hour + ":" + end_minute,
'MinTrucks': $.trim($('#dialog_mintrucks').val()),
'MaxTrucks': $.trim($('#dialog_maxtrucks').val()),
'AssetTypes': assettypes,
'Notes': $('#dialog_notes').val()
};
var alerttitle;
if (jlid) {
item.ID = jlid;
alerttitle = GetTextByKey("P_M3_EDITJOBSITELIMITCONFIGURATION", "Edit Jobsite Limit Configuration");
} else {
item.ID = -1;
alerttitle = GetTextByKey("P_M3_ADDJOBSITELIMITCONFIGURATION", "Add Jobsite Limit Configuration");
}
if ((start_hour + start_minute) >= (end_hour + end_minute)) {
showAlert(GetTextByKey("P_M3_ENDTIMEMUSTBELATERTHANSTARTTIME", "End Time must be later than Start Time."), alerttitle);
return;
}
if (item.MinTrucks !== "" && !IsPositiveInteger.test(item.MinTrucks)) {
showAlert(GetTextByKey("P_M3_ACCEPTABLEMINIMUMTRUCKSFORMATERROR", 'Acceptable minimum trucks format error.'), alerttitle);
return;
}
if (item.MaxTrucks !== "" && !IsPositiveInteger.test(item.MaxTrucks)) {
showAlert(GetTextByKey("P_M3_ACCEPTABLEMAXIMUMTRUCKSFORMATERROR", 'Acceptable maximum trucks format error.'), alerttitle);
return;
}
if (item.MinTrucks === "")
item.MinTrucks = 0;
if (item.MaxTrucks === "")
item.MaxTrucks = 0;
if (parseInt(item.MinTrucks) > parseInt(item.MaxTrucks)) {
showAlert(GetTextByKey("P_M3_ACCEPTABLEMAXIMUMTRUCKSCANNOTBELESSTHANACCEPTABLEMINIMUMTRUCKS", 'Acceptable Maximum Trucks cannot be less than Acceptable Minimum Trucks.'), alerttitle);
return;
}
if (assettypes === "") {
showAlert(GetTextByKey("P_M3_ACCEPTABLEASSETTYPESCANNOTBEEMPTY", 'Acceptable Asset Types cannot be empty.'), alerttitle);
return;
}
showloading(false);
var param = JSON.stringify(item);
param = htmlencode(param);
jobsitelimitquery("SaveJobsiteLimit", contractorid + String.fromCharCode(170) + param, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, alerttitle);
} else {
jlid = data[0];
if (exit == 0)
showAlert(GetTextByKey("P_M3_SAVSUCCESSFULLY", "Saved successfully."), alerttitle);
if (exit == 1)
OnExit(exit);
}
}, function (err) {
showloading(false);
showAlert(GetTextByKey("P_M3_FAILEDTOSAVEJOBSITELIMITCONFIGURATION", 'Failed to save jobsite limit configuration.'), alerttitle);
});
}
function OnExit(type) {
window.parent.CloseDialog(type);
}
var jobsitelimit;
var jlid;
function init(cid, jl) {
contractorid = cid;
if (jl) {
jlid = jl.ID;
jobsitelimit = jl;
OnEdit();
}
else
OnAdd();
}
function GetMachineTypes() {
devicerequest("GetMachineTypes", contractorid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_M3_ERROR", 'Error'));
return;
}
assettypeparam = {
items: data,
selectedvalue: [],
allowall: false
};
editmultiselect_type = editmultiselect(assettypeparam);
$('#dialog_assettype').append(editmultiselect_type);
}, function (err) {
});
}
var activejobsitedata;
function GetActiveJobsites(contractorid) {
devicerequest('GetActiveJobsites', contractorid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_M3_ERROR", 'Error'));
return;
}
if (data && data.length > 0) {
activejobsitedata = data;
$("#dialog_jobsite").empty();
for (var i = 0; i < data.length; i++) {
var kv = data[i];
var op = $("<option></option>").val(kv.ID).text(kv.Name);
$("#dialog_jobsite").append(op);
}
}
});
}
function initTime() {
var c = $('#dialog_starttimehour');
for (var i = 0; i < 24; i++) {
if (i < 10)
c.append($("<option></option>").val("0" + i).text("0" + i))
else
c.append($("<option></option>").val(i).text(i))
}
c = $('#dialog_starttimeminute');
for (var i = 0; i < 60; i++) {
if (i < 10)
c.append($("<option></option>").val("0" + i).text("0" + i))
else
c.append($("<option></option>").val(i).text(i))
}
c = $('#dialog_endtimehour');
for (var i = 0; i < 24; i++) {
if (i < 10)
c.append($("<option></option>").val("0" + i).text("0" + i))
else
c.append($("<option></option>").val(i).text(i))
}
c = $('#dialog_endtimeminute');
for (var i = 0; i < 60; i++) {
if (i < 10)
c.append($("<option></option>").val("0" + i).text("0" + i))
else
c.append($("<option></option>").val(i).text(i))
}
}
$(function () {
GetMachineTypes();
GetActiveJobsites();
init();
initTime();
function resizeContent() {
$('#divcontent').css('height', $(window).height() - $('#divcontent').offset().top - 4);
}
window.onresize = resizeContent;
resizeContent();
});
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div>
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave(0);" data-lgid="P_M3_SAVE">Save</span>
<span class="sbutton iconsave" onclick="OnSave(1);" data-lgid="P_M3_SAVE1">Save and Exit</span>
<span class="sbutton iconexit" onclick="OnExit(0);" data-lgid="P_M3_SAVE2">Exit Without Saving</span>
</div>
<div class="clear"></div>
<div class="content_main" id="divcontent" style="overflow: auto;">
<div class="edit-content">
<div class="subtitle">
<span data-lgid="P_M3_JOBSITELIMITINFORMATION">Jobsite Limit Information</span>
<hr />
</div>
<table style="line-height: 30px;">
<tr>
<td class="label" data-lgid="P_M3_JOBSITE_COLON">JobSite:</td>
<td>
<select id="dialog_jobsite" tabindex="1" style="width: 322px;"></select></td>
</tr>
<tr>
<td class="label"></td>
<td>
<input type="checkbox" id="dialog_active" tabindex="2" style="width: auto; height: 13px; margin-left: 0; margin-top: -2px; margin-bottom: 1px; vertical-align: middle;" />
<label data-lgid="P_M3_ACTIVE">Active</label></td>
</tr>
<tr>
<td class="label" data-lgid="P_M3_STARTTIME_COLON">Start Time:</td>
<td>
<select id="dialog_starttimehour" style="width: 48px;" tabindex="3"></select><span style="font-weight: bold;">&nbsp;&nbsp;:&nbsp;&nbsp;</span>
<select id="dialog_starttimeminute" style="width: 48px;" tabindex="4"></select>
</td>
</tr>
<tr>
<td class="label" data-lgid="P_M3_ENDTIME_COLON">End Time:</td>
<td>
<select id="dialog_endtimehour" style="width: 48px;" tabindex="5"></select><span style="font-weight: bold;">&nbsp;&nbsp;:&nbsp;&nbsp;</span>
<select id="dialog_endtimeminute" style="width: 48px;" tabindex="6"></select>
</td>
</tr>
<tr>
<td class="label" data-lgid="P_M3_ACCEPTABLEMINIMUMTRUCKS_COLON">Acceptable Minimum Trucks:</td>
<td>
<input id="dialog_mintrucks" tabindex="7" maxlength="8" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_M3_ACCEPTABLEMAXIMUMTRUCKS_COLON">Acceptable Maximum Trucks:</td>
<td>
<input id="dialog_maxtrucks" tabindex="8" maxlength="8" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_M3_ACCEPTABLEASSETTYPES_COLON">Acceptable Asset Types:</td>
<td>
<div id="dialog_assettype" tabindex="9"></div>
</td>
</tr>
<tr>
<td class="label" data-lgid="P_M3_NOTES_COLON">Notes:</td>
<td>
<textarea id="dialog_notes" maxlength="1000" tabindex="10" style="margin-top: 10px;"></textarea></td>
</tr>
</table>
</div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,52 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site;
using IronIntel.Contractor.Site.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class AddCurfew : JobsiteLimitBasePage
{
public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
protected void Page_Load(object sender, EventArgs e)
{
if (!CheckLoginSession())
{
RedirectToLoginPage();
}
else
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest(methodName);
}
else if (!IsPostBack)
{
this.Title = PageTitle;
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOBSITE_LIMIT);
if (!permission)
RedirectToLoginPage();
}
}
}
public bool IsAdmin
{
get
{
var user = GetCurrentUser();
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
return true;
else
return false;
}
}
}

View File

@ -0,0 +1,851 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="AddRequirements.aspx.cs" Inherits="AddRequirements" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.edit-content table {
border-collapse: collapse;
width: 100%;
}
.edit-content table td.label {
width: 200px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: top;
}
.edit-content table td input,
.edit-content table td textarea {
border: 1px solid #a9a9a9;
width: 320px;
height: 18px;
padding: 1px;
}
.edit-content table td input[type="checkbox"] {
border: none;
}
.edit-content table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.a {
text-decoration: none;
color: #2140fb;
}
.subtitle {
margin: 20px 40px 5px 0px;
font-size: 16px;
color: gray;
}
.subtitle span {
margin-left: 10px;
}
.subtitle hr {
background-color: #d8d8d8;
border: none;
height: 1px;
}
.machinetd {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#basemapTitle {
position: absolute;
z-index: 2;
bottom: 0px;
width: 90%;
color: #4c4c4c;
margin: 0;
font-size: 10px;
line-height: 12px;
display: block;
padding: 2px 5%;
background: #fff;
background: rgba(255, 255, 255, 0.80);
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
text-align: center;
}
#basemapImg {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-repeat: no-repeat;
background-position: center center;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#basemapgalleryDiv {
position: absolute;
right: 30px;
top: 100px;
z-index: 199;
background-color: #EFEFEF;
height: 75px;
width: 75px;
border: solid 1px #57585A;
border-radius: 5px;
padding: 1px;
}
#basemapGallery {
position: absolute;
right: 15px;
top: 35px;
width: 370px;
height: 120px;
overflow: auto;
display: none;
z-index: 200;
background-color: #EFEFEF;
}
.div_filter {
margin-top: -3px;
}
.div_filter .dropdown {
width: 200px;
margin: 2px 0 0 0px;
}
.div_panel {
min-width: 200px;
}
#machine-name {
margin: 10px 10px 6px;
/*color: gray;*/
font-weight: lighter;
font-size: 18px;
width: 770px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.jobsitetitle {
font-weight: bold;
font-size: 16px;
padding-left: 10px;
}
#div_jslocation {
position: absolute;
background-color: #E8E8E8;
padding: 5px;
margin-left: 60px;
}
.jslocation_lable {
text-align: right;
padding-right: 10px;
line-height: 24px;
}
.machine_filter {
height: 20px;
line-height: 20px;
padding: 5px;
}
.machine_filter select {
height: 23px;
min-width: 100px;
max-width: 300px;
}
.requireinfo {
line-height: 30px;
margin-left: 10px;
}
.requireinfospan {
font-weight: 500;
margin-left: 20px;
}
.quantity {
padding: 3px 0 3px 10px;
margin-top: 5px;
margin-bottom: 5px;
/*color: gray;*/
font-weight: 500;
font-size: 16px;
/*width: 770px;*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #f0f0f0;
}
.fi-input-wrapper {
width: 100%;
}
.dialog .dialog-func input {
width: unset;
}
.span-caption {
position: absolute;
}
.span-bar {
position: absolute;
height: 100%;
margin: 0;
vertical-align: bottom;
}
</style>
<script>
//必须放在地图js之前
var dojoConfig = {
paths: {
extras1: location.pathname.replace(/\/[^/]+$/, "") + "/../js/mapview"
},
cacheBust: true
};
</script>
<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("../css/jquery.datetimepicker.css")%>" rel="stylesheet" />
<link href="<%=GetFileUrlWithVersion("../fic/css/datepicker.min.css")%>" rel="stylesheet" />
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/js/datepicker.min.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>"></script>
<%--<link rel="stylesheet" type="text/css" href="css/default.css" />--%>
<link href="<%=GetFileUrlWithVersion("../css/spectrum.css")%>" rel="stylesheet" type="text/css" />
<script src="../js/spectrum.js?v=1" type="text/javascript"></script>
<script src="../Maintenance/js/inputdatactr.js"></script>
<script src="<%=GetFileUrlWithVersion("../js/editmultiselect.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/jobsiterequirement.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/email.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/dispatchassign.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var alljobsites;
var addrequirement = true;
var _sendType = 0;
var IsRequestOnly = <%=IsRequestOnly ?"true":"false"%>;
var _createrequireids;
var _assetids;
var _seltype;//0.print;1.email
var allroadassets;
var currentdate = "<%=CurrentDate %>";
jobsitequery = function (method, param, callback, error, nolog) {
_network.request("JobSite/AddRequirements.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
function showConfirm1(msg, title, fok, fcancel) {
showmaskbg(true);
_dialog.showConfirm(msg, title, function (e) {
showmaskbg(false);
if (typeof fok === 'function') {
fok(e);
}
}, function () {
showmaskbg(false);
});
}
_dialog.showAssetConfirm = function (msg, title, fedit, fcancel, fclose, iniframe, shownote) {
if (!fclose)
fclose = fcancel;
_dialog.showButtonDialog(msg, title, 'question', fclose, [{
value: GetTextByKey("P_JS_COMPLETEREMAININGREQUIREMENTS", 'Complete Remaining Requirements'),
func: fedit
}, {
value: GetTextByKey("P_JS_SAVEWITHCURRENTSELECTIONS", 'Save with Current Selections'),
func: fcancel
}], iniframe, shownote);
};
function showAssetConfirm(msg, title, fcancel, fedit, fclose) {
showmaskbg(true);
_dialog.showAssetConfirm(msg, title, function (e) {
showmaskbg(false);
if (typeof fedit === 'function') {
fedit(e);
}
}, function (e) {
showmaskbg(false);
if (typeof fcancel === 'function') {
fcancel(e);
}
}, function (e) {
showmaskbg(false);
if (typeof fclose === 'function') {
fclose(e);
}
});
}
_dialog.showRequirementConfirm = function (msg, title, fprint, femail, fsave, fcancel, fclose, iniframe, shownote) {
if (!fclose)
fclose = fcancel;
_dialog.showButtonDialog(msg, title, 'question', fclose, [{
value: GetTextByKey("P_JS_PRINTDISPATCHINSTRUCTIONS", 'Print Dispatch Instructions'),
func: fprint
}, {
value: GetTextByKey("P_JS_EMAILDISPATCHINSTRUCTIONS", 'Email Dispatch Instructions'),
func: femail
}, {
value: GetTextByKey("P_JS_CONTINUE", 'Continue'),
func: fsave
}], iniframe, shownote);
};
function showRequirementConfirm(msg, title, fprint, femai, fsave, fclose) {
$("#mask_bg").show();
_dialog.showRequirementConfirm(msg, title, function (e) {
$("#mask_bg").hide();
if (typeof fprint === 'function') {
fprint(e);
}
}, function (e) {
$("#mask_bg").hide();
if (typeof femai === 'function') {
femai(e);
}
}, function (e) {
$("#mask_bg").hide();
if (typeof fsave === 'function') {
fsave(e);
}
}, function (e) {
$("#mask_bg").hide();
if (typeof fclose === 'function') {
fclose(e);
}
});
}
function checkRequirementItem(alerttitle, ignorebeginpast) {
var items = allRequirements;
for (var i = 0; i < items.length; i++) {
var req = items[i];
if (req.BeginDate.length === 0) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEBEGINDATE", "Please enter the Begin Date."), alerttitle);
return false;
}
if (!checkDate(req.BeginDate)) {
showAlert(GetTextByKey("P_JS_BEGINDATEFORMATERROR", "Begin Date format error."), alerttitle);
return false;
}
if (req.EndDate.length === 0) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEENDDATE", "Please enter the End Date."), alerttitle);
return false;
}
if (!checkDate(req.EndDate)) {
showAlert(GetTextByKey("P_JS_ENDDATEFORMATERROR", "End Date format error."), alerttitle);
return false;
}
var nowdt = new Date(currentdate.replace("-", "/"));
var sdate = req.BeginDate;
var stdt = new Date(sdate.replace("-", "/"));
var edate = req.EndDate;
var etdt = new Date(edate.replace("-", "/"));
if (!ignorebeginpast && stdt < nowdt) {
var msg = GetTextByKey("P_JS_BEGINDATEPAST", "The begin date for this requirement is in the past, do you want to continue?")
showConfirm1(msg, alerttitle, function () {
OnSave(true);
});
return false;
}
//if (etdt < nowdt) {
// showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE1", "End Date must be later than Begin Date. Please select another date range."), alerttitle);
// return false;
//}
if (stdt > etdt) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), alerttitle);
return false;
}
if (req.Quantity === "" || isNaN(req.Quantity)) {
showAlert(GetTextByKey("P_JS_QUANTITYISINVALID", "Quantity is invalid."), alerttitle);
return false;
}
req.Quantity = parseInt(req.Quantity);
if (req.Quantity < 1 || req.Quantity > 2147483647) {
showAlert(GetTextByKey("P_JS_QUANTITYISINVALID", "Quantity is invalid."), alerttitle);
return false;
}
if (req.Assets && req.Assets.length > req.Quantity) {
showAlert(GetTextByKey("P_JS_REQUIREMENTIFORASSETSPLEASEREMOVEEXCESSASSETS", "{0} requirement is for {1} asset(s), please remove excess asset(s).").replace('{0}', req.AssetTypeName).replace('{1}', (req.Quantity)), alerttitle);
return false;
}
}
return true;
}
function getRelatedData() {
var daycount = 0;
var msg = "";
var alertids = [];
var cmsg = "";
var rmsg = "";
var ccount = 0;
var rcount = 0;
for (var i = 0; i < allRequirements.length; i++) {
var req = allRequirements[i];
var txt = "&nbsp;&nbsp;" + req.Quantity + " " + req.AssetTypeName;
if (req.Assets && req.Assets.length >= req.Quantity) {
ccount++;
if (cmsg === "")
cmsg += txt
else
cmsg += "<br/>" + txt;
}
else {
rcount++;
if (rmsg === "")
rmsg += txt;
else
rmsg += "<br/>" + txt;
}
var stdt = new Date(req.BeginDate.replace("-", "/"));
var now = new Date(currentdate);
var time = now.getFullYear() + "/" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "/" + (now.getDate() < 10 ? "0" : "") + now.getDate();
var stime = stdt.getFullYear() + "/" + ((stdt.getMonth() + 1) < 10 ? "0" : "") + (stdt.getMonth() + 1) + "/" + (stdt.getDate() < 10 ? "0" : "") + stdt.getDate();
var days = getDaysBetween(time, stime, true);
if (days > 0 && days < 8 && req.Assets && req.Assets.length > 0) {
daycount++;
for (var j = 0; j < req.Assets.length; j++) {
alertids.push(req.Assets[j].AssetId)
}
}
}
if (ccount > 0 && ccount < allRequirements.length) {
msg = GetTextByKey("P_JS_REQUIREMENTSTIP1", '{0} of {1} requirements have been scheduled for {2}:<br/>')
.replace('{0}', ccount).replace('{1}', allRequirements.length).replace('{2}', req.JobSiteName);
if (cmsg !== "")
msg += cmsg + "<br/><br/>";
}
if (rcount > 0) {
msg += GetTextByKey("P_JS_REQUIREMENTSTIP2", '{0} requirement remains:<br/>').replace('{0}', rcount);
if (rmsg !== "")
msg += rmsg + "<br/><br/>";
}
return [msg, daycount, alertids];
}
function OnSave(ignorebeginpast) {
_assetids = [];
if (!allRequirements || allRequirements.length == 0)
return;
var alerttitle = GetTextByKey("P_JS_JOBSITEREQUIREMENTS", "Jobsite Requirements");
var check = checkRequirementItem(alerttitle, ignorebeginpast);
if (!check)
return;
var item = getRelatedData();
var msg = item[0];
var daycount = item[1];
var assetids = item[2];
if (msg !== "") {
showAssetConfirm(msg, alerttitle,
function () {
saveRequirments(daycount, assetids);
}, function () {
$('#dialog_managemahchine').hide();
showmaskbg(false);
}, null);
}
else
saveRequirments(daycount, assetids);
}
function saveRequirments(daycount, assetids) {
_assetids = assetids;
var alerttitle = GetTextByKey("P_JS_JOBSITEREQUIREMENTS", "Jobsite Requirements");
var items = allRequirements;
showloading(true);
var param = JSON.stringify(items);
param = htmlencode(param);
jobsitequery("CreateNewRequirments", param, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, alerttitle);
} else {
_createrequireids = data;
if (daycount > 0) {
var msg = GetTextByKey("P_JS_SCHEDULEDREQUIREMENTSTAKEPLACEWITHINTHENEXTDAYSWOULDYOULIKETO", "{0} scheduled requirements take place within the next 7 days. Would you like to:").replace('{0}', daycount);
showRequirementConfirm(msg, alerttitle,
function () {
openAssignDispatch(0);
}, function () {
openAssignDispatch(1);
}, function () {
OnExit();
}, function () {
OnExit();
});
}
else {
OnExit();
}
}
}, function (err) {
console.log(err);
showloading(false);
showAlert(GetTextByKey("P_JS_FAILEDTOSAVE", "Failed to save jobsite."), alerttitle);
});
}
function onPrint(requireids, assignto) {
if (!assignto)
assignto = "";
window.open("../Print.aspx?pt=2&t=" + _sendType + "&assignto=" + encodeURIComponent(assignto) + "&ids=" + JSON.stringify(requireids));
}
function OnExit(msg) {
window.parent.CloseDialog(msg);
}
function OnAdd() {
$('#begindatetxt').val('');
$('#enddatetxt').val('');
$('#pointofcontacttxt').val('');
if (assettypeipt)
assettypeipt.reset();
jobsiterequirementCtrl.setData([]);
allRequirements = [];
}
function init(jss) {
OnAdd();
if (jss) {
alljobsites = jss;
setJobsites();
}
else
getJobsites();
}
function getJobsites() {
if (alljobsites)
return;
jobsitequery('GetJobsites', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
alljobsites = data;
setJobsites();
});
}
function setJobsites() {
if (!alljobsites)
return;
$('#dialog_jobsite').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_jobsite').append(ops);
}
}
var assettypes;
var assettypeparam;
var assettypeipt;
function getAssetTypes() {
if (assettypes)
return;
$('#div_assettypes').empty();
jobsitequery('GetAssetTypes', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
assettypes = data;
assettypeparam = {
items: data,
selectedvalue: [],
allowall: false,
allowsearch: true,
width: 280
};
assettypeipt = editmultiselect(assettypeparam);
$('#div_assettypes').append(assettypeipt);
});
}
var editableSelectAssignAsset;
$(function () {
jobsiterequirementCtrl = new $jobsiterequirementCtrl();
jobsiterequirementCtrl.Init($("#requirementlist"), false);
InitAssetGridData();
InitEmailGridData();
editableSelectAssignAsset = new $editableselect($("#dialog_assignasset"));
editableSelectAssignAsset.setEnable(false);
getAssetTypes();
if (!alljobsites)
getJobsites();
$("#dialog_jobsite").change(function () {
var jsid = $('#dialog_jobsite').find("option:selected").val();
var jsname = $("#dialog_jobsite").find("option:selected").text();
for (var i = 0; i < allRequirements.length; i++) {
allRequirements[i].JobSiteId = jsid;
allRequirements[i].JobSiteName = jsname;
}
})
$('#dialog_managemahchine').dialog(function () {
if (allRequirements && allRequirements.length > 0) {
for (var i = 0; i < allRequirements.length; i++) {
var req = allRequirements[i];
if (req.Assets)
req.ScheduledQuantity = req.Assets.length;
}
}
currentRequirement = null;
showmaskbg(false);
});
$(window).resize(function () {
$("#requirementlist").css("height", $(window).height() - $("#requirementlist").offset().top - 14);
}).resize();
$('#begindatetxt').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]);
}
})
$('#enddatetxt').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_sendmail').dialog(function () {
$('#mask_bg').hide();
OnExit();
});
$('#dialog_assignment').dialog(function () {
$('#mask_bg').hide();
});
$('#sendmail_othertextaddress').focus(function (e) {
var left = $('#dialog_sendmail').offset().left + $('#dialog_sendmail').width() + 2;
var top = $('#dialog_sendmail').offset().top + $("#dialog_sendmail").height() - $("#div_tooltip").height() - 9;
$('#div_tooltip').css({ 'display': '', 'left': left, 'top': top });
});
});
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave();" data-lgid="P_JS_SAVE">Save</span>
<span class="sbutton iconexit" onclick="OnExit(0);" data-lgid="P_JS_SAVE2">Exit Without Saving</span>
<%if (!IsRequestOnly)
{ %>
<span class="sbutton iconasset" id="btnFulfillRequest" style="display: none;" onclick="onManageAssets(null,true,0);" data-lgid="P_JS_FULFILLREQUEST">Fulfill Request</span>
<%} %>
</div>
<div class="clear"></div>
<div class="edit-content" style="margin: 10px;">
<table>
<tr>
<td>
<div class="search_bar">
<span data-lgid="P_JS_JOBSITE_COLON">Jobsite:</span>
<select id="dialog_jobsite" style="width: 150px;" tabindex="1">
</select>
<span data-lgid="P_JS_BEGINDATE_COLON" style="margin-left: 10px;">Begin Date:</span>
<div>
<input type="text" id="begindatetxt" autocomplete="off" style="width: 100px; margin-left: 5px;" />
</div>
<span data-lgid="P_JS_ENDDATE_COLON" style="margin-left: 10px;">End Date:</span>
<div>
<input type="text" id="enddatetxt" autocomplete="off" style="width: 100px; margin-left: 5px;" />
</div>
<span data-lgid="P_JS_ASSETTYPE_COLON" style="margin-left: 10px;">Asset Type:</span>
<div id="div_assettypes" style="margin-left: 5px;"></div>
<span data-lgid="P_JS_POINTOFCONTACT_COLON" style="margin-left: 10px;">Point of Contact:</span>
<div>
<input type="text" id="pointofcontacttxt" maxlength="100" autocomplete="off" style="width: 100px; margin-left: 5px;" />
</div>
<input id="search_requirements" class="search" type="button" value="Apply" data-lgid="P_MV_APPLY" onclick="getMatchRequirements();" style="margin-left: 5px; height: unset;" />
</div>
</td>
</tr>
<tr>
<td>
<div id="requirementlist" style="height: 240px;">
</div>
</td>
</tr>
</table>
</div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div class="dialog" id="dialog_managemahchine" style="display: none;">
<div class="dialog-title"><span id="spTitle" class="title" data-lgid="P_JS_MANAGEASSETS"></span><em class="dialog-close"></em></div>
<div class="requireinfo">
<span class="requireinfospan" data-lgid="P_JS_JOBSITE_COLON" style="margin-left: 0px;">Jobsite:</span>
<span id="span_jobsite"></span>
<span class="requireinfospan" data-lgid="P_JS_BEGINDATE_COLON">Begin Date:</span>
<span id="span_begindate"></span>
<span class="requireinfospan" data-lgid="P_JS_ENDDATE_COLON">End Date:</span>
<span id="span_enddate"></span>
<span class="requireinfospan" data-lgid="P_JS_ASSETTYPE_COLON">Asset Type:</span>
<span id="span_assettypes"></span>
<span class="requireinfospan" data-lgid="P_JS_POINTOFCONTACT_COLON">Point of Contact:</span>
<span id="span_pointofcontact"></span>
</div>
<div class="quantity">
<span data-lgid="P_JS_QUANTITY_COLON">Quantity:</span>
<span id="span_quantity"></span>
<span class="sbutton iconprevious" id="btnNext" onclick="OnPrevious();" data-lgid="P_MA_PREVIOUS">Previous</span>
<span class="sbutton iconnext" id="btnPrevious" onclick="OnNext();" data-lgid="P_MA_NEXT">Next</span>
</div>
<div id="selectedmachinelist" style="height: 500px; width: 100%;"></div>
<div class="dialog-func">
<input type="button" value="Close" data-lgid="P_JS_CANCEL" class="dialog-close" tabindex="28" />
<input type="button" onclick="OnSetMachine();" 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_sendmail" style="display: none; width: 320px;">
<div class="dialog-title"><span class="title" data-lgid="P_JS_SENDDISPATCHREQUEST">Send Dispatch Request</span><em class="dialog-close"></em></div>
<div class="dialog-content" style="height: 378px;">
<table>
<tr>
<td colspan="2" data-lgid="P_MV_SENDTHISTO">Who do you want to send this to? Select from existing relationships or manual entry.</td>
</tr>
<tr>
<td colspan="2">
<div id="contactlist" style="height: 168px; width: 440px; margin-left: 10px; margin-right: 10px;"></div>
</td>
</tr>
<tr style="height: 24px;">
<td colspan="2" data-lgid="P_MV_EMAILORTEXTADDRESSESTIPS">Separate multiple manually entered email or text addresses with a semi-colon (;).</td>
</tr>
<tr style="height: 24px;">
<td><span data-lgid="P_MV_OTHEREMAILADDRESS">Other Email Address</span>
</td>
<td>
<input type="text" id="sendmail_otheremailaddress" style="width: 312px;" autocomplete="off" /></td>
</tr>
<tr style="height: 24px; display: none;">
<td><span data-lgid="P_MV_OTHERTEXTADDRESS">Other Text Address</span>
</td>
<td>
<input type="text" id="sendmail_othertextaddress" style="width: 312px;" autocomplete="off" />
</td>
<%--<span id="span_hepler" class='helper pointer' title='Help'></span>--%>
</tr>
<tr style="height: 24px;">
<td colspan="2" data-lgid="P_MV_DESCRIPTION_COLON">Description:</td>
</tr>
<tr>
<td colspan="2">
<textarea id="sendmail_desc" style="width: 444px; height: 80px; resize: none; margin-left: 12px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_MV_CANCEL" class="dialog-close" tabindex="12" />
<input type="button" onclick="onSendEmails();" value="OK" data-lgid="P_MV_OK" tabindex="11" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="dialog_assignment" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_JS_DISPATCHASSIGNMENT">Dispatch Assignment</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; margin-left: 30px;">
<tr>
<td data-lgid="P_JS_SELECTASSETFORDISPATCH">Select Asset for Dispatch</td>
</tr>
<tr>
<td>
<div id="dialog_assignasset" style="width: 320px; height: 22px;"></div>
</td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" onclick="onAssignContinue();" value="Continue" data-lgid="P_JS_CONTINUE" tabindex="12" />
<input type="button" onclick="onAssignSkip();" value="Skip" data-lgid="P_JS_SKIP" tabindex="11" />
<div class="clear"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,44 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class AddRequirements : JobSiteRequirementsBasePage
{
public string CurrentDate = "";
protected bool IsRequestOnly = false;
protected void Page_Load(object sender, EventArgs e)
{
string tp = Request.Params["tp"];
if (string.Compare(tp, "ashx", true) == 0)
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
bool license = SystemParams.HasLicense("JobSites");
bool license1 = SystemParams.HasLicense("JobsiteDispatch");
if (!license || !license1)
RedirectToEntryPage();
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES_REQUIREMENTS, Permissions.RequestOnly);
if (!permission)
RedirectToLoginPage();
bool ro = CheckReadonly(SystemParams.CompanyID, Feature.JOB_SITES_REQUIREMENTS);
if (ro)
RedirectToLoginPage();
IsRequestOnly = CheckRequestonly(SystemParams.CompanyID);
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
CurrentDate = userlocaldate.ToShortDateString();
}
}

View File

@ -0,0 +1,591 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="AddScheduler.aspx.cs" Inherits="AddScheduler" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.edit-content table {
border-collapse: collapse;
width: 100%;
}
.edit-content table td.label {
width: 200px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: top;
}
.edit-content table td input,
.edit-content table td textarea {
border: 1px solid #a9a9a9;
width: 320px;
height: 18px;
padding: 1px;
}
.edit-content table td input[type="checkbox"] {
border: none;
}
.edit-content table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.a {
text-decoration: none;
color: #2140fb;
}
.subtitle {
margin: 20px 40px 5px 0px;
font-size: 16px;
color: gray;
}
.subtitle span {
margin-left: 10px;
}
.subtitle hr {
background-color: #d8d8d8;
border: none;
height: 1px;
}
.machinetd {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#basemapTitle {
position: absolute;
z-index: 2;
bottom: 0px;
width: 90%;
color: #4c4c4c;
margin: 0;
font-size: 10px;
line-height: 12px;
display: block;
padding: 2px 5%;
background: #fff;
background: rgba(255, 255, 255, 0.80);
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
text-align: center;
}
#basemapImg {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-repeat: no-repeat;
background-position: center center;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#basemapgalleryDiv {
position: absolute;
right: 30px;
top: 100px;
z-index: 199;
background-color: #EFEFEF;
height: 75px;
width: 75px;
border: solid 1px #57585A;
border-radius: 5px;
padding: 1px;
}
#basemapGallery {
position: absolute;
right: 15px;
top: 35px;
width: 370px;
height: 120px;
overflow: auto;
display: none;
z-index: 200;
background-color: #EFEFEF;
}
.div_filter {
margin-top: -3px;
}
.div_filter .dropdown {
width: 200px;
margin: 2px 0 0 0px;
}
.div_panel {
min-width: 200px;
}
#machine-name {
margin: 10px 10px 6px;
/*color: gray;*/
font-weight: lighter;
font-size: 18px;
width: 770px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.jobsitetitle {
font-weight: bold;
font-size: 16px;
padding-left: 10px;
}
#div_jslocation {
position: absolute;
background-color: #E8E8E8;
padding: 5px;
margin-left: 60px;
}
.jslocation_lable {
text-align: right;
padding-right: 10px;
line-height: 24px;
}
.machine_filter {
height: 20px;
line-height: 20px;
padding: 5px;
}
.machine_filter select {
height: 23px;
min-width: 100px;
max-width: 300px;
}
.requireinfo {
line-height: 30px;
margin-left: 10px;
}
.requireinfospan {
font-weight: 500;
margin-left: 20px;
}
.quantity {
padding: 3px 0 3px 10px;
margin-top: 5px;
margin-bottom: 5px;
/*color: gray;*/
font-weight: 500;
font-size: 16px;
/*width: 770px;*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #f0f0f0;
}
.fi-input-wrapper {
width: 100%;
}
.dialog .dialog-func input {
width: unset;
}
.span-caption {
position: absolute;
}
.span-bar {
position: absolute;
height: 100%;
margin: 0;
vertical-align: bottom;
}
</style>
<script>
//必须放在地图js之前
var dojoConfig = {
paths: {
extras1: location.pathname.replace(/\/[^/]+$/, "") + "/../js/mapview"
},
cacheBust: true
};
</script>
<script src="<%=GetFileUrlWithVersion("../js/components/datagrid.js")%>" type="text/javascript"></script>
<link href="<%=GetFileUrlWithVersion("../css/jquery.datetimepicker.css")%>" rel="stylesheet" />
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>"></script>
<%--<link rel="stylesheet" type="text/css" href="css/default.css" />--%>
<link href="<%=GetFileUrlWithVersion("../css/spectrum.css")%>" rel="stylesheet" type="text/css" />
<script src="../js/spectrum.js?v=1" type="text/javascript"></script>
<script src="../Maintenance/js/inputdatactr.js"></script>
<script type="text/javascript">
var alljobsites;
var addrequirement = true;
var _sendType = 0;
var currentdate = "<%=CurrentDate %>";
jobsitequery = function (method, param, callback, error, nolog) {
_network.request("JobSite/AddRequirements.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
_dialog.showAssetConfirm = function (msg, title, fedit, fcancel, fclose, iniframe, shownote) {
if (!fclose)
fclose = fcancel;
_dialog.showButtonDialog(msg, title, 'question', fclose, [{
value: GetTextByKey("P_JS_COMPLETEREMAININGREQUIREMENTS", 'Complete Remaining Requirements'),
func: fedit
}, {
value: GetTextByKey("P_JS_SAVEWITHCURRENTSELECTIONS", 'Save with Current Selections'),
func: fcancel
}], iniframe, shownote);
};
function showAssetConfirm(msg, title, fcancel, fedit, fclose) {
$("#mask_bg").show();
_dialog.showAssetConfirm(msg, title, function (e) {
$("#mask_bg").hide();
if (typeof fedit === 'function') {
fedit(e);
}
}, function (e) {
$("#mask_bg").hide();
if (typeof fcancel === 'function') {
fcancel(e);
}
}, function (e) {
$("#mask_bg").hide();
if (typeof fclose === 'function') {
fclose(e);
}
});
}
function OnSave(exit, ignorebeginpast) {
var alerttitle = GetTextByKey("P_JS_ADDSCHEDULER", "Add Scheduler");
var item = {
'JobSiteId': $('#dialog_jobsite').val(),
'BeginDate': $.trim($('#dialog_begindate').val()),
'EndDate': $.trim($('#dialog_enddate').val()),
'Quantity': 1,
'Notes': $('#dialog_notes').val(),
'PointOfContact': $('#dialog_pointofcontact').val(),
};
var machine = editableSelectMachine.selecteditem();
if (machine == null) {
showAlert(GetTextByKey("P_FR_ASSETNOTEMPTY", 'Asset cannot be empty.'), alerttitle);
$('#dialog_machine').focus();
return;
}
else {
item.AssetType = machine.TypeID;
var assets = [];
var asset = {
'AssetId': machine.Id,
'BeginDate': item.BeginDate,
'EndDate': item.EndDate
};
assets.push(asset);
item.Assets = assets;
}
if (item.BeginDate.length === 0) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEBEGINDATE", "Please enter the Begin Date."), alerttitle);
return;
}
if (!checkDate(item.BeginDate)) {
showAlert(GetTextByKey("P_JS_BEGINDATEFORMATERROR", "Begin Date format error."), alerttitle);
return;
}
if (item.EndDate.length === 0) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEENDDATE", "Please enter the End Date."), alerttitle);
return;
}
if (!checkDate(item.EndDate)) {
showAlert(GetTextByKey("P_JS_ENDDATEFORMATERROR", "End Date format error."), alerttitle);
return;
}
var nowdt = new Date(currentdate.replace("-", "/"));
var sdate = item.BeginDate;
var stdt = new Date(sdate.replace("-", "/"));
var edate = item.EndDate;
var etdt = new Date(edate.replace("-", "/"));
if (!ignorebeginpast && stdt < nowdt) {
var msg = GetTextByKey("P_JS_BEGINDATEPAST", "The begin date for this requirement is in the past, do you want to continue?")
showConfirm(msg, alerttitle, function () {
OnSave(exit, true);
});
return;
}
//if (etdt < nowdt) {
// showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE1", "End Date must be later than Begin Date. Please select another date range."), alerttitle);
// return;
//}
if (stdt > etdt) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), alerttitle);
return;
}
showloading(true);
var param = JSON.stringify(item);
param = htmlencode(param);
jobsitequery("CreateNewRequirment", param, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, alerttitle);
} else {
if (exit == 0)
OnExit(exit);
else if (exit == 1)
OnAdd();
}
}, function (err) {
console.log(err);
showloading(false);
showAlert(GetTextByKey("P_JS_FAILEDTOSAVESCHEDULER", "Failed to save scheduler."), alerttitle);
});
}
function OnExit(msg) {
window.parent.CloseDialog(msg);
}
function OnAdd() {
editableSelectMachine.val('');
setMachineInfo();
$('#dialog_jobsite').val('');
$('#dialog_begindate').val('');
$('#dialog_enddate').val('');
$('#dialog_notes').val('');
$('#dialog_pointofcontact').val('');
}
function init(jss) {
GetMachines();
OnAdd();
if (jss) {
alljobsites = jss;
setJobsites();
}
else
getJobsites();
editableSelectMachine.reload();
}
function getJobsites() {
if (alljobsites)
return;
jobsitequery('GetJobsites', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
alljobsites = data;
setJobsites();
});
}
function setJobsites() {
if (!alljobsites)
return;
$('#dialog_jobsite').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_jobsite').append(ops);
}
}
function GetMachines(next) {
jobsitequery("GetMachines", "", function (data) {
if (data && data.length > 0) {
machines = data;
editableSelectMachine.datasource = machines;
editableSelectMachine.valuepath = "Id"
editableSelectMachine.displaypath = "DisplayName";
}
if (next)
next();
}, function (err) {
});
}
var editableSelectMachine;
function setMachineInfo() {
var machine = editableSelectMachine.selecteditem();
if (machine) {
$('#dialog_vin').text(machine.VIN);
$('#dialog_make').text(machine.MakeName);
$('#dialog_model').text(machine.ModelName);
$('#dialog_type').text(machine.TypeName);
}
else {
$('#dialog_vin').text('');
$('#dialog_make').text('');
$('#dialog_model').text('');
$('#dialog_type').text('');
}
}
$(function () {
editableSelectMachine = new $editableselect($("#dialog_machine"));
editableSelectMachine.tabIndex(1);
editableSelectMachine.change(function () {
setMachineInfo();
});
if (!alljobsites)
getJobsites();
$('#dialog_begindate').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_enddate').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]);
}
})
$(document).mousedown(function () {
$('.div_panel').css('display', 'none');
});
});
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave(0);" data-lgid="P_JS_SAVE">Save</span>
<span class="sbutton iconsave sbutton-ui" onclick="OnSave(1);" data-lgid="P_FR_SAVE3">Save and Add New</span>
<span class="sbutton iconexit" onclick="OnExit(0);" data-lgid="P_JS_SAVE2">Exit Without Saving</span>
</div>
<div id="div_container" style="height: 100%;">
<div id="div_content">
<div class="clear"></div>
<div id="divcontent" style="overflow: auto;">
<div class="edit-content">
<div class="subtitle">
<span data-lgid="P_FR_ASSETINFORMATION">Asset Information</span>
<hr />
</div>
<table>
<tr>
<td class="label" data-lgid="P_FR_ASSET_COLON">Asset:</td>
<td colspan="4">
<div id="dialog_machine" style="width: 322px; height: 22px;"></div>
</td>
</tr>
<tr>
<td class="label" data-lgid="P_FR_VIN_COLON">VIN:</td>
<td id="dialog_vin" style="width: 200px;"></td>
<td class="label" style="width: 60px;" data-lgid="P_FR_ASSETTYPE_COLON">Type:</td>
<td id="dialog_type" style="width: 200px;"></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_FR_MAKE_COLON">Make:</td>
<td id="dialog_make" style="width: 200px;"></td>
<td class="label" style="width: 60px;" data-lgid="P_FR_MODEL_COLON">Model:</td>
<td id="dialog_model" style="width: 200px;"></td>
<td></td>
</tr>
</table>
<div class="subtitle">
<span data-lgid="P_JS_SCHEDULERINFORMATION">Scheduler Information</span>
<hr />
</div>
<table style="line-height: 30px;">
<tr>
<td class="label" data-lgid="P_JS_JOBSITE_COLON"></td>
<td>
<select id="dialog_jobsite" tabindex="1" style="height: 22px;"></select></td>
</tr>
<tr>
<td class="label" data-lgid="P_JS_BEGINDATE_COLON"><span>*</span></td>
<td>
<table style="width: 500px;">
<tr>
<td style="padding: 0;">
<input type="text" id="dialog_begindate" maxlength="200" tabindex="1" style="width: 200px;" autocomplete="off" />
</td>
<td style="text-align: right; padding-right: 5px;" data-lgid="P_JS_ENDDATE_COLON"></td>
<td>
<input type="text" id="dialog_enddate" maxlength="200" tabindex="1" style="width: 200px;" autocomplete="off" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="label" data-lgid="P_JS_POINTOFCONTACT">Point Of Contact</td>
<td>
<input type="text" id="dialog_pointofcontact" maxlength="100" tabindex="1" autocomplete="off" />
</td>
</tr>
<tr>
<td class="label" data-lgid="P_FR_NOTES_COLON">Notes:</td>
<td>
<textarea id="dialog_notes" maxlength="1000" tabindex="1" style="width: 582px; height: 120px; margin-top: 5px;"></textarea>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="dialogmask" class="maskbg" style="display: none;">
<div class="loading_icon icon c-spin"></div>
</div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,42 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class AddScheduler : JobSiteRequirementsBasePage
{
public string CurrentDate = "";
protected void Page_Load(object sender, EventArgs e)
{
string tp = Request.Params["tp"];
if (string.Compare(tp, "ashx", true) == 0)
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
bool license = SystemParams.HasLicense("JobSites");
bool license1 = SystemParams.HasLicense("JobsiteDispatch");
if (!license || !license1)
RedirectToEntryPage();
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES_SCHEDULER);
if (!permission)
RedirectToLoginPage();
bool ro = CheckReadonly(SystemParams.CompanyID, Feature.JOB_SITES_SCHEDULER);
if (ro)
RedirectToLoginPage();
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
CurrentDate = userlocaldate.ToShortDateString();
}
}

View File

@ -0,0 +1,324 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="DispatchChangeHistory.aspx.cs" Inherits="DispatchChangeHistory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
<style type="text/css">
.itemselcted {
background-color: #ccc;
}
.itemhidden {
display: none;
}
.itemsuggested {
background-color: #ffff99;
}
#tbMachineTypes tbody tr:hover {
cursor: default;
background: #ddd;
}
#tbodyAssigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodyUnassigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodySelected tr:hover {
cursor: default;
background: #ddd;
}
#contentctrl {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.float_left {
float: left;
}
.function_bar {
float: right;
}
.user_main {
padding: 0 4px;
}
.dialog .dialog-title .dialog-close {
float: right;
margin-right: 6px;
cursor: pointer;
}
.dialog .dialog-title .dialog-close:before {
content: '\e600';
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 170px;
text-align: right;
padding-right: 10px;
line-height: 28px;
height: 24px;
vertical-align: top;
}
#dialog_machines .dialog-content table td input,
#dialog_layouts .dialog-content table td input {
width: auto;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
#dialog_user_randompass {
width: auto;
height: 16px;
margin: 3px 4px 0 4px;
}
.icon {
font-family: CalciteWebCoreIcons;
cursor: default;
}
.ybutton {
width: 80px;
line-height: normal;
margin-left: 6px;
border: none;
background: rgb(249, 189, 117);
padding: 5px 14px;
cursor: pointer;
}
.ybutton:hover {
background: #d7690E;
}
.td_controller {
vertical-align: middle;
padding: 40px 8px;
/*border-left: 1px solid #b0b0b0;
border-right: 1px solid #b0b0b0;*/
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.subdialog {
width: -moz-calc(100% - 24px);
width: -webkit-calc(100% - 24px);
width: calc(100% - 24px);
}
.machine_maskbg {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
background: #000;
opacity: 0.2;
}
#machine-name {
margin: 10px 10px 6px;
/*color: gray;*/
font-weight: lighter;
font-size: 18px;
width: 770px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.div_filter .dropdown {
width: 120px;
}
</style>
<link href="<%=GetFileUrlWithVersion("../css/spectrum.css")%>" rel="stylesheet" type="text/css" />
<script src="../js/spectrum.js?v=1" type="text/javascript"></script>
<script>
jobsitequery = function (method, param, callback, error, nolog) {
_network.request("JobSite/DispatchChangeHistory.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
var IsReadOnly = <%=IsReadOnly ?"true":"false"%>;
var _id = "<%=ID %>";
var _sendtype = "<%=SendType %>";
/***************************Jobsites***************************/
function OnRefresh() {
showloading(true);
var p = [_sendtype, _id];
jobsitequery("GetAssetDispatchHistory", htmlencode(JSON.stringify(p)), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
showDispatchList(data);
}, function (err) {
showloading(false);
});
}
function showDispatchList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "MoveDate")
r[j] = { DisplayValue: r["BeginDateStr"], Value: r[j] };
else if (j === "BeginDate")
r[j] = { DisplayValue: r["BeginDateStr"], Value: r[j] };
else if (j === "EndDate")
r[j] = { DisplayValue: r["EndDateStr"], Value: r[j] };
else if (j === "Completed")
r[j] = { DisplayValue: r["Completed"] ? "Yes" : "No", Value: r[j] };
else if (j === "CompletedTime")
r[j] = { DisplayValue: r["CompletedTimeStr"], Value: r[j] };
else if (j === "AddedOn")
r[j] = { DisplayValue: r["AddedOnStr"], Value: r[j] };
else if (j === "DeletedOn")
r[j] = { DisplayValue: r["DeletedOnStr"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
grid_dt.refresh();
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#dispatchlist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'BeginDate', caption: GetTextByKey("P_JS_MOVEDATE", "Move Date"), valueIndex: 'BeginDate', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AssetName', caption: GetTextByKey("P_JS_ASSETNAME", "Asset Name"), valueIndex: 'AssetName', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AssetTypeName', caption: GetTextByKey("P_JS_ASSETTYPE", "Asset Type"), valueIndex: 'AssetTypeName', css: { 'width': 180, 'text-align': 'left' } },
{ name: 'AssetModelName', caption: GetTextByKey("P_JS_MODEL", "Model"), valueIndex: 'AssetModelName', css: { 'width': 180, 'text-align': 'left' } },
{ name: 'CurrentJobSiteName', caption: GetTextByKey("P_JS_FROMJOBSITE", "From Jobsite"), valueIndex: 'CurrentJobSiteName', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'RequiredJobSiteName', caption: GetTextByKey("P_JS_TOJOBSITE", "To Jobsite"), valueIndex: 'RequiredJobSiteName', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Completed', caption: GetTextByKey("P_JS_MARKCOMPLETE", "Mark Complete"), valueIndex: 'Completed', css: { 'width': 100, 'text-align': 'center' } },
{ name: 'CompletedTime', caption: GetTextByKey("P_JS_COMPLETEDATE", "Completed Date"), valueIndex: 'CompletedTime', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_JS_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AssignedTo', caption: GetTextByKey("P_JS_ASSIGNEDTO", "Assigned To"), valueIndex: 'AssignedToAssetName', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'PointOfContact', caption: GetTextByKey("P_JS_POINTOFCONTACT", "Point Of Contact"), valueIndex: 'PointOfContact', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AddedByName', caption: GetTextByKey("P_MA_ADDEDBY", "Added By"), valueIndex: 'AddedByName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AddedOn', caption: GetTextByKey("P_MA_ADDEDON", "Added On"), valueIndex: 'AddedOn', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'DeletedByName', caption: GetTextByKey("P_JS_DELETEDBY", "Deleted By"), valueIndex: 'DeletedByName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'DeletedOn', caption: GetTextByKey("P_JS_DELETEDON", "Deleted On"), valueIndex: 'DeletedOn', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'DeletedNotes', caption: GetTextByKey("P_JS_DELETIONNOTES", "Deletion Notes"), valueIndex: 'DeletedNotes', css: { 'width': 200, 'text-align': 'left' } }
];
var columns = [
];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = list_columns[hd].visible === false ? false : true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
col.type = list_columns[hd].type;
col.alwaysshow = list_columns[hd].alwaysshow;
if (col.name === "DeletedByName" || col.name === "DeletedOn" || col.name === "DeletedNotes") {
col.visible = _sendtype === "0";
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
}
}
}
$(function () {
if (_sendtype == 0)
$('#div_title').text(GetTextByKey("P_JS_REQUIREMENTCHANGEHISTORY", "Requirement Change History"));
else if (_sendtype == 1)
$('#div_title').text(GetTextByKey("P_JS_DISPATCHCHANGEHISTORY", "Dispatch Change History"));
InitGridData();
$(window).resize(function () {
$("#dispatchlist").css("height", $(window).height() - $("#dispatchlist").offset().top - 14);
grid_dt && grid_dt.resize();
}).resize();
OnRefresh();
});
function OnPrint(assignto) {
if (!assignto)
assignto = "";
if (_selectdispatchids.length == 0) {
showAlert(GetTextByKey('P_JS_PLEASESELECTDISPATCH', 'Please select Dispatch.'), GetTextByKey('P_MR_PRINT', 'Print'));
return;
}
window.open("../Print.aspx?pt=2&t=" + _sendType + "&assignto=" + encodeURIComponent(assignto) + "&ids=" + JSON.stringify(_selectdispatchids));
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="contentctrl">
<div class="page_title" id="div_title" data-lgid="P_JS_DISPATCHCHANGEHISTORY">Dispatch Change History</div>
<div class="search_bar">
</div>
<div class="function_title">
<%--<span class="sbutton iconmail" onclick="openAssignDispatch(1);" data-lgid="P_JS_EMAIL">Email</span>--%>
<%--<span class="sbutton iconprint" onclick="openAssignDispatch(0);" data-lgid="P_JS_PRIINT">Print</span>--%>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_JS_REFRESH"></span>
</div>
<div id="dispatchlist"></div>
</div>
</asp:Content>

View File

@ -0,0 +1,56 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class DispatchChangeHistory : JobSiteRequirementsBasePage
{
protected bool CanConfig = false;
protected string LatestStartDate = "";
protected bool IsReadOnly = false;
public string SendType = "";
public string ID = "";
protected void Page_Load(object sender, EventArgs e)
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
if (CheckLoginSession())
{
bool license = SystemParams.HasLicense("JobSites");
bool license1 = SystemParams.HasLicense("JobsiteDispatch");
if (!license || !license1)
RedirectToEntryPage();
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES_DISPATCHREQUESTS);
if (!permission)
RedirectToLoginPage();
IsReadOnly = CheckReadonly(SystemParams.CompanyID, Feature.JOB_SITES_DISPATCHREQUESTS);
SendType = Request.Params["stype"];
ID = Request.Params["id"];
}
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
LatestStartDate = userlocaldate.ToShortDateString();
}
protected override int FeatureID
{
get
{
return Foresight.Fleet.Services.User.Feature.JOB_SITES_DISPATCHREQUESTS;
}
}
}

View File

@ -0,0 +1,629 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="DispatchRequests.aspx.cs" Inherits="DispatchRequests" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
<style type="text/css">
.itemselcted {
background-color: #ccc;
}
.itemhidden {
display: none;
}
.itemsuggested {
background-color: #ffff99;
}
#tbMachineTypes tbody tr:hover {
cursor: default;
background: #ddd;
}
#tbodyAssigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodyUnassigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodySelected tr:hover {
cursor: default;
background: #ddd;
}
#contentctrl {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.float_left {
float: left;
}
.function_bar {
float: right;
}
.user_main {
padding: 0 4px;
}
.dialog .dialog-title .dialog-close {
float: right;
margin-right: 6px;
cursor: pointer;
}
.dialog .dialog-title .dialog-close:before {
content: '\e600';
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 170px;
text-align: right;
padding-right: 10px;
line-height: 28px;
height: 24px;
vertical-align: top;
}
#dialog_machines .dialog-content table td input,
#dialog_layouts .dialog-content table td input {
width: auto;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
#dialog_user_randompass {
width: auto;
height: 16px;
margin: 3px 4px 0 4px;
}
.icon {
font-family: CalciteWebCoreIcons;
cursor: default;
}
.ybutton {
width: 80px;
line-height: normal;
margin-left: 6px;
border: none;
background: rgb(249, 189, 117);
padding: 5px 14px;
cursor: pointer;
}
.ybutton:hover {
background: #d7690E;
}
.td_controller {
vertical-align: middle;
padding: 40px 8px;
/*border-left: 1px solid #b0b0b0;
border-right: 1px solid #b0b0b0;*/
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.subdialog {
width: -moz-calc(100% - 24px);
width: -webkit-calc(100% - 24px);
width: calc(100% - 24px);
}
.machine_maskbg {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
background: #000;
opacity: 0.2;
}
#machine-name {
margin: 10px 10px 6px;
/*color: gray;*/
font-weight: lighter;
font-size: 18px;
width: 770px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.div_filter .dropdown {
width: 120px;
}
</style>
<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/editableselect.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/editmultiselect.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/email.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/dispatchassign.js")%>" type="text/javascript"></script>
<script>
jobsitequery = function (method, param, callback, error, nolog) {
_network.request("JobSite/DispatchRequests.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
var jobsiteparam;
var regionparam;
var IsReadOnly = <%=IsReadOnly ?"true":"false"%>;
var allroadassets;
var _sendType = 1;
var _seltype;//0.print;1.email
var _selectdispatchids;
/***************************Jobsites***************************/
function OnDelete(dis) {
if (!dis) {
return;
}
var text = $('<div style="padding-right:20px;line-height:20px;">' + GetTextByKey("P_JS_DELETETHEDISPATCH", "Would you like to delete the dispatch?") + '<br/></div');
text.append($('<span></span>').text(GetTextByKey("P_JS_MOVEDATE_COLON", "Move Date:") + " " + dis.BeginDateStr));
text.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_MA_ASSETNAME_COLON", "Asset Name:") + " " + dis.AssetName));
text.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_JS_ASSETTYPE_COLON", "Asset Type:") + " " + dis.AssetTypeName));
text.append("<br/>")
text.append($('<span></span>').text(GetTextByKey("P_JS_FROMJOBSITE_COLON", "From Jobsite:") + " " + dis.CurrentJobSiteName));
text.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_JS_TOJOBSITE_COLON", "To Jobsite:") + " " + dis.RequiredJobSiteName));
var alerttile = GetTextByKey("P_JS_DELETEDISPATCH", "Delete Dispatch");
showConfirm(text, alerttile, function (e, notes) {
var item = {
'DispatchId': [dis.DispatchId],
'DeleteNotes': notes
};
var p = htmlencode(JSON.stringify(item));
jobsitequery("DeleteDispatch", p, function (data) {
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_JS_FAILEDTODELETETHISDISPATCH", "Failed to delete this dispatch."), alerttile);
});
}, null, true);
}
function OnRefresh() {
showloading(true);
var jobsites = [];
if (jobsiteparam)
jobsites = jobsiteparam.selectedvalue;
var regions = [];
if (regionparam)
regions = regionparam.selectedvalue;
var p = {
"LatestStartDate": $.trim($('#latesdatetxt').val()),
"JobSites": jobsites,
"Regions": regions,
"SearchText": $.trim($('#searchinputtxt').val()),
"UnScheduledOnly": $('#chk_unscheduled').prop('checked')
};
jobsitequery("GetAssetDispatchItems", htmlencode(JSON.stringify(p)), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
showDispatchList(data);
}, function (err) {
showloading(false);
});
}
function showDispatchList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "MoveDate")
r[j] = { DisplayValue: r["BeginDateStr"], Value: r[j] };
else if (j === "BeginDate")
r[j] = { DisplayValue: r["BeginDateStr"], Value: r[j] };
else if (j === "EndDate")
r[j] = { DisplayValue: r["EndDateStr"], Value: r[j] };
else if (j === "CompletedTime")
r[j] = { DisplayValue: r["CompletedTimeStr"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
grid_dt.refresh();
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#dispatchlist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
//{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'BeginDate', caption: GetTextByKey("P_JS_MOVEDATE", "Move Date"), valueIndex: 'BeginDate', css: { 'width': 100, 'text-align': 'left' } },
//{ name: 'BeginDate', caption: GetTextByKey("P_JS_BEGINDATE", "Begin Date"), valueIndex: 'BeginDate', css: { 'width': 100, 'text-align': 'left' } },
//{ name: 'EndDate', caption: GetTextByKey("P_JS_ENDDATE", "End Date"), valueIndex: 'EndDate', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AssetName', caption: GetTextByKey("P_JS_ASSETNAME", "Asset Name"), valueIndex: 'AssetName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AssetTypeName', caption: GetTextByKey("P_JS_ASSETTYPE", "Asset Type"), valueIndex: 'AssetTypeName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'AssetModelName', caption: GetTextByKey("P_JS_MODEL", "Model"), valueIndex: 'AssetModelName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'CurrentJobSiteName', caption: GetTextByKey("P_JS_FROMJOBSITE", "From Jobsite"), allowFilter: true, valueIndex: 'CurrentJobSiteName', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'RequiredJobSiteName', caption: GetTextByKey("P_JS_TOJOBSITE", "To Jobsite"), allowFilter: true, valueIndex: 'RequiredJobSiteName', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Completed', caption: GetTextByKey("P_JS_MARKCOMPLETE", "Mark Complete"), valueIndex: 'Completed', type: 3, css: { 'width': 100, 'text-align': 'center' } },
{ name: 'CompletedTime', caption: GetTextByKey("P_JS_COMPLETEDATE", "Completed Date"), valueIndex: 'CompletedTime', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_JS_NOTES", "Notes"), valueIndex: 'Notes', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AssignedTo', caption: GetTextByKey("P_JS_ASSIGNEDTO", "Assigned To"), valueIndex: 'AssignedToAssetName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'PointOfContact', caption: GetTextByKey("P_JS_POINTOFCONTACT", "Point Of Contact"), valueIndex: 'PointOfContact', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Delete', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'History', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } }
];
var columns = [
{
// checkbox
name: 'check',
key: 'Selected',
width: 30,
align: 'center',
sortable: false,
allcheck: true,
type: 3
}
];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = list_columns[hd].visible === false ? false : true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
col.type = list_columns[hd].type;
col.alwaysshow = list_columns[hd].alwaysshow;
if (col.name === "Completed") {
col.events = {
onchange: function () {
var item = this;
var msg = "";
if (item.Completed)
msg = GetTextByKey("P_JS_DOYOUWANTTOMARKCOMPLETE", "Do you want to mark complete?");
else
msg = GetTextByKey("P_JS_DOYOUWANTTOUNMARKCOMPLETION", "Do you want to unmark completion?");
showConfirm(msg, GetTextByKey("P_JS_MARKCOMPLATE", 'Mark Complete'), function () {
UpdateDispatchCompleted(item.DispatchId, item.Completed);
}, function () {
item.Completed = !item.Completed;
grid_dt.reload();
showmaskbg(false);
});
}
};
col.enabled = !IsReadOnly;
}
if (col.name === "Delete") {
col.sortable = false;
col.isurl = true;
col.text = "\uf00d";
col.events = {
onclick: function () {
OnDelete(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_JS_DELETE", 'Delete') };
col.styleFilter = function (e) {
if (e.Completed)
return {
display: 'none'
};
};
col.visible = !IsReadOnly;
}
if (col.name === "History") {
col.sortable = false;
col.isurl = true;
col.text = "\uf06e";
col.events = {
onclick: function () {
OnViewChangeHistory(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_MR_VIEWCHANGEHIS", 'View Change History') };
col.visible = !IsReadOnly;
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
}
}
}
function searchEnter(e) {
if (e.keyCode == 13) {
OnRefresh();
}
}
var alljobsites;
var jobsite_editmultiselect;
function getJobsitesAndRegions() {
jobsitequery('GetJobsitesAndRegions', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
alljobsites = data.Jobsites;
jobsiteparam = {
allitems: data.Jobsites,
items: JSON.parse(JSON.stringify(data.Jobsites)),
selectedvalue: [],
width: 240
};
jobsite_editmultiselect = editmultiselect(jobsiteparam);
$('#div_jobsites').append(jobsite_editmultiselect);
regionparam = {
items: data.Regions,
selectedvalue: [],
width: 240,
oncompleted: onregioncompleted
};
var ipt = editmultiselect(regionparam);
$('#div_region').append(ipt);
});
}
function onregioncompleted() {
if (!jobsiteparam || !jobsiteparam.allitems) return;
jobsiteparam.items.length = 0;
for (var i in jobsiteparam.allitems) {
var item = jobsiteparam.allitems[i];
if (!regionparam.selectedvalue
|| regionparam.selectedvalue.length == 0
|| regionparam.selectedvalue.indexOf(item.Tag3) >= 0)
jobsiteparam.items.push(item);
}
jobsite_editmultiselect.reset();
}
var editableSelectAssignAsset;
$(function () {
setPageTitle(GetTextByKey("P_JS_DISPATCHREQUESTS", "Dispatch Requests"), true);
editableSelectAssignAsset = new $editableselect($("#dialog_assignasset"));
editableSelectAssignAsset.setEnable(false);
InitGridData();
InitEmailGridData();
getJobsitesAndRegions();
$(window).resize(function () {
$("#dispatchlist").css("height", $(window).height() - $("#dispatchlist").offset().top - 14);
grid_dt && grid_dt.resize();
}).resize();
OnRefresh();
$('#searchinputtxt').keydown(searchEnter);
$('#dialog_sendmail').dialog(function () {
showmaskbg(false);
});
$('#dialog_assignment').dialog(function () {
showmaskbg(false);
});
$('#sendmail_othertextaddress').focus(function (e) {
var left = $('#dialog_sendmail').offset().left + $('#dialog_sendmail').width() + 2;
var top = $('#dialog_sendmail').offset().top + $("#dialog_sendmail").height() - $("#div_tooltip").height() - 9;
$('#div_tooltip').css({ 'display': '', 'left': left, 'top': top });
});
$('#latesdatetxt').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]);
}
});
if (!canExport) {
$('#spExport').hide();
}
});
function UpdateDispatchCompleted(dispatchid, competed) {
var item = { 'Key': dispatchid, 'Value': competed };
var p = htmlencode(JSON.stringify(item));
jobsitequery('UpdateDispatchCompleted', p, function (data) {
if (data !== "OK") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
}
OnRefresh();
});
}
function OnPrint(assignto) {
if (!assignto)
assignto = "";
if (_selectdispatchids.length == 0) {
showAlert(GetTextByKey('P_JS_PLEASESELECTDISPATCH', 'Please select Dispatch.'), GetTextByKey('P_MR_PRINT', 'Print'));
return;
}
window.open("../Print.aspx?pt=2&t=" + _sendType + "&assignto=" + encodeURIComponent(assignto) + "&ids=" + JSON.stringify(_selectdispatchids));
}
function OnViewChangeHistory(dis) {
if (!dis) {
return;
}
window.open("DispatchChangeHistory.aspx?stype=" + _sendType + "&id=" + dis.DispatchId);
}
function OnExport() {
var jobsites = [];
if (jobsiteparam)
jobsites = jobsiteparam.selectedvalue;
var regions = [];
if (regionparam)
regions = regionparam.selectedvalue;
var p = {
"LatestStartDate": $.trim($('#latesdatetxt').val()),
"JobSites": jobsites,
"Regions": regions,
"SearchText": $.trim($('#searchinputtxt').val()),
"UnScheduledOnly": $('#chk_unscheduled').prop('checked')
};
window.open("../ExportToFile.aspx?type=dispatchrequests&t=" + htmlencode(JSON.stringify(p)));
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="contentctrl">
<div class="page_title" data-lgid="P_JS_DISPATCHREQUESTS">Dispatch Requests</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_JS_LATESTSTARTDATE_COLON"></span>
<input type="text" id="latesdatetxt" autocomplete="off" style="float: left; width: 80px; margin-left: 5px;" value="<%=LatestStartDate %>" />
<span data-lgid="P_JS_REGION_COLON">Region:</span>
<div id="div_region"></div>
<span data-lgid="P_JS_JOBSITES_COLON">Jobsites:</span>
<div id="div_jobsites"></div>
<input type="text" id="searchinputtxt" autocomplete="off" style="margin-left: 5px; display: none;" />
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_CM_SEARCH" style="margin-left: 5px;" />
<input id="chk_unscheduled" type="checkbox" onclick="OnRefresh();" />
<label data-lgid="P_JS_MARKCOMPLETE" for="chk_unscheduled">Mark Complete</label>
</div>
<div class="function_title">
<span class="sbutton iconmail" onclick="openAssignDispatch(1);" data-lgid="P_JS_EMAIL">Email</span>
<span class="sbutton iconprint" onclick="openAssignDispatch(0);" data-lgid="P_JS_PRIINT">Print</span>
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_JS_REFRESH"></span>
</div>
<div id="dispatchlist"></div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div class="dialog" id="dialog_sendmail" style="display: none; width: 320px;">
<div class="dialog-title"><span class="title" data-lgid="P_JS_SENDDISPATCHREQUEST">Send Dispatch Request</span><em class="dialog-close"></em></div>
<div class="dialog-content" style="height: 378px;">
<table>
<tr>
<td colspan="2" data-lgid="P_MV_SENDTHISTO">Who do you want to send this to? Select from existing relationships or manual entry.</td>
</tr>
<tr>
<td colspan="2">
<div id="contactlist" style="height: 168px; width: 440px; margin-left: 10px; margin-right: 10px;"></div>
</td>
</tr>
<tr style="height: 24px;">
<td colspan="2" data-lgid="P_MV_EMAILORTEXTADDRESSESTIPS">Separate multiple manually entered email or text addresses with a semi-colon (;).</td>
</tr>
<tr style="height: 24px;">
<td><span data-lgid="P_MV_OTHEREMAILADDRESS">Other Email Address</span>
</td>
<td>
<input type="text" id="sendmail_otheremailaddress" style="width: 312px;" autocomplete="off" /></td>
</tr>
<tr style="height: 24px; display: none;">
<td><span data-lgid="P_MV_OTHERTEXTADDRESS">Other Text Address</span>
</td>
<td>
<input type="text" id="sendmail_othertextaddress" style="width: 312px;" autocomplete="off" />
</td>
<%--<span id="span_hepler" class='helper pointer' title='Help'></span>--%>
</tr>
<tr style="height: 24px;">
<td colspan="2" data-lgid="P_MV_DESCRIPTION_COLON">Description:</td>
</tr>
<tr>
<td colspan="2">
<textarea id="sendmail_desc" style="width: 444px; height: 80px; resize: none; margin-left: 12px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_MV_CANCEL" class="dialog-close" tabindex="12" />
<input type="button" onclick="onSendEmails();" value="OK" data-lgid="P_MV_OK" tabindex="11" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="dialog_assignment" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_JS_DISPATCHASSIGNMENT">Dispatch Assignment</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; margin-left: 30px;">
<tr>
<td data-lgid="P_JS_SELECTASSETFORDISPATCH">Select Asset for Dispatch</td>
</tr>
<tr>
<td>
<div id="dialog_assignasset" style="width: 320px; height: 22px;"></div>
</td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" onclick="onAssignContinue();" value="Continue" data-lgid="P_JS_CONTINUE" tabindex="12" />
<input type="button" onclick="onAssignSkip();" value="Skip" data-lgid="P_JS_SKIP" tabindex="11" />
<div class="clear"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,51 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class DispatchRequests : JobSiteRequirementsBasePage
{
protected bool CanConfig = false;
protected string LatestStartDate = "";
protected bool IsReadOnly = false;
protected void Page_Load(object sender, EventArgs e)
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
if (CheckLoginSession())
{
bool license = SystemParams.HasLicense("JobSites");
bool license1 = SystemParams.HasLicense("JobsiteDispatch");
if (!license || !license1)
RedirectToEntryPage();
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES_DISPATCHREQUESTS);
if (!permission)
RedirectToLoginPage();
IsReadOnly = CheckReadonly(SystemParams.CompanyID, Feature.JOB_SITES_DISPATCHREQUESTS);
}
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
LatestStartDate = userlocaldate.ToShortDateString();
}
protected override int FeatureID
{
get
{
return Foresight.Fleet.Services.User.Feature.JOB_SITES_DISPATCHREQUESTS;
}
}
}

120
Site/JobSite/JobSite.aspx Normal file
View File

@ -0,0 +1,120 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="JobSite.aspx.cs" Inherits="JobSite" %>
<asp:Content ID="Content1" ContentPlaceHolderID="holder_head" runat="Server">
<link href="<%=GetFileUrlWithVersion("../css/split.css")%>" rel="stylesheet" type="text/css" />
<script src="<%=GetFileUrlWithVersion("../js/split.js")%>"></script>
<%--<script src="<%=GetFileUrlWithVersion("../fic/js/utility.js")%>" type="text/javascript"></script>--%>
<script type="text/javascript">
$(function () {
setFavoriteDisplay(true);
_network.query = function (method, param, callback, error) {
_network.request("JobSite/JobSite.aspx", -1, method, param, callback, error);
}
_network.query('GetNavigations', '', function (data) {
if (data != null && data.length > 0) {
var list = [];
for (var i = 0; i < data.length; i++) {
var icon = $(' <button></button>');
var title = getNavInfoByID(data[i].ID, data[i].Title, icon);
var li = $('<li class="nav_item"></li>').attr({
'id': data[i].ID,
'page': data[i].Url,
'title': title
});
var a = $('<a></a>').attr('href', '#' + data[i].ID);
var src = data[i].IconPath;
if (!src) {
src = 'img/none.png';
}
var img = $('<img style="width: 20px; height: 20px;"/>').attr("src", src);
var divicon = $('<div></div>').append(img);
//var divicon = $('<div></div>').append(icon);
a.append(divicon);
a.append($('<span></span>').text(title));
li.append(a);
list.push(li);
}
$('.ul_menu').append(list);
}
if (data.length > 0) {
default_page = '#' + data[0].ID;
if (!old_hash) {
old_hash = default_page;
}
window.changePage(old_hash);
} else {
// 无权限时跳转至登录页面
window.location.href = '<%=LoginPageUrl%>';
}
}, function (e) {
console.log(e);
});
window.changePage(old_hash);
});
function getNavInfoByID(id, title1, icon) {
var title = title1;
if (id === "nav_jobsiterequirements") {
title = GetTextByKey("P_JS_JOBSITEREQUIREMENTS", title);
//$(icon).addClass("iconmanagealerts");
}
else if (id === "nav_dispatchrequests") {
title = GetTextByKey("P_JS_DISPATCHREQUESTS", title);
//$(icon).addClass("iconworkorder");
}
else if (id === "nav_jobsitemanage") {
title = GetTextByKey("P_JOBSITES", title);
//$(icon).addClass("iconpreventative");
}
else if (id === "nav_scheduler") {
title = GetTextByKey("P_JS_SCHEDULER", title);
//$(icon).addClass("icontimebased");
}
return title;
}
function afterpagechanged(hash, name) {
setFavorateStyle(hash, name);
};
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="holder_content" runat="Server">
<div id="set_left">
<ul class="ul_menu">
<li id="nav_arrow">
<div class="icn collapse"></div>
</li>
<%--<li class="nav_item" id="nav_jobsiterequirements" page="JobSiteRequirements.aspx" title="Jobsite Requirements" data-title-lgid="P_JS_JOBSITEREQUIREMENTS"><a href="#nav_jobsiterequirements">
<div>
<img style="width: 20px; height: 20px;" src="img/jobsiterequirements.png" />
</div>
<span data-lgid="P_JS_JOBSITEREQUIREMENTS">Jobsite Requirements</span></a></li>
<li class="nav_item" id="nav_dispatchrequests" page="DispatchRequests.aspx" title="Dispatch Requests" data-title-lgid="P_JS_DISPATCHREQUESTS"><a href="#nav_dispatchrequests">
<div>
<img style="width: 20px; height: 20px;" src="img/dispatch.png" />
</div>
<span data-lgid="P_JS_DISPATCHREQUESTS">Dispatch Requests</span></a></li>
<li class="nav_item" id="nav_jobsitemanage" page="JobSiteManage.aspx" title="Jobsites" data-title-lgid="P_JOBSITES"><a href="#nav_jobsitemanage">
<div>
<img style="width: 20px; height: 20px;" src="img/jobsite.png" />
</div>
<span data-lgid="P_JOBSITES">Jobsites</span></a></li>
<li class="nav_item" id="nav_scheduler" page="SchedulerManagement.aspx" title="Scheduler" data-title-lgid="P_JS_SCHEDULER"><a href="#nav_scheduler">
<div>
<img style="width: 20px; height: 20px;" src="img/scheduler.png" />
</div>
<span data-lgid="P_JS_SCHEDULER">Scheduler</span></a></li>--%>
</ul>
<div class="hostmask maskbg" style="display: none;"></div>
</div>
<div id="set_right">
<div class="loading_holder">
<div class="loading_icon icn icn-spin"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,51 @@
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class JobSite : JobSitesBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else
{
Title = PageTitle;
if (CheckLoginSession())
{
bool license = SystemParams.HasLicense("JobSites");
if (!license)
RedirectToEntryPage();
}
}
}
//protected override bool AllowCurrentLoginSessionEnter()
//{
// var f = base.AllowCurrentLoginSessionEnter();
// if (!f)
// {
// return false;
// }
// var user = GetCurrentUser();
// return user != null && user.UserType >= IronIntel.Contractor.Users.UserTypes.Common;
//}
//protected override int FeatureID
//{
// get
// {
// return Foresight.Fleet.Services.User.Feature.JOB_SITES;
// }
//}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class JobSiteManage : JobSitesBasePage
{
protected bool CanConfig = false;
protected void Page_Load(object sender, EventArgs e)
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
if (CheckLoginSession())
{
bool license = SystemParams.HasLicense("JobSites");
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES);
if (!license || !permission)
RedirectToEntryPage();
bool autoCreate = SystemParams.HasLicense("AutoCreationConfig");
var user = GetCurrentUser();
if (autoCreate)
{
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin)
{
CanConfig = true;
}
else
{
var client = FleetServiceClientHelper.CreateClient<PermissionProvider>();
Tuple<Feature, Permissions>[] pmss = client.GetUserPermissions(SystemParams.CompanyID, user.IID);
if (pmss.Length > 0)
{
Tuple<Feature, Permissions> autojobsitespms = pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_AUTOCREATE);
if (autojobsitespms != null)
{
CanConfig = true;
}
}
}
}
}
}
}
protected override int FeatureID
{
get
{
return Foresight.Fleet.Services.User.Feature.JOB_SITES;
}
}
public bool IsAdmin
{
get
{
var user = GetCurrentUser();
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
return true;
else
return false;
}
}
}

View File

@ -0,0 +1,111 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="JobSiteMasterPage.master.cs" Inherits="JobSiteMasterPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title></title>
<link type="text/css" href="<%=GetUrl("js/components/css/gridview.css") %>" rel="stylesheet" />
<link type="text/css" href="<%=GetUrl("css/override.css") %>" rel="stylesheet" />
<link rel="stylesheet" href="<%=GetUrl("css/default.css")%>" type="text/css" />
<link rel="stylesheet" href="<%=GetUrl("css/split_sub.css")%>" type="text/css" />
<link rel="stylesheet" href="<%=GetUrl("css/editmultiselect.css")%>" type="text/css" />
<style type="text/css">
:root { <%=StyleVariables%> }
.data-grid {
height: 100%;
font-size: 12px !important;
font-family: "Segoe UI","Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,"Roboto","Helvetica Neue",sans-serif !important;
}
</style>
<script src="<%=GetUrl("js/jquery-3.6.0.min.js")%>" type="text/javascript"></script>
<script src="<%=GetUrl("js/cookie.js")%>" type="text/javascript"></script>
<script src="<%=GetUrl("js/utility.js")%>" type="text/javascript"></script>
<script type="text/javascript" src="<%=GetUrl("js/components/gridview.js") %>"></script>
<script src="<%=GetUrl("js/editmultiselect.js")%>" type="text/javascript"></script>
<script src="<%=GetUrl("js/language.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var GridView = window.GridView || window['g5-gridview'];
var canExport = <%= CanExportFile %>;
_network.root = '<%=Page.ResolveUrl("~/")%>';
var sitePath = "<%=this.ResolveUrl("~/fic/") %>";
//if (typeof _utility !== 'object') {
// _utility = {};
//}
function getText(s, flag) {
return (s == null)
? (flag ? '<i>null</i>' : '')
: htmlencode(s).replace(/ /g, '&nbsp;');
}
function GetLanguageByCookie() {
var lang = getCookie('<%=Common.LanguageCookieName%>');
if (lang == null) {
return "en-us";
} else {
return lang;
}
}
function systemrequest(method, param, callback, error) {
_network.request("SystemSettings/SystemOptions.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_WO_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_WO_QUERY', 'Query'));
});
}
var systemunitofodometer;
function GetSystemUnitOfOdometer() {
systemrequest("GetSystemUnitOfOdometer", "", function (data) {
systemunitofodometer = data;
$('#dialogadd_sel_odometeruom').val(systemunitofodometer);
$('#dialogadjust_sel_odometeruom').val(systemunitofodometer);
}, function (err) {
});
}
$(function () {
_fleet.currentLang = GetLanguageByCookie();
$("#content1").applyFleetLanguageText(true);
GetSystemUnitOfOdometer();
// 加载完毕后通知上级页面
if (typeof window.parent.onsubpageloaded == 'function') {
window.parent.onsubpageloaded();
}
if (typeof window.parent.ondocumentclick == 'function') {
$(document.body).click(window.parent.ondocumentclick);
}
function resizeContent() {
if ($('.content_main').length > 0)
$('.content_main').css('min-height', $(window).height() - $('.content_main').offset().top - 4);
$('#mask_bg').height($(document).outerHeight(false)).width($(document).outerWidth(false));
}
$(window).resize(function () {
resizeContent();
});
resizeContent();
$(document.body).click(function (e) {
if (typeof hidePanels === 'function')
hidePanels();
});
});
</script>
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head>
<body>
<div id="content1">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</body>
</html>

View File

@ -0,0 +1,35 @@
using FI.FIC;
using Foresight.Fleet.Services.Styles;
using IronIntel.Contractor;
using IronIntel.Contractor.iisitebase;
using IronIntel.Contractor.Site;
using IronIntel.Contractor.Users;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class JobSiteMasterPage : CommonBase
{
protected override bool ExportModule
{
get { return true; }
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
GetUIStyle();
}
catch
{
// TODO: errors when get the ui style.
}
}
}
}

View File

@ -0,0 +1,847 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="JobSiteRequirements.aspx.cs" Inherits="JobSiteRequirements" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
<style type="text/css">
.itemselcted {
background-color: #ccc;
}
.itemhidden {
display: none;
}
.itemsuggested {
background-color: #ffff99;
}
#tbMachineTypes tbody tr:hover {
cursor: default;
background: #ddd;
}
#tbodyAssigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodyUnassigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodySelected tr:hover {
cursor: default;
background: #ddd;
}
#contentctrl {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.float_left {
float: left;
}
.function_bar {
float: right;
}
.user_main {
padding: 0 4px;
}
.dialog .dialog-title .dialog-close {
float: right;
margin-right: 6px;
cursor: pointer;
}
.dialog .dialog-title .dialog-close:before {
content: '\e600';
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 170px;
text-align: right;
padding-right: 10px;
line-height: 28px;
height: 24px;
vertical-align: top;
}
#dialog_machines .dialog-content table td input,
#dialog_layouts .dialog-content table td input {
width: auto;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog .dialog-func input {
width: unset;
}
#dialog_user_randompass {
width: auto;
height: 16px;
margin: 3px 4px 0 4px;
}
.icon {
font-family: CalciteWebCoreIcons;
cursor: default;
}
.ybutton {
width: 80px;
line-height: normal;
margin-left: 6px;
border: none;
background: rgb(249, 189, 117);
padding: 5px 14px;
cursor: pointer;
}
.ybutton:hover {
background: #d7690E;
}
.td_controller {
vertical-align: middle;
padding: 40px 8px;
/*border-left: 1px solid #b0b0b0;
border-right: 1px solid #b0b0b0;*/
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.subdialog {
width: -moz-calc(100% - 24px);
width: -webkit-calc(100% - 24px);
width: calc(100% - 24px);
}
.machine_maskbg {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
background: #000;
opacity: 0.2;
}
#machine-name {
margin: 10px 10px 6px;
/*color: gray;*/
font-weight: lighter;
font-size: 18px;
width: 770px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.div_filter .dropdown {
width: 120px;
}
.requireinfo {
line-height: 30px;
margin-left: 10px;
}
.requireinfospan {
font-weight: 500;
margin-left: 20px;
}
.quantity {
padding: 3px 0 3px 10px;
margin-top: 5px;
margin-bottom: 5px;
/*color: gray;*/
font-weight: 500;
font-size: 16px;
/*width: 770px;*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #f0f0f0;
}
.span-caption {
position: absolute;
}
.span-bar {
position: absolute;
height: 100%;
margin: 0;
vertical-align: bottom;
}
</style>
<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/editableselect.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/editmultiselect.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/jobsiterequirement.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/dispatchassign.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/email.js")%>" type="text/javascript"></script>
<script>
jobsitequery = function (method, param, callback, error, nolog) {
_network.request("JobSite/JobSiteRequirements.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
var jobsiteparam;
var regionparam;
var addrequirement = false;
var IsReadOnly = <%=IsReadOnly ?"true":"false"%>;
var IsRequestOnly = <%=IsRequestOnly ?"true":"false"%>;
var allroadassets;
var _sendType = 2;
var _seltype;//0.print;1.email
var _selectdispatchids;
var currentdate = "<%=CurrentDate %>";
/***************************Jobsites***************************/
_dialog.showRequirementConfirm = function (msg, title, fprint, femail, fsave, fcancel, fclose, iniframe, shownote) {
if (!fclose)
fclose = fcancel;
_dialog.showButtonDialog(msg, title, 'question', fclose, [{
value: GetTextByKey("P_JS_PRINTDISPATCHINSTRUCTIONS", 'Print Dispatch Instructions'),
func: fprint
}, {
value: GetTextByKey("P_JS_EMAILDISPATCHINSTRUCTIONS", 'Email Dispatch Instructions'),
func: femail
}, {
value: GetTextByKey("P_JS_CONTINUE", 'Continue'),
func: fsave
}], iniframe, shownote);
};
function showRequirementConfirm(msg, title, fprint, femai, fsave, fclose) {
showmaskbg(true);
_dialog.showRequirementConfirm(msg, title, function (e) {
showmaskbg(false);
if (typeof fprint === 'function') {
fprint(e);
}
}, function (e) {
showmaskbg(false);
if (typeof femai === 'function') {
femai(e);
}
}, function (e) {
showmaskbg(false);
if (typeof fsave === 'function') {
fsave(e);
}
}, function (e) {
showmaskbg(false);
if (typeof fclose === 'function') {
fclose(e);
}
});
}
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 OnDelete(req) {
if (!req) {
return;
}
var text = $('<div style="padding-right:20px;line-height:20px;">' + GetTextByKey("P_JS_DELETETHEREQUIREMENT", "Would you like to delete the requirement?") + '<br/></div');
text.append($('<span></span>').text(GetTextByKey("P_JS_JOBSITE_COLON", "Jobsite:") + " " + req.JobSiteName));
text.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_JS_ASSETTYPE_COLON", "Asset Type:") + " " + req.AssetTypeName));
text.append("<br/>")
text.append($('<span></span>').text(GetTextByKey("P_JS_BEGINDATE_COLON", "Begin Date:") + " " + req.BeginDateStr));
text.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_JS_ENDDATE_COLON", "Begin Date:") + " " + req.EndDateStr));
var alerttile = GetTextByKey("P_JS_DELETEREQUIREMENT", "Delete Requirement");
showConfirm(text, alerttile, function (e, notes) {
var item = {
'Key': req.Id,
'Value': notes
};
var p = htmlencode(JSON.stringify(item));
jobsitequery("DeleteRequirment", p, function (data) {
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_JS_FAILEDTODELETETHISREQUIREMENT", "Failed to delete this requirement."), alerttile);
});
}, null, true);
}
function CloseDialog(msg) {
if (msg) {
var alerttitle = GetTextByKey("P_WO_SENDEMAIL", 'Send Email');
if (msg !== 'OK') {
showAlert(msg, alerttitle);
}
else {
showAlert(GetTextByKey("P_WO_MESSAGESENT", 'Message sent'), alerttitle);
}
}
$('#dialog_requirements').hideDialog();
OnRefresh();
}
function ShowDialog(type) {
showmaskbg(true);
$('#dialog_requirements')
.attr('act', type)
.showDialogRight();
}
function OnAdd() {
execIframeFunc("init", [alljobsites], "iframerequirements");
ShowDialog("add");
}
var requireid;
function OnRefresh(keepmasg) {
showloading(true);
var jobsites = [];
if (jobsiteparam)
jobsites = jobsiteparam.selectedvalue;
var regions = [];
if (regionparam)
regions = regionparam.selectedvalue;
var p = {
"LatestStartDate": $.trim($('#latesdatetxt').val()),
"JobSites": jobsites,
"Regions": regions,
"SearchText": $.trim($('#searchinputtxt').val()),
"UnScheduledOnly": $('#chk_unscheduled').prop('checked')
};
jobsitequery("GetRequirements", htmlencode(JSON.stringify(p)), function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
showRequirementList(data);
if (!keepmasg)
showloading(false);
}, function (err) {
if (!keepmasg)
showloading(false);
});
}
function showRequirementList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "BeginDate")
r[j] = { DisplayValue: r["BeginDateStr"], Value: r[j] };
else if (j === "EndDate")
r[j] = { DisplayValue: r["EndDateStr"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
grid_dt.refresh();
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#jobsitelist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'BeginDate', caption: GetTextByKey("P_JS_BEGINDATE", "Begin Date"), valueIndex: 'BeginDate', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'EndDate', caption: GetTextByKey("P_JS_ENDDATE", "End Date"), valueIndex: 'EndDate', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AssetTypeName', caption: GetTextByKey("P_JS_ASSETTYPE", "Asset Type"), valueIndex: 'AssetTypeName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'Quantity', caption: GetTextByKey("P_JS_QUANTITY", "Quantity"), valueIndex: 'Quantity', css: { 'width': 80, 'text-align': 'right' } },
{ name: 'ScheduledQuantity', caption: GetTextByKey("P_JS_SCHEDULED", "Scheduled"), valueIndex: 'ScheduledQuantity', css: { 'width': 80, 'text-align': 'right' } },
{ name: 'JobSiteName', caption: GetTextByKey("P_JOBSITE", "Jobsite"), valueIndex: 'JobSiteName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'NumberOfDays', caption: GetTextByKey("P_JS_NUMBEROFDAYS", "Number of Days"), valueIndex: 'NumberOfDays', css: { 'width': 120, 'text-align': 'right' } },
{ name: 'Notes', caption: GetTextByKey("P_JS_NOTES", "Notes"), valueIndex: 'Notes', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'PointOfContact', caption: GetTextByKey("P_JS_POINTOFCONTACT", "Point Of Contact"), allowFilter: true, valueIndex: 'PointOfContact', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AddedByName', caption: GetTextByKey("P_JS_CREATOR", "Creator"), valueIndex: 'AddedByName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'FulfilledByName', caption: GetTextByKey("P_JS_FULFILLEDBY", "Fulfilled By"), allowFilter: true, valueIndex: 'FulfilledByName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'ManageAssets', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Delete', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'History', caption: "", alwaysshow: true, css: { 'width': 30, 'text-align': 'center' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = list_columns[hd].visible === false ? false : true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
col.alwaysshow = list_columns[hd].alwaysshow;
if (col.name === "ManageAssets") {
col.sortable = false;
col.isurl = true;
col.text = "\uf63c";
col.events = {
onclick: function () {
onManageAssets(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_JS_MANAGEASSETS", "Manage Assets") };
col.visible = !IsReadOnly && !IsRequestOnly;
}
else if (col.name === "Delete") {
col.sortable = false;
col.isurl = true;
col.text = "\uf00d";
col.events = {
onclick: function () {
OnDelete(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_JS_DELETE", 'Delete') };
col.visible = !IsReadOnly && !IsRequestOnly;
}
if (col.name === "History") {
col.sortable = false;
col.isurl = true;
col.text = "\uf06e";
col.events = {
onclick: function () {
OnViewChangeHistory(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_MR_VIEWCHANGEHIS", 'View Change History') };
col.visible = !IsReadOnly && !IsRequestOnly;
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = function (rowindex) {
if (!IsReadOnly && !IsRequestOnly) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
onManageAssets(rowdata.Values);
}
}
}
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
}
}
}
function searchEnter(e) {
if (e.keyCode == 13) {
OnRefresh();
}
}
var jobsite_editmultiselect;
var region_editmultiselect;
var alljobsites;
function getJobsitesAndRegions() {
showmaskbg(true);
jobsitequery('GetJobsitesAndRegions', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
alljobsites = data.Jobsites;
jobsiteparam = {
allitems: data.Jobsites,
items: JSON.parse(JSON.stringify(data.Jobsites)),
selectedvalue: [],
width: 240
};
jobsite_editmultiselect = editmultiselect(jobsiteparam);
$('#div_jobsites').append(jobsite_editmultiselect);
regionparam = {
items: data.Regions,
selectedvalue: [],
width: 240,
oncompleted: onregioncompleted
};
region_editmultiselect = editmultiselect(regionparam);
$('#div_region').append(region_editmultiselect);
getRequirmentsDefault();
}, function () {
showmaskbg(false);
});
}
function onregioncompleted() {
if (!jobsiteparam || !jobsiteparam.allitems) return;
jobsiteparam.items.length = 0;
for (var i in jobsiteparam.allitems) {
var item = jobsiteparam.allitems[i];
if (!regionparam.selectedvalue
|| regionparam.selectedvalue.length == 0
|| regionparam.selectedvalue.indexOf(item.Tag3) >= 0)
jobsiteparam.items.push(item);
}
jobsite_editmultiselect.reset();
}
var editableSelectAssignAsset;
$(function () {
setPageTitle(GetTextByKey("P_JS_JOBSITEREQUIREMENTS", "Jobsite Requirements"), true);
editableSelectAssignAsset = new $editableselect($("#dialog_assignasset"));
editableSelectAssignAsset.setEnable(false);
InitGridData();
InitAssetGridData();
InitAllAssetGridData();
InitEmailGridData();
getJobsitesAndRegions();
$(window).resize(function () {
$("#jobsitelist").css("height", $(window).height() - $("#jobsitelist").offset().top - 14);
grid_dt && grid_dt.resize();
$("#allmachinelist").css("height", 500);
grid_allassetdt && grid_allassetdt.resize();
}).resize();
$('#searchinputtxt').keydown(searchEnter);
$('#dialog_managemahchine').dialog(function () {
OnRefresh();
showmaskbg(false);
})
$('#dialog_allmahchine').dialog(function () {
$('#dialogmask').hide();
})
$('#dialog_assignment').dialog(function () {
showmaskbg(false);
$('#dialogmask').hide();
});
$('#dialog_sendmail').dialog(function () {
showmaskbg(false);
});
$('#sendmail_othertextaddress').focus(function (e) {
var left = $('#dialog_sendmail').offset().left + $('#dialog_sendmail').width() + 2;
var top = $('#dialog_sendmail').offset().top + $("#dialog_sendmail").height() - $("#div_tooltip").height() - 9;
$('#div_tooltip').css({ 'display': '', 'left': left, 'top': top });
});
$('#latesdatetxt').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]);
}
});
if (!canExport) {
$('#spExport').hide();
}
});
function searchEnter(e) {
if (e.keyCode == 13 || e.keyCode == 9) {
OnRefresh();
}
}
function OnExport() {
var jobsites = [];
if (jobsiteparam)
jobsites = jobsiteparam.selectedvalue;
var regions = [];
if (regionparam)
regions = regionparam.selectedvalue;
var p = {
"LatestStartDate": $.trim($('#latesdatetxt').val()),
"JobSites": jobsites,
"Regions": regions,
"SearchText": $.trim($('#searchinputtxt').val()),
"UnScheduledOnly": $('#chk_unscheduled').prop('checked')
};
var param = JSON.stringify(p);
window.open("../ExportToFile.aspx?type=requirements&param=" + param);
}
function getRequirmentsDefault() {
jobsitequery("GetRequirmentsDefault", '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey('P_JS_ERROR', 'Error'));
return;
}
if (data) {
region_editmultiselect.setValues(data.Regions);
onregioncompleted();
jobsite_editmultiselect.setValues(data.Jobsites);
}
OnRefresh();
}, function (err) {
showmaskbg(false);
});
}
function onSaveDefault() {
var jobsites = [];
if (jobsiteparam)
jobsites = jobsiteparam.selectedvalue;
var regions = [];
if (regionparam)
regions = regionparam.selectedvalue;
var item = {
'JobSites': jobsites,
'Regions': regions
};
var alerttitle = GetTextByKey("P_JS_SAVEDEFAULT", "Save Default");
var param = JSON.stringify(item);
param = htmlencode(param);
jobsitequery("SetRequirmentsDefault", param, function (data) {
if (data !== 'OK') {
showAlert(data, alerttitle);
}
else {
showAlert(GetTextByKey("P_JS_SAVSUCCESSFULLY", 'Saved successfully.'), alerttitle);
}
}, function (err) {
});
}
function OnViewChangeHistory(req) {
if (!req) {
return;
}
window.open("DispatchChangeHistory.aspx?stype=0&id=" + req.Id);
}
function OnViewDeleteHistory() {
window.open("RequirementChangeHistory.aspx");
}
function OnPrint(assignto) {
if (!assignto)
assignto = "";
window.open("../Print.aspx?pt=2&t=" + _sendType + "&assignto=" + encodeURIComponent(assignto) + "&ids=" + JSON.stringify(_selectdispatchids));
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="contentctrl">
<div class="page_title" data-lgid="P_JS_JOBSITEREQUIREMENTS"></div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_JS_LATESTSTARTDATE_COLON"></span>
<input type="text" id="latesdatetxt" autocomplete="off" style="width: 80px; margin-left: 5px;" value="<%=LatestStartDate %>" />
<span data-lgid="P_JS_REGION_COLON">Region:</span>
<div id="div_region"></div>
<span data-lgid="P_JS_JOBSITES_COLON">Jobsites:</span>
<div id="div_jobsites"></div>
<input type="text" id="searchinputtxt" autocomplete="off" style="margin-left: 5px; display: none;" />
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_CM_SEARCH" style="margin-left: 5px;" />
<input id="chk_unscheduled" type="checkbox" checked="checked" onclick="OnRefresh();" />
<label data-lgid="P_JS_UNSCHEDULEDREQUIREMENTSONLY" for="chk_unscheduled">Unscheduled Requirements Only</label>
<span class="sbutton iconsave" onclick="onSaveDefault();" style="margin-left: 20px;padding: 0px 0px 0px 7px;" data-title-lgid="P_JS_SAVEJOBSITEANDREGIONSELECTIONASDEFAULT"></span>
</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 id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>
<span class="sbutton iconview" onclick="OnViewDeleteHistory();" data-lgid="P_JS_VIEWDELETEDRECORDS">View Deleted Records</span>
</div>
<div id="jobsitelist"></div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div class="dialog subdialog" id="dialog_requirements" style="display: none; border-bottom: 0; border-top: 0;">
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
<iframe id="iframerequirements" src="AddRequirements.aspx" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_managemahchine" style="display: none;">
<div class="dialog-title"><span id="spTitle" class="title" data-lgid="P_JS_MANAGEASSETS"></span><em class="dialog-close"></em></div>
<div class="requireinfo">
<span class="requireinfospan" data-lgid="P_JS_JOBSITE_COLON" style="margin-left: 0px;">Jobsite:</span>
<span id="span_jobsite"></span>
<span class="requireinfospan" data-lgid="P_JS_BEGINDATE_COLON">Begin Date:</span>
<span id="span_begindate"></span>
<span class="requireinfospan" data-lgid="P_JS_ENDDATE_COLON">End Date:</span>
<span id="span_enddate"></span>
<span class="requireinfospan" data-lgid="P_JS_ASSETTYPE_COLON">Asset Type:</span>
<span id="span_assettypes"></span>
</div>
<div class="quantity">
<span data-lgid="P_JS_QUANTITY_COLON">Quantity:</span>
<span id="span_quantity"></span>
<span class="sbutton iconadd" onclick="OnMachineAdd()" data-lgid="P_UM_ADD" style="margin-left: 20px; font-weight: lighter;">Add</span>
<span class="sbutton icondelete" onclick="onDeleteDispatch()" data-lgid="P_UM_DELETE" style="font-weight: lighter;">Delete</span>
</div>
<div id="selectedmachinelist" style="height: 500px; width: 100%;"></div>
<div class="dialog-func">
<input type="button" value="Close" data-lgid="P_JS_CLOSE" class="dialog-close" tabindex="28" />
<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_allmahchine" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_MA_SELECTASSET"></span><em class="dialog-close"></em></div>
<div id="allmachinelist" style="height: 500px; width: 100%;"></div>
<div class="dialog-func">
<input type="button" value="Close" data-lgid="P_JS_CANCEL" class="dialog-close" tabindex="28" />
<input type="button" onclick="onAddDispatch();" data-lgid="P_JS_OK" value="OK" tabindex="27" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="dialog_sendmail" style="display: none; width: 320px;">
<div class="dialog-title"><span class="title" data-lgid="P_JS_SENDDISPATCHREQUEST">Send Dispatch Request</span><em class="dialog-close"></em></div>
<div class="dialog-content" style="height: 378px;">
<table>
<tr>
<td colspan="2" data-lgid="P_MV_SENDTHISTO">Who do you want to send this to? Select from existing relationships or manual entry.</td>
</tr>
<tr>
<td colspan="2">
<div id="contactlist" style="height: 168px; width: 440px; margin-left: 10px; margin-right: 10px;"></div>
</td>
</tr>
<tr style="height: 24px;">
<td colspan="2" data-lgid="P_MV_EMAILORTEXTADDRESSESTIPS">Separate multiple manually entered email or text addresses with a semi-colon (;).</td>
</tr>
<tr style="height: 24px;">
<td><span data-lgid="P_MV_OTHEREMAILADDRESS">Other Email Address</span>
</td>
<td>
<input type="text" id="sendmail_otheremailaddress" style="width: 312px;" autocomplete="off" /></td>
</tr>
<tr style="height: 24px; display: none;">
<td><span data-lgid="P_MV_OTHERTEXTADDRESS">Other Text Address</span>
</td>
<td>
<input type="text" id="sendmail_othertextaddress" style="width: 312px;" autocomplete="off" />
</td>
<%--<span id="span_hepler" class='helper pointer' title='Help'></span>--%>
</tr>
<tr style="height: 24px;">
<td colspan="2" data-lgid="P_MV_DESCRIPTION_COLON">Description:</td>
</tr>
<tr>
<td colspan="2">
<textarea id="sendmail_desc" style="width: 444px; height: 80px; resize: none; margin-left: 12px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_MV_CANCEL" class="dialog-close" tabindex="12" />
<input type="button" onclick="onSendEmails();" value="OK" data-lgid="P_MV_OK" tabindex="11" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="dialog_assignment" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_JS_DISPATCHASSIGNMENT">Dispatch Assignment</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; margin-left: 30px;">
<tr>
<td data-lgid="P_JS_SELECTASSETFORDISPATCH">Select Asset for Dispatch</td>
</tr>
<tr>
<td>
<div id="dialog_assignasset" style="width: 320px; height: 22px;"></div>
</td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" onclick="onAssignContinue();" value="Continue" data-lgid="P_JS_CONTINUE" tabindex="12" />
<input type="button" onclick="onAssignSkip();" value="Skip" data-lgid="P_JS_SKIP" tabindex="11" />
<div class="clear"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,56 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class JobSiteRequirements : JobSiteRequirementsBasePage
{
public string CurrentDate = "";
protected bool CanConfig = false;
protected string LatestStartDate = "";
protected bool IsReadOnly = false;
protected bool IsRequestOnly = false;
protected void Page_Load(object sender, EventArgs e)
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
if (CheckLoginSession())
{
bool license = SystemParams.HasLicense("JobSites");
bool license1 = SystemParams.HasLicense("JobsiteDispatch");
if (!license || !license1)
RedirectToEntryPage();
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES_REQUIREMENTS);
if (!permission)
RedirectToLoginPage();
IsReadOnly = CheckReadonly(SystemParams.CompanyID, Feature.JOB_SITES_REQUIREMENTS);
IsRequestOnly = CheckRequestonly(SystemParams.CompanyID);
}
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
LatestStartDate = userlocaldate.ToShortDateString();
CurrentDate = userlocaldate.ToShortDateString();
}
protected override int FeatureID
{
get
{
return Foresight.Fleet.Services.User.Feature.JOB_SITES_REQUIREMENTS;
}
}
}

View File

@ -0,0 +1,580 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="JobsiteAutoCreateConfig.aspx.cs" Inherits="JobsiteAutoCreateConfig" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.edit-content table {
border-collapse: collapse;
width: 100%;
}
.edit-content table td.label {
/*width: 200px;*/
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: top;
}
.edit-content table td input,
.edit-content table td textarea {
border: 1px solid #a9a9a9;
width: 320px;
height: 18px;
padding: 1px;
}
.edit-content table td input[type="checkbox"] {
border: none;
}
.edit-content table td input[type="radio"] {
border: none;
width: unset;
height: unset;
}
.edit-content table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.dialog, .data-column-header-filter-bg, .data-column-header-filter-panel {
z-index: 2;
}
</style>
<script src="<%=GetFileUrlWithVersion("../js/assetselector.js")%>" type="text/javascript"></script>
<script type="text/javascript">
_network.jobsitequery = function (method, param, callback, error, nolog) {
_network.request("JobSite/JobSiteManage.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
var dialogAUAssets;
$(function () {
InitGridSelectedMachines();
InitGridAvailableAssetTypes();
InitGridSelectedAssetTypes();
dialogAUAssets = new $assetselector('dialog_machines');
dialogAUAssets.onDialogClosed = function () {
showmaskbg(false);
};
dialogAUAssets.onOK = function (source) {
var items = [];
var itemids = [];
for (var i = 0; i < source.length; i++) {
var it = source[i].Values;
if (it.Selected) {
items.push({
Values: {
AssetId: it.Id,
VIN: it.VIN,
Name: it.Name,
MakeName: it.MakeName,
ModelName: it.ModelName,
TypeName: it.TypeName
}
});
itemids.push(it.Id);
}
}
grid_dtassets.setData(grid_dtassets.innerSource.concat(items));
doSave(0, itemids);
$('#mask_bg').hide();
};
$('#dialog_assettype').prop('iframe', true).dialog(function () {
showmaskbg(false);
});
$("#txt_assettype_key").keypress(onJobsiteKeyPress);
//function resizeContent() {
// $('#divcontent').css('height', $(window).height() - $('#divcontent').offset().top - 4);
// //$("#selectedmachinelist").css("height", $(window).height() - $("#selectedmachinelist").offset().top - 4);
// //grid_dtag && grid_dtag.resize();
// //$("#selectedassettypelist").css("height", $(window).height() - $("#selectedassettypelist").offset().top - 4);
// //grid_dtsg && grid_dtsg.resize();
//}
//window.onresize = resizeContent;
//resizeContent();
getConfigData();
});
var _selectedMachines = [];
var allAssetTypes = null;
var _selectedAssetTypes = [];
function getConfigData() {
_selectedMachines = [];
_selectedAssetTypes = [];
grid_dtassets.setData([]);
grid_dtat.setData([]);
GetJobsiteAutoCreateItems();
}
function init() {
getConfigData();
}
//**************************************Asset(s)****************************************************//
var grid_dtassets;
function InitGridSelectedMachines() {
grid_dtassets = new GridView('#selectedmachinelist');
grid_dtassets.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'VIN', caption: GetTextByKey("P_UM_SN", "SN"), valueIndex: 'VIN', css: { 'width': 160, 'text-align': 'left' } },
{ name: 'Name', caption: GetTextByKey("P_UM_NAME", "Name"), valueIndex: 'Name', css: { 'width': 160, 'text-align': 'left' } },
{ name: 'MakeName', caption: GetTextByKey("P_UM_MAKE", "Make"), valueIndex: 'MakeName', css: { 'width': 90, 'text-align': 'left' } },
{ name: 'ModelName', caption: GetTextByKey("P_UM_MODEL", "Model"), valueIndex: 'ModelName', css: { 'width': 90, 'text-align': 'left' } },
{ name: 'TypeName', caption: GetTextByKey("P_UM_ASSETSTYPE", "Type"), valueIndex: 'TypeName', css: { 'width': 170, 'text-align': 'left' } }
];
var columns = [
{
// checkbox
name: 'check',
key: 'selected',
width: 30,
align: 'center',
sortable: false,
allcheck: true,
type: 3
}
];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.allowFilter = col.name === 'TypeName';
col.styleFilter = function (item) {
if (item.Highlight)
return { 'background-color': 'yellow' };
}
columns.push(col);
}
grid_dtassets.canMultiSelect = true;
grid_dtassets.columns = columns;
grid_dtassets.init();
}
function showSelectedMachine(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dtassets.setData(rows);
}
// 获取已选中的Assets和Asset Types
function GetJobsiteAutoCreateItems() {
$("#dialogmask").show();
showloading(true);
_network.jobsitequery('GetJobsiteAutoCreateItems', '', function (data) {
showloading(false);
if (typeof data === "string") {
showAlert(data, GetTextByKey("P_JS_CONFIGURATION", "Configuration"));
return;
}
_selectedMachines = [];
_selectedAssetTypes = [];
for (var i in data) {
var item = data[i];
if (item.Criteria == 0)
_selectedMachines.push(item);
else
_selectedAssetTypes.push(item);
}
showSelectedMachine(_selectedMachines);
showSelectedAssetType(_selectedAssetTypes);
$("#dialogmask").hide();
}, function (e) {
showmaskbg(true);
$("#dialogmask").hide();
});
}
function OnAssetAdd() {
showmaskbg(true);
dialogAUAssets.exceptSource = grid_dtassets.innerSource.map(function (s) {
return s.Values.AssetId;
});
dialogAUAssets.showSelector();
$('#mask_bg').css('height', '100%');
}
function OnMachineDelete() {
showConfirm(GetTextByKey("P_JS_AREYOUSUREYOUWANTTODELETETHESESELECTEDASSETS", 'Are you sure you want to delete these selected asset(s)?'), GetTextByKey("P_JS_CONFIGURATION", "Configuration"), function () {
deleteitems = [];
for (var i = grid_dtassets.innerSource.length - 1; i >= 0; i--) {
var s = grid_dtassets.innerSource[i].Values;
if (s.selected) {
grid_dtassets.innerSource.splice(i, 1);
deleteitems.push(s.AssetId);
}
}
if (grid_dtassets.source != null) {
for (var j = grid_dtassets.source.length - 1; j >= 0; j--) {
var l = grid_dtassets.source[j].Values;
if (l.selected) {
grid_dtassets.source.splice(j, 1);
}
}
}
grid_dtassets.reset();
if (deleteitems.length > 0)
doDelete(0, deleteitems);
});
}
//**************************************Asset Type(s)****************************************************//
var grid_dtat;
function InitGridSelectedAssetTypes() {
grid_dtat = new GridView('#selectedassettypelist');
grid_dtat.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_UM_NAME", "Name"), valueIndex: 'Name', css: { 'width': 380, 'text-align': 'left' } }
];
var columns = [
{
// checkbox
name: 'check',
key: 'selected',
width: 30,
align: 'center',
sortable: false,
allcheck: true,
type: 3
}
];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
}
grid_dtat.canMultiSelect = true;
grid_dtat.columns = columns;
grid_dtat.init();
}
function showSelectedAssetType(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dtat.setData(rows);
}
var grid_dtnjs;
function InitGridAvailableAssetTypes() {
grid_dtnjs = new GridView('#availableassettypelist');
grid_dtnjs.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_UM_NAME", "Name"), valueIndex: 'Name', css: { 'width': 380, 'text-align': 'left' } }
];
var columns = [
{
// checkbox
name: 'check',
key: 'selected',
width: 30,
align: 'center',
sortable: false,
allcheck: true,
type: 3
}
];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
}
grid_dtnjs.canMultiSelect = true;
grid_dtnjs.columns = columns;
grid_dtnjs.init();
grid_dtnjs.rowdblclick = function (rowindex) {
var rowdata = grid_dtnjs.source[rowindex];
if (rowdata) {
var AssetType = rowdata.Values;
}
};
grid_dtnjs.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtnjs.source[rowindex];
if (rowdata) {
}
}
}
function showAvailableAssetType(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dtnjs.setData(rows);
}
function onJobsiteKeyPress(e) {
if (e.keyCode === 13) {
GetAssetTypeList();
}
};
function GetAssetTypeList() {
if (allAssetTypes)
filterAvailableAssetTypes();
else {
$("#assettypedialogmask").show();
_network.jobsitequery('GetMachineTypes', '', function (data) {
if (typeof data === "string") {
showAlert(data, GetTextByKey("P_JS_CONFIGURATION", 'Configuration'));
return;
}
allAssetTypes = data;
filterAvailableAssetTypes();
$("#assettypedialogmask").hide();
}, function (e) {
$("#assettypedialogmask").hide();
});
}
}
function filterAvailableAssetTypes() {
var selected = [];
for (var i = 0; i < _selectedAssetTypes.length; i++) {
var m = _selectedAssetTypes[i];
selected.push(m.AssetId || m.ID);
}
var filter = $('#txt_assettype_key').val().toLowerCase();
var _availableAssetTypes = [];
if (allAssetTypes) {
for (var i = 0; i < allAssetTypes.length; i++) {
var m = allAssetTypes[i];
if ((filter == "" || m.Name.toLowerCase().indexOf(filter) >= 0)
&& $.inArray(m.ID, selected) < 0) {
m.selected = false;
_availableAssetTypes.push(m);
}
}
}
showAvailableAssetType(_availableAssetTypes);
}
function OnAssetTypeAdd() {
$('#txt_assettype_key').val('');
$('#dialog_assettype .dialog-title span.title').text(GetTextByKey("P_JS_SELECTASSETTYPES", 'Select Asset Types'));
$('#mask_bg').show();
$('#dialog_assettype')
.attr('act', 'edit')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_assettype').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_assettype').width()) / 2
})
.showDialogfixed();
GetAssetTypeList();
}
function OnSelectAssetTypes() {
var itemids = [];
for (var i = 0; i < grid_dtnjs.source.length; i++) {
var m = grid_dtnjs.source[i].Values;
if (m.selected) {
m.selected = false;
_selectedAssetTypes.push(m);
itemids.push(m.ID);
}
}
showSelectedAssetType(_selectedAssetTypes);
doSave(1, itemids);
$('#dialog_assettype').hideDialog();
//$('#mask_bg').hide();
}
function OnAssetTypeDelete() {
showConfirm(GetTextByKey("P_JS_AREYOUSUREYOUWANTTODELETETHESESELECTEDASSETTYPES", 'Are you sure you want to delete these selected asset type(s)?'), GetTextByKey("P_JS_CONFIGURATION", 'Configuration'), function () {
_selectedAssetTypes = [];
var deleteitems = [];
if (grid_dtat.source != null) {
for (var j = grid_dtat.source.length - 1; j >= 0; j--) {
var l = grid_dtat.source[j].Values;
if (l.selected) {
grid_dtat.source.splice(j, 1);
deleteitems.push(l.AssetId || l.ID);
}
else {
_selectedAssetTypes.push(l);
}
}
}
grid_dtat.reset();
if (deleteitems.length > 0)
doDelete(1, deleteitems);
});
}
function doDelete(criteria, items) {
var alerttitle = GetTextByKey("P_JS_CONFIGURATION", "Configuration");
items = JSON.stringify(items);
var param = JSON.stringify([criteria, items]);
param = htmlencode(param);
_network.jobsitequery("DeleteJobsiteAutoCreateItems", param, function (data) {
if (data !== "OK") {
showAlert(data, alerttitle);
} else {
if (criteria == 0)
showAlert(GetTextByKey("P_JS_DELETEDASSETSSUCCESSFULLY", "Deleted asset(s) successfully."), alerttitle);
else
showAlert(GetTextByKey("P_JS_DELETEDASSETTYPESSUCCESSFULLY", "Deleted asset type(s) successfully."), alerttitle);
}
}, function (err) {
});
}
function doSave(criteria, items) {
var alerttitle = GetTextByKey("P_JS_CONFIGURATION", "Configuration");
items = JSON.stringify(items);
var param = JSON.stringify([criteria, items]);
param = htmlencode(param);
showloading(true);
_network.jobsitequery("SaveJobsiteAutoCreateItems", param, function (data) {
showloading(false);
if (data !== "OK") {
showAlert(data, alerttitle);
} else {
if (criteria == 0)
showAlert(GetTextByKey("P_JS_ADDEDASSETSSUCCESSFULLY", "Added asset(s) successfully."), alerttitle);
else
showAlert(GetTextByKey("P_JS_ADDEDASSETTYPESSUCCESSFULLY", "Added asset type(s) successfully."), alerttitle);
}
}, function (err) {
showloading(false);
});
}
function OnExit() {
window.parent.CloseACConfigDialog();
}
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="mask_bg" style="display: none; z-index: 1">
<div class="loading c-spin"></div>
</div>
<div>
<div id="dialogmask" class="maskbg" style="display: none; z-index: 1;">
<div class="loading_icon icon c-spin"></div>
</div>
<div class="function_title">
<span class="sbutton iconexit" onclick="OnExit();" data-lgid="P_JS_EXIT">Exit</span>
</div>
<div class="clear"></div>
<div class="content_main" id="divcontent" style="overflow: auto;">
<div class="edit-content">
<div style="font-size: 14px; padding: 10px;">
<span data-lgid="P_JS_AUTOCREATEJOBSITETIPS">Auto-Create Jobsites Based Upon the Behavior of the Following Assets and Asset Types</span>
</div>
<div id="div_container">
<div style="display: inline-block;">
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_ASSETASS">Asset(s)</span>
<span class="sbutton iconadd" onclick="OnAssetAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnMachineDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedmachinelist" style="height: 200px; width: 760px;"></div>
</div>
<div>
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_JS_ASSETTYPES">Asset Type(s)</span>
<span class="sbutton iconadd" onclick="OnAssetTypeAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnAssetTypeDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedassettypelist" style="height: 200px; width: 760px;"></div>
</div>
<div class="mask_loading dialog" style="display: none;"></div>
</div>
</div>
</div>
</div>
<div class="dialog" id="dialog_assettype" style="display: none; width: 650px;">
<div class="dialog-title"><span class="title" data-lgid="P_JS_SELECTASSETTYPES">Select Asset Types</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div style="position: relative; width: 470px; margin-top: 4px; float: left">
<input type="text" placeholder="Search" id="txt_assettype_key" autocomplete="off" style="width: 100%; padding-right: 28px; height: 25px; line-height: 25px; box-sizing: border-box; text-indent: 4px;" />
<div style="position: absolute; top: 0px; right: 0px; height: 25px; width: 28px; text-align: center; line-height: 25px; font-size: 1.2em; font-family: FontAwesome; font-weight: 900; color: rgb(123, 28, 33); cursor: pointer;" onclick="GetAssetTypeList()">&#xf002;</div>
</div>
<div style="clear: both;"></div>
<div id="availableassettypelist" style="height: 400px; width: 630px; margin: 10px 0 4px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSelectAssetTypes();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
<div class="clear"></div>
</div>
<div class="maskbg" style="display: none;"></div>
</div>
</asp:Content>

View File

@ -0,0 +1,31 @@
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class JobsiteAutoCreateConfig : JobSitesBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!CheckLoginSession())
{
RedirectToLoginPage();
}
else
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else if (!IsPostBack)
{
this.Title = PageTitle;
}
}
}
}

View File

@ -0,0 +1,891 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="JobsiteLimitManagement.aspx.cs" Inherits="JobsiteLimitManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="holder_head" runat="Server">
<style type="text/css">
.selectinput {
width: 150px;
margin-right: 10px;
}
.no_wrap th {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.max160 {
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
line-height: 32px;
}
.dialog-content table td.label {
width: 124px;
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: 250px;
height: 18px;
padding: 1px;
}
.dialog-content table td select {
width: 254px;
height: 24px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 100px;
max-width: 200px;
}
#dialog_user_randompass {
width: auto;
height: 16px;
margin: 3px 4px 0 4px;
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}
.group_table .main_table thead tr {
display: block;
}
.group_table .main_table tbody {
height: 280px;
display: block;
overflow-y: auto;
}
.group_table .main_table th {
width: 165px;
}
.group_table .main_table td {
width: 165px;
white-space: nowrap;
word-break: keep-all;
}
.group_table .main_table td div {
width: 165px;
overflow: hidden;
white-space: nowrap;
word-break: keep-all;
text-overflow: ellipsis;
}
.table_holder {
border-collapse: collapse;
height: 400px;
}
.table_holder thead th {
text-align: left;
}
.table_holder tbody tr {
line-height: 28px;
height: 28px;
}
.table_holder td {
vertical-align: top;
}
.table_holder .td_controller {
vertical-align: middle;
padding: 40px 8px;
}
.table_holder .scroller {
height: 400px;
overflow-y: auto;
width: 410px;
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.machine_filter {
height: 32px;
line-height: 32px;
}
.machine_filter select {
height: 23px;
min-width: 100px;
max-width: 300px;
}
.machine_filter span {
margin-left: 8px;
}
.ybutton {
width: auto;
line-height: normal;
margin-left: 6px;
border: none;
background: rgb(249, 189, 117);
padding: 5px 14px;
cursor: pointer;
}
.ybutton:hover {
background: #d7690E;
}
.machines {
/*table-layout: fixed;*/
word-break: keep-all;
}
.machines td {
padding-right: 5px;
white-space: nowrap;
}
.middlechk {
width: auto;
height: 13px;
margin-top: 0px;
margin-bottom: 1px;
vertical-align: middle;
}
</style>
<script>
var IsDealer = <%=IsDealer ?"true":"false"%>;
var IsAdmin =<%=IsAdmin ?"true":"false"%>;
jobsitelimitquery = function (method, param, callback, error, nolog) {
_network.request("JobSite/JobsiteLimitManagement.aspx", -1, method, param, callback, error || function (e) {
showAlert(GetTextByKey("P_M3_FAILEDTOLOADDATA", 'Failed to load data: {0}').replace('{0}', e.statusText), GetTextByKey("P_M3_SCHEDULEASSETS", 'Schedule Assets'));
});
}
function getText(s, flag) {
return (s == null)
? (flag ? '<i>null</i>' : '')
: htmlencode(s, $('#span_text_holder')).replace(/ /g, '&nbsp;');
}
function trim_str(s) {
if (s == null)
return "";
else
return s.replace(/(^\s*)|(\s*$)/g, "");
}
/***************************jobsite limit***************************/
function OnDelete(jl) {
if (!jl) {
return;
}
var contractorid = htmlencode($.trim($('#sel_contractor').val()));
showConfirm(GetTextByKey("P_M3_DOYOUWANTTODELETETHEJOBSITELIMIT", 'Do you want to delete the Jobsite limit?'), GetTextByKey("P_M3_DELETEJOBSITELIMITCONFIGURATION", 'Delete jobsite limit configuration'), function () {
jobsitelimitquery("DeleteJobsiteLimit", contractorid + String.fromCharCode(170) + jl.ID, function (data) {
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_M3_FAILEDTODELETETHISJOBSITELIMIT", 'Failed to delete this jobsite limit.'), GetTextByKey("P_M3_DELETEJOBSITELIMITCONFIGURATION", 'Delete jobsite limit configuration'));
});
});
}
function ShowDialog(type) {
$('#mask_bg').show();
$('#dialog_jobsitelimit')
.attr('act', type)
.showDialogRight1(450);
}
//执行iframe中函数
var doIFrameFunc = function (v_mymethod, v_params, v_frmName) {
if (document.getElementById(v_frmName)) {
var fn = document.getElementById(v_frmName).contentWindow[v_mymethod];
if (fn) {
if (v_params == null)
return fn();
else {
return fn.apply(this, v_params);
}
}
return null;
}
}
function CloseDialog(type) {
$('#dialog_jobsitelimit').hideDialog();
OnRefresh();
}
function OnAdd() {
var contractorid = htmlencode($.trim($('#sel_contractor').val()));
doIFrameFunc("init", [contractorid], "iframejobsitelimit");
ShowDialog("add");
}
var jlid;
function OnEdit() {
var jl = grid_dt.source[grid_dt.selectedIndex].Values;
if (!jl) {
jlid = undefined;
return;
}
jlid = jl.ID;
var contractorid = htmlencode($.trim($('#sel_contractor').val()));
doIFrameFunc("init", [contractorid, jl], "iframejobsitelimit");
ShowDialog("edit");
}
function OnDblClick(e) {
OnEdit();
}
function OnRefresh() {
showloading(true);
var contractorid = htmlencode($.trim($('#sel_contractor').val()));
var searchtxt = "";
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
jobsitelimitquery("GetJobsiteLimits", contractorid + String.fromCharCode(170) + searchtxt, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_M3_ERROR", 'Error'));
return;
}
showJobsiteLimitList(data);
}, function (err) {
showloading(false);
});
}
//admin用户 获取所有contractor
function getContractors() {
devicerequest('GetContractors', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_M3_ERROR", 'Error'));
return;
}
if (data && data.length > 0) {
var sel_search = $('#sel_contractor').empty();
for (var i = 0; i < data.length; i++) {
var kv = data[i];
var op_search = $('<option></option>').val(kv.Key).text(kv.Value);
sel_search.append(op_search);
}
}
OnRefresh();
});
}
//普通用户 获取可操作的contractor
function GetContractorsByUser() {
devicerequest('GetContractorsByUser', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_M3_ERROR", 'Error'));
return;
}
if (data && data.length > 0) {
var sel_search = $('#sel_contractor').empty();
for (var i = 0; i < data.length; i++) {
var kv = data[i];
var op_search = $('<option></option>').val(kv.Key).text(kv.Value);
sel_search.append(op_search);
}
}
OnRefresh();
});
}
function showJobsiteLimitList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "Active") {
r[j] = { DisplayValue: r.Active ? "Yes" : "No", Value: r[j] };
}
}
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#jobsitelimitlist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'ID', caption: GetTextByKey("P_M3_ID", "ID"), valueIndex: 'ID', css: { 'width': 40, 'text-align': 'left' } },
{ name: 'JobSiteName', caption: GetTextByKey("P_M3_JOBSITENAME", "Jobsite Name"), valueIndex: 'JobSiteName', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Active', caption: GetTextByKey("P_M3_ACTIVE", "Active"), valueIndex: 'Active', allowFilter: true, css: { 'width': 70, 'text-align': 'left' } },
{ name: 'StartTime', caption: GetTextByKey("P_M3_STARTTIME", "Start Time"), valueIndex: 'StartTime', css: { 'width': 70, 'text-align': 'left' } },
{ name: 'EndTime', caption: GetTextByKey("P_M3_ENDTIME", "End Time"), valueIndex: 'EndTime', css: { 'width': 70, 'text-align': 'left' } },
{ name: 'MinTrucks', caption: GetTextByKey("P_M3_ACCEPTABLEMINIMUMTRUCKS", "Acceptable Minimum Trucks"), valueIndex: 'MinTrucks', css: { 'width': 170, 'text-align': 'left' } },
{ name: 'MaxTrucks', caption: GetTextByKey("P_M3_ACCEPTABLEMAXIMUMTRUCKS", "Acceptable Maximum Trucks"), valueIndex: 'MaxTrucks', css: { 'width': 170, 'text-align': 'left' } },
{ name: 'AssetTypeNames', caption: GetTextByKey("P_M3_ACCEPTABLEASSETTYPES", "Acceptable Asset Types"), valueIndex: 'AssetTypeNames', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_M3_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Subscribe', caption: "", css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.allowFilter = list_columns[hd].allowFilter;
col.key = list_columns[hd].valueIndex;
if (col.name === "Active") {
col.filterSource = [{ Value: true, DisplayValue: 'Yes' }, { Value: false, DisplayValue: 'No' }];
}
else if (col.name === "Edit") {
col.isurl = true;
col.text = "\uf044";
col.events = {
onclick: function () {
OnEdit()
}
};
col.classFilter = function (e) {
return "icon-col";
}
col.attrs = { 'title': GetTextByKey("P_M3_EDIT", 'Edit') };
}
else if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.events = {
onclick: function () {
OnDelete(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_M3_DELETE", 'Delete') };
}
else if (col.name === "Subscribe") {
col.isurl = true;
col.text = "\uf0e0";
col.events = {
onclick: function () {
OnSubscribe(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_M3_SUBSCRIBECONTACTS", 'Subscribe Contacts') };
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = OnEdit;
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
curfewid = rowdata.Values.CurfewID;
}
}
}
$(function () {
setPageTitle(GetTextByKey("P_OVERUNDERTRUCKINGALERTSCONFIGURATION", "Over/Under Trucking Alerts Configuration"), true);
setFavoriteDisplay(true, 550);
InitGridData();
InitGridAvailableContacts();
InitGridSelectedContacts();
if (IsDealer == true) {
$('#span_contractor').css('display', '');
if (IsAdmin)
getContractors();
else {
GetContractorsByUser();
}
}
else
OnRefresh();
$("#sel_contractor").change(function () {
OnRefresh();
});
$('#dialog_subscribecontacts').dialog(function () {
$('#mask_bg').hide();
});
$('#btnsubscribefilter').click(getMatchAvailableContacts);
$('#chk_showallassignedcontacts').click(getMatchSelectedContacts);
$('#searchinputtxt').keydown(searchEnter);
$(window).resize(function () {
$("#jobsitelimitlist").css("height", $(window).height() - $("#jobsitelimitlist").offset().top - 4);
grid_dt && grid_dt.resize();
}).resize();
});
function searchEnter(e) {
if (e.keyCode == 13 || e.keyCode == 9) {
OnRefresh();
}
}
/************************** Subscribe Contacts********************************/
/*************************************************************************/
var allContacts;
var _availableContacts = [];
var _selectedContacts = [];
var _showSelectedContacts = [];
function OnSubscribe(jl) {
if (!jl) return;
$('#chk_showallassignedcontacts').prop('checked', false);
$('#txt_contact_key').val('');
jlid = jl.ID;
var title = GetTextByKey("P_M3_SUBSCRIBECONTACTS", "Subscribe Contacts");
$('#dialog_subscribecontacts .dialog-title span.title').html(title);
$('#mask_bg').show();
$('#dialog_subscribecontacts')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_subscribecontacts').height()) / 5,
'left': (document.documentElement.clientWidth - $('#dialog_subscribecontacts').width()) / 2
}).showDialog();
GetSelectedContacts();
}
// 获取已选中的Contacts
function GetSelectedContacts() {
_selectedContacts = [];
$("#subscribedialogmask").show();
jobsitelimitquery('GetSelectedContacts', jlid, function (data) {
if (typeof data === "string") {
showAlert(data, GetTextByKey("P_M3_SUBSCRIBECONTACTS", "Subscribe Contacts"));
return;
}
_selectedContacts = data;
queryContacts();
}, function (e) {
$("#subscribedialogmask").hide();
});
}
function queryContacts() {
$('#btnsubscribefilter').prop('disabled', true);
setTimeout(function () {
$('#btnsubscribefilter').prop('disabled', false);
}, 1000);
_availableContacts = [];
$("#subscribedialogmask").show();
jobsitelimitquery('GetContactList', '', function (data) {
if (typeof data === "string") {
showAlert(data, GetTextByKey("P_M3_SUBSCRIBECONTACTS", "Subscribe Contacts"));
return;
}
allContacts = data;
getMatchAvailableContacts();
$("#subscribedialogmask").hide();
}, function (e) {
$("#subscribedialogmask").hide();
});
}
function getMatchAvailableContacts() {
getMatchSelectedContacts();
var selected = [];
for (var i = 0; i < _showSelectedContacts.length; i++) {
var c = _showSelectedContacts[i];
selected.push(c.IID);
}
var filter = $('#txt_contact_key').val().toLowerCase();
_availableContacts = [];
for (var i = 0; i < allContacts.length; i++) {
var c = allContacts[i];
if ((filter == "" || c.DisplayName.toLowerCase().indexOf(filter) >= 0)
&& $.inArray(c.IID, selected) < 0) {
_availableContacts.push(c);
}
}
showAvailableContact(_availableContacts);
}
function getMatchSelectedContacts() {
var filter = $('#txt_contact_key').val().toLowerCase();
var showallassigned = $('#chk_showallassignedcontacts').prop('checked');
_showSelectedContacts = [];
var unMatched = [];
for (var i = 0; i < _selectedContacts.length; i++) {
var c = _selectedContacts[i];
c.Highlight = false;
if (filter == "" || c.DisplayName.toLowerCase().indexOf(filter) >= 0) {
matched = true;
c.Highlight = showallassigned && filter !== "";
_showSelectedContacts.push(c);
}
else if (showallassigned)
unMatched.push(c);
}
for (var i in unMatched)
_showSelectedContacts.push(unMatched[i]);
showSelectedContact(_showSelectedContacts);
}
function showContacts() {
showAvailableContact(_availableContacts);
showSelectedContact(_showSelectedContacts);
}
function showAvailableContact(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dtac.setData(rows);
}
function showSelectedContact(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dtsc.setData(rows);
}
var grid_dtac;
function InitGridAvailableContacts() {
grid_dtac = new GridView('#availablecontacts');
grid_dtac.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'DisplayName', caption: GetTextByKey("P_M3_CONTACTNAME", "Contact Name"), valueIndex: 'DisplayName', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'ContactTypeName', caption: GetTextByKey("P_M3_CONTACTTYPE", "Contact Type"), valueIndex: 'ContactTypeName', css: { 'width': 150, 'text-align': 'left' } },
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
}
grid_dtac.canMultiSelect = true;
grid_dtac.columns = columns;
grid_dtac.init();
grid_dtac.rowdblclick = function (rowindex) {
var rowdata = grid_dtac.source[rowindex];
if (rowdata) {
var contact = rowdata.Values;
_availableContacts.splice(_availableContacts.indexOf(contact), 1);
_selectedContacts.push(contact);
_showSelectedContacts.push(contact);
showContacts();
}
};
grid_dtac.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtac.source[rowindex];
if (rowdata) {
}
}
}
var grid_dtsc;
function InitGridSelectedContacts() {
grid_dtsc = new GridView('#selectedcontacts');
grid_dtsc.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'DisplayName', caption: GetTextByKey("P_M3_CONTACTNAME", "Contact Name"), valueIndex: 'DisplayName', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'ContactTypeName', caption: GetTextByKey("P_M3_CONTACTTYPE", "Contact Type"), valueIndex: 'ContactTypeName', css: { 'width': 150, 'text-align': 'left' } },
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.styleFilter = function (item) {
if (item.Highlight)
return { 'background-color': 'yellow' };
}
columns.push(col);
}
grid_dtsc.canMultiSelect = true;
grid_dtsc.columns = columns;
grid_dtsc.init();
grid_dtsc.rowdblclick = function (rowindex) {
var rowdata = grid_dtsc.source[rowindex];
if (rowdata) {
var contact = rowdata.Values;
_selectedContacts.splice(_selectedContacts.indexOf(contact), 1);
_showSelectedContacts.splice(_showSelectedContacts.indexOf(contact), 1);
_availableContacts.push(contact);
showContacts();
}
};
grid_dtsc.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtsc.source[rowindex];
if (rowdata) {
}
}
}
function OnContactEditorAdd() {
var indexs = grid_dtac.selectedIndexes;
if (indexs.length <= 0)
return;
for (var i = 0; i < indexs.length; i++) {
var index = indexs[i];
var c = grid_dtac.source[index].Values;
_availableContacts.splice(_availableContacts.indexOf(c), 1);
_selectedContacts.push(c);
_showSelectedContacts.push(c);
}
showContacts();
}
function OnContactEditorAddAll() {
for (var i = 0; i < _availableContacts.length; i++) {
var c = _availableContacts[i];
_selectedContacts.push(c);
_showSelectedContacts.push(c);
}
_availableContacts = [];
showContacts();
}
function OnContactEditorRemove() {
var indexs = grid_dtsc.selectedIndexes;
if (indexs.length <= 0)
return;
for (var i = 0; i < indexs.length; i++) {
var index = indexs[i];
var c = grid_dtsc.source[index].Values;
_selectedContacts.splice(_selectedContacts.indexOf(c), 1);
_showSelectedContacts.splice(_showSelectedContacts.indexOf(c), 1);
_availableContacts.push(c);
}
showContacts();
}
function OnContactEditorRemoveAll() {
for (var i = 0; i < _showSelectedContacts.length; i++) {
var c = _showSelectedContacts[i];
_selectedContacts.splice(_selectedContacts.indexOf(c), 1);
_availableContacts.push(c);
}
_showSelectedContacts = [];
showContacts();
}
function OnSaveSubscribeContacts() {
var uids = [];
for (var i = 0; i < _selectedContacts.length; i++) {
var j = _selectedContacts[i];
uids.push(j.IID);
}
showloading(true);
jobsitelimitquery("SaveSubscribeContacts", jlid + String.fromCharCode(170) + JSON.stringify(uids), function (data) {
showloading(false);
if (data !== 'OK') {
showAlert(data, GetTextByKey("P_M3_SUBSCRIBECONTACTS", "Subscribe Contacts"));
} else {
$('#dialog_subscribecontacts').hideDialog();
OnRefresh();
}
}, function (err) {
console.log(err);
showloading(false);
showAlert(GetTextByKey("P_M3_FAILEDTOSAVESUBSCRIBECONTACTS", 'Failed to save subscribe contacts.'), GetTextByKey("P_M3_SUBSCRIBECONTACTS", "Subscribe Contacts"));
});
}
/**************************End Subscribe Contacts********************************/
/*****************************************************************************/
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="holder_content" runat="Server">
<div style="min-width: 400px;">
<div class="page_title" data-lgid="P_OVERUNDERTRUCKINGALERTSCONFIGURATION">Over/Under Trucking Alerts Configuration</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span id="span_contractor" style="display: none;">
<span data-lgid="P_M3_CONTRACTOR_COLON">Contractor:</span>
<select id="sel_contractor"></select></span>
<input type="text" id="searchinputtxt" autocomplete="off" />
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_M3_SEARCH" style="margin-left: 5px;" />
</div>
<div class="function_title">
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_M3_ADD">Add</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_M3_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="jobsitelimitlist"></div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_jobsitelimit" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
<iframe id="iframejobsitelimit" src="AddJobsiteLimit.aspx" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_subscribecontacts" style="display: none;">
<div id="subscribedialogmask" class="maskbg" style="display: none; z-index: 1;">
<div class="loading_icon icon c-spin"></div>
</div>
<div class="dialog-title"><span class="title" data-lgid="P_M3_SUBSCRIBECONTACTS">Subscribe Contacts</span><em class="dialog-close"></em></div>
<div class="machine_filter">
<input type="text" id="txt_contact_key" style="margin-left: 8px; width: 280px;" tabindex="40" />
<input type="button" class="ybutton" id="btnsubscribefilter" value="Filter" data-lgid="P_M3_FILTER" tabindex="42" />
</div>
<div class="div_machines">
<table class="table_holder">
<thead>
<tr>
<td data-lgid="P_M3_AVAILABLECONTACTS">Available Contacts</td>
<td></td>
<td data-lgid="P_M3_ASSIGNEDCONTACTS">Assigned Contacts
<input type="checkbox" id="chk_showallassignedcontacts" title="When checked, all associated or linked items will display regardless of filter. " data-title-lgid="P_M3_SHOWALLASSIGNEDCONTACTSTITLE" /><label for="chk_showallassignedcontacts" data-lgid="P_M3_SHOWALLASSIGNED">Show All Assigned</label>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<div id="availablecontacts" style="height: 400px; width: 410px;"></div>
</td>
<td class="td_controller">
<input class="ctl_button" type="button" value="&#xe62b;" onclick="OnContactEditorAdd();" tabindex="42" />
<input class="ctl_button" type="button" value="&#xe632;" onclick="OnContactEditorAddAll();" tabindex="43" />
<input class="ctl_button" type="button" value="&#xe62a;" onclick="OnContactEditorRemove();" tabindex="44" />
<input class="ctl_button" type="button" value="&#xe631;" onclick="OnContactEditorRemoveAll();" tabindex="45" />
</td>
<td>
<div id="selectedcontacts" style="height: 400px; width: 410px;"></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_M3_CANCEL" class="dialog-close" tabindex="47" />
<input type="button" onclick="OnSaveSubscribeContacts();" value="OK" data-lgid="P_M3_OK" tabindex="46" />
<div class="clear"></div>
</div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,53 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.Security;
using System;
public partial class JobsiteLimitManagement : JobsiteLimitBasePage
{
public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
protected void Page_Load(object sender, EventArgs e)
{
if (!CheckLoginSession())
{
// TODO: sub page
//RedirectToLoginPage();
}
else
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest(methodName);
}
else if (!IsPostBack)
{
Title = PageTitle;
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOBSITE_LIMIT);
if (!permission)
RedirectToLoginPage();
}
}
}
protected override int FeatureID
{
get
{
return Foresight.Fleet.Services.User.Feature.JOBSITE_LIMIT;
}
}
public bool IsAdmin
{
get
{
var user = GetCurrentUser();
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
return true;
else
return false;
}
}
}

View File

@ -0,0 +1,450 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/JobSite/JobSiteMasterPage.master" AutoEventWireup="true" CodeFile="RequirementChangeHistory.aspx.cs" Inherits="RequirementChangeHistory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
<style type="text/css">
.itemselcted {
background-color: #ccc;
}
.itemhidden {
display: none;
}
.itemsuggested {
background-color: #ffff99;
}
#tbMachineTypes tbody tr:hover {
cursor: default;
background: #ddd;
}
#tbodyAssigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodyUnassigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodySelected tr:hover {
cursor: default;
background: #ddd;
}
#contentctrl {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.float_left {
float: left;
}
.function_bar {
float: right;
}
.user_main {
padding: 0 4px;
}
.dialog .dialog-title .dialog-close {
float: right;
margin-right: 6px;
cursor: pointer;
}
.dialog .dialog-title .dialog-close:before {
content: '\e600';
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 170px;
text-align: right;
padding-right: 10px;
line-height: 28px;
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_machines .dialog-content table td input,
#dialog_layouts .dialog-content table td input {
width: auto;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 100px;
max-width: 200px;
}
#dialog_user_randompass {
width: auto;
height: 16px;
margin: 3px 4px 0 4px;
}
.icon {
font-family: CalciteWebCoreIcons;
cursor: default;
}
.ybutton {
width: 80px;
line-height: normal;
margin-left: 6px;
border: none;
background: rgb(249, 189, 117);
padding: 5px 14px;
cursor: pointer;
}
.ybutton:hover {
background: #d7690E;
}
.td_controller {
vertical-align: middle;
padding: 40px 8px;
/*border-left: 1px solid #b0b0b0;
border-right: 1px solid #b0b0b0;*/
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.subdialog {
width: -moz-calc(100% - 24px);
width: -webkit-calc(100% - 24px);
width: calc(100% - 24px);
}
.machine_maskbg {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
background: #000;
opacity: 0.2;
}
#machine-name {
margin: 10px 10px 6px;
/*color: gray;*/
font-weight: lighter;
font-size: 18px;
width: 770px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.div_filter .dropdown {
width: 120px;
}
.requireinfo {
line-height: 30px;
margin-left: 10px;
}
.requireinfospan {
font-weight: 500;
margin-left: 20px;
}
.quantity {
padding: 3px 0 3px 10px;
margin-top: 5px;
margin-bottom: 5px;
/*color: gray;*/
font-weight: 500;
font-size: 16px;
/*width: 770px;*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #f0f0f0;
}
.span-caption {
position: absolute;
}
.span-bar {
position: absolute;
height: 100%;
margin: 0;
vertical-align: bottom;
}
</style>
<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/editmultiselect.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/jobsiterequirement.js")%>" type="text/javascript"></script>
<script>
jobsitequery = function (method, param, callback, error, nolog) {
_network.request("JobSite/RequirementChangeHistory.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
var currentdate = "<%=CurrentDate %>";
var jobsiteparam;
var IsReadOnly = <%=IsReadOnly ?"true":"false"%>;
var IsRequestOnly = <%=IsRequestOnly ?"true":"false"%>;
/***************************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 OnRefresh() {
showloading(true);
var jobsites = [];
if (jobsiteparam)
jobsites = jobsiteparam.selectedvalue;
var p = [
htmlencode($('#startdatetxt').val()),
htmlencode($('#enddatetxt').val()),
JSON.stringify(jobsites),
$.trim($('#searchinputtxt').val())
];
jobsitequery("GetRequirementHistory", htmlencode(JSON.stringify(p)), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
showRequirementList(data);
}, function (err) {
showloading(false);
});
}
function showRequirementList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "BeginDate")
r[j] = { DisplayValue: r["BeginDateStr"], Value: r[j] };
else if (j === "EndDate")
r[j] = { DisplayValue: r["EndDateStr"], Value: r[j] };
else if (j === "DeletedOn")
r[j] = { DisplayValue: r["DeletedOnStr"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
grid_dt.refresh();
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#jobsitelist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'BeginDate', caption: GetTextByKey("P_JS_BEGINDATE", "Begin Date"), valueIndex: 'BeginDate', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'EndDate', caption: GetTextByKey("P_JS_ENDDATE", "End Date"), valueIndex: 'EndDate', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AssetTypeName', caption: GetTextByKey("P_JS_ASSETTYPE", "Asset Type"), valueIndex: 'AssetTypeName', css: { 'width': 180, 'text-align': 'left' } },
{ name: 'Quantity', caption: GetTextByKey("P_JS_QUANTITY", "Quantity"), valueIndex: 'Quantity', css: { 'width': 80, 'text-align': 'right' } },
{ name: 'ScheduledQuantity', caption: GetTextByKey("P_JS_SCHEDULED", "Scheduled"), valueIndex: 'ScheduledQuantity', css: { 'width': 80, 'text-align': 'right' } },
{ name: 'JobSiteName', caption: GetTextByKey("P_JOBSITE", "Jobsite"), valueIndex: 'JobSiteName', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'NumberOfDays', caption: GetTextByKey("P_JS_NUMBEROFDAYS", "Number of Days"), valueIndex: 'NumberOfDays', css: { 'width': 120, 'text-align': 'right' } },
{ name: 'Notes', caption: GetTextByKey("P_JS_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'PointOfContact', caption: GetTextByKey("P_JS_POINTOFCONTACT", "Point Of Contact"), valueIndex: 'PointOfContact', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AddedByName', caption: GetTextByKey("P_JS_CREATOR", "Creator"), valueIndex: 'AddedByName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'FulfilledByName', caption: GetTextByKey("P_JS_FULFILLEDBY", "Fulfilled By"), valueIndex: 'FulfilledByName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'DeletedByName', caption: GetTextByKey("P_JS_DELETEDBY", "Deleted By"), valueIndex: 'DeletedByName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'DeletedOn', caption: GetTextByKey("P_JS_DELETEDON", "Deleted On"), valueIndex: 'DeletedOn', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'DeletedNotes', caption: GetTextByKey("P_JS_DELETIONNOTES", "Deletion Notes"), valueIndex: 'DeletedNotes', css: { 'width': 200, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = list_columns[hd].visible === false ? false : true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
col.alwaysshow = list_columns[hd].alwaysshow;
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = function (rowindex) {
if (!IsReadOnly && !IsRequestOnly) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
onManageAssets(rowdata.Values);
}
}
}
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
}
}
}
function searchEnter(e) {
if (e.keyCode == 13) {
OnRefresh();
}
}
var jobsite_editmultiselect;
var alljobsites;
function getJobsitesAndRegions() {
showmaskbg(true);
jobsitequery('GetJobsitesAndRegions', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
alljobsites = data.Jobsites;
jobsiteparam = {
items: data.Jobsites,
selectedvalue: [],
width: 300
};
jobsite_editmultiselect = editmultiselect(jobsiteparam);
$('#div_jobsites').append(jobsite_editmultiselect);
}, function () {
showmaskbg(false);
});
}
$(function () {
InitGridData();
getJobsitesAndRegions();
OnRefresh();
$(window).resize(function () {
$("#jobsitelist").css("height", $(window).height() - $("#jobsitelist").offset().top - 14);
grid_dt && grid_dt.resize();
}).resize();
$('#searchinputtxt').keydown(searchEnter);
$('#startdatetxt').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]);
}
});
$('#enddatetxt').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]);
}
});
});
function searchEnter(e) {
if (e.keyCode == 13 || e.keyCode == 9) {
OnRefresh();
}
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="contentctrl">
<div class="page_title" data-lgid="P_JS_DELETEDJOBSITEREQUIREMENTS">Deleted Jobsite Requirements</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_JS_DELETEDBEGINDATE_COLON">Deleted Begin Date:</span>
<div>
<input type="text" id="startdatetxt" autocomplete="off" style="width: 100px; margin-left: 5px;" value="<%=BeginDate %>" />
</div>
<span style="margin-left: 10px;" data-lgid="P_JS_DELETEDENDDATE_COLON">Deleted End Date:</span>
<div>
<input type="text" id="enddatetxt" autocomplete="off" style="width: 100px; margin-left: 5px;" value="<%=EndDate %>" />
</div>
<input type="text" id="searchinputtxt" autocomplete="off" style="margin-left: 5px; display: none;" />
<span style="margin-left: 10px;" data-lgid="P_JS_JOBSITES_COLON">Jobsites:</span>
<div id="div_jobsites"></div>
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_CM_SEARCH" style="margin-left: 5px;" />
</div>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_JS_REFRESH"></span>
<%--<span class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>--%>
</div>
<div id="jobsitelist"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>

View File

@ -0,0 +1,58 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class RequirementChangeHistory : JobSiteRequirementsBasePage
{
protected bool CanConfig = false;
protected bool IsReadOnly = false;
protected bool IsRequestOnly = false;
public string BeginDate = "";
public string EndDate = "";
public string CurrentDate = "";
protected void Page_Load(object sender, EventArgs e)
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
if (CheckLoginSession())
{
bool license = SystemParams.HasLicense("JobSites");
bool license1 = SystemParams.HasLicense("JobsiteDispatch");
if (!license || !license1)
RedirectToEntryPage();
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES_REQUIREMENTS);
if (!permission)
RedirectToLoginPage();
IsReadOnly = CheckReadonly(SystemParams.CompanyID, Feature.JOB_SITES_REQUIREMENTS);
IsRequestOnly = CheckRequestonly(SystemParams.CompanyID);
}
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
BeginDate = userlocaldate.AddDays(-6).ToShortDateString();
EndDate = userlocaldate.ToShortDateString();
CurrentDate = userlocaldate.ToShortDateString();
}
protected override int FeatureID
{
get
{
return Foresight.Fleet.Services.User.Feature.JOB_SITES_REQUIREMENTS;
}
}
}

View File

@ -0,0 +1,581 @@
<%@ 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">
.itemselcted {
background-color: #ccc;
}
.itemhidden {
display: none;
}
.itemsuggested {
background-color: #ffff99;
}
#tbMachineTypes tbody tr:hover {
cursor: default;
background: #ddd;
}
#tbodyAssigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodyUnassigned tr:hover {
cursor: default;
background: #ddd;
}
#tbodySelected tr:hover {
cursor: default;
background: #ddd;
}
#contentctrl {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.float_left {
float: left;
}
.function_bar {
float: right;
}
.user_main {
padding: 0 4px;
}
.edit-content table {
border-collapse: collapse;
width: 100%;
}
.edit-content table td.label {
width: 130px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: top;
}
.edit-content table td input,
.edit-content table td textarea {
border: 1px solid #a9a9a9;
width: 320px;
height: 18px;
padding: 1px;
}
.edit-content table td input[type="checkbox"] {
border: none;
}
.edit-content table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.icon {
font-family: CalciteWebCoreIcons;
cursor: default;
}
.ybutton {
width: 80px;
line-height: normal;
margin-left: 6px;
border: none;
background: rgb(249, 189, 117);
padding: 5px 14px;
cursor: pointer;
}
.ybutton:hover {
background: #d7690E;
}
.td_controller {
vertical-align: middle;
padding: 40px 8px;
/*border-left: 1px solid #b0b0b0;
border-right: 1px solid #b0b0b0;*/
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.subdialog {
width: -moz-calc(100% - 24px);
width: -webkit-calc(100% - 24px);
width: calc(100% - 24px);
}
.machine_maskbg {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
background: #000;
opacity: 0.2;
}
#machine-name {
margin: 10px 10px 6px;
/*color: gray;*/
font-weight: lighter;
font-size: 18px;
width: 770px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.div_filter .dropdown {
width: 100px;
}
.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;
}
</style>
<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="../Maintenance/js/inputdatactr.js"></script>
<script src="<%=GetFileUrlWithVersion("../js/editmultiselect.js")%>" type="text/javascript"></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 IsReadOnly = <%=IsReadOnly ?"true":"false"%>;
var currentdate = "<%=CurrentDate %>";
/***************************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 alerttitle = GetTextByKey('P_JS_SCHEDULER', 'Scheduler');
var begindate = $.trim($('#txtbegindate').val());
var enddate = $.trim($('#txtenddate').val());
if (begindate && !checkDate(begindate)) {
showAlert(GetTextByKey("P_JS_BEGINDATEFORMATERROR", "Begin Date format error."), alerttitle);
return;
}
if (enddate && !checkDate(enddate)) {
showAlert(GetTextByKey("P_JS_ENDDATEFORMATERROR", "End Date format error."), alerttitle);
return;
}
if (begindate && enddate) {
var sdate = begindate;
var stdt = new Date(sdate.replace("-", "/"));
var edate = enddate;
var etdt = new Date(edate.replace("-", "/"));
if (stdt > etdt) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), alerttitle);
return;
}
}
showloading(true);
var jobsites = [];
if (jobsiteparam)
jobsites = jobsiteparam.selectedvalue;
var regions = [];
if (regionparam)
regions = regionparam.selectedvalue;
var agroups = [];
if (assetgroupparam)
agroups = assetgroupparam.selectedvalue;
var atypes = [];
if (assettypeparam)
atypes = assettypeparam.selectedvalue;
var unscheduled = $('#chk_unscheduled').prop('checked') ? "1" : "0";
var p = [
JSON.stringify(jobsites),
JSON.stringify(regions),
JSON.stringify(agroups),
JSON.stringify(atypes),
$.trim($('#searchinputtxt').val()),
begindate,
enddate,
unscheduled
];
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;
var jobsiteparam;
var regionparam;
var jobsite_editmultiselect;
function getJobsitesAndRegions() {
jobsitequery('GetJobsitesAndRegions', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
alljobsites = data.Jobsites;
jobsiteparam = {
allitems: data.Jobsites,
items: JSON.parse(JSON.stringify(data.Jobsites)),
selectedvalue: [],
width: 240
};
jobsite_editmultiselect = editmultiselect(jobsiteparam);
$('#div_jobsites').append(jobsite_editmultiselect);
setJobsites();
regionparam = {
items: data.Regions,
selectedvalue: [],
width: 240,
oncompleted: onregioncompleted
};
var ipt = editmultiselect(regionparam);
$('#div_region').append(ipt);
});
}
function onregioncompleted() {
if (!jobsiteparam || !jobsiteparam.allitems) return;
jobsiteparam.items.length = 0;
for (var i in jobsiteparam.allitems) {
var item = jobsiteparam.allitems[i];
if (!regionparam.selectedvalue
|| regionparam.selectedvalue.length == 0
|| regionparam.selectedvalue.indexOf(item.Tag3) >= 0)
jobsiteparam.items.push(item);
}
jobsite_editmultiselect.reset();
}
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;
var assettypeparam;
function getAssetTypes() {
if (assettypes)
return;
$('#div_assettypes').empty();
jobsitequery('GetAssetTypes', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
assettypes = data;
assettypeparam = {
items: data,
selectedvalue: [],
allowall: false,
width: 280
};
var ipt = editmultiselect(assettypeparam);
$('#div_assettypes').append(ipt);
});
}
var assetgroups;
var assetgroupparam;
function getAssetGroups() {
jobsitequery('GetAssetGroups', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
assetgroups = data;
assetgroupparam = {
items: data,
selectedvalue: [],
width: 240
};
var ipt = editmultiselect(assetgroupparam);
$('#div_assetgroup').append(ipt);
});
}
$(function () {
setPageTitle(GetTextByKey("P_JS_SCHEDULER", "Scheduler"), true);
InitGridData();
jobsiteschedulerCtrl = new $jobsiteschedulerCtrl();
jobsiteschedulerCtrl.Init($("#schedulerlist1"), false);
getJobsitesAndRegions();
getAssetGroups();
getAssetTypes();
$(window).resize(function () {
$("#schedulerlist").css("height", $(window).height() - $("#schedulerlist").offset().top - 14);
grid_dt && grid_dt.resize();
}).resize();
OnRefresh();
$('#searchinputtxt').keydown(searchEnter);
$('#dialog_managescheduler').dialog(function () {
$('#dialogmask').hide();
OnRefresh();
})
$('#dialog_addscheduler').dialog(function () {
$('#dialogmask').hide();
$('#dialogmask1').hide();
})
$("#txtbegindate").datetimepicker({
timepicker: false,
format: 'm/d/Y'
});
$("#txtenddate").datetimepicker({
timepicker: false,
format: 'm/d/Y'
}); $('#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">
<div class="page_title" data-lgid="P_JS_SCHEDULER">Scheduler</div>
<div class="search_bar" style="min-width: 1300px;">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_AM_BEGINDATE_COLON">Begin Date:</span>
<div>
<input type="text" style="margin-left: 5px; width: 75px;" id="txtbegindate" value="<%=BeginDate %>" autocomplete="off" />
</div>
<span data-lgid="P_AM_ENDDATE_COLON">End Date:</span>
<div>
<input type="text" style="margin-left: 5px; width: 75px;" id="txtenddate" 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="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;" />
<input id="chk_unscheduled" type="checkbox" onclick="OnRefresh();" />
<label data-lgid="P_JS_UNSCHEDULED" for="chk_unscheduled">Unscheduled</label>
</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>
</div>
<div id="schedulerlist"></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: 300px; width: 600px;"></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: 500px;">
<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;">
<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" 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="28" />
<input type="button" onclick="onAddScheduler();" data-lgid="P_JS_OK" value="OK" tabindex="27" />
<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>

View File

@ -0,0 +1,54 @@
using Foresight.Fleet.Services.User;
using IronIntel.Contractor;
using IronIntel.Contractor.Site.JobSite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class SchedulerManagement : JobSiteRequirementsBasePage
{
protected bool CanConfig = false;
protected string BeginDate = "";
protected string CurrentDate = "";
protected bool IsReadOnly = false;
protected void Page_Load(object sender, EventArgs e)
{
string methodName = Request.Form["MethodName"];
if (!string.IsNullOrEmpty(methodName))
{
ProcessRequest();
}
else if (!IsPostBack)
{
Title = PageTitle;
if (CheckLoginSession())
{
bool license = SystemParams.HasLicense("JobSites");
bool license1 = SystemParams.HasLicense("JobsiteDispatch");
if (!license || !license1)
RedirectToEntryPage();
bool permission = CheckRight(SystemParams.CompanyID, Feature.JOB_SITES_SCHEDULER);
if (!permission)
RedirectToLoginPage();
IsReadOnly = CheckReadonly(SystemParams.CompanyID, Feature.JOB_SITES_SCHEDULER);
}
}
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
BeginDate = userlocaldate.ToShortDateString();
CurrentDate = userlocaldate.ToShortDateString();
}
protected override int FeatureID
{
get
{
return Foresight.Fleet.Services.User.Feature.JOB_SITES_SCHEDULER;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

View File

@ -0,0 +1,119 @@

function GetRoadMachines() {
jobsitequery("GetRoadMachines", "", function (data) {
if (data && data.length > 0) {
allroadassets = data;
editableSelectAssignAsset.setEnable(true);
editableSelectAssignAsset.datasource = data;
editableSelectAssignAsset.valuepath = "Id"
editableSelectAssignAsset.displaypath = "DisplayName";
}
}, function (err) {
});
}
function openAssignDispatch(seltype,) {
assignAsset = null;
_seltype = seltype;
if (_sendType == 1) {
_selectdispatchids = [];
for (var i = 0; i < grid_dt.source.length; i++) {
var ct = grid_dt.source[i].Values;
if (ct.Selected) {
_selectdispatchids.push(ct.DispatchId);
}
}
if (_selectdispatchids.length == 0) {
var title = "";
if (seltype == 1)
title = GetTextByKey('P_JS_EMAIL', 'Email');
else
title = GetTextByKey('P_MR_PRINT', 'Print');
showAlert(GetTextByKey('P_JS_PLEASESELECTDISPATCH', 'Please select Dispatch.'), title);
return;
}
}
if (!allroadassets)
GetRoadMachines();
editableSelectAssignAsset.val('');
showmaskbg(true);
$('#dialog_assignment .dialog-title span.title').text(GetTextByKey('P_JS_DISPATCHASSIGNMENT', 'Dispatch Assignment'));
//$('#mask_bg').show();
$('#dialog_assignment')
.attr('act', 'edit')
.css({
'width': 400,
'top': (document.documentElement.clientHeight - $('#dialog_assignment').height()) / 4,
'left': (document.documentElement.clientWidth - $('#dialog_assignment').width()) / 2
})
.showDialogfixed();
}
var assignAsset = null;
function onAssignContinue() {
assignAsset = editableSelectAssignAsset.selecteditem();
if (assignAsset == null) {
onAssignSkip();
}
else {
onAssignSkip(assignAsset.DisplayName);
}
}
function assignDispatch(asset) {
var item = {
'Type': _sendType,
'AssetID': asset.Id,
'ObjectIDs': _sendType == 0 ? _createrequireids : _selectdispatchids
};
var param = JSON.stringify(item);
param = htmlencode(param);
jobsitequery("AssignDispatch", param, function (data) {
if (typeof OnRefresh == "function")
OnRefresh();
}, function (err) {
});
}
function onAssignSkip(assignto) {
$("#dialog_assignment").hide();
if (_seltype == 0) {
showmaskbg(false);
if (_sendType == 0) {
onPrint(_createrequireids, assignto);
OnExit();
}
else if (_sendType == 1) {
OnPrint(assignto);
}
else if (_sendType == 2) {
OnPrint(assignto);
}
if (assignAsset != null)
assignDispatch(assignAsset);
}
else if (_seltype == 1) {
if (_sendType == 0) {
openSendEmails(assignto, _assetids, function () {
if (assignAsset != null)
assignDispatch(assignAsset);
});
}
else if (_sendType == 1) {
openSendEmails(assignto, null, function () {
if (assignAsset != null)
assignDispatch(assignAsset);
});
}
else if (_sendType == 2) {
openSendEmails(assignto, null, function () {
if (assignAsset != null)
assignDispatch(assignAsset);
});
}
}
}

224
Site/JobSite/js/email.js Normal file
View File

@ -0,0 +1,224 @@

function CheckEmail(mail) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (mail.length == 0)
return true;
return filter.test(mail);
}
function showContactList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
var a = r[j];
}
r.Text = false;
r.Email = false;
var fr = { Values: r };
rows.push(fr);
}
grid_maildt.setData(rows);
}
var grid_maildt;
function InitEmailGridData() {
grid_maildt = new GridView('#contactlist');
grid_maildt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'DisplayName', caption: GetTextByKey("P_MV_CONTACTNAME", "Contact Name"), valueIndex: 'DisplayName', css: { 'width': 148, 'text-align': 'left' } },
{ name: 'ContactTypeName', caption: GetTextByKey("P_MV_CONTACTTYPE", "Contact Type"), valueIndex: 'ContactTypeName', css: { 'width': 148, 'text-align': 'left' } },
//{ name: 'Text', caption: GetTextByKey("P_MV_TEXT", "Text"), valueIndex: 'Text', type: 3, css: { 'width': 45, 'text-align': 'center' } },
{ name: 'Email', caption: GetTextByKey("P_MV_EMAIL", "Email"), valueIndex: 'Email', type: 3, css: { 'width': 45, 'text-align': 'center' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
if (list_columns[hd].type) {
col.type = list_columns[hd].type;
}
columns.push(col);
if (col.name === "Text") {
col.enabled = function (item) {
return item.TextAddress !== '';
};
}
if (col.name === "Email") {
col.enabled = function (item) {
return item.ID !== '';
};
}
}
grid_maildt.canMultiSelect = false;
grid_maildt.columns = columns;
grid_maildt.init();
grid_maildt.selectedrowchanged = function (rowindex) {
var rowdata = grid_maildt.source[rowindex];
if (rowdata) {
}
}
}
function getDispatchContacts(assetids) {
var ctr = $("#selContractor").val();
if (!ctr) ctr = "";
var p = ctr + ";";
var ids = [];
if (_sendType == 0 || _sendType == 2) {
ids = assetids;
}
else {
for (var i = 0; i < grid_dt.source.length; i++) {
var ct = grid_dt.source[i].Values;
if (ct.Selected && ids.indexOf(ct.AssetId) < 0)
ids.push(ct.AssetId);
}
}
jobsitequery("GetDispatchContacts", JSON.stringify(ids), function (data) {
if (typeof (data) !== "string")
showContactList(data);
}, function () {
});
}
var _selectdispatchids = [];
var _assignto;
var aftersend = null;
function openSendEmails(assignto, assetids, next) {
_assignto = "";
if (assignto)
_assignto = assignto;
aftersend = next;
var title = GetTextByKey("P_JS_SENDDISPATCHREQUEST", 'Send Dispatch Request');
var aids = [];
if (_sendType == 0)
aids = assetids;
else if (_sendType == 1) {
aids = _selectdispatchids;
if (aids.length == 0) {
showAlert(GetTextByKey('P_JS_PLEASESELECTDISPATCH', 'Please select Dispatch.'), title);
return;
}
}
else if (_sendType == 2)
aids = _selectdispatchids;
getDispatchContacts(aids);
$('#sendmail_otheremailaddress').val('');
$('#sendmail_othertextaddress').val('');
$('#sendmail_desc').val('Please make the pick-ups/deliveries as indicated.');
$('#dialog_sendmail .dialog-title span.title').text(title);
$('#dialog_sendmail')
.attr('act', 'edit')
.css({
'width': 500,
'top': (document.documentElement.clientHeight - $('#dialog_sendmail').height()) / 4,
'left': (document.documentElement.clientWidth - $('#dialog_sendmail').width()) / 2
})
.showDialogfixed();
}
function onSendEmails() {
var alerttitle = GetTextByKey("P_WO_SENDEMAIL", 'Send Email');
var ids = [];
if (_sendType == 0) {
ids = _createrequireids;
}
else {
ids = _selectdispatchids;
}
if (ids.length == 0)
return;
var emailaddress = [];
var textaddress = [];
var otheremailaddressstr = $('#sendmail_otheremailaddress').val();
if (otheremailaddressstr !== "") {
var address = otheremailaddressstr.split(';');
for (var i = 0; i < address.length; i++) {
if (!CheckEmail($.trim(address[i]))) {
showAlert(GetTextByKey("P_MV_OTHEREMAILADDRESSISINVALID", 'The other email address {0} is invalid.').replace('{0}', emailaddress[i]), alerttitle);
return;
}
emailaddress.push({ 'Key': '', 'Value': address[i] });
}
}
var othertextaddressstr = $('#sendmail_othertextaddress').val();
if (othertextaddressstr !== "") {
var address = othertextaddressstr.split(';');
for (var i = 0; i < address.length; i++) {
if (!CheckEmail($.trim(address[i]))) {
showAlert(GetTextByKey("P_MV_OTHERTEXTADDRESSISINVALID", 'The other text address {0} is invalid.').replace('{0}', emailaddress[i]), alerttitle);
return;
}
textaddress.push({ 'Key': '', 'Value': address[i] });
}
}
for (var i = 0; i < grid_maildt.source.length; i++) {
var ct = grid_maildt.source[i].Values;
if (ct.Email) {
emailaddress.push({ 'Key': ct.IID, 'Value': ct.ID });
}
if (ct.Text) {
textaddress.push({ 'Key': ct.IID, 'Value': ct.TextAddress });
}
}
if (emailaddress.length == 0 && textaddress.length == 0) {
$('#dialog_sendmail').hideDialog();
$('#mask_bg').hide();
return;
}
var item = {
'Type': _sendType,
'ObjectIDs': ids,
'Description': $('#sendmail_desc').val(),
'EmailAddress': emailaddress,
'TextAddress': textaddress,
'AssignTo': _assignto
};
jobsitequery('SendEmails', htmlencode(JSON.stringify(item)), function (data) {
if (_sendType == 0) {
$('#dialog_sendmail').hideDialog();
$('#mask_bg').hide();
OnExit(data);
}
else {
if (data !== 'OK')
showAlert(data, alerttitle);
else
showAlert(GetTextByKey("P_WO_MESSAGESENT", 'Message sent'), alerttitle);
$('#dialog_sendmail').hideDialog();
$('#mask_bg').hide();
}
if (aftersend)
aftersend();
});
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,632 @@

function showSchedulerData(data) {
if (data) {
assetsObj = data;
if (assetsObj.HasSchedule)
grid_dt.columns[grid_dt.columns.length - 1].width = assetsObj.TotalDays * 5;
else
grid_dt.columns[grid_dt.columns.length - 1].width = 320;
grid_dt.init();
showSchedulerList(data.DispatchAssets);
}
else {
assetsObj = null;
grid_dt.columns[grid_dt.columns.length - 1].width = 320;
grid_dt.init();
showSchedulerList([]);
}
}
function showSchedulerList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
grid_dt.refresh();
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#schedulerlist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'TypeName', caption: GetTextByKey("P_JS_ASSETTYPE", "Asset Type"), valueIndex: 'TypeName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'MakeName', caption: GetTextByKey("P_PM_MAKE", "Make"), valueIndex: 'MakeName', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'ModelName', caption: GetTextByKey("P_PM_MODEL", "Model"), valueIndex: 'ModelName', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AssetName', caption: GetTextByKey("P_JS_ASSETNAME", "Asset Name"), valueIndex: 'AssetName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'CurrentJobSite', caption: GetTextByKey("P_JS_CURRJOBSITE", "Current Jobsite"), allowFilter: true, valueIndex: 'CurrentJobSite', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AssetGroups', caption: GetTextByKey("P_JS_ASSETGROUP", "Asset Group"), valueIndex: 'AssetGroups', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'EngineHours', caption: GetTextByKey("P_JS_ENGINEHOURS", "Engine Hours"), valueIndex: 'EngineHours', css: { 'width': 100, 'text-align': 'right' } },
{ name: 'AquisitionType', caption: GetTextByKey("P_JS_ACQUISITIONTYPE", "Acquisition Type"), valueIndex: 'AquisitionType', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Schedules', caption: "gantt", valueIndex: 'ScheduleParts', css: { 'width': 320, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = list_columns[hd].visible === false ? false : true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
col.type = list_columns[hd].type;
col.alwaysshow = list_columns[hd].alwaysshow;
if (col.name === "Schedules") {
var labelCount = 4;
col.sortable = false;
col.allowHtml = true;
col.caption = function () {
if (!assetsObj || !assetsObj.HasSchedule) return;
var container = $('<span></span>').css({ position: 'relative', height: '100%', display: 'block' });
var left = 0;
for (var i = 0; i < assetsObj.Labels.length; i++) {
var label = assetsObj.Labels[i];
var sp = $('<span class="span-caption"></span>').text(label.Key).css({ left: left });
left += parseInt(label.Value) * 5;
container.append(sp);
}
grid_dt.resize();
//var totalDays = (led.getTime() - fbd.getTime()) / (1000 * 60 * 60 * 24);
//var interval = parseInt(totalDays / labelCount);
//if (totalDays % labelCount != 0)
// interval += 1;
//var d = new Date(assetsObj.BeginDate);
//var w = col.width / labelCount;
//for (var i = 0; i < labelCount; i++) {
// var label = new DateFormatter().formatDate(d, 'm/d/Y');
// var sp = $('<span class="span-caption"></span>').text(label).css({ left: w * i });
// container.append(sp);
// d = new Date(d.getTime() + interval * 1000 * 60 * 60 * 24);
//}
return container;
}
col.filter = function (item) {
if (item.ScheduleParts && assetsObj && assetsObj.HasSchedule) {
var totalDays = assetsObj.TotalDays;
var interval = parseInt(totalDays / labelCount);
if (totalDays % labelCount != 0)
interval += 1;
totalDays = interval * labelCount;
var container = $('<div></div>').css({
position: 'relative',
height: '20px',
});
var d = new Date(assetsObj.BeginDate);
for (var i = 0; i < item.ScheduleParts.length; i++) {
var sp = item.ScheduleParts[i];
var bdate = new Date(sp.BeginDate);
var edate = new Date(sp.EndDate);
var l = (bdate.getTime() - d.getTime()) / (1000 * 60 * 60 * 24) / totalDays * col.width;
var w = (edate.getTime() - bdate.getTime()) / (1000 * 60 * 60 * 24) / totalDays * col.width;
var color = "";
if (sp.Schedules.length == 1)
color = sp.Schedules[0].Color;
else {
for (var j = 0; j < sp.Schedules.length; j++) {
if (color !== "")
color += ","
color += sp.Schedules[j].Color;
}
}
var df = new DateFormatter();
var title = df.formatDate(bdate, 'm/d/Y') + " - " + df.formatDate(new Date((edate.getTime() - 1000 * 60 * 60 * 24)), 'm/d/Y') + "\n";
for (var j = 0; j < sp.Schedules.length; j++) {
var bd = new Date(sp.Schedules[j].BeginDate);
var ed = new Date(sp.Schedules[j].EndDate);
title += sp.Schedules[j].JobSiteName + ": " + df.formatDate(bd, 'm/d/Y') + " - " + df.formatDate(ed, 'm/d/Y');
if (sp.Schedules[j].PointOfContact)
title += "\n " + GetTextByKey("P_JS_CONTACT_COLON", "Contact: ") + " " + sp.Schedules[j].PointOfContact;
if (sp.Schedules[j].Creator)
title += "\n " + GetTextByKey("P_JS_CREATOR_COLON", "Creator: ") + " " + sp.Schedules[j].Creator;
if (j != sp.Schedules.length - 1)
title += "\n";
}
var bar = $('<span class="span-bar"></span>');
bar.css({
left: l,
width: w - 1,
'border-left': '1px solid transparen'
});
if (sp.Schedules.length == 1)
bar.css("backgroundColor", color);
else {
//bar.css("background", "url(img/gridline.jpg) repeat 20px 20px");
//bar.css("background", "linear-gradient(45deg," + color + ")");
//bar.css("background-image", "repeating-linear-gradient(45deg,white, white 5px,#ff9900 5px,#ff9900 7px)");
//bar.css("background-image", "repeating-linear-gradient(135deg,blue 1px, transparent 0), repeating-linear-gradient(45deg, red 1px, transparent 0)");
//bar.css("background-size", "5px 5px");
//bar.css("background-image", "url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><g fill='orange' fill-opacity='1'><path fill-rule='evenodd' d='M0 0h4v4H0V0zm4 4h4v4H4V4z'/></g></svg>\")");
bar.css("background-image", "url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><g fill-opacity='0.5'><path d='M0 0L8 8z M0 8L8 0z' style='fill:white;stroke:gray;stroke-width:1'/></g></svg>\")");
}
bar.attr("title", title);
if (!IsReadOnly) {
bar.dblclick(sp, function (e) {
onEditScheduler(item, e.data.Schedules);
});
}
container.append(bar);
}
return container;
}
};
col.styleFilter = function () {
return {
'margin-top': '3px',
'margin-bottom': '0px',
};
}
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.celldblclick = function (rowindex, columnIndex) {
if (!IsReadOnly) {
if (columnIndex != grid_dt.columns.length - 1) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
onEditScheduler(rowdata.Values);
}
}
}
}
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
}
}
}
if (typeof jobsiteschedulerCtrl !== 'function') {
$jobsiteschedulerCtrl = function jobsiteschedulerCtrl() {
this.tmpobj = {
};
this.wizardCtrl = null;
this.vue = null;
};
(function () {
'use strict';
var dataGrid = window.DataGrid || window['g5-datagrid'];
$jobsiteschedulerCtrl.prototype.getData = function (/*dataObj, tmpdata*/) {
return this.vue.source;
};
$jobsiteschedulerCtrl.prototype.setData = function (data) {
if (data) {
for (var i = 0; i < data.length; i++) {
data[i].Selected = false;
}
}
this.vue.source = data ? data : [];
this.vue.$refs.grid.resize();
};
$jobsiteschedulerCtrl.prototype.reload = function () {
this.vue.$refs.grid.reload()
};
$jobsiteschedulerCtrl.prototype.Init = function (parent, newselected) {
var ethis = this;
//加载子页面模版
parent.load('../template/JobsiteSchedulerCtrl.html?v=8', function () {
ethis.vue = new Vue({
el: parent.find('.JobsiteSchedulerCtrl')[0],
components: {
'data-grid': dataGrid
},
data: {
wnd: window.parent,
//editable: true,
columns: [],
source: []
},
computed: {
},
watch: {
source: function (val) {
}
},
methods: {
cellvaluechanged: function (item, key) {
},
rowdblclick: function (e) {
}
}
});
ethis.vue.columns = createGridColumn(newselected);
});
};
function createGridColumn(newselected) {
var editable = true;
var columns = [
{
key: 'Selected',
caption: '',
type: dataGrid.COLUMN_TYPE.checkbox,
width: 30,
align: 'center',
sortable: false,
orderable: false,
resizable: false,
allcheck: false,
enabled: function (item) {
return !item.Completed;
}
},
{
key: 'JobSiteName',
caption: GetTextByKey("P_JS_JOBSITE", "Jobsite"),
type: dataGrid.COLUMN_TYPE.label,
width: 200,
orderable: false,
resizable: false,
enabled: false
},
{
key: 'BeginDateStr',
caption: GetTextByKey("P_JS_BEGINDATE", 'Begin Date'),
type: dataGrid.COLUMN_TYPE.datepicker,
width: 120,
orderable: false,
resizable: false,
enabled: editable,
onchanged: function (item) {
item.Changed = true;
}
},
{
key: 'EndDateStr',
caption: GetTextByKey("P_JS_ENDDATE", 'End Date'),
type: dataGrid.COLUMN_TYPE.datepicker,
width: 120,
orderable: false,
resizable: false,
enabled: editable,
onchanged: function (item) {
item.Changed = true;
}
},
{
key: 'Delete',
type: dataGrid.COLUMN_TYPE.link,
align: 'center',
width: 30,
orderable: false,
resizable: false,
enabled: editable,
filter: function (item) {
return item.Completed ? '' : '\uf00d';
},
onclick: function (e, item) {
onDeleteScheduler(item);
},
styleFilter: function (item) {
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
},
attrs: { 'title': GetTextByKey("P_JS_DELETE", 'Delete') }
}
];
return columns;
}
}());
}
var currentscheduler;
var allSchedulers;
function onEditScheduler(item, schedules) {
allSchedulers = [];
currentscheduler = item;
if (!schedules || schedules.length == 0) {
schedules = item.Schedules;
}
if (schedules && schedules.length > 0)
allSchedulers = schedules;
$('#dialog_assetname').text(item.AssetName);
$('#dialog_assettype').text(item.TypeName);
$('#dialog_make').text(item.MakeName);
$('#dialog_model').text(item.ModelName);
showmaskbg(true);
var title = GetTextByKey("P_JS_MANAGESCHEDULER", "Manage Scheduler");
$('#dialog_managescheduler .dialog-title span.title').html(title);
$('#dialog_managescheduler')
.attr('init', 1)
.css({
'top': (document.documentElement.clientHeight - $('#dialog_managescheduler').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_managescheduler').width()) / 2
}).showDialogfixed();
if (jobsiteschedulerCtrl) {
jobsiteschedulerCtrl.setData(allSchedulers);
}
}
function onDeleteScheduler(item) {
var schduler = item;
var ids = [];
if (schduler) {
ids.push(schduler.DispatchId);
}
else {
for (var i = 0; i < jobsiteschedulerCtrl.vue.source.length; i++) {
var sch = jobsiteschedulerCtrl.vue.source[i];
if (sch.Selected && !sch.Completed) {
ids.push(sch.DispatchId);
}
}
}
if (ids.length == 0)
return;
var text = GetTextByKey("P_JS_WOULDYOULIKETODELETETHESCHEDULERS", "Would you like to delete the scheduler(s)?");
var alerttitle = GetTextByKey("P_JS_DELETESCHEDULER", "Delete Scheduler");
showConfirmIndialog(text, alerttitle, function () {
var dispatchids = [];
if (schduler) {
dispatchids.push(schduler.DispatchId);
var index = jobsiteschedulerCtrl.vue.source.indexOf(schduler);
jobsiteschedulerCtrl.vue.$refs.grid.deleteRow(index);
}
else {
for (var i = jobsiteschedulerCtrl.vue.source.length - 1; i >= 0; i--) {
var sch = jobsiteschedulerCtrl.vue.source[i];
if (sch.Selected && !sch.Completed) {
dispatchids.push(sch.DispatchId);
jobsiteschedulerCtrl.vue.$refs.grid.deleteRow(i);
}
}
}
if (dispatchids.length == 0)
return;
var item = {
'DispatchId': dispatchids,
'DeleteNotes': ''
};
var p = htmlencode(JSON.stringify(item));
jobsitequery("DeleteDispatch", p, function (data) {
}, function (err) {
});
});
}
function checkSchedulerItems(alerttitle) {
var items = [];
for (var i = 0; i < jobsiteschedulerCtrl.vue.source.length; i++) {
var sch = jobsiteschedulerCtrl.vue.source[i];
if (sch.Changed) {
var item = {
'DispatchId': sch.DispatchId,
'MoveDate': sch.MoveDate,
'BeginDate': sch.BeginDateStr,
'EndDate': sch.EndDateStr,
'Notes': sch.Notes
};
if (!item.BeginDate) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEBEGINDATE", "Please enter the Begin Date."), alerttitle);
return false;
}
if (!checkDate(item.BeginDate)) {
showAlert(GetTextByKey("P_JS_BEGINDATEFORMATERROR", "Begin Date format error."), alerttitle);
return false;
}
if (!item.EndDate) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEENDDATE", "Please enter the End Date."), alerttitle);
return false;
}
if (!checkDate(item.EndDate)) {
showAlert(GetTextByKey("P_JS_ENDDATEFORMATERROR", "End Date format error."), alerttitle);
return false;
}
var nowdt = new Date(currentdate.replace("-", "/"));
var sdate = item.BeginDate;
var stdt = new Date(sdate.replace("-", "/"));
var edate = item.EndDate;
var etdt = new Date(edate.replace("-", "/"));
//if (stdt < nowdt) {
// showAlert(GetTextByKey("P_JS_BEGINDATESHOULDBENOEARLIERTHANTODAYSDATE", "Begin Date should be no earlier than todays date. Please select another date."), alerttitle);
// return false;
//}
//if (etdt < nowdt) {
// showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE1", "End Date must be later than Begin Date. Please select another date range."), alerttitle);
// return false;
//}
if (stdt > etdt) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), alerttitle);
return false;
}
items.push(item);
}
}
return items;
}
function onUpdateScheduler() {
if (jobsiteschedulerCtrl.vue.source.length == 0) {
$('#dialog_managescheduler').hide();
$('#mask_bg').hide();
OnRefresh();
return;
}
var alerttitle = GetTextByKey("P_JS_MANAGESCHEDULER", "Manage Scheduler");
var items = checkSchedulerItems(alerttitle);
if (!items)
return;
if (items.length == 0) {
$('#dialog_managescheduler').hide();
$('#dialogmask').hide();
OnRefresh();
return;
}
showloading(true);
var param = JSON.stringify(items);
param = htmlencode(param);
jobsitequery("UpdateDispatch", param, function (data) {
showloading(false);
if (data !== "OK") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
}
$('#dialog_managescheduler').hide();
$('#dialogmask').hide();
OnRefresh();
}, function (err) {
console.log(err);
showloading(false);
showAlert(GetTextByKey("P_JS_FAILEDTOSAVE", "Failed to save jobsite."), alerttitle);
});
}
function openAddScheduler() {
showmaskbg(true);
$('#dialogmask').show();
$('#dialog_addjobsite').val('');
$('#dialog_addbegindate').val('');
$('#dialog_addenddate').val('');
$('#dialog_addnotes').val('');
$('#dialog_pointofcontact').val('');
var title = GetTextByKey("P_JS_ADDSCHEDULER", "Add Scheduler");
$('#dialog_addscheduler .dialog-title span.title').html(title);
$('#dialog_addscheduler')
.attr('init', 1)
.css({
'top': (document.documentElement.clientHeight - $('#dialog_addscheduler').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_addscheduler').width()) / 2
}).showDialogfixed();
}
function onAddScheduler(ignorebeginpast) {
var alerttitle = GetTextByKey("P_JS_ADDSCHEDULER", "Add Scheduler");
var item = {
'JobSiteId': $('#dialog_addjobsite').find("option:selected").val(),
'JobSiteName': $("#dialog_addjobsite").find("option:selected").text(),
'BeginDate': $.trim($('#dialog_addbegindate').val()),
'EndDate': $.trim($('#dialog_addenddate').val()),
'Quantity': 1,
'Notes': $('#dialog_addnotes').val(),
'PointOfContact': $('#dialog_pointofcontact').val()
};
item.AssetType = currentscheduler.TypeId;
var assets = [];
var asset = {
'AssetId': currentscheduler.AssetId,
'BeginDate': item.BeginDate,
'EndDate': item.EndDate
};
assets.push(asset);
item.Assets = assets;
if (item.BeginDate.length === 0) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEBEGINDATE", "Please enter the Begin Date."), alerttitle);
return;
}
if (!checkDate(item.BeginDate)) {
showAlert(GetTextByKey("P_JS_BEGINDATEFORMATERROR", "Begin Date format error."), alerttitle);
return;
}
if (item.EndDate.length === 0) {
showAlert(GetTextByKey("P_JS_PLEASEENTERTHEENDDATE", "Please enter the End Date."), alerttitle);
return;
}
if (!checkDate(item.EndDate)) {
showAlert(GetTextByKey("P_JS_ENDDATEFORMATERROR", "End Date format error."), alerttitle);
return;
}
var nowdt = new Date(currentdate.replace("-", "/"));
var sdate = item.BeginDate;
var stdt = new Date(sdate.replace("-", "/"));
var edate = item.EndDate;
var etdt = new Date(edate.replace("-", "/"));
if (!ignorebeginpast && stdt < nowdt) {
var msg = GetTextByKey("P_JS_BEGINDATEPAST", "The begin date for this requirement is in the past, do you want to continue?")
showConfirm(msg, alerttitle, function () {
onAddScheduler(true);
});
return;
}
//if (etdt < nowdt) {
// showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE1", "End Date must be later than Begin Date. Please select another date range."), alerttitle);
// return;
//}
if (stdt > etdt) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), alerttitle);
return;
}
$('#dialogmask1').show();
var param = JSON.stringify(item);
param = htmlencode(param);
jobsitequery("CreateNewRequirment", param, function (data) {
if (typeof (data) === "string") {
showAlert(data, alerttitle);
$('#dialogmask1').hide();
} else {
$('#dialog_addscheduler').hide();
$('#dialogmask').hide();
$('#dialogmask1').hide();
var scheduleritem = item;
scheduleritem.DispatchId = data[0];
scheduleritem.BeginDateStr = item.BeginDate;
scheduleritem.EndDateStr = item.EndDate;
allSchedulers.push(scheduleritem);
}
}, function (err) {
console.log(err);
showAlert(GetTextByKey("P_JS_FAILEDTOSAVESCHEDULER", "Failed to save scheduler."), alerttitle);
$('#dialogmask1').hide();
});
}