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

869 lines
38 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="SurveyManagement.aspx.cs" Inherits="SurveyManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
.no_wrap th {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.max160 {
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#dialog_machines .dialog-content table td input {
width: auto;
}
.dialog-content table td textarea {
margin-top: 6px;
}
.dialog-content table td select {
width: 254px;
height: 24px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 150px;
width: 420px;
max-width: 500px;
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.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;
}
.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;
}
.machine_maskbg {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
background: #000;
opacity: 0.2;
}
</style>
<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/js/utility.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var IsDealer = <%=IsDealer ?"true":"false"%>;
woquery = function (method, param, callback, error) {
_network.request("Maintenance/SurveyManagement.aspx", -1, method, param, callback, error);
}
function OnRefresh() {
var type = $('#typeselectinput').find("option:selected").val();
var begindate = $('#startdatetxt').val();
var enddate = $('#enddatetxt').val();
if (begindate && !$('#startdatetxt').is(':valid')) {
showAlert(GetTextByKey('P_WOS_SURVEYSENTBEGINDATEISINVALID', "Survey sent begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#enddatetxt').is(':valid')) {
showAlert(GetTextByKey('P_WOS_SURVEYSENTENDDATEISINVALID', "Survey sent end date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_WOS_SURVEYSENTENDDATEMUSTBELATERTHANBEGINDATE", "Survey sent end date must be later than begin date."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
var wostartdate = htmlencode($('#wostartdatetxt').val());
var woenddate = htmlencode($('#woenddatetxt').val());
if (wostartdate && !$('#wostartdatetxt').is(':valid')) {
showAlert(GetTextByKey('P_WOS_WORKORDERCOMPLETEDBEGINDATEISINVALID', "Work order completed begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (woenddate && !$('#woenddatetxt').is(':valid')) {
showAlert(GetTextByKey('P_WOS_WORKORDERCOMPLETEDENDDATEISINVALID', "Work order completed end date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (wostartdate && woenddate && wostartdate > woenddate) {
showAlert(GetTextByKey("P_WOS_WORKORDERCOMPLETEDENDDATEMUSTBELATERTHANBEGINDATE", "Work order completed end date must be later than begin date."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
var searchtxt = "";
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
var locations = $("#div_locations").dropdownVals();
var advisors = $("#div_advisors").dropdownVals();
var template = $('#templateselectinput').find("option:selected").val();
showloading(true);
var param = JSON.stringify([type, begindate, enddate, searchtxt, JSON.stringify(locations), JSON.stringify(advisors), template, wostartdate, woenddate]);
param = htmlencode(param);
if (drilldownparams == null) {
woquery('GetWorkOrderSurveys', param, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey('P_WOS_SURVEYMANAGEMENTRESULT', "Survey Management/Result"));
return;
}
showSurveyList(data);
}, function (err) {
showloading(false);
});
}
else {
woquery('GetWorkOrderSurveysByIDs', htmlencode(drilldownparams), function (data) {
drilldownparams = null;
if (typeof (data) === "string") {
showAlert(data, GetTextByKey('P_WOS_SURVEYMANAGEMENTRESULT', "Survey Management/Result"));
showmaskbg(false);
return;
}
showSurveyList(data);
showmaskbg(false);
}, function (err) {
drilldownparams = null;
showmaskbg(false);
});
}
}
function showSurveyList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var statusstr = "";
if (r.Status === 0)
statusstr = GetTextByKey('P_WOS_WAITINGCUSTOMERREPLY', 'Waiting Customer Reply');
else if (r.Status === 1)
statusstr = GetTextByKey('P_WOS_REPLIED', 'Replied');
else if (r.Status === 2)
statusstr = GetTextByKey('P_WOS_NOSENT', 'No Sent');
else if (r.Status === 3)
statusstr = GetTextByKey('P_WOS_DONOTSEND', 'Do Not Send');
for (var j in r) {
if (j === "SentTime") {
r[j] = { DisplayValue: r["SentTimeStr"], Value: r[j] };
}
else if (j === "SubmitTime") {
r[j] = { DisplayValue: r["SubmitTimeStr"], Value: r[j] };
}
else if (j === "Status") {
r[j] = { DisplayValue: statusstr, Value: r[j] };
}
}
rows.push(r);
}
grid_dt.setData(rows);
}
var grid_dt;
function InitGridData() {
grid_dt = createGridView('#surveylist');
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 45, 'text-align': 'center' } },
{ name: 'WorkOrderNumber', caption: GetTextByKey("P_WO_WORKORDERNUMBER", "Work Order Number"), valueIndex: 'WorkOrderNumber', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'SurveyName', caption: GetTextByKey("P_WOS_SURVEYNAME", "Survey Name"), valueIndex: 'SurveyName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Status', caption: GetTextByKey("P_WO_STATUS", "Status"), valueIndex: 'Status', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },
{ name: 'SentTime', caption: GetTextByKey("P_WOS_SENTDATE", "Sent Date"), valueIndex: 'SentTime', css: { 'width': 130, 'text-align': 'left' } },
{ name: 'SubmitTime', caption: GetTextByKey("P_WOS_REPLYDATE", "Reply Date"), valueIndex: 'SubmitTime', css: { 'width': 130, 'text-align': 'left' } },
{ name: 'CustomerName', caption: GetTextByKey("P_WOS_CUSTOMERNAME", "Customer Name"), valueIndex: 'CustomerName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'ContactName', caption: GetTextByKey("P_WOS_CONTACTNAME", "Contact Name"), valueIndex: 'ContactName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'ContactNumber', caption: GetTextByKey("P_WOS_CONTACTNUMBER", "Contact Number"), valueIndex: 'ContactNumberStr', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
//{ name: 'AssetVIN', caption: GetTextByKey("P_WO_VIN", "VIN"), valueIndex: 'AssetVIN', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'LocationName', caption: GetTextByKey("P_WO_LOCATION", "Location"), valueIndex: 'LocationName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AdvisorName', caption: GetTextByKey("P_WO_ADVISOR", "Advisor"), valueIndex: 'AdvisorName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AssetMake', caption: GetTextByKey("P_WO_MAKE", "Make"), valueIndex: 'AssetMake', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'AssetModel', caption: GetTextByKey("P_WO_MODEL", "Model"), valueIndex: 'AssetModel', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'DoNotSend', caption: GetTextByKey("P_WOS_DONOTSEND", "Do Not Send"), valueIndex: 'DoNotSend', allowFilter: true, type: 3, css: { 'width': 90, 'text-align': 'center' } },
//{ name: 'AssetType', caption: GetTextByKey("P_WO_ASSETTYPE", "Asset Type"), valueIndex: 'AssetType', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Detail', caption: "", css: { 'width': 30, 'text-align': 'center' } },
{ name: 'DownloadPDF', caption: "", css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Print', caption: "", css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Surveys', 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 = 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;
if (col.name === "DoNotSend") {
col.filterSource = [{ Value: true, DisplayValue: GetTextByKey('P_UTILITY_YES', 'Yes') }, { Value: false, DisplayValue: GetTextByKey('P_UTILITY_NO', 'No') }];
}
if (col.name === "Selected") {
col.allcheck = true;
col.events = {
onchange: function (item) {
item.Selected = this.Selected;
}
};
col.styleFilter = function (item) {
return {
display: (item.Status.Value == 2 && item.Contacts.length > 0) ? '' : 'none'
};
}
}
else if (col.name === "Status") {
col.sortFilter = function (a, b) {
a = a.Status.DisplayValue;
b = b.Status.DisplayValue;
return a > b ? 1 : (a < b ? -1 : 0);
};
}
else if (col.name === "DoNotSend") {
col.events = {
onchange: function () {
var item = this;
SetDoNotSendSurvey(item.WorkOrderId, item.DoNotSend);
}
};
col.styleFilter = function (item) {
return {
display: (item.Status.Value == 2 || item.DoNotSend) ? '' : 'none'
};
}
}
else if (col.name === "Surveys") {
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "file-lines";
col.events = {
onclick: function () {
onSendWOSurveys(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.styleFilter = function (item) {
return {
display: (item.Status.Value == 2 && item.Contacts.length > 0) ? '' : 'none'
};
};
col.attrs = { 'title': GetTextByKey("P_WOS_SENDSURVEY", 'Send Survey') };
}
else if (col.name === "WorkOrderNumber" || col.name === "SurveyName") {
//col.sortable = false;
col.events = {
onclick: function () {
openSurveyDetail();
}
};
col.styleFilter = function () {
return {
'color': 'black',
'cursor': 'pointer',
//'text-decoration': 'none'
};
}
}
else if (col.name === "Detail") {
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "bars";
col.events = {
onclick: function () {
openSurveyDetail();
}
};
col.classFilter = function (e) {
return "icon-col";
}
col.styleFilter = function (e) {
if (e.Status.Value != 1)
return { "display": "none" };
};
col.attrs = { 'title': GetTextByKey("P_IPT_DETAIL", 'Detail') };
}
else if (col.name === "DownloadPDF") {
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "download";
col.events = {
onclick: function () {
window.open("SurveyManagement.aspx?rt=f&t=1&id=" + this.Id, '_blank');
}
};
col.classFilter = function (e) {
return "icon-col";
}
col.styleFilter = function (e) {
if (!canExport) {
return { "display": "none" };
}
if (e.Status.Value != 1)
return { "display": "none" };
};
col.attrs = { 'title': GetTextByKey("P_IPT_DOWNLOADPDF", 'Download PDF') };
}
else if (col.name === "Print") {
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "print";
col.events = {
onclick: function () {
if (navigator.userAgent.indexOf('Firefox') >= 0 ||
navigator.userAgent.indexOf('Opera') >= 0) {
window.open("SurveyManagement.aspx?rt=f&t=2&id=" + this.Id, '_blank');
}
else
OnPrint(this.Id);
}
};
col.classFilter = function (e) {
return "icon-col";
}
col.styleFilter = function (e) {
if (!canExport) {
return { "display": "none" };
}
if (e.Status.Value != 1)
return { "display": "none" };
};
col.attrs = { 'title': GetTextByKey("P_IPT_PRINT", 'Print') };
}
if (col.name === "NotSend") {
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 () {
}, function () {
item.NotSend = !item.NotSend;
grid_dt.reload();
showmaskbg(false);
});
}
};
}
columns.push(col);
}
grid_dt.multiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.onRowDblClicked = openSurveyDetail;
}
function CloseDialog(type) {
$('#dialog_survey').hideDialog();
showmaskbg(false);
}
var surveyid;
function openSurveyDetail() {
var index = grid_dt.selectedIndex;
if (index < 0) {
showAlert(GetTextByKey("P_WOS_PLEASESELECTSURVEY", "Please select survey."), GetTextByKey("P_WORKORDERSURVEYTEMPLATES", "Work Order Survey Templates")); return;
}
var survey = grid_dt.source[index];
if (!survey) {
surveyid = undefined;
return;
}
if (survey.Status.Value !== 1)
return;
surveyid = survey.Id;
execIframeFunc("init", [surveyid], "iframesurveydetail");
showmaskbg(true);
$('#dialog_survey')
.attr('act', 'edit')
.showDialogRight2();
}
function GetFilterDataSource() {
woquery('GetFilterDataSource', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
for (var i = 0; i < data.Locations.length; i++) {
var loc = data.Locations[i];
loc.sublevel = loc.PId > 0 ? 1 : 0;
}
$("#div_locations").dropdownSource(data.Locations);
$("#div_advisors").dropdownSource(data.Advisors);
}, function () {
});
}
function GetTemplateData() {
woquery("GetSurveyTemplateItems", '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
$('#templateselectinput').empty();
$("<option></option>").val("-1").text(GetTextByKey("P_SELECT_ALL", "All")).appendTo($("#templateselectinput"));
for (var i = 0; i < data.length; i++) {
$("<option></option>").val(data[i].Id).text(data[i].Name).appendTo($("#templateselectinput"));
}
if (selecttemplate)
$('#templateselectinput').val(selecttemplate);
OnRefresh();
}, function (err) {
})
}
var drilldownparams = null;
function getParams() {
var p = getCookie("WOSurveyReportParams");
if (!p) return;
setCookie("WOSurveyReportParams", "", -1);
p = JSON.parse(htmldecode(decodeURIComponent(p)));
//$('#templateselectinput').val(p[0]);
selecttemplate = p[0];
$('#startdatetxt').val(p[1]);
$('#enddatetxt').val(p[2]);
$('#wostartdatetxt').val('');
$('#woenddatetxt').val('');
$("#div_locations").dropdownVals(JSON.parse(p[3]));
$("#div_advisors").dropdownVals(JSON.parse(p[4]));
if (p[5] != null) {
drilldownparams = p[5];
}
}
var selecttemplate = null;
$(function () {
setPageTitle(GetTextByKey("P_WOS_SURVEYMANAGEMENTRESULT", "Survey Management/Result"), true);
InitGridData();
getParams();
GetFilterDataSource();
GetTemplateData();
$("#div_locations").css('width', 120).dropdown([], {
search: true,
multiselect: true,
allowselectall: true,
textKey: 'Name',
valueKey: 'ID'
});
$("#div_advisors").css('width', 120).dropdown([], {
search: true,
multiselect: true,
allowselectall: true,
textKey: 'Value',
valueKey: 'Key'
});
$('#dialog_sendwosurveys').dialog(function () {
showmaskbg(false);
});
$('#templateselectinput').change(function () { OnRefresh(); });
$('#searchinputtxt').keydown(searchEnter);
$(window).resize(function () {
$("#surveylist").css("height", $(window).height() - $("#surveylist").offset().top - 4);
grid_dt && grid_dt.resize();
}).resize();
});
function searchEnter(e) {
if (e.keyCode == 13 || e.keyCode == 9) {
OnRefresh();
}
}
function OnExport() {
var searchtxt = "";
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
window.open("../ExportToFile.aspx?type=custrecord&t=" + searchtxt);
}
function OnPrint(rid) {
$("#ifdiv").attr('src', "SurveyManagement.aspx?rt=f&t=2&id=" + rid);
if (!$("#ifdiv").data('inited')) {
$("#ifdiv").on('load', function () {
onifload();
}).show();
$("#ifdiv").data('inited', 1);
}
//window.open("Inspection.aspx?rt=f&t=2&id=" + reportid, '_blank');
}
function onifload() {
var iframe = document.getElementById('ifdiv');
iframe.contentWindow.focus();
iframe.contentWindow.print();
}
var surveytemplatedata;
function GetSurveyTemplateItems() {
$('#dialog_wosurveytemplates').empty();
woquery('GetSurveyTemplateItems', '', function (data) {
$('#dialog_wosurveytemplates').empty();
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
surveytemplatedata = data;
if (data && data.length > 0) {
for (var i = 0; i < data.length; i++) {
if (data[i].Active) {
var op = $("<option></option>").val(data[i].Id).text(data[i].Name);
$('#dialog_wosurveytemplates').append(op);
}
}
}
});
}
var _selectedwoids = [];
function onSendWOSurveys(wo) {
_selectedwoids = [];
$('#tr_wocontact').hide();
if (!wo) {
var woids = [];
var wos = [];
var tempsource = grid_dt.source;
for (var i = 0; i < tempsource.length; i++) {
var gwo = tempsource[i];
if (gwo.Selected && gwo.Status.Value == 2 && gwo.Contacts.length > 0) {
woids.push(gwo.WorkOrderId);
wos.push(gwo);
}
}
if (woids.length == 0)
return;
_selectedwoids = woids;
if (wos.length == 1)
wo = wos[0];
}
if (wo) {
$('#tr_wocontact').show();
if (wo.Contacts && wo.Contacts.length > 0) {
var tb = $('<table style="width:98%;"></table>');
for (var i = 0; i < wo.Contacts.length; i++) {
var contact = wo.Contacts[i];
var mp = $.trim(contact.MobilePhone);
var email = $.trim(contact.Email);
if ((contact.ContactPreference == "0" && !checkPhoneNumber(mp))
|| (contact.ContactPreference == "1" && !isEmail(email))
|| contact.ContactPreference == "2")
continue;
var ptext = contact.Name;
if (contact.ContactPreference === 0)
ptext += " " + contact.MobilePhoneDisplayText;
else if (contact.ContactPreference === 1)
ptext += " - " + contact.Email;
var tr = $('<tr></tr>');
var td = $('<td></td>');
var span = $('<span></span>').text(ptext);
if (contact.SurveyOptOut_BC) {
span.css('color', 'lightgray').css('padding-left', 20);
}
else {
var chk = $('<input name="wocontactsurvey" type="checkbox" style="width: unset;" />').data('contact', contact);
td.append(chk)
}
td.append(span);
tr.append(td).appendTo(tb);
}
$("#dialog_wosurveyscontacts").empty().append(tb);
}
}
$('#dialog_wosurveytemplates').val('');
showmaskbg(true);
$('#dialog_sendwosurveys .dialog-title span.title').text(GetTextByKey("P_WO_SENDWORKORDERSURVEYS", 'Send Work Order Surveys'));
if (!surveytemplatedata) {
GetSurveyTemplateItems();
}
$('#dialog_sendwosurveys').data('wo', wo)
.css({
'top': (document.documentElement.clientHeight - $('#dialog_sendwosurveys').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_sendwosurveys').width()) / 2
}).showDialogfixed();
}
function SendWOSurveys() {
var tempid = $('#dialog_wosurveytemplates').val();
if (!tempid || tempid == "") {
showAlert(GetTextByKey("P_WO_PLEASESELECTATEMPLATE", 'Please select a template.'), GetTextByKey("P_WO_SENDWORKORDERSURVEYS", 'Send Work Order Surveys'));
return;
}
var wo = $('#dialog_sendwosurveys').data('wo');
if (wo) {
var contacts = [];
$('#dialog_sendwosurveys input:checkbox[name=wocontactsurvey]:checked').each(function (i, chk) {
var contact = $(chk).data('contact');
contacts.push(contact);
});
var param = JSON.stringify([wo.WorkOrderId, tempid, JSON.stringify(contacts)]);
param = htmlencode(param);
woquery("CreateWorkOrderSurveysByContacts", param, function (data) {
if (data !== "") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
OnRefresh();
}, function (err) {
showAlert(err, GetTextByKey("P_WO_ERROR", 'Error'));
showmaskbg(false);
});
}
else {
if (!_selectedwoids || _selectedwoids.length == 0)
return;
var param = JSON.stringify([JSON.stringify(_selectedwoids), tempid]);
param = htmlencode(param);
woquery("SendWorkOrderSurveys", param, function (data) {
if (data !== "") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
OnRefresh();
}, function (err) {
showAlert(err, GetTextByKey("P_WO_ERROR", 'Error'));
showmaskbg(false);
});
}
$('#dialog_sendwosurveys').hideDialog();
showmaskbg(false);
}
function CloseSurveyAutomationDialog(type) {
$('#dialog_surveyautomation').hideDialog();
OnRefresh();
execIframeFunc("refreshstatus", [], "iframeworkorder");
}
function ShowSurveyAutomationDialog(type) {
showmaskbg(true);
$('#dialog_surveyautomation')
.attr('act', type)
.showDialogRight();
}
function openSurveyAutomation() {
$('#iframesurveyautomation').attr('src', 'SurveyAutomationManagement.aspx');
ShowSurveyAutomationDialog();
}
function SetDoNotSendSurvey(woid, donotsend) {
var item = [woid, donotsend];
var p = htmlencode(JSON.stringify(item));
woquery('SetDoNotSendSurvey', p, function (data) {
if (data !== "OK") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
}
OnRefresh();
});
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="min-width: 1850px;">
<div class="page_title">
<span data-lgid="P_WOS_SURVEYMANAGEMENTRESULT">Survey Management/Result</span>
<%if (IsAdmin)
{%>
<span class="sbutton iconcog" style="float: right; font-size: 14px; margin-right: 15px; cursor: pointer;" onclick="openSurveyAutomation();">
<label data-lgid="P_WOS_SURVEYAUTOMATION">Survey Automation</label></span>
<%}%>
<div style="clear: both;"></div>
</div>
<div style="margin-top: -15px; font-size: 12px;">
<span style="margin-left: 345px;" data-lgid="P_WOS_SURVEYSENTDATE">Survey Sent Date</span>
<span style="margin-left: 790px;" data-lgid="P_WOS_WORKORDERCOMPLETED">Work Order Completed</span>
</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_WO_TEMPLATES_COLON">Template:</span>
<div>
<select class="selectinput" style="width: 120px; margin-left: 5px;" id="templateselectinput"></select>
</div>
<span style="margin-left: 5px;" data-lgid="P_WOS_BEGINDATE_COLON">Begin Date:&nbsp;</span>
<div>
<input id="startdatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 90px; margin-left: 5px;" value="<%=BeginDate %>" autocomplete="off" />
</div>
<span style="margin-left: 5px;" data-lgid="P_WOS_ENDDATE_COLON">End Date:&nbsp;</span>
<div>
<input id="enddatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 90px; margin-left: 5px;" value="<%=EndDate %>" autocomplete="off" />
</div>
<span data-lgid="P_WOS_SURVEYSTATUS" style="margin-left: 5px;">Survey Status:</span>&nbsp;&nbsp;
<div>
<select class="selectinput" id="typeselectinput" style="width: 150px; margin-left: 5px;">
<option value="-1" data-lgid="P_WOS_ALL">All</option>
<option value="0" data-lgid="P_WOS_WAITINGCUSTOMERREPLY">Waiting Customer Reply</option>
<option value="1" data-lgid="P_WOS_REPLIED">Replied</option>
<option value="2" data-lgid="P_WOS_NOSENT">No Sent</option>
<option value="3" data-lgid="P_WOS_DONOTSEND">Do Not Send</option>
</select>
</div>
<span data-lgid="P_WO_LOCATION_COLON">Location:</span>
<div id="div_locations"></div>
<span data-lgid="P_WO_ADVISOR_COLON">Advisor:</span>
<div id="div_advisors"></div>
<span style="margin-left: 5px;" data-lgid="P_WOS_BEGINDATE_COLON">Begin Date:&nbsp;</span>
<div>
<input id="wostartdatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 90px; margin-left: 5px;" value="<%=BeginDate %>" autocomplete="off" />
</div>
<span style="margin-left: 5px;" data-lgid="P_WOS_ENDDATE_COLON">End Date:&nbsp;</span>
<div>
<input id="woenddatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 90px; margin-left: 5px;" value="<%=EndDate %>" autocomplete="off" />
</div>
<input id="searchinputtxt" type="text" autocomplete="off" style="width: 100px; margin-left: 5px;" />
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_FR_SEARCH" style="margin-left: 5px;" />
</div>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_UM_REFRESH">Refresh</span>
<span class="sbutton iconsendsurvey" onclick="onSendWOSurveys(null);" data-lgid="P_WOS_SENDSURVEY">Send Survey</span>
<%--<span class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>--%>
</div>
<div class="clear"></div>
<div id="surveylist"></div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_survey" style="display: none; height: 100%; border-bottom: 0; border-top: 0; left: unset;">
<iframe id="iframesurveydetail" src="SurveyDetail.aspx" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
</div>
</div>
<div class="dialog" id="dialog_sendwosurveys" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_SENDWORKORDERSURVEYS">Send Work Order Surveys</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; margin-left: 10px; margin-right: 10px;">
<tr>
<td class="label" data-lgid="P_WO_TEMPLATES_COLON">Templates:</td>
<td class="cont">
<select id="dialog_wosurveytemplates" tabindex="1" style="height: 22px; width: 324px;">
</select></td>
</tr>
<tr id="tr_wocontact" style="display: none;">
<td class="label" style="vertical-align: top;">
<span data-lgid="P_WO_CONTACTS_COLON">Contacts:</span></td>
<td>
<div id="dialog_wosurveyscontacts" style="max-height: 150px; overflow: auto;"></div>
</td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="dialog-close" tabindex="18" />
<input type="button" onclick="SendWOSurveys();" value="Send" data-lgid="P_WO_SEND" tabindex="17" />
<div class="clear"></div>
</div>
</div>
<iframe id="ifdiv" style="position: absolute; top: -9999px; height: 1px; width: 1px; border: 0; display: none;"></iframe>
<div class="dialog" id="dialog_surveyautomation" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
<iframe id="iframesurveyautomation" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
</div>
</asp:Content>