.
This commit is contained in:
@ -273,7 +273,7 @@
|
||||
$('<option value="[Model]">Model</option>'),
|
||||
$('<option value="[VIN]">VIN/SN</option>'),
|
||||
$('<option value="[Work_Order_Number]">Work Order Number</option>'),
|
||||
$('<option value="[Work_Order_Type]">Work Order Type</option>'),
|
||||
$('<option value="[Work_Order_Type]">Work Order Type</option>'),
|
||||
$('<option value="[Parts_Order_Number]">Parts Order Number</option>'),
|
||||
$('<option value="[Year]">Year</option>')
|
||||
);
|
||||
@ -318,9 +318,12 @@
|
||||
}
|
||||
|
||||
function editLayout(info) {
|
||||
$('#right_popup').load('js/modules/layouts/addlayout.html?v=2', function () {
|
||||
$('#right_popup').load('js/modules/layouts/addlayout.html?v=5', function () {
|
||||
var modified = false;
|
||||
var deleteIcon = false;
|
||||
var deleteCenterIcon = false;
|
||||
var deleteRightIcon = false;
|
||||
initColorCtrl();
|
||||
var content = $(this).applyFleetLanguageText(true);
|
||||
content.find('.button-exit').on('click', function () {
|
||||
if (modified) {
|
||||
@ -342,7 +345,7 @@
|
||||
}
|
||||
});
|
||||
content.find('.button-icon-upload').on('click', function () {
|
||||
content.find('.icon-file file').remove();
|
||||
content.find('.icon-file input[type="file"]').remove();
|
||||
$('<input type="file" accept="image/png,image/jpeg" />')
|
||||
.hide().appendTo(content.find('.icon-file'))
|
||||
.on('change', function () {
|
||||
@ -365,7 +368,78 @@
|
||||
content.find('.button-icon-delete').on('click', function () {
|
||||
deleteIcon = true;
|
||||
content.find('.img-icon-filename').remove();
|
||||
content.find('.icon-file input[type="file"]').remove();
|
||||
});
|
||||
|
||||
content.find('.button-icon-centerupload').on('click', function () {
|
||||
content.find('.icon-centerfile input[type="file"]').remove();
|
||||
$('<input type="file" accept="image/png,image/jpeg" />')
|
||||
.hide().appendTo(content.find('.icon-centerfile'))
|
||||
.on('change', function () {
|
||||
if (!/image\/\w+/.test(this.files[0].type)) {
|
||||
showAlert(GetTextByKey("P_LAYOUT_UPLOADICONTIPS", 'The file type for the logo is invalid. The file must be JPG or PNG.'), GetTextByKey('P_LAYOUT_SAVEINSPECTLAYOUT', 'Save Inspection Layout'));
|
||||
$(this).remove();
|
||||
return;
|
||||
}
|
||||
var file = this.files[0];
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function (e) {
|
||||
setTimeout(function () {
|
||||
content.find('.img-icon-centerfilename').remove();
|
||||
$('<img class="img-icon-centerfilename" />').attr('src', e.target.result).insertAfter(content.find('.icon-centerfile-title'));
|
||||
});
|
||||
};
|
||||
}).click();
|
||||
});
|
||||
content.find('.button-icon-centerdelete').on('click', function () {
|
||||
deleteCenterIcon = true;
|
||||
content.find('.img-icon-centerfilename').remove();
|
||||
content.find('.icon-centerfile input[type="file"]').remove();
|
||||
});
|
||||
|
||||
content.find('.button-icon-rightupload').on('click', function () {
|
||||
content.find('.icon-rightfile input[type="file"]').remove();
|
||||
$('<input type="file" accept="image/png,image/jpeg" />')
|
||||
.hide().appendTo(content.find('.icon-rightfile'))
|
||||
.on('change', function () {
|
||||
if (!/image\/\w+/.test(this.files[0].type)) {
|
||||
showAlert(GetTextByKey("P_LAYOUT_UPLOADICONTIPS", 'The file type for the logo is invalid. The file must be JPG or PNG.'), GetTextByKey('P_LAYOUT_SAVEINSPECTLAYOUT', 'Save Inspection Layout'));
|
||||
$(this).remove();
|
||||
return;
|
||||
}
|
||||
var file = this.files[0];
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function (e) {
|
||||
setTimeout(function () {
|
||||
content.find('.img-icon-rightfilename').remove();
|
||||
$('<img class="img-icon-rightfilename" />').attr('src', e.target.result).insertAfter(content.find('.icon-rightfile-title'));
|
||||
});
|
||||
};
|
||||
}).click();
|
||||
});
|
||||
content.find('.button-icon-rightdelete').on('click', function () {
|
||||
deleteRightIcon = true;
|
||||
content.find('.img-icon-rightfilename').remove();
|
||||
content.find('.icon-rightfile input[type="file"]').remove();
|
||||
});
|
||||
|
||||
content.find('#layout-style').on('change', function () {
|
||||
var style = $('#layout-style').val();
|
||||
if (parseInt(style) === 2) {
|
||||
$('#layout-picturesdisplay').val(1);
|
||||
$('#layout-picturesdisplay').prop('disabled', true);
|
||||
}
|
||||
else {
|
||||
$('#layout-picturesdisplay').prop('disabled', false);
|
||||
}
|
||||
});
|
||||
content.find('#layout-highlightcolor-input').keyup(null, function () {
|
||||
$("#layout-highlightcolor-selector").spectrum("set", $('#layout-highlightcolor-input').val());
|
||||
})
|
||||
|
||||
|
||||
var save = function (exit) {
|
||||
return function () {
|
||||
var title = GetTextByKey('P_LAYOUT_SAVEINSPECTLAYOUT', 'Save Inspection Layout');
|
||||
@ -379,20 +453,26 @@
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
var layout = {
|
||||
Id: info && info.Id,
|
||||
Target: layouts.isteam ? 1 : 0,
|
||||
Name: name,
|
||||
IncludeLOGO: content.find('#layout-include-logo').prop('checked'),
|
||||
Notes: content.find('.text-layout-notes').val(),
|
||||
PageHeaderLeft: content.find('.layout-headers-left .editor-content').val(),
|
||||
PageHeaderCenter: content.find('.layout-headers-middle .editor-content').val(),
|
||||
PageHeaderRight: content.find('.layout-headers-right .editor-content').val(),
|
||||
PageFooterLeft: content.find('.layout-footers-left .editor-content').val(),
|
||||
PageFooterCenter: content.find('.layout-footers-middle .editor-content').val(),
|
||||
PageFooterRight: content.find('.layout-footers-right .editor-content').val()
|
||||
PageFooterRight: content.find('.layout-footers-right .editor-content').val(),
|
||||
Style: content.find('#layout-style').val(),
|
||||
Spacing: content.find('#layout-spacing').val(),
|
||||
PicturesDisplay: content.find('#layout-picturesdisplay').val(),
|
||||
CaptionImages: content.find('#layout-captionimages').prop('checked'),
|
||||
Divider: content.find('#layout-divider').val(),
|
||||
HighlightColor: content.find('#layout-highlightcolor-input').val()
|
||||
};
|
||||
if (layout.Style === "")
|
||||
layout.Style = -1;
|
||||
var data = new FormData();
|
||||
var files = content.find('.icon-file input[type="file"]').prop('files');
|
||||
if (files && files[0]) {
|
||||
@ -401,6 +481,23 @@
|
||||
var logo = content.find('.img-icon-filename').prop('src');
|
||||
layout.LOGO = logo.substr(logo.indexOf(';base64,') + 8);
|
||||
}
|
||||
|
||||
var centerfiles = content.find('.icon-centerfile input[type="file"]').prop('files');
|
||||
if (centerfiles && centerfiles[0]) {
|
||||
data.append('iconCenterFile', centerfiles && centerfiles[0]);
|
||||
} else if (!deleteCenterIcon) {
|
||||
var logo = content.find('.img-icon-centerfilename').prop('src');
|
||||
layout.CenterLOGO = logo.substr(logo.indexOf(';base64,') + 8);
|
||||
}
|
||||
|
||||
var rightfiles = content.find('.icon-rightfile input[type="file"]').prop('files');
|
||||
if (rightfiles && rightfiles[0]) {
|
||||
data.append('iconRightFile', rightfiles && rightfiles[0]);
|
||||
} else if (!deleteRightIcon) {
|
||||
var logo = content.find('.img-icon-rightfilename').prop('src');
|
||||
layout.RightLOGO = logo.substr(logo.indexOf(';base64,') + 8);
|
||||
}
|
||||
|
||||
data.append('MethodName', 'SaveInspectLayout');
|
||||
data.append('ClientData', encodeURIComponent(JSON.stringify(layout)));
|
||||
$.ajax({
|
||||
@ -459,10 +556,15 @@
|
||||
var onchange = function () { modified = true };
|
||||
if (info != null) {
|
||||
content.find('.text-layout-name').val(info.Name);
|
||||
content.find('#layout-include-logo').prop('checked', info.IncludeLOGO);
|
||||
if (info.LOGO != null) {
|
||||
content.find('.img-icon-filename').attr('src', 'data:image/png;base64,' + info.LOGO);
|
||||
}
|
||||
if (info.CenterLOGO != null) {
|
||||
content.find('.img-icon-centerfilename').attr('src', 'data:image/png;base64,' + info.CenterLOGO);
|
||||
}
|
||||
if (info.RightLOGO != null) {
|
||||
content.find('.img-icon-rightfilename').attr('src', 'data:image/png;base64,' + info.RightLOGO);
|
||||
}
|
||||
content.find('.text-layout-notes').val(info.Notes);
|
||||
content.find('.layout-headers-left .editor-content').val(info.PageHeaderLeft);
|
||||
content.find('.layout-headers-middle .editor-content').val(info.PageHeaderCenter);
|
||||
@ -470,9 +572,17 @@
|
||||
content.find('.layout-footers-left .editor-content').val(info.PageFooterLeft);
|
||||
content.find('.layout-footers-middle .editor-content').val(info.PageFooterCenter);
|
||||
content.find('.layout-footers-right .editor-content').val(info.PageFooterRight);
|
||||
|
||||
content.find('#layout-style').val(info.Style);
|
||||
content.find('#layout-spacing').val(info.Spacing);
|
||||
content.find('#layout-picturesdisplay').val(info.PicturesDisplay);
|
||||
content.find('#layout-captionimages').prop('checked', info.CaptionImages);
|
||||
content.find('#layout-divider').val(info.Divider);
|
||||
content.find('#layout-highlightcolor-input').val(info.HighlightColor);
|
||||
content.find('#layout-highlightcolor-selector').spectrum("set", info.HighlightColor);
|
||||
}
|
||||
content.find('.text-layout-name').on('change', onchange);
|
||||
content.find('#layout-include-logo').on('change', onchange);
|
||||
//content.find('#layout-style').on('change', onchange);
|
||||
content.find('.text-layout-notes').on('change', onchange);
|
||||
content.find('.layout-headers-left .editor-content').on('change', onchange);
|
||||
content.find('.layout-headers-middle .editor-content').on('change', onchange);
|
||||
@ -480,6 +590,12 @@
|
||||
content.find('.layout-footers-left .editor-content').on('change', onchange);
|
||||
content.find('.layout-footers-middle .editor-content').on('change', onchange);
|
||||
content.find('.layout-footers-right .editor-content').on('change', onchange);
|
||||
content.find('#layout-style').on('change', onchange);
|
||||
content.find('#layout-spacing').on('change', onchange);
|
||||
content.find('#layout-picturesdisplay').on('change', onchange);
|
||||
content.find('#layout-captionimages').on('change', onchange);
|
||||
content.find('#layout-divider').on('change', onchange);
|
||||
content.find('#layout-highlightcolor-input').on('change', onchange);
|
||||
|
||||
content.find('.text-layout-name').focus();
|
||||
});
|
||||
@ -509,5 +625,59 @@
|
||||
}
|
||||
});
|
||||
|
||||
function initColorCtrl() {
|
||||
$('#layout-highlightcolor-selector').spectrum({
|
||||
allowEmpty: true,
|
||||
color: "#FFF",
|
||||
showInput: true,
|
||||
containerClassName: "full-spectrum",
|
||||
showInitial: true,
|
||||
showPalette: true,
|
||||
showSelectionPalette: true,
|
||||
showAlpha: true,
|
||||
maxPaletteSize: 10,
|
||||
preferredFormat: "hex",
|
||||
localStorageKey: "spectrum.demo",
|
||||
chooseText: GetTextByKey("P_IPT_OK", "OK"),
|
||||
cancelText: GetTextByKey("P_IPT_CANCEL", "Cancel"),
|
||||
clearText: GetTextByKey("P_SPECTRUM_CLEARCOLORSELECTION", "Clear Color Selection"),
|
||||
noColorSelectedText: GetTextByKey("P_SPECTRUM_NOCOLORSELECTED", "No Color Selected"),
|
||||
move: function (color) {
|
||||
if (color)
|
||||
$('#layout-highlightcolor-input').val(color.toHexString().toUpperCase()); // #ff0000
|
||||
},
|
||||
show: function () {
|
||||
|
||||
},
|
||||
beforeShow: function () {
|
||||
|
||||
},
|
||||
hide: function (color) {
|
||||
if (color) {
|
||||
$('#layout-highlightcolor-input').val(color.toHexString().toUpperCase()); // #ff0000
|
||||
}
|
||||
},
|
||||
|
||||
palette: [
|
||||
["rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)", /*"rgb(153, 153, 153)","rgb(183, 183, 183)",*/
|
||||
"rgb(204, 204, 204)", "rgb(217, 217, 217)", /*"rgb(239, 239, 239)", "rgb(243, 243, 243)",*/ "rgb(255, 255, 255)"],
|
||||
["rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)",
|
||||
"rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)"],
|
||||
["rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)",
|
||||
"rgb(208, 224, 227)", "rgb(201, 218, 248)", "rgb(207, 226, 243)", "rgb(217, 210, 233)", "rgb(234, 209, 220)",
|
||||
"rgb(221, 126, 107)", "rgb(234, 153, 153)", "rgb(249, 203, 156)", "rgb(255, 229, 153)", "rgb(182, 215, 168)",
|
||||
"rgb(162, 196, 201)", "rgb(164, 194, 244)", "rgb(159, 197, 232)", "rgb(180, 167, 214)", "rgb(213, 166, 189)",
|
||||
"rgb(204, 65, 37)", "rgb(224, 102, 102)", "rgb(246, 178, 107)", "rgb(255, 217, 102)", "rgb(147, 196, 125)",
|
||||
"rgb(118, 165, 175)", "rgb(109, 158, 235)", "rgb(111, 168, 220)", "rgb(142, 124, 195)", "rgb(194, 123, 160)",
|
||||
"rgb(166, 28, 0)", "rgb(204, 0, 0)", "rgb(230, 145, 56)", "rgb(241, 194, 50)", "rgb(106, 168, 79)",
|
||||
"rgb(69, 129, 142)", "rgb(60, 120, 216)", "rgb(61, 133, 198)", "rgb(103, 78, 167)", "rgb(166, 77, 121)",
|
||||
/*"rgb(133, 32, 12)", "rgb(153, 0, 0)", "rgb(180, 95, 6)", "rgb(191, 144, 0)", "rgb(56, 118, 29)",
|
||||
"rgb(19, 79, 92)", "rgb(17, 85, 204)", "rgb(11, 83, 148)", "rgb(53, 28, 117)", "rgb(116, 27, 71)",*/
|
||||
"rgb(91, 15, 0)", "rgb(102, 0, 0)", "rgb(120, 63, 4)", "rgb(127, 96, 0)", "rgb(39, 78, 19)",
|
||||
"rgb(12, 52, 61)", "rgb(28, 69, 135)", "rgb(7, 55, 99)", "rgb(32, 18, 77)", "rgb(76, 17, 48)"]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
return layouts;
|
||||
});
|
Reference in New Issue
Block a user