This commit is contained in:
2024-03-26 15:56:31 +08:00
parent 634e8b71ab
commit 0855ae42cd
547 changed files with 94818 additions and 60463 deletions

View File

@ -1,7 +1,6 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/OTRConfig/OTRConfig.master" AutoEventWireup="true" CodeFile="ManageSpeeding.aspx.cs" Inherits="ManageSpeeding" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
<style type="text/css">
.main_group {
table-layout: fixed;
@ -71,7 +70,6 @@
text-overflow: ellipsis;
}
</style>
<script src="../js/jquery.datetimepicker.full.js"></script>
<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var groups;
@ -87,8 +85,7 @@
if (j === "EventTime")
r[j] = { DisplayValue: r["EventTimeStr"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
grid_dt.setData(rows);
@ -98,18 +95,18 @@
function InitGridData() {
grid_dt = new GridView('#speedinglist');
var list_columns = [
{ name: 'AssetName', caption: "Asset Name", valueIndex: 'AssetName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Make', caption: "Make", valueIndex: 'Make', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'Model', caption: "Model", valueIndex: 'Model', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AssetName', caption: "Asset Name", valueIndex: 'AssetName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Make', caption: "Make", valueIndex: 'Make', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'Model', caption: "Model", valueIndex: 'Model', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'EventTime', caption: "Event Time", valueIndex: 'EventTime', css: { 'width': 110, 'text-align': 'left' } },
{ name: 'Street', caption: "Street", valueIndex: 'Street', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'City', caption: "City", valueIndex: 'Street', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'State', caption: "State", valueIndex: 'State', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'PostalCode', caption: "Postal Code", valueIndex: 'PostalCode', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'Country', caption: "Country", valueIndex: 'Country', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'TopSpeed', caption: "Top Speed", valueIndex: 'TopSpeed', css: { 'width': 100, 'text-align': 'right' } },
{ name: 'PostedSpeedLimit', caption: "Posted Speed Limit", valueIndex: 'PostedSpeedLimit', css: { 'width': 100, 'text-align': 'right' } },
{ name: 'SpeedingOverage', caption: "Speeding Overage", valueIndex: 'SpeedingOverage', css: { 'width': 100, 'text-align': 'right' } },
{ name: 'Street', caption: "Street", valueIndex: 'Street', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'City', caption: "City", valueIndex: 'Street', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'State', caption: "State", valueIndex: 'State', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'PostalCode', caption: "Postal Code", valueIndex: 'PostalCode', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'Country', caption: "Country", valueIndex: 'Country', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'TopSpeed', caption: "Top Speed", valueIndex: 'TopSpeed', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'PostedSpeedLimit', caption: "Posted Speed Limit", valueIndex: 'PostedSpeedLimit', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'SpeedingOverage', caption: "Speeding Overage", valueIndex: 'SpeedingOverage', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'Excluded', css: { 'width': 100, 'text-align': 'left' } }
];
var columns = [];
@ -123,41 +120,54 @@
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;
if (col.name === "Excluded") {
col.isurl = true;
col.text = "Excluded";
col.events = {
onclick: function () {
OnExcluded();
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.styleFilter = function (e) {
return { 'cursor': 'pointer', 'color': '#2140fb' };
}
col.attrs = { 'title': 'Excluded' };
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.multiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = OnExcluded;
grid_dt.onRowDblClicked = OnExcluded;
grid_dt.selectedrowchanged = function (rowindex) {
grid_dt.onSelectedRowChanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
uiid = rowdata.Values.ID;
uiid = rowdata.ID;
}
}
}
function OnRefresh() {
var begindate = $('#startdatetxt').val();
var enddate = $('#enddatetxt').val();
if (begindate && !$('#startdatetxt').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_BEGINDATEISINVALID', "The begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#enddatetxt').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_ENDDATEISINVALID', "The end date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
showloading(true);
var startdate = htmlencode($('#startdatetxt').val());
var enddate = htmlencode($('#enddatetxt').val());
otrconfigquery('GetSpeedingEvents', startdate + String.fromCharCode(170) + enddate, function (data) {
otrconfigquery('GetSpeedingEvents', htmlencode(begindate) + String.fromCharCode(170) + htmlencode(enddate), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, 'Error');
showAlert(data, GetTextByKey('P_MS_ERROR', 'Error'));
return;
}
showList(data);
@ -169,7 +179,7 @@
var rowdata;
function OnExcluded() {
$('#dialog_notes').val('');
var data = grid_dt.source[grid_dt.selectedIndex].Values;
var data = grid_dt.source[grid_dt.selectedIndex];
if (!data) {
rowdata = undefined;
return;
@ -192,25 +202,25 @@
return;
var notes = $('#dialog_notes').val();
var alerttitle = "Excluded Speeding";
var alerttitle = GetTextByKey('P_MS_EXCLUDEDSPEEDING', "Excluded Speeding");
showloading(true);
otrconfigquery("ExcludedSpeedingEvents", rowdata.AssetID + String.fromCharCode(170) + rowdata.LogID + String.fromCharCode(170) + notes, function (data) {
showloading(false);
if (data !== 'OK') {
showAlert(data, alerttitle);
} else {
showAlert('Excluded speeding successfully.', alerttitle);
showAlert(GetTextByKey('P_MS_EXCLUDEDSPEEDINGSUCCESSFULLY', 'Excluded speeding successfully.'), alerttitle);
$('#dialog_excluded').hideDialog();
OnRefresh();
}
}, function (err) {
showloading(false);
showAlert('Failed to speeding driving.', alerttitle);
showAlert(GetTextByKey('P_MS_FAILEDTOSPEEDINGDRIVING', 'Failed to speeding driving.'), alerttitle);
});
}
$(function () {
setPageTitle(GetTextByKey("P_XXXXXX", "Manage Speedings"), true);
setPageTitle(GetTextByKey("P_MANAGESPEEDINGS", "Manage Speedings"), true);
InitGridData();
OnRefresh();
@ -219,26 +229,6 @@
showmaskbg(false);
});
$('#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]);
}
});
$(window).resize(function () {
$("#speedinglist").css("height", $(window).height() - $("#speedinglist").offset().top - 4);
grid_dt && grid_dt.resize();
@ -249,19 +239,19 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="min-width: 400px;">
<div class="page_title" data-lgid="P_XXXXXX">Manage Speedings</div>
<div class="page_title" data-lgid="P_MANAGESPEEDINGS">Manage Speedings</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span style="padding-left: 5px;">Begin Date:&nbsp;</span>
<span style="padding-left: 5px;" data-lgid="P_MS_BEGINDATE_COLON">Begin Date:&nbsp;</span>
<span>
<input id="startdatetxt" type="text" style="width: 100px;" value="<%=BeginDate %>" /></span>
<span style="padding-left: 5px;">End Date:&nbsp;</span>
<input id="startdatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 100px;" value="<%=BeginDate %>" /></span>
<span style="padding-left: 5px;" data-lgid="P_MS_ENDDATE_COLON">End Date:&nbsp;</span>
<span>
<input id="enddatetxt" type="text" style="width: 100px;" value="<%=EndDate %>" /></span>
<input class="search" type="button" onclick="OnRefresh();" value="Search" style="margin-left: 5px;" />
<input id="enddatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 100px;" value="<%=EndDate %>" /></span>
<input class="search" type="button" onclick="OnRefresh();" data-lgid="P_MS_SEARCH" value="Search" style="margin-left: 5px;" />
</div>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();">Refresh</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_MS_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="speedinglist"></div>
@ -272,19 +262,19 @@
</div>
<div class="dialog" id="dialog_excluded" style="display: none; width: 400px;">
<div class="dialog-title"><span class="title">Excluded</span><em class="dialog-close"></em></div>
<div class="dialog-title"><span class="title" data-lgid="P_MS_EXCLUDED">Excluded</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table>
<tr>
<td style="width: 50px; vertical-align: top;">Notes:</td>
<td style="width: 50px; vertical-align: top;" data-lgid="P_MS_NOTES_COLON">Notes:</td>
<td>
<textarea id="dialog_notes" maxlength="1000" tabindex="1" style="width: 300px; height: 100px; margin-top: 3px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" class="dialog-close" tabindex="3" />
<input type="button" onclick="OnDialogOK();" value="OK" tabindex="2" />
<input type="button" value="Cancel" data-lgid="P_MS_CANCEL" class="dialog-close" tabindex="3" />
<input type="button" onclick="OnDialogOK();" data-lgid="P_MS_OK" value="OK" tabindex="2" />
<div class="clear"></div>
</div>
</div>