add site
This commit is contained in:
937
Site/Maintenance/SurveyManagement.aspx
Normal file
937
Site/Maintenance/SurveyManagement.aspx
Normal file
@ -0,0 +1,937 @@
|
||||
<%@ 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-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 130px;
|
||||
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_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;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.div_filter .dropdown {
|
||||
width: 100px;
|
||||
}
|
||||
</style>
|
||||
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
|
||||
<script src="../js/jquery.datetimepicker.full.js"></script>
|
||||
<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() {
|
||||
showloading(true);
|
||||
var type = $('#typeselectinput').find("option:selected").val();
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
var wostartdate = htmlencode($('#wostartdatetxt').val());
|
||||
var woenddate = htmlencode($('#woenddatetxt').val());
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
|
||||
var locations = [];
|
||||
if (locationparam)
|
||||
locations = locationparam.selectedvalue;
|
||||
var advisors = [];
|
||||
if (advisorparam)
|
||||
advisors = advisorparam.selectedvalue;
|
||||
|
||||
var template = $('#templateselectinput').find("option:selected").val();
|
||||
|
||||
var param = JSON.stringify([type, startdate, 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_XXX', 'No Sent');
|
||||
else if (r.Status === 3)
|
||||
statusstr = GetTextByKey('P_WOS_XXX', '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] };
|
||||
}
|
||||
}
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
grid_dt = new GridView('#surveylist');
|
||||
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: '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', 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: 'ContactNumber', 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_JS_XXX", "Do Not Send"), valueIndex: 'DoNotSend', 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 === "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'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (col.name === "Surveys") {
|
||||
col.sortable = false;
|
||||
col.isurl = true;
|
||||
col.text = "\uf15c";
|
||||
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_XXXXX", 'Send Survey') };
|
||||
}
|
||||
|
||||
if (col.name === "WorkOrderNumber" || col.name === "SurveyName") {
|
||||
col.isurl = true;
|
||||
//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.isurl = true;
|
||||
col.text = "\uf0c9";
|
||||
col.sortable = false;
|
||||
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.isurl = true;
|
||||
col.text = "\uf019";
|
||||
col.sortable = false;
|
||||
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.isurl = true;
|
||||
col.text = "\uf02f";
|
||||
col.sortable = false;
|
||||
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.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = openSurveyDetail;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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].Values;
|
||||
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();
|
||||
}
|
||||
|
||||
var locationparam;
|
||||
var advisorparam;
|
||||
var location_editmultiselect;
|
||||
var advisor_editmultiselect;
|
||||
function GetFilterDataSource() {
|
||||
$('#div_locations').empty();
|
||||
$('#div_departments').empty();
|
||||
$('#div_advisors').empty();
|
||||
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;
|
||||
}
|
||||
locationparam = {
|
||||
items: data.Locations,
|
||||
selectedvalue: locationparam ? locationparam.selectedvalue : [],
|
||||
width: 120,
|
||||
valuepath: "ID",
|
||||
textpath: "Name"
|
||||
};
|
||||
location_editmultiselect = editmultiselect(locationparam);
|
||||
$('#div_locations').append(location_editmultiselect);
|
||||
|
||||
advisorparam = {
|
||||
items: JSON.parse(JSON.stringify(data.Advisors)),
|
||||
selectedvalue: advisorparam ? advisorparam.selectedvalue : [],
|
||||
width: 120
|
||||
};
|
||||
advisor_editmultiselect = editmultiselect(advisorparam);
|
||||
$('#div_advisors').append(advisor_editmultiselect);
|
||||
}, 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('');
|
||||
if (!locationparam) locationparam = {};
|
||||
locationparam.selectedvalue = JSON.parse(p[3]);
|
||||
if (!advisorparam) advisorparam = {};
|
||||
advisorparam.selectedvalue = 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();
|
||||
|
||||
$('#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]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#wostartdatetxt').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]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#woenddatetxt').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_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 = [];
|
||||
for (var i = 0; i < grid_dt.source.length; i++) {
|
||||
var gwo = grid_dt.source[i].Values;
|
||||
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_XXXXXX", '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_XXXXX">Survey Automation</label></span>
|
||||
<%}%>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<div style="margin-top: -15px; font-size: 12px;">
|
||||
<span style="margin-left: 310px;" data-lgid="P_FR_XXX">Survey Sent Date</span>
|
||||
<span style="margin-left: 730px;" data-lgid="P_FR_XXX">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_FR_XXX">Begin Date: </span>
|
||||
<div>
|
||||
<input id="startdatetxt" type="text" style="width: 70px; margin-left: 5px;" value="<%=BeginDate %>" autocomplete="off" />
|
||||
</div>
|
||||
<span style="margin-left: 5px;" data-lgid="P_FR_XXX">End Date: </span>
|
||||
<div>
|
||||
<input id="enddatetxt" type="text" style="width: 70px; margin-left: 5px;" value="<%=EndDate %>" autocomplete="off" />
|
||||
</div>
|
||||
<span data-lgid="P_WOS_SURVEYSTATUS" style="margin-left: 5px;">Survey Status:</span>
|
||||
<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_XXX">No Sent</option>
|
||||
<option value="3" data-lgid="P_WOS_XXX">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_FR_XXX">Begin Date: </span>
|
||||
<div>
|
||||
<input id="wostartdatetxt" type="text" style="width: 70px; margin-left: 5px;" value="<%=BeginDate %>" autocomplete="off" />
|
||||
</div>
|
||||
<span style="margin-left: 5px;" data-lgid="P_FR_XXX">End Date: </span>
|
||||
<div>
|
||||
<input id="woenddatetxt" type="text" style="width: 70px; 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_UM_XXX">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>
|
||||
|
Reference in New Issue
Block a user