sync
This commit is contained in:
@ -13,6 +13,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
var locationenabledcontrol = undefined;
|
||||
var needsignaturecontrol = undefined;
|
||||
var forworkordercontrol = undefined;
|
||||
var displayidentitycontrol = undefined;
|
||||
var displaycommittimecontrol = undefined;
|
||||
var displaycommitbycontrol = undefined;
|
||||
var displayinspectiontitlecontrol = undefined;
|
||||
@ -31,7 +32,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
|
||||
|
||||
s.prototype.createContent = function () {
|
||||
var content = $('<div style="min-width:1350px;"></div>');
|
||||
var content = $('<div style="min-width:1450px;"></div>');
|
||||
this.content = content;
|
||||
var _this = this;
|
||||
function createHeader() {
|
||||
@ -111,19 +112,23 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
forworkordercontrol = $('<input type="checkbox"/>');
|
||||
td.append(forworkordercontrol);
|
||||
}
|
||||
td.append($('<span style="margin-left:40px"></span>').text(GetTextByKey("P_IPT_DISPLAYIDENTIFIEDISSUES_COLON", "Display Identified Issues:")));
|
||||
displayidentitycontrol = $('<input type="checkbox" checked="checked"/>');
|
||||
td.append(displayidentitycontrol);
|
||||
|
||||
tr.append(td);
|
||||
|
||||
tr = $('<tr class="templatetr"></tr>');
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label" style="width:160px;">' + GetTextByKey("P_IPT_XXXXX_COLON", "Display Commit Time:") + '</td>');
|
||||
tr.append('<td class="label" style="width:160px;">' + GetTextByKey("P_IPT_DISPLAYCOMMITTIME_COLON", "Display Commit Time:") + '</td>');
|
||||
displaycommittimecontrol = $('<input type="checkbox" checked="checked"/>');
|
||||
displaycommitbycontrol = $('<input type="checkbox" checked="checked"/>');
|
||||
displayinspectiontitlecontrol = $('<input type="checkbox" checked="checked"/>');
|
||||
var td = $('<td></td>').append(
|
||||
displaycommittimecontrol,
|
||||
$('<span style="margin-left:40px"></span>').text(GetTextByKey("P_IPT_XXXXXX_COLON", "Display Commit By:")),
|
||||
$('<span style="margin-left:40px"></span>').text(GetTextByKey("P_IPT_DISPLAYCOMMITBY_COLON", "Display Commit By:")),
|
||||
displaycommitbycontrol,
|
||||
$('<span style="margin-left:40px"></span>').text(GetTextByKey("P_IPT_XXXXXX_COLON", "Display Inspection Title:")),
|
||||
$('<span style="margin-left:40px"></span>').text(GetTextByKey("P_IPT_DISPLAYINSPECTIONTITLE_COLON", "Display Inspection Title:")),
|
||||
displayinspectiontitlecontrol
|
||||
);
|
||||
tr.append(td);
|
||||
@ -203,39 +208,35 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
}
|
||||
|
||||
function createEmailContent() {
|
||||
var tb = $('<table style="line-height:25px;margin-top:10px;"></table>');
|
||||
var tb = $('<table style="line-height:24px;margin-top:10px;width:470px;"></table>');
|
||||
|
||||
var tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
tr.append($('<td>' + GetTextByKey('P_IPT_SENDTHISTO', 'Who do you want to send this to? Select from existing relationships or manual entry.') + '</td>'));
|
||||
tr.append($('<td colspan="2">' + GetTextByKey('P_IPT_SENDTHISTO', 'Who do you want to send this to? Select from existing relationships or manual entry.') + '</td>'));
|
||||
|
||||
tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
tr.append($('<td></td>').append(InitContactGridData()));
|
||||
tr.append($('<td colspan="2"></td>').append(InitContactGridData()));
|
||||
|
||||
tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
tr.append($('<td>' + GetTextByKey("P_IPT_EMAILADDRESSESTIPS", "Separate multiple manually entered email addresses with a semi-colon (;).") + '</td>'));
|
||||
tr.append($('<td colspan="2">' + GetTextByKey("P_IPT_EMAILADDRESSESTIPS", "Separate multiple manually entered email addresses with a semi-colon (;).") + '</td>'));
|
||||
|
||||
tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
otheremailcontrol = $('<input type="text" class="form-control" maxlength="1000" autocomplete="off" style="margin-left:5px;width: 312px;" autocomplete="off" />');
|
||||
tr.append($('<td><span>' + GetTextByKey("P_IPT_OTHEREMAILADDRESS", "Other Email Address") + '</span></td>').append(otheremailcontrol));
|
||||
otheremailcontrol = $('<input type="text" class="form-control" maxlength="1000" autocomplete="off" style="width: 350px;" autocomplete="off" />');
|
||||
tr.append($('<td style="padding-right:5px;"><span>' + GetTextByKey("P_IPT_OTHEREMAILADDRESS", "Other Email Address") + '</span></td>'));
|
||||
tr.append($('<td></td>').append(otheremailcontrol));
|
||||
|
||||
td = $('<td></td>');
|
||||
td = $('<td colspan="2"></td>');
|
||||
tr.append(td);
|
||||
|
||||
return tb;
|
||||
}
|
||||
|
||||
function InitContactGridData() {
|
||||
var div_grid = $('<div style="width:430px;height:160px;"></div>');
|
||||
grid_contactdt = new GridView(div_grid);
|
||||
grid_contactdt.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
var div_grid = $('<div style="width:470px;height:160px;"></div>');
|
||||
grid_contactdt = createGridView(div_grid);
|
||||
var list_columns = [
|
||||
{ name: 'UserName', caption: GetTextByKey("P_IPT_CONTACTNAME", "Contact Name"), valueIndex: 'UserName', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'ContactType', caption: GetTextByKey("P_IPT_CONTACTTYPE", "Contact Type"), valueIndex: 'ContactType', css: { 'width': 180, 'text-align': 'left' } },
|
||||
@ -265,12 +266,6 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
grid_contactdt.canMultiSelect = false;
|
||||
grid_contactdt.columns = columns;
|
||||
grid_contactdt.init();
|
||||
|
||||
grid_contactdt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_contactdt.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
return div_grid;
|
||||
}
|
||||
|
||||
@ -308,8 +303,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
}
|
||||
}
|
||||
}
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
rows.push(r);
|
||||
}
|
||||
|
||||
grid_contactdt.setData(rows);
|
||||
@ -342,11 +336,11 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
filtertd.empty();
|
||||
|
||||
pagesicon = $('<div class="section-icon" style="width:30px;margin:10px 0 5px 15px;font-size:18px;color:#666;">' + GetTextByKey("P_IPT_PAGES", "Pages") + '</div>');
|
||||
content.append(pagesicon);
|
||||
subcontent.append(pagesicon);
|
||||
var template = _this.template;
|
||||
|
||||
if (template.Id) {
|
||||
if ((!template.IssueId || template.IssueId == "") && (template.Editable))
|
||||
if (template.Editable)
|
||||
editable = true;
|
||||
else
|
||||
editable = false;
|
||||
@ -356,6 +350,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
needsignaturecontrol.prop('checked', template.NeedSignature);
|
||||
if (forworkordercontrol)
|
||||
forworkordercontrol.prop('checked', template.ForWorkOrder);
|
||||
displayidentitycontrol.prop('checked', template.DisplayInspectionIssues);
|
||||
|
||||
displaycommittimecontrol.prop('checked', template.DisplayCommitTime);
|
||||
displaycommitbycontrol.prop('checked', template.DisplayCommitBy);
|
||||
@ -364,8 +359,6 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
layoutcontrol.val(template.ReportLayoutId);
|
||||
if (IsForesight) {
|
||||
lockedcontrol.prop('checked', !template.Editable);
|
||||
if (template.IssueId && template.IssueId != "")
|
||||
lockedcontrol.prop('disabled', true);
|
||||
}
|
||||
|
||||
notescontrol.val(template.Notes);
|
||||
@ -374,7 +367,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
var next = function () {
|
||||
pages = new Pages(template.Pages);
|
||||
pagescontent = pages.createContent();
|
||||
content.append(pagescontent);
|
||||
subcontent.append(pagescontent);
|
||||
if (!teamintelligence) {
|
||||
filtersmodule = new Filters(template.Filters)
|
||||
filtertd.append(filtersmodule.createContent(template));
|
||||
@ -393,7 +386,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
var next = function () {
|
||||
pages = new Pages();
|
||||
pagescontent = pages.createContent();
|
||||
content.append(pagescontent);
|
||||
subcontent.append(pagescontent);
|
||||
if (!teamintelligence) {
|
||||
filtersmodule = new Filters()
|
||||
filtertd.append(filtersmodule.createContent());
|
||||
@ -431,6 +424,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
|
||||
if (forworkordercontrol)
|
||||
forworkordercontrol.prop('disabled', false);
|
||||
displayidentitycontrol.prop('disabled', false);
|
||||
|
||||
displaycommittimecontrol.prop('disabled', false);
|
||||
displaycommitbycontrol.prop('disabled', false);
|
||||
@ -446,6 +440,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
needsignaturecontrol.prop('disabled', true);
|
||||
if (forworkordercontrol)
|
||||
forworkordercontrol.prop('disabled', true);
|
||||
displayidentitycontrol.prop('disabled', true);
|
||||
|
||||
displaycommittimecontrol.prop('disabled', true);
|
||||
displaycommitbycontrol.prop('disabled', true);
|
||||
@ -463,6 +458,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
needsignaturecontrol.prop('disabled', true);
|
||||
if (forworkordercontrol)
|
||||
forworkordercontrol.prop('disabled', true);
|
||||
displayidentitycontrol.prop('disabled', true);
|
||||
|
||||
displaycommittimecontrol.prop('disabled', true);
|
||||
displaycommitbycontrol.prop('disabled', true);
|
||||
@ -534,7 +530,7 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
};
|
||||
if (forworkordercontrol)
|
||||
item.ForWorkOrder = forworkordercontrol.prop('checked');
|
||||
|
||||
item.DisplayInspectionIssues = displayidentitycontrol.prop('checked');
|
||||
if (teamintelligence)
|
||||
item.Target = 1;
|
||||
|
||||
@ -584,8 +580,9 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
}
|
||||
item.Emails = otheremailaddressstr;
|
||||
item.EmailList = [];
|
||||
for (var i = 0; i < grid_contactdt.source.length; i++) {
|
||||
var ct = grid_contactdt.source[i].Values;
|
||||
var tempsource = grid_contactdt.source;
|
||||
for (var i = 0; i < tempsource.length; i++) {
|
||||
var ct = tempsource[i];
|
||||
if (ct.Selected)
|
||||
item.EmailList.push(ct);
|
||||
}
|
||||
@ -620,6 +617,10 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < pages.pageModules.length; i++) {
|
||||
pages.pageModules[i]?.refreshIdIndex();
|
||||
}
|
||||
}
|
||||
|
||||
item.Filters = [];
|
||||
@ -635,18 +636,23 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
inspectionrequest("SaveTemplate", p, function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_IPT_SAVETEMPLATE", 'Save Template'));
|
||||
} else {
|
||||
return;
|
||||
} else if (typeof data === 'number') {
|
||||
if (!_this.template.Id) {
|
||||
_this.template.Id = data[0];
|
||||
}
|
||||
if (exit == 0) {
|
||||
showAlert(GetTextByKey("P_IPT_SAVSUCCESSFULLY", 'Saved successfully.'), GetTextByKey("P_IPT_SAVETEMPLATE", 'Save Template'));
|
||||
_this.datasaved = true;
|
||||
}
|
||||
if (exit == 1) {
|
||||
_this.gsmodule.refresh();
|
||||
showRightPopup(false);
|
||||
_this.template.Id = data;
|
||||
}
|
||||
} else {
|
||||
_this.template = data;
|
||||
}
|
||||
if (exit == 0) {
|
||||
showAlert(GetTextByKey("P_IPT_SAVSUCCESSFULLY", 'Saved successfully.'), GetTextByKey("P_IPT_SAVETEMPLATE", 'Save Template'));
|
||||
_this.datasaved = true;
|
||||
} else {
|
||||
|
||||
}
|
||||
if (exit == 1) {
|
||||
_this.gsmodule.refresh();
|
||||
showRightPopup(false);
|
||||
}
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_IPT_FAILEDTOSAVETEMPLATE", 'Failed to save Template.'), GetTextByKey("P_IPT_SAVETEMPLATE", 'Save Template'));
|
||||
@ -654,7 +660,9 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
}
|
||||
|
||||
content.append(createHeader());
|
||||
content.append(createTemplateContent());
|
||||
var subcontent = $('<div style="overflow:auto;"></div>');
|
||||
content.append(subcontent);
|
||||
subcontent.append(createTemplateContent());
|
||||
|
||||
if (this.template.Id)
|
||||
getTemplateInfo(this.template.Id);
|
||||
@ -666,6 +674,12 @@ define(['modules/templates/pages', 'modules/templates/filters', 'modules/templat
|
||||
|
||||
if (templatereadonly)
|
||||
setDisabled();
|
||||
function resizeContent() {
|
||||
subcontent.css('height', $(window).height() - 95);
|
||||
}
|
||||
window.onresize = resizeContent;
|
||||
resizeContent();
|
||||
|
||||
return content;
|
||||
}
|
||||
return s;
|
||||
|
@ -62,6 +62,7 @@ define(['common'], function (Common) {
|
||||
this.txtmake = null;
|
||||
this.txtmodel = null;
|
||||
this.txttype = null;
|
||||
this.txtgroup = null;
|
||||
this.ondelete = null;
|
||||
};
|
||||
fm.prototype.description = "Template filter module";
|
||||
@ -91,6 +92,10 @@ define(['common'], function (Common) {
|
||||
this.txttype = $('<td style="width:120px;padding-left:5px;overflow:hidden;"></td>');
|
||||
tr.append(this.txttype);
|
||||
|
||||
tr.append($('<td style="width:115px;text-align:right;">' + GetTextByKey("P_AM_ASSETGROUP_COLON", "Asset Group:") + '</td>'));
|
||||
this.txtgroup = $('<td style="width:120px;padding-left:5px;overflow:hidden;"></td>');
|
||||
tr.append(this.txtgroup);
|
||||
|
||||
var btnedit = $('<em class="spanbtn iconedit"></em>').click(function () {
|
||||
_this.editFilter();
|
||||
}).attr('title', GetTextByKey("P_IPT_EDIT", 'Edit'));
|
||||
@ -116,6 +121,7 @@ define(['common'], function (Common) {
|
||||
this.txtmake.text(flt.MakeName);
|
||||
this.txtmodel.text(flt.ModelName);
|
||||
this.txttype.text(flt.TypeName);
|
||||
this.txtgroup.text(flt.AssetGroupName);
|
||||
}
|
||||
}
|
||||
fm.prototype.getFilterValue = function () {
|
||||
@ -145,7 +151,7 @@ define(['common'], function (Common) {
|
||||
var selMake = null;
|
||||
var selModel = null;
|
||||
var selType = null;
|
||||
|
||||
var selGroup = null;
|
||||
var _this = this;
|
||||
|
||||
this.beginEdit = function (filter, onok) {
|
||||
@ -154,14 +160,16 @@ define(['common'], function (Common) {
|
||||
if (this.filter) {
|
||||
txtVIN.val(this.filter.VIN);
|
||||
selMake.val(this.filter.AssetMake);
|
||||
selModel.val(this.filter.AssetModel);
|
||||
selType.val(this.filter.AssetType);
|
||||
selModel.dropdownVal(this.filter.AssetModel);
|
||||
selType.dropdownVal(this.filter.AssetType);
|
||||
selGroup.dropdownVals(this.filter.AssetGroups || []);
|
||||
}
|
||||
else {
|
||||
txtVIN.val('');
|
||||
selMake.val('-1');
|
||||
selModel.val('-1');
|
||||
selType.val('-1');
|
||||
selModel.dropdownVal(-1);
|
||||
selType.dropdownVal(-1);
|
||||
selGroup.dropdownVals([]);
|
||||
}
|
||||
showAssetModels();
|
||||
|
||||
@ -173,7 +181,7 @@ define(['common'], function (Common) {
|
||||
}
|
||||
|
||||
this.createContent = function () {
|
||||
var tb = $('<table></table>');
|
||||
var tb = $('<table style="line-height:30px;"></table>');
|
||||
var tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label">' + GetTextByKey("P_IPT_VINSN_COLON", "VIN/SN:") + '</td>');
|
||||
@ -192,35 +200,71 @@ define(['common'], function (Common) {
|
||||
tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label">' + GetTextByKey("P_IPT_MODEL_COLON", "Model:") + '</td>');
|
||||
selModel = $('<select class="form-control" style="width:204px;height:22px;"></select>');
|
||||
tr.append($('<td></td>').append(selModel));
|
||||
var td = $('<td></td>');
|
||||
tr.append(td);
|
||||
selModel = $('<div></div>').css('width', 204).dropdown([], {
|
||||
search: true,
|
||||
multiselect: false,
|
||||
allowselectall: true,
|
||||
textKey: 'Name',
|
||||
valueKey: 'ID'
|
||||
});
|
||||
td.append(selModel);
|
||||
|
||||
tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label">' + GetTextByKey("P_IPT_ASSETTYPE_COLON", "Asset Type:") + '</td>');
|
||||
selType = $('<select class="form-control" style="width:204px;height:22px;"></select>');
|
||||
tr.append($('<td></td>').append(selType));
|
||||
td = $('<td></td>');
|
||||
tr.append(td);
|
||||
selType = $('<div></div>').css('width', 204).dropdown([], {
|
||||
search: true,
|
||||
multiselect: false,
|
||||
allowselectall: true,
|
||||
textKey: 'Name',
|
||||
valueKey: 'ID'
|
||||
});
|
||||
td.append(selType);
|
||||
|
||||
|
||||
tr = $('<tr></tr>');
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label">' + GetTextByKey("P_AM_ASSETGROUP_COLON", "Asset Group:") + '</td>');
|
||||
td = $('<td></td>');
|
||||
tr.append(td);
|
||||
selGroup = $('<div></div>').css('width', 204).dropdown([], {
|
||||
search: true,
|
||||
multiselect: true,
|
||||
allowselectall: true,
|
||||
textKey: 'Name',
|
||||
valueKey: 'Id'
|
||||
});
|
||||
td.append(selGroup);
|
||||
|
||||
getAssetMakes();
|
||||
getAssetModels();
|
||||
getAssetTypes();
|
||||
getAssetGroups();
|
||||
|
||||
function OnSave() {
|
||||
var item = {
|
||||
'VIN': $.trim(txtVIN.val()),
|
||||
'AssetMake': selMake.val(),
|
||||
'MakeName': selMake.find("option:selected").text(),
|
||||
'AssetModel': selModel.val(),
|
||||
'ModelName': selModel.find("option:selected").text(),
|
||||
'AssetType': selType.val(),
|
||||
'TypeName': selType.find("option:selected").text()
|
||||
'AssetModel': selModel.dropdownVal(),
|
||||
'ModelName': selModel.dropdownItem().Name,
|
||||
'AssetType': selType.dropdownVal(),
|
||||
'TypeName': selType.dropdownItem().Name,
|
||||
'AssetGroups': selGroup.dropdownVals(),
|
||||
'AssetGroupName': selGroup.dropdownTexts().join(',')
|
||||
};
|
||||
if (!item.AssetMake || item.AssetMake == '')
|
||||
item.AssetMake = '-1';
|
||||
if (!item.AssetModel || item.AssetModel == '')
|
||||
item.AssetModel = '-1';
|
||||
item.AssetModel = -1;
|
||||
if (!item.AssetType || item.AssetType == '')
|
||||
item.AssetType = '-1';
|
||||
item.AssetType = -1;
|
||||
if (!item.AssetGroup || item.AssetGroup == '')
|
||||
item.AssetGroup = [];
|
||||
if (_this.onok)
|
||||
_this.onok(item);
|
||||
_this.dialog.hideDialog();
|
||||
@ -233,6 +277,7 @@ define(['common'], function (Common) {
|
||||
var makesdata = undefined;
|
||||
var modelsdata = undefined;
|
||||
var typesdata = undefined;
|
||||
var groupsdata = undefined;
|
||||
function getAssetMakes() {
|
||||
inspectionrequest("GetAssetMakes", "", function (data) {
|
||||
if (data && data.length > 0) {
|
||||
@ -265,6 +310,16 @@ define(['common'], function (Common) {
|
||||
});
|
||||
}
|
||||
|
||||
function getAssetGroups() {
|
||||
inspectionrequest("GetAssetGroups", "", function (data) {
|
||||
if (data && data.length > 0) {
|
||||
groupsdata = data;
|
||||
showAssetGroups();
|
||||
}
|
||||
}, function (err) {
|
||||
});
|
||||
}
|
||||
|
||||
function showAssetMakes() {
|
||||
selMake.append('<option value="-1">*</option>');
|
||||
if (makesdata && makesdata.length > 0) {
|
||||
@ -280,35 +335,53 @@ define(['common'], function (Common) {
|
||||
}
|
||||
|
||||
function showAssetModels() {
|
||||
selModel.empty();
|
||||
var makeid = selMake.val();
|
||||
selModel.append('<option value="-1">*</option>');
|
||||
if (!makeid || makeid == "-1")
|
||||
selModel.prop('disabled', true);
|
||||
selModel.dropdownDisabled(true);
|
||||
else
|
||||
selModel.prop('disabled', false);
|
||||
selModel.dropdownDisabled(false);
|
||||
|
||||
var match_items = [];
|
||||
match_items.push({ ID: -1, Name: '*' });
|
||||
if (modelsdata && modelsdata.length > 0 && makeid != "-1") {
|
||||
for (var i = 0; i < modelsdata.length; i++) {
|
||||
var item = modelsdata[i];
|
||||
if (item.MakeID == parseInt(makeid)) {
|
||||
selModel.append('<option value="' + item.ID + '">' + item.Name + '</option>');
|
||||
match_items.push(item);
|
||||
}
|
||||
}
|
||||
if (_this.filter)
|
||||
selModel.val(_this.filter.AssetModel);
|
||||
}
|
||||
selModel.dropdownSource(match_items);
|
||||
selModel.dropdownVal(-1);
|
||||
if (_this.filter)
|
||||
selModel.dropdownVal(_this.filter.AssetModel);
|
||||
}
|
||||
|
||||
function showAssetTypes() {
|
||||
selType.append('<option value="-1">*</option>');
|
||||
var match_items = [];
|
||||
match_items.push({ ID: -1, Name: '*' });
|
||||
if (typesdata && typesdata.length > 0) {
|
||||
for (var i = 0; i < typesdata.length; i++) {
|
||||
var item = typesdata[i];
|
||||
selType.append('<option value="' + item.Key + '">' + item.Value + '</option>');
|
||||
match_items.push(typesdata[i]);
|
||||
}
|
||||
if (_this.filter)
|
||||
selType.val(_this.filter.AssetType);
|
||||
}
|
||||
|
||||
selType.dropdownSource(match_items);
|
||||
if (_this.filter)
|
||||
selType.dropdownVal(_this.filter.AssetType);
|
||||
}
|
||||
|
||||
function showAssetGroups() {
|
||||
var match_items = [];
|
||||
if (groupsdata && groupsdata.length > 0) {
|
||||
for (var i = 0; i < groupsdata.length; i++) {
|
||||
match_items.push(groupsdata[i]);
|
||||
}
|
||||
}
|
||||
|
||||
selGroup.dropdownSource(match_items);
|
||||
if (_this.filter)
|
||||
selGroup.dropdownVals(_this.filter.AssetGroups || []);
|
||||
}
|
||||
};
|
||||
/************end addfilter module***************/
|
||||
|
@ -133,13 +133,13 @@ define(['common'], function (Common) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var it = data[i];
|
||||
if (excepts == null || !excepted(it.Id, excepts)) {
|
||||
items.push({ Values: it });
|
||||
items.push(it);
|
||||
}
|
||||
}
|
||||
gridctrl.setData(items);
|
||||
maskbg.hide();
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_IPT_FAILEDTOGETTHESECTIONS1",'Failed to get the sections.'), title);
|
||||
showAlert(GetTextByKey("P_IPT_FAILEDTOGETTHESECTIONS1", 'Failed to get the sections.'), title);
|
||||
maskbg.hide();
|
||||
});
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
this.namecontrol = undefined;
|
||||
this.displaytextcontrol = undefined;
|
||||
this.notescontrol = undefined;
|
||||
this.displayonreportcontrol = undefined;
|
||||
this.onNameChanged = undefined;
|
||||
this.datacontent = null;
|
||||
|
||||
@ -28,18 +29,19 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label" style="width:154px;">' + GetTextByKey("P_IPT_NAME_COLON", "Name:") + '<span class="redasterisk">*</span></td>');
|
||||
_this.namecontrol = $('<input type="text" class="form-control" maxlength="100" autocomplete="off"/>');
|
||||
var addiText = $('<span class="spanbtn iconmultitext" style="font-size:14px;" title="' + GetTextByKey("P_IPT_XXX", "Language Selection") + '"/>');
|
||||
var addiText = $('<span class="spanbtn iconmultitext" style="font-size:14px;" title="' + GetTextByKey("P_IPT_LANGUAGESELECTION", "Language Selection") + '"/>');
|
||||
addiText.click(function () {
|
||||
Common.createMultiTextDialog(_this.namecontrol);
|
||||
});
|
||||
tr.append($('<td style="white-space:nowrap;"></td>').append(_this.namecontrol).append(addiText));
|
||||
tr.append($('<td style="white-space:nowrap;width:370px;"></td>').append(_this.namecontrol).append(addiText));
|
||||
_this.namecontrol.change(function () {
|
||||
if (_this.onNameChanged)
|
||||
_this.onNameChanged($.trim(_this.namecontrol.val()))
|
||||
})
|
||||
|
||||
tr.append($('<td></td>'));
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label" style="width:154px;">' + GetTextByKey("P_IPT_NOTES_COLON", "Notes:") + '</td>');
|
||||
|
||||
tr.append('<td class="label" style="width:100px;">' + GetTextByKey("P_IPT_NOTES_COLON", "Notes:") + '</td>');
|
||||
_this.notescontrol = $('<textarea id="dialog_notes" class="form-control" maxlength="500" autocomplete="off" style="width: 540px; margin-top:6px;height:55px;"></textarea>');
|
||||
tr.append($('<td rowspan="2"></td>').append(_this.notescontrol));
|
||||
|
||||
@ -47,19 +49,27 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
tb.append(tr);
|
||||
tr.append('<td class="label" style="width:154px;">' + GetTextByKey("P_IPT_DISPLAYTEXT_COLON", "Display Text:") + '<span class="redasterisk">*</span></td>');
|
||||
_this.displaytextcontrol = $('<input type="text" class="form-control" maxlength="200" autocomplete="off"/>');
|
||||
addiText = $('<span class="spanbtn iconmultitext" style="font-size:14px;" title="' + GetTextByKey("P_IPT_XXX", "Language Selection") + '"/>');
|
||||
addiText = $('<span class="spanbtn iconmultitext" style="font-size:14px;" title="' + GetTextByKey("P_IPT_LANGUAGESELECTION", "Language Selection") + '"/>');
|
||||
addiText.click(function () {
|
||||
Common.createMultiTextDialog(_this.displaytextcontrol);
|
||||
});
|
||||
tr.append($('<td style="white-space:nowrap;"></td>').append(_this.displaytextcontrol).append(addiText));
|
||||
|
||||
var td_displayonreport = $('<td></td>')
|
||||
.attr('title', GetTextByKey("P_IPT_PAGEDISPLAYONREPORTTIPS", 'Checked indicates that there will be a \n Page Break and Page Title on the report.\n\n Unchecked indicates that the Page Break \n is only visible during inspection completion.'));
|
||||
|
||||
tr.append(td_displayonreport);
|
||||
_this.displayonreportcontrol = $('<input id="tempchk1" type="checkbox"/>');
|
||||
td_displayonreport.append(_this.displayonreportcontrol);
|
||||
td_displayonreport.append("<label for='tempchk1' data-lgid='P_IPT_DISPLAYONREPORT'>Display on Report</label>");
|
||||
|
||||
var sectioncontent = createSectionContent();
|
||||
div_main.append(sectioncontent);
|
||||
return div_main;
|
||||
}
|
||||
|
||||
function createSectionContent() {
|
||||
var content = $('<div style="min-width:1820px;"></div>');
|
||||
var content = $('<div style="min-width:1780px;"></div>');
|
||||
|
||||
function createSectionHeader() {
|
||||
var header = $('<div></div>');
|
||||
@ -72,7 +82,7 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
// updateContent(true);
|
||||
//}
|
||||
//$('#right_popup1').empty().append(s.createContent()).show();
|
||||
var section = {};
|
||||
var section = { DisplayOnReport: true };
|
||||
_this.page.Sections.push(section);
|
||||
addSectionModule(section);
|
||||
});
|
||||
@ -91,11 +101,12 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
|
||||
var dataheader = $('<div class="question-holder no-hover" style="font-weight: bold;font-size:14px;"></div>');
|
||||
dataheader.append('<div style="width: 60px; flex-shrink: 0"></div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 200px">' + GetTextByKey("P_IPT_NAME", "Name") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 235px">' + GetTextByKey("P_IPT_NAME", "Name") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 310px">' + GetTextByKey("P_IPT_DISPLAYTEXT", "Display Text") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 400px">' + GetTextByKey("P_IPT_TYPE", "Type") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 80px; text-align: center">' + GetTextByKey("P_IPT_REQUIRED", "Required") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 65px; text-align: center;white-space:normal;line-height:20px;">' + GetTextByKey("P_IPT_XXX", "Include Comment") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 370px">' + GetTextByKey("P_IPT_TYPE", "Type") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 80px; text-align: center;white-space:normal;line-height:20px;">' + GetTextByKey("P_IPT_DISPLAYONREPORT", "Display on Report") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 80px; text-align: center;">' + GetTextByKey("P_IPT_REQUIRED", "Required") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 65px; text-align: center;white-space:normal;line-height:20px;">' + GetTextByKey("P_IPT_INCLUDECOMMENT", "Include Comment") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 70px; text-align: center;white-space:normal;line-height:20px;">' + GetTextByKey("P_IPT_ISIMPORTANT", "Is Important") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 70px; text-align: center;white-space:normal;line-height:20px;"">' + GetTextByKey("P_IPT_CUSTOMERVISIBLE", "Customer Visible") + '</div>');
|
||||
dataheader.append('<div class="question-cell" style="width: 80px; text-align: center;white-space:normal;line-height:20px;">' + GetTextByKey("P_IPT_SEVERITYLEVEL", "Severity Level") + '</div>');
|
||||
@ -114,6 +125,7 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
_this.namecontrol.val(_this.page.Name).data("texts", _this.page.LocalNames);
|
||||
_this.displaytextcontrol.val(_this.page.DisplayText).data("texts", _this.page.LocalDisplayTexts);
|
||||
_this.notescontrol.val(_this.page.Notes);
|
||||
_this.displayonreportcontrol.attr('checked', _this.page.DisplayOnReport);
|
||||
}
|
||||
|
||||
if (_this.page.Sections) {
|
||||
@ -121,20 +133,22 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
_this.datacontent.empty();
|
||||
for (var i = 0; i < _this.page.Sections.length; i++) {
|
||||
//var s = new Section(_this.page.Sections[i], null, _this);
|
||||
addSectionModule(_this.page.Sections[i]);
|
||||
addSectionModule(_this.page.Sections[i], i);
|
||||
}
|
||||
} else
|
||||
_this.page.Sections = [];
|
||||
}
|
||||
|
||||
function addSectionModule(s) {
|
||||
var sectionmodule = new Section(s, null, _this);
|
||||
function addSectionModule(s, index) {
|
||||
var sectionmodule = new Section(s, null, _this, index);
|
||||
sectionmodule.oncopy = function (section) {
|
||||
section = JSON.parse(JSON.stringify(section));
|
||||
section.Id = "";
|
||||
section.Conditional = null;
|
||||
if (!section.IsLink && section.Questions) {
|
||||
for (var j = 0; j < section.Questions.length; j++) {
|
||||
section.Questions[j].Id = "";
|
||||
section.Questions[j].Conditional = null;
|
||||
}
|
||||
}
|
||||
_this.page.Sections.push(section);
|
||||
@ -152,6 +166,7 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
_this.namecontrol.prop('disabled', true);
|
||||
_this.displaytextcontrol.prop('disabled', true);
|
||||
_this.notescontrol.prop('disabled', true);
|
||||
_this.displayonreportcontrol.prop('disabled', true);
|
||||
|
||||
content.find(".iconmultitext").hide();
|
||||
content.find(".iconimage").hide();
|
||||
@ -179,7 +194,7 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
}
|
||||
if (sections && sections.length > 0) {
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
var it = sections[i].Values;
|
||||
var it = sections[i];
|
||||
if (it.Selected && linkedSectionIds.indexOf(it.Id) >= 0) {
|
||||
showAlert(GetTextByKey("P_IPT_ALREADYLINKED", '{0} has already been linked to current template.').replace("{0}", it.Name), GetTextByKey("P_ADDGLOBALSECTION", "Add Global Section"));
|
||||
return;
|
||||
@ -205,7 +220,7 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
if (sections && sections.length > 0) {
|
||||
var sids = [];
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
var it = sections[i].Values;
|
||||
var it = sections[i];
|
||||
if (it.Selected)
|
||||
sids.push(it.Id);
|
||||
}
|
||||
@ -252,6 +267,7 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
page.Name = this.namecontrol.val();
|
||||
page.DisplayText = this.displaytextcontrol.val();
|
||||
page.Notes = this.notescontrol.val();
|
||||
page.DisplayOnReport = this.displayonreportcontrol.prop('checked');
|
||||
|
||||
var texts = this.namecontrol.data("texts");
|
||||
if (texts) {
|
||||
@ -308,6 +324,69 @@ define(['modules/sections/section', 'modules/sections/addsection', 'common', 'mo
|
||||
this.sectionmodules.splice(tindex, 0, sm);
|
||||
}
|
||||
};
|
||||
|
||||
p.prototype.refreshIdIndex = function () {
|
||||
var id = 0;
|
||||
var needRefreshes = [];
|
||||
var needReloads = [];
|
||||
for (var s = 0; s < this.sectionmodules.length; s++) {
|
||||
var section = this.sectionmodules[s];
|
||||
section.index = s;
|
||||
section.btncondition.css('display', section.conditionalTree.init() ? '' : 'none');
|
||||
for (var i = 0; i < section.questionmodules.length; i++) {
|
||||
var question = section.questionmodules[i];
|
||||
question.idIndex = ++id;
|
||||
question.questionholder.children('.question-index').text('#' + String(id));
|
||||
question.btncondition.css('display', question.conditionalTree.init() ? '' : 'none');
|
||||
if (question.conditional?.QuestionId != null) {
|
||||
needReloads.push(question);
|
||||
}
|
||||
var root = question.conditionalTree;
|
||||
if (root == null) {
|
||||
continue;
|
||||
}
|
||||
root.initialized = false;
|
||||
if (root.tree?.is(':visible')) {
|
||||
needRefreshes.push(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
var qs = this.sectionmodules.reduce(function (array, s) { return array.concat(s.questionmodules) }, []);
|
||||
for (var i = 0; i < needReloads.length; i++) {
|
||||
var q = needReloads[i];
|
||||
var conditional = q.conditional;
|
||||
var r = cleanConditional(conditional, q.idIndex, qs);
|
||||
if (r) {
|
||||
q.conditional.QuestionId = '-';
|
||||
q.conditional.SubItems = [];
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < needRefreshes.length; i++) {
|
||||
needRefreshes[i].refresh();
|
||||
}
|
||||
};
|
||||
|
||||
function cleanConditional(c, index, qs) {
|
||||
if (!['-', 'or', 'and'].includes(c.QuestionId)) {
|
||||
var cq = qs.find(function (q) { return q.question.Id == c.QuestionId });
|
||||
if (cq == null) {
|
||||
return true;
|
||||
}
|
||||
if (cq.idIndex >= index) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (c.SubItems?.length > 0) {
|
||||
for (var i = c.SubItems.length - 1; i >= 0; i--) {
|
||||
var r = cleanConditional(c.SubItems[i], index, qs);
|
||||
if (r) {
|
||||
c.SubItems.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return p;
|
||||
});
|
||||
|
||||
|
@ -34,7 +34,7 @@ define(['modules/templates/page'], function (Page) {
|
||||
|
||||
function addTab(p, newadd) {
|
||||
if (!p) {
|
||||
p = {};
|
||||
p = { 'DisplayOnReport': true };
|
||||
_this.pages.push(p);
|
||||
}
|
||||
var tabName = 'tab_' + tabIndex++;
|
||||
@ -149,10 +149,12 @@ define(['modules/templates/page'], function (Page) {
|
||||
for (var i = 0; i < p.Sections.length; i++) {
|
||||
var s = p.Sections[i];
|
||||
s.Id = "";
|
||||
s.Conditional = null;
|
||||
if (s.Questions) {
|
||||
for (var j = 0; j < s.Questions.length; j++) {
|
||||
var q = s.Questions[j];
|
||||
q.Id = "";
|
||||
q.Id = $.generateUUID();
|
||||
q.Conditional = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,7 @@ define(['common', 'modules/templates/templatepicture'], function (Common, Templa
|
||||
var nopictr = null;
|
||||
var tabindex = 0;
|
||||
if (sectiontype === 0) {
|
||||
if (!_this.pageele.IssueId || _this.pageele.IssueId == "")
|
||||
editable = true;
|
||||
else
|
||||
editable = false;
|
||||
editable = true;
|
||||
}
|
||||
|
||||
var content = $('<div style="max-height: 200px;overflow-y: auto;"></div>');
|
||||
@ -71,7 +68,7 @@ define(['common', 'modules/templates/templatepicture'], function (Common, Templa
|
||||
if (pics && pics.length > 0) {
|
||||
var sids = [];
|
||||
for (var i = 0; i < pics.length; i++) {
|
||||
var it = pics[i].Values;
|
||||
var it = pics[i];
|
||||
if (it.Selected) {
|
||||
var p = {};
|
||||
p.Id = $.newGuid();
|
||||
|
@ -17,7 +17,6 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
|
||||
holder.append('<div class="question-cell template-name" style="width:390px;padding-left:10px;"><span></span></div>');
|
||||
//holder.append('<div class="question-cell template-display" style="width: 280px;"><span></span></div>');
|
||||
holder.append('<div class="question-cell template-notes" style="width:400px;"></div>');
|
||||
holder.append('<div class="question-cell template-createdby" style="width:200px;"><span></span></div>');
|
||||
var funcs = $('<div class="question-cell template-func" style="width:110px;padding-right:20px;"></div>');
|
||||
holder.append(funcs);
|
||||
var _this = this;
|
||||
@ -42,11 +41,9 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
|
||||
_this.delete();
|
||||
}).attr('title', GetTextByKey("P_IPT_DELETETEMPLATE", 'Delete Template')));
|
||||
|
||||
if (!_this.template.IssueId || _this.template.IssueId == "") {
|
||||
funcs.append($('<em class="spanbtn iconcopy"></em>').click(function () {
|
||||
_this.openSaveAs();
|
||||
}).attr('title', GetTextByKey("P_IPT_SAVEAS", 'Save As')));
|
||||
}
|
||||
funcs.append($('<em class="spanbtn iconcopy"></em>').click(function () {
|
||||
_this.openSaveAs();
|
||||
}).attr('title', GetTextByKey("P_IPT_SAVEAS", 'Save As')));
|
||||
}
|
||||
this.holder = holder;
|
||||
if (this.template != null) {
|
||||
@ -69,8 +66,6 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
|
||||
this.holder.find('.template-display span').attr('title', template.DisplayText);
|
||||
this.holder.children('.template-notes').html(replaceHtmlText(template.Notes));
|
||||
this.holder.children('.template-notes').attr('title', replaceHtmlText(template.Notes));
|
||||
this.holder.find('.template-createdby span').text(template.IssueName);
|
||||
this.holder.find('.template-createdby span').attr('title', template.IssueName);
|
||||
};
|
||||
q.prototype.delete = function () {
|
||||
var _this = this;
|
||||
@ -114,6 +109,7 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
|
||||
dialog.showDialog();
|
||||
};
|
||||
|
||||
var savingas = false;
|
||||
q.prototype.onSaveAs = function () {
|
||||
var _this = this;
|
||||
var name = newnamecontrol.val();
|
||||
@ -121,10 +117,14 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
|
||||
showAlert(GetTextByKey("P_IPT_TEMPLATENAMENOTBEEMPTY", 'Template name cannot be empty.'), GetTextByKey("P_IPT_SAVEAS", 'Save As'));
|
||||
return;
|
||||
}
|
||||
if (savingas) return;
|
||||
savingas = true;
|
||||
|
||||
name = htmlencode(name);
|
||||
var p = JSON.stringify([teamintelligence, _this.template.Id, name]);
|
||||
|
||||
inspectionrequest("TemplateSaveAs", htmlencode(p), function (data) {
|
||||
savingas = false;
|
||||
if (data !== 'OK')
|
||||
showAlert(data, GetTextByKey("P_IPT_SAVEAS", 'Save As'));
|
||||
else if (_this.templatemodule && typeof _this.templatemodule.refresh === "function")
|
||||
@ -132,6 +132,7 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
|
||||
|
||||
dialog.hideDialog();
|
||||
}, function (err) {
|
||||
savingas = false;
|
||||
showAlert(GetTextByKey("P_IPT_FAILEDTOSAVEAS", 'Failed to save as.'), GetTextByKey("P_IPT_SAVEAS", 'Save As'));
|
||||
});
|
||||
};
|
||||
|
@ -101,7 +101,7 @@ define(['common'], function (Common) {
|
||||
for (var i = 0; i < currenttemplate.StaticPictures.length; i++) {
|
||||
var it = currenttemplate.StaticPictures[i];
|
||||
it.Selected = false;
|
||||
items.push({ Values: it });
|
||||
items.push(it);
|
||||
}
|
||||
this.gridctrl.setData(items);
|
||||
}
|
||||
|
Reference in New Issue
Block a user