add site
This commit is contained in:
906
Site/Maintenance/SurveyTemplateReport.aspx
Normal file
906
Site/Maintenance/SurveyTemplateReport.aspx
Normal file
@ -0,0 +1,906 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="SurveyTemplateReport.aspx.cs" Inherits="Maintenance_SurveyTemplateReport" %>
|
||||
|
||||
<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;
|
||||
}
|
||||
|
||||
.emailpopus-close {
|
||||
float: right;
|
||||
margin-right: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.emailpopus-close:before {
|
||||
content: '\e600';
|
||||
}
|
||||
|
||||
.dialog-content .data-grid .data-grid-body .data-grid-body-content td input {
|
||||
width: unset;
|
||||
height: unset;
|
||||
}
|
||||
</style>
|
||||
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
|
||||
<script src="../js/jquery.datetimepicker.full.js"></script>
|
||||
<script src="../js/echarts.min.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 colors = [
|
||||
"#4386d8", "#ff9a2e", "#db443f", "#a8d44f", "#8560b3",
|
||||
"#3cbfe3", "#afd8f8", "#008e8e", "#8BBa00", "#fabd0f",
|
||||
"#fa6e46", "#9d080d", "#a186be", "#cc6600", "#fdc689"
|
||||
];
|
||||
function reportrequest(method, param, callback, error) {
|
||||
_network.request("Maintenance/SurveyTemplateReport.aspx", -1, method, param, callback, error || function (e) {
|
||||
showmaskbg(false, true);
|
||||
showAlert(GetTextByKey('P_FR_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_FR_QUERY', 'Query'));
|
||||
});
|
||||
}
|
||||
|
||||
function InitYesNoBar(q, content, id, s1, s2, d1, d2, index) {
|
||||
var myChart = echarts.init(content.find('#' + id)[0]);
|
||||
var option = {
|
||||
//title: {
|
||||
// text: q.Title
|
||||
//},
|
||||
color: ['#a8d44f', '#db443f'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'none'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
top: '10%',
|
||||
left: 'right'
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
boundaryGap: [0, 0.01]
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: [' ', ' ', ' ']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: s1,
|
||||
type: 'bar',
|
||||
data: [null, d1, null]
|
||||
},
|
||||
{
|
||||
name: s2,
|
||||
type: 'bar',
|
||||
data: [null, d2, null]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
|
||||
myChart.on('dblclick', function (params) {
|
||||
var i = params.seriesIndex;
|
||||
var s = q.Values[i].Surveys.join(',');
|
||||
console.log(s);
|
||||
if (s.length > 0) {
|
||||
drilldowndetail(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function InitChooseBar(q, content, id, data, text) {
|
||||
var myChart = echarts.init(content.find('#' + id)[0]);
|
||||
var option = {
|
||||
//title: {
|
||||
// text: q.Title
|
||||
//},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'none'
|
||||
}
|
||||
},
|
||||
color: colors,
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: data,
|
||||
axisTick: {
|
||||
alignWithLabel: true
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: 45
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
name: '',
|
||||
position: 'left',
|
||||
alignTicks: true,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#5470C6'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: function (value, index) {
|
||||
if ((value + '').indexOf('.') >= 0) {
|
||||
return '';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}],
|
||||
series: [
|
||||
{
|
||||
data: text,
|
||||
type: 'bar',
|
||||
barWidth: 50
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
|
||||
myChart.on('dblclick', function (params) {
|
||||
var i = params.dataIndex;
|
||||
var s = q.Values[i].Surveys.join(',');
|
||||
console.log(s);
|
||||
if (s.length > 0) {
|
||||
drilldowndetail(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function InitScoreBar(q, content, id, data, text, avgData) {
|
||||
var myChart = echarts.init(content.find('#' + id)[0]);
|
||||
var option = {
|
||||
//title: {
|
||||
// text: q.Title
|
||||
//},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'none'
|
||||
}
|
||||
},
|
||||
color: colors,
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: data,
|
||||
axisTick: {
|
||||
alignWithLabel: true
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: 45
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {},
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
name: '',
|
||||
position: 'left',
|
||||
alignTicks: true,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#5470C6'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: function (value, index) {
|
||||
if ((value + '').indexOf('.') >= 0) {
|
||||
return '';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
//{
|
||||
// type: 'value',
|
||||
// name: '',
|
||||
// position: 'right',
|
||||
// alignTicks: true,
|
||||
// offset: 0,
|
||||
// axisLine: {
|
||||
// show: true,
|
||||
// lineStyle: {
|
||||
// color: '#91CC75'
|
||||
// }
|
||||
// },
|
||||
// axisLabel: {
|
||||
// formatter: '{value}'
|
||||
// }
|
||||
//}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
data: text,
|
||||
type: 'bar',
|
||||
barWidth: 50
|
||||
},
|
||||
//{
|
||||
// name: '',
|
||||
// type: 'line',
|
||||
// yAxisIndex: 1,
|
||||
// data: avgData
|
||||
//}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
|
||||
myChart.on('dblclick', function (params) {
|
||||
var i = params.dataIndex;
|
||||
var s = q.Values[i].Surveys.join(',');
|
||||
console.log(s);
|
||||
if (s.length > 0) {
|
||||
drilldowndetail(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function InitScorePie(q, content, id, pieData) {
|
||||
var myChart1 = echarts.init(content.find('#' + id)[0]);
|
||||
var option1 = {
|
||||
//title: {
|
||||
// text: q.Title,
|
||||
// left: 'center'
|
||||
//},
|
||||
color: colors,
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{b} : {c} ({d}%)'
|
||||
},
|
||||
legend: {
|
||||
type: 'scroll',
|
||||
orient: 'vertical',
|
||||
right: 10,
|
||||
top: 20,
|
||||
bottom: 20,
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['40%', '50%'],
|
||||
data: pieData,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option1 && myChart1.setOption(option1);
|
||||
|
||||
myChart1.on('dblclick', function (params) {
|
||||
var i = params.dataIndex;
|
||||
var s = q.Values[i].Surveys.join(',');
|
||||
console.log(s);
|
||||
if (s.length > 0) {
|
||||
drilldowndetail(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function drilldowndetail(ids) {
|
||||
|
||||
var template = $('#templateselectinput').find("option:selected").val();
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
|
||||
var locations = [];
|
||||
if (locationparam)
|
||||
locations = locationparam.selectedvalue;
|
||||
var advisors = [];
|
||||
if (advisorparam)
|
||||
advisors = advisorparam.selectedvalue;
|
||||
|
||||
var param = JSON.stringify([template, startdate, enddate, JSON.stringify(locations), JSON.stringify(advisors), ids]);
|
||||
param = htmlencode(param);
|
||||
|
||||
setCookieSeconds("WOSurveyReportParams", param, 60);
|
||||
|
||||
window.open("maintenance.aspx?#nav_surveymanagementresult")
|
||||
//alert('testing');
|
||||
}
|
||||
|
||||
function InitReport(report) {
|
||||
var content = $('#surveyreport');
|
||||
content.html('');
|
||||
$('<div></div>').css('font-size', 24).css('text-align', 'center').css('font-weight', 'bold').text(report.TemplateName).appendTo(content);
|
||||
var text = GetTextByKey('P_WOS_TEMPLATES_REPORT_COUNT', 'There are {0} surveys in total.').replace('{0}', report.SurveyCount);
|
||||
if (report.SurveyCount > 0) {
|
||||
text = text + " <a style='font-weight: normal' href='javascript:void(0);' onclick='drilldowndetail();'>" + GetTextByKey('P_MA_DETAIL', 'Detail') + "</a>";
|
||||
}
|
||||
$('<div></div>').css('font-size', 16).css('text-align', 'center').css('font-weight', 'bold').html(text).appendTo(content);
|
||||
$('<br/>').appendTo(content);
|
||||
$('<br/>').appendTo(content);
|
||||
for (var i in report.Questions) {
|
||||
var q = report.Questions[i];
|
||||
if (q.QuestionType === 2) {
|
||||
//Choose
|
||||
$('<div></div>').css('font-size', 24).css('font-weight', 'bold').css('padding-left', '10px').text(q.Title).appendTo(content);
|
||||
var data = [];
|
||||
var vs = [];
|
||||
var pieData = [];
|
||||
for (var j in q.Values) {
|
||||
var vv = q.Values[j];
|
||||
data.push(vv.DisplayText);
|
||||
vs.push(vv.Count);
|
||||
pieData.push({ value: vv.Count, name: vv.DisplayText });
|
||||
}
|
||||
var id = 'choosediv' + i;
|
||||
var div = $('<div id=\'' + id + '\' style=\'display: flex; height: 320px\'></div>');
|
||||
div.appendTo(content);
|
||||
var id = 'choosebardiv' + i;
|
||||
$('<div id=\'' + id + '\'></div>').css('width', '50%').appendTo(div);
|
||||
InitChooseBar(q, content, id, data, vs);
|
||||
id = 'choosepiediv' + i;
|
||||
$('<div id=\'' + id + '\'></div>').css('width', '50%').appendTo(div);
|
||||
InitScorePie(q, content, id, pieData);
|
||||
$('<br/>').appendTo(content);
|
||||
$('<br/>').appendTo(content);
|
||||
}
|
||||
else if (q.QuestionType === 3) {
|
||||
//YesOrNo
|
||||
$('<div></div>').css('font-size', 24).css('font-weight', 'bold').css('padding-left', '10px').text(q.Title).appendTo(content);
|
||||
|
||||
var id = 'yesnobardiv' + i;
|
||||
$('<div id=\'' + id + '\'></div>').css('width', '70%').css('height', '220px').appendTo(content);
|
||||
InitYesNoBar(q, content, id, q.Values[0].DisplayText, q.Values[1].DisplayText, q.Values[0].Count, q.Values[1].Count, i);
|
||||
$('<br/>').appendTo(content);
|
||||
$('<br/>').appendTo(content);
|
||||
} else if (q.QuestionType === 4) {
|
||||
//Score
|
||||
$('<div></div>').css('font-size', 24).css('font-weight', 'bold').css('padding-left', '10px').text(q.Title).appendTo(content);
|
||||
var data = [];
|
||||
var vs = [];
|
||||
var pieData = [];
|
||||
var avgData = [];
|
||||
for (var j in q.Values) {
|
||||
var vv = q.Values[j];
|
||||
data.push(vv.DisplayText);
|
||||
vs.push(vv.Count);
|
||||
pieData.push({ value: vv.Count, name: vv.DisplayText });
|
||||
avgData.push(q.AverageScore);
|
||||
}
|
||||
var id = 'scorediv' + i;
|
||||
var div = $('<div id=\'' + id + '\' style=\'display: flex; height: 320px\'></div>');
|
||||
div.appendTo(content);
|
||||
id = 'scorebardiv' + i;
|
||||
$('<div id=\'' + id + '\'></div>').css('width', '50%').appendTo(div);
|
||||
InitScoreBar(q, content, id, data, vs, avgData);
|
||||
id = 'scorepiediv' + i;
|
||||
$('<div id=\'' + id + '\'></div>').css('width', '50%').appendTo(div);
|
||||
InitScorePie(q, content, id, pieData);
|
||||
$('<br/>').appendTo(content);
|
||||
$('<br/>').appendTo(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var locationparam;
|
||||
var advisorparam;
|
||||
var location_editmultiselect;
|
||||
var advisor_editmultiselect;
|
||||
|
||||
function GetFilterDataSource() {
|
||||
$('#div_locations').empty();
|
||||
$('#div_advisors').empty();
|
||||
reportrequest('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: [],
|
||||
width: 120,
|
||||
valuepath: "ID",
|
||||
textpath: "Name"
|
||||
};
|
||||
location_editmultiselect = editmultiselect(locationparam);
|
||||
$('#div_locations').append(location_editmultiselect);
|
||||
|
||||
advisorparam = {
|
||||
items: JSON.parse(JSON.stringify(data.Advisors)),
|
||||
selectedvalue: [],
|
||||
width: 120
|
||||
};
|
||||
advisor_editmultiselect = editmultiselect(advisorparam);
|
||||
$('#div_advisors').append(advisor_editmultiselect);
|
||||
}, function () {
|
||||
});
|
||||
}
|
||||
|
||||
function getParams(tid) {
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
|
||||
var locations = [];
|
||||
if (locationparam)
|
||||
locations = locationparam.selectedvalue;
|
||||
var advisors = [];
|
||||
if (advisorparam)
|
||||
advisors = advisorparam.selectedvalue;
|
||||
|
||||
return JSON.stringify([tid, startdate, enddate, JSON.stringify(locations), JSON.stringify(advisors)]);
|
||||
}
|
||||
|
||||
var reportData;
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
var template = $('#templateselectinput').find("option:selected").val();
|
||||
var param = getParams(template);
|
||||
param = htmlencode(param);
|
||||
reportrequest('GetSurveyTemplateReport', param, function (data) {
|
||||
showloading(false);
|
||||
//console.log(data);
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey('P_WOS_TEMPLATES_REPORT', "Report"));
|
||||
return;
|
||||
}
|
||||
if (data != null) {
|
||||
InitReport(data);
|
||||
}
|
||||
else {
|
||||
reportData = null;
|
||||
$('#surveyreport').html('');
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function OnPrint() {
|
||||
var selectedTemplate = $('#templateselectinput').find("option:selected");
|
||||
var tid = Number(selectedTemplate.val());
|
||||
if (tid < 0) {
|
||||
showAlert(GetTextByKey("P_WO_XXXX", "Please select a template."), GetTextByKey("P_MR_PRINT", "Print"));
|
||||
return;
|
||||
}
|
||||
var tname = encodeURIComponent(selectedTemplate.text());
|
||||
var start = encodeURIComponent($('#startdatetxt').val());
|
||||
var end = encodeURIComponent($('#enddatetxt').val());
|
||||
var locs = locationparam == null ? '' : encodeURIComponent(locationparam.selectedvalue.map(function (v) {
|
||||
var item = locationparam.items.filter(function (i) { return i.ID == v })[0];
|
||||
if (item != null) {
|
||||
return v + ';' + item.Name;
|
||||
}
|
||||
return v;
|
||||
}).join(','));
|
||||
var advs = advisorparam == null ? '' : encodeURIComponent(advisorparam.selectedvalue.map(function (v) {
|
||||
var item = advisorparam.items.filter(function (i) { return i.Key == v })[0];
|
||||
if (item != null) {
|
||||
return v + ';' + item.Value;
|
||||
}
|
||||
return v;
|
||||
}).join(','));
|
||||
|
||||
window.open('SurveyTemplatePrint.aspx?tid=' + tid + '&tname=' + tname + '&start=' + start + '&end=' + end + '&locs=' + locs + '&advs=' + advs);
|
||||
}
|
||||
|
||||
var grid_contactdt;
|
||||
function InitContactGridData() {
|
||||
grid_contactdt = new GridView('#contactlist');
|
||||
grid_contactdt.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_WO_CONTACTNAME", "Contact Name"), valueIndex: 'DisplayName', css: { 'width': 148, 'text-align': 'left' } },
|
||||
//{ name: 'ContactTypeName', caption: GetTextByKey("P_WO_CONTACTTYPE", "Contact Type"), valueIndex: 'ContactTypeName', css: { 'width': 148, 'text-align': 'left' } },
|
||||
{ name: 'ID', caption: GetTextByKey("P_WO_EMAIL", "Email"), valueIndex: 'ID', css: { 'width': 148, 'text-align': 'left' } },
|
||||
{ name: 'Email', caption: '', valueIndex: 'Email', type: 3, css: { 'width': 60, '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);
|
||||
}
|
||||
grid_contactdt.canMultiSelect = false;
|
||||
grid_contactdt.columns = columns;
|
||||
grid_contactdt.init();
|
||||
}
|
||||
|
||||
function getContacts() {
|
||||
reportrequest("GetAllFollowers", '', function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
var fr = {
|
||||
Values: {
|
||||
ID: r.ID,
|
||||
DisplayName: r.DisplayName,
|
||||
ContactTypeName: r.ContactTypeName,
|
||||
Email: false
|
||||
}
|
||||
};
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_contactdt.setData(rows);
|
||||
}, function () {
|
||||
});
|
||||
}
|
||||
|
||||
function openSendEmail() {
|
||||
$('#email_otheremailaddress').val('');
|
||||
var template = $('#templateselectinput').find("option:selected").val();
|
||||
var tid = Number(template);
|
||||
|
||||
if (isNaN(tid) || tid < 0) {
|
||||
showAlert(GetTextByKey("P_WO_XXXX", "Please select a template."), GetTextByKey("P_WO_SENDEMAIL", "Send Email"));
|
||||
return;
|
||||
}
|
||||
$(document.body).css('overflow', 'hidden');
|
||||
getContacts();
|
||||
|
||||
$('#sendemailpopupmask').css('height', $('#dialog_workorder').height());
|
||||
$('#sendemailpopupmask').css('min-width', $('#divcontent').width());
|
||||
$('#sendemailpopupmask').show();
|
||||
$('#sendemailpopupdialog').show();
|
||||
$('#sendemailpopupdialog').css({
|
||||
"top": ($("#sendemailpopupmask").height() - $('#sendemailpopupdialog').height()) / 2,
|
||||
"left": ($("#sendemailpopupmask").width() - $('#sendemailpopupdialog').width()) / 2
|
||||
});
|
||||
}
|
||||
|
||||
function hideSendEmailPopup() {
|
||||
$('#sendemailpopupmask').hide();
|
||||
$('#sendemailpopupdialog').hide();
|
||||
$(document.body).css('overflow', '');
|
||||
}
|
||||
|
||||
function CheckEmail(mail) {
|
||||
if (mail == null || mail.length == 0)
|
||||
return false;
|
||||
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
||||
return filter.test(mail);
|
||||
}
|
||||
|
||||
function onSendSurveyReport() {
|
||||
var alerttitle = GetTextByKey("P_WO_SENDEMAIL", "Send Email");
|
||||
var emailaddress = [];
|
||||
var otheremailaddressstr = $('#email_otheremailaddress').val();
|
||||
if (otheremailaddressstr !== "") {
|
||||
var address = otheremailaddressstr.split(';');
|
||||
for (var i = 0; i < address.length; i++) {
|
||||
if (!CheckEmail($.trim(address[i]))) {
|
||||
_dialog.showAlert(GetTextByKey("P_WO_OTHERADDRESSINVALID", 'The other email address {0} is invalid.').replace('{0}', emailaddress[i]), alerttitle);
|
||||
return;
|
||||
}
|
||||
emailaddress.push({ 'Key': address[i], 'Value': address[i] });
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < grid_contactdt.source.length; i++) {
|
||||
var ct = grid_contactdt.source[i].Values;
|
||||
if (ct.Email) {
|
||||
emailaddress.push({ 'Key': ct.DisplayName, 'Value': ct.ID });
|
||||
}
|
||||
}
|
||||
|
||||
if (emailaddress.length == 0) {
|
||||
hideSendEmailPopup();
|
||||
return;
|
||||
}
|
||||
|
||||
var template = $('#templateselectinput').find("option:selected").val();
|
||||
var param = getParams(template);
|
||||
reportrequest('GetSurveyTemplateEmail', encodeURIComponent(param + String.fromCharCode(170) + JSON.stringify(emailaddress)), function (data) {
|
||||
if (typeof data === 'string') {
|
||||
_dialog.showAlert(data, alerttitle);
|
||||
return;
|
||||
}
|
||||
hideSendEmailPopup();
|
||||
_dialog.showAlert(GetTextByKey("P_WO_MESSAGESENT", 'Message sent'), alerttitle);
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_WOS_TEMPLATES_REPORT", "Report"), true);
|
||||
InitContactGridData();
|
||||
GetTemplateData();
|
||||
GetFilterDataSource();
|
||||
|
||||
$('.emailpopus-close').on('click', function () {
|
||||
hideSendEmailPopup();
|
||||
});
|
||||
|
||||
$('#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]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#templateselectinput').change(function () { OnRefresh(); });
|
||||
|
||||
});
|
||||
|
||||
function GetTemplateData() {
|
||||
reportrequest("GetSurveyTemplateItems", '', function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_FR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
$('#templateselectinput').empty();
|
||||
$("<option></option>").val("-1").text('').appendTo($("#templateselectinput"));
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
$("<option></option>").val(data[i].Id).text(data[i].Name).appendTo($("#templateselectinput"));
|
||||
}
|
||||
|
||||
//OnRefresh();
|
||||
}, function () {
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_WOS_TEMPLATES_REPORT">Report</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_BEGINDATE_COLON">Begin Date: </span>
|
||||
<div>
|
||||
<input id="startdatetxt" type="text" style="width: 80px; margin-left: 5px;" autocomplete="off" />
|
||||
</div>
|
||||
<span style="margin-left: 5px;" data-lgid="P_FR_ENDDATE_COLON">End Date: </span>
|
||||
<div>
|
||||
<input id="enddatetxt" type="text" style="width: 80px; margin-left: 5px;" autocomplete="off" />
|
||||
</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>
|
||||
<input class="search" style="margin-left: 5px;" type="button" onclick="OnRefresh();" value="View" data-lgid="P_MA_VIEW" />
|
||||
<input class="search" style="margin-left: 5px" type="button" onclick="OnPrint();" value="Print" data-lgid="P_MR_PRINT" />
|
||||
<input class="search" style="width: unset; min-width: 80px; margin-left: 5px" type="button" onclick="openSendEmail();" value="Send Email" data-lgid="P_WO_SENDEMAIL" />
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
<br />
|
||||
<div id="surveyreport"></div>
|
||||
|
||||
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="sendemailpopupmask" class="maskbg" style="display: none;"></div>
|
||||
<div class="dialog" id="sendemailpopupdialog" style="display: none; width: 480px">
|
||||
<div class="dialog-title"><span class="title" data-lgid="P_WO_XXXX">Send Survey Report</span><em class="emailpopus-close"></em></div>
|
||||
<div class="dialog-content" style="height: 350px">
|
||||
<table>
|
||||
<tr>
|
||||
<td data-lgid="P_WO_SENDTHISTO">Who do you want to send this to? Select from existing relationships or manual entry.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div id="contactlist" style="height: 240px; width: 420px; margin-left: 10px; margin-right: 10px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-lgid="P_WO_EMAILADDRESSESTIPS">Separate multiple manually entered email addresses with a semi-colon (;).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span data-lgid="P_WO_OTHEREMAILADDRESS">Other Email Address</span>
|
||||
<input type="text" id="email_otheremailaddress" style="width: 312px;" autocomplete="off" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func">
|
||||
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="emailpopus-close" tabindex="153" />
|
||||
<input type="button" onclick="onSendSurveyReport();" value="OK" data-lgid="P_WO_OK" tabindex="152" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
Reference in New Issue
Block a user