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="ManageHarshDriving.aspx.cs" Inherits="ManageHarshDriving" %>
<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">
otrconfigquery = function (method, param, callback, error) {
@ -86,12 +84,11 @@
if (j === "AsofTimeLocal")
r[j] = { DisplayValue: r["AsofTimeLocalStr"], Value: r[j] };
else if (j === "Excluded") {
r["SetText"] = r.Excluded ? GetTextByKey("P_MHD_EXCLUDE", "Exclude") : GetTextByKey("P_MHD_EXCLUDE", "Exclude");
r[j] = { DisplayValue: r.Excluded ? "Yes" : "No", Value: r[j] };
r["SetText"] = r.Excluded ? GetTextByKey("P_MHD_EXCLUDED", "Excluded") : GetTextByKey("P_MHD_EXCLUDE", "Exclude");
r[j] = { DisplayValue: r.Excluded ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
}
}
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
grid_dt.setData(rows);
@ -99,31 +96,26 @@
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#harshdrivinglist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
grid_dt = createGridView('#harshdrivinglist');
var list_columns = [
{ name: 'Set', valueIndex: 'SetText', css: { 'width': 60, 'text-align': 'left' } },
{ name: 'Excluded', caption: GetTextByKey("P_MHD_EXCLUDED", "Excluded"), valueIndex: 'Excluded', allowFilter: true, css: { 'width': 80, 'text-align': 'left' } },
{ name: 'Set', valueIndex: 'SetText', css: { 'width': 70, 'text-align': 'left' } },
{ name: 'Excluded', caption: GetTextByKey("P_MHD_EXCLUDED", "Excluded"), valueIndex: 'Excluded', allowFilter: true, css: { 'width': 90, 'text-align': 'left' } },
{ name: 'DisplayName', caption: GetTextByKey("P_MHD_ASSETNAME", "Asset Name"), valueIndex: 'DisplayName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'MakeName', caption: GetTextByKey("P_MHD_MAKE", "Make"), valueIndex: 'MakeName', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'ModelName', caption: GetTextByKey("P_MHD_MODEL", "Model"), valueIndex: 'ModelName', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'EventDesc', caption: GetTextByKey("P_MHD_EVENTTYPE", "Event Type"), valueIndex: 'EventDesc', allowFilter: true, css: { 'width': 90, 'text-align': 'left' } },
{ name: 'AsofTimeLocal', caption: GetTextByKey("P_MHD_EVENTTIME", "Event Time"), valueIndex: 'AsofTimeLocal', css: { 'width': 110, 'text-align': 'left' } },
{ name: 'Street', caption: GetTextByKey("P_MHD_STREET", "Street"), valueIndex: 'Street', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'City', caption: GetTextByKey("P_MHD_CITY", "City"), valueIndex: 'City', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'State', caption: GetTextByKey("P_MHD_STATE", "State"), valueIndex: 'State', css: { 'width': 90, 'text-align': 'left' } },
{ name: 'PostalCode', caption: GetTextByKey("P_MHD_POSTALCODE", "Postal Code"), valueIndex: 'PostalCode', css: { 'width': 60, 'text-align': 'left' } },
{ name: 'Street', caption: GetTextByKey("P_MHD_STREET", "Street"), valueIndex: 'Street', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'City', caption: GetTextByKey("P_MHD_CITY", "City"), valueIndex: 'City', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'State', caption: GetTextByKey("P_MHD_STATE", "State"), valueIndex: 'State', allowFilter: true, css: { 'width': 90, 'text-align': 'left' } },
{ name: 'PostalCode', caption: GetTextByKey("P_MHD_POSTALCODE", "Postal Code"), valueIndex: 'PostalCode', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
//{ name: 'Country', caption: GetTextByKey("P_MHD_EXCLUDED", "Country"), valueIndex: 'Country', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'StartingSpeed', caption: GetTextByKey("P_MHD_STARTINGSPEED", "Starting Speed"), valueIndex: 'StartingSpeed', css: { 'width': 60, 'text-align': 'right' } },
{ name: 'SpeedUnits', caption: GetTextByKey("P_MHD_SPEEDUNITS", "Speed Units"), valueIndex: 'SpeedUnits', css: { 'width': 60, 'text-align': 'right' } },
{ name: 'Duration', caption: GetTextByKey("P_MHD_DURATION", "Duration"), valueIndex: 'Duration', css: { 'width': 65, 'text-align': 'right' } },
{ name: 'DurationUnits', caption: GetTextByKey("P_MHD_DURATIONUNITS", "Duration Units"), valueIndex: 'DurationUnits', css: { 'width': 65, 'text-align': 'right' } },
{ name: 'Magnitude', caption: GetTextByKey("P_MHD_MAGNITUDE", "Magnitude"), valueIndex: 'Magnitude', css: { 'width': 75, 'text-align': 'right' } },
{ name: 'MagnitudeUnits', caption: GetTextByKey("P_MHD_MAGNITUDEUNITS", "Magnitude Units"), valueIndex: 'MagnitudeUnits', css: { 'width': 80, 'text-align': 'right' } }
{ name: 'StartingSpeed', caption: GetTextByKey("P_MHD_STARTINGSPEED", "Starting Speed"), valueIndex: 'StartingSpeed', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'SpeedUnits', caption: GetTextByKey("P_MHD_SPEEDUNITS", "Speed Units"), valueIndex: 'SpeedUnits', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'Duration', caption: GetTextByKey("P_MHD_DURATION", "Duration"), valueIndex: 'Duration', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'DurationUnits', caption: GetTextByKey("P_MHD_DURATIONUNITS", "Duration Units"), valueIndex: 'DurationUnits', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'Magnitude', caption: GetTextByKey("P_MHD_MAGNITUDE", "Magnitude"), valueIndex: 'Magnitude', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } },
{ name: 'MagnitudeUnits', caption: GetTextByKey("P_MHD_MAGNITUDEUNITS", "Magnitude Units"), valueIndex: 'MagnitudeUnits', allowFilter: true, css: { 'width': 100, 'text-align': 'right' } }
];
var columns = [];
// head
@ -138,34 +130,43 @@
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
if (col.name === "Set") {
col.isurl = true;
col.events = {
onclick: function () {
OnExcluded();
}
};
col.styleFilter = function (e) {
return { 'cursor': 'pointer', 'color': '#2140fb' };
}
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.multiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = OnExcluded;
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
}
}
grid_dt.onRowDblClicked = OnExcluded;
}
function OnRefresh() {
showloading(true);
var startdate = htmlencode($('#startdatetxt').val());
var enddate = htmlencode($('#enddatetxt').val());
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;
}
var searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
otrconfigquery('GetHarshDrivingEvents', startdate + String.fromCharCode(170) + enddate + String.fromCharCode(170) + searchtxt, function (data) {
showloading(true);
otrconfigquery('GetHarshDrivingEvents', htmlencode(begindate) + String.fromCharCode(170) + htmlencode(enddate) + String.fromCharCode(170) + searchtxt, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_MHD_ERROR", 'Error'));
@ -180,7 +181,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;
@ -240,26 +241,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]);
}
});
$('#searchinputtxt').keydown(searchEnter);
$(window).resize(function () {
$("#harshdrivinglist").css("height", $(window).height() - $("#harshdrivinglist").offset().top - 4);
@ -283,10 +264,10 @@
<input type="password" autocomplete="new-password" style="display: none" />
<span style="padding-left: 5px;" data-lgid="P_MHD_STATDATE_COLON">Start Date:&nbsp;</span>
<span>
<input id="startdatetxt" type="text" style="width: 100px;" value="<%=BeginDate %>" /></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_MHD_ENDDATE_COLON">End Date:&nbsp;</span>
<span>
<input id="enddatetxt" type="text" style="width: 100px;" value="<%=EndDate %>" /></span>
<input id="enddatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 100px;" value="<%=EndDate %>" /></span>
<input id="searchinputtxt" type="text" style="width: 200px; margin-left: 5px;" autocomplete="off" />
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_MHD_SEARCH" style="margin-left: 5px;" />
</div>