Skip to content

Commit 6ad552e

Browse files
committed
QCADOOCLS-8704, QCADOOCLS-8705, QCADOOCLS-8706, QCADOOCLS-8707
1 parent 1c4a835 commit 6ad552e

File tree

3 files changed

+56
-21
lines changed

3 files changed

+56
-21
lines changed

mes-plugins/mes-plugins-basic/src/main/resources/basic/public/js/dashboard.js

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ QCD.dashboard = (function () {
4747
registerChart();
4848
registerButtons();
4949
registerKanban();
50-
51-
setKanbanHeight();
5250
}
5351

5452
function registerChart() {
@@ -61,6 +59,7 @@ QCD.dashboard = (function () {
6159
let ctx = chart.chart.ctx;
6260
let width = chart.chart.width;
6361
let height = chart.chart.height
62+
6463
chart.clear();
6564

6665
ctx.save();
@@ -113,6 +112,8 @@ QCD.dashboard = (function () {
113112
}
114113
}
115114
});
115+
116+
setKanbanHeight();
116117
}
117118
);
118119
}
@@ -135,6 +136,10 @@ QCD.dashboard = (function () {
135136
}
136137

137138
function registerKanban() {
139+
if (!$("#dashboardChart").length) {
140+
setKanbanHeight();
141+
}
142+
138143
if ($("#dashboardKanban #ordersPending").length) {
139144
$.each(QCD.dashboardContext.getOrdersPending(), function (index, order) {
140145
addItem(order);
@@ -184,14 +189,20 @@ QCD.dashboard = (function () {
184189
}
185190

186191
function setKanbanHeight() {
187-
var containerHeight = $(".container").height();
188-
var dashboardButtonsHeight = $("#dashboardButtons").height();
189-
var dashboardChartHeight = $("#dashboardChart").height();
190-
var dashboardSearchHeight = $("#dashboardSearch").height();
191-
var dashboardPaddingHeight = 20;
192-
var containerPaddingHeight = 20;
193-
var cardPaddingHeight = 15;
194-
var cardTitleHeight = $(".card-title").height();
192+
let containerHeight = $(".container").height();
193+
let dashboardButtonsHeight = $("#dashboardButtons").height();
194+
let dashboardChartHeight = $("#dashboardChart").height();
195+
let dashboardSearchHeight = $("#dashboardSearch").height();
196+
let cardTitleHeight = $(".card-title").height();
197+
198+
let dashboardPaddingHeight = 20;
199+
let cardTitlePaddingHeight = 8;
200+
let cardTitleMarginHeight = 12;
201+
let cardPaddingHeight = 16;
202+
203+
let headerHeight = 0;
204+
let height = 0;
205+
let marginTop = 0;
195206

196207
if (dashboardButtonsHeight == undefined) {
197208
dashboardButtonsHeight = 0;
@@ -201,14 +212,19 @@ QCD.dashboard = (function () {
201212
if (dashboardChartHeight == undefined) {
202213
dashboardChartHeight = 0;
203214
} else {
215+
marginTop = 40;
204216
dashboardChartHeight = dashboardChartHeight + dashboardPaddingHeight;
205217
}
206218

207-
var headerHeight = (dashboardButtonsHeight > dashboardChartHeight) ? dashboardButtonsHeight : dashboardChartHeight;
219+
dashboardSearchHeight = dashboardSearchHeight + dashboardPaddingHeight;
220+
cardTitleHeight = cardTitleHeight + (cardTitlePaddingHeight * 2) + cardTitleMarginHeight;
221+
222+
headerHeight = (dashboardButtonsHeight > dashboardChartHeight) ? dashboardButtonsHeight : dashboardChartHeight;
208223

209-
var height = containerHeight - (containerPaddingHeight * 2) - headerHeight - (cardPaddingHeight * 2) - dashboardSearchHeight - dashboardPaddingHeight - cardTitleHeight;
224+
height = containerHeight - headerHeight - dashboardSearchHeight - (cardPaddingHeight * 2) - cardTitleHeight + marginTop;
210225

211-
$("#dashboardKanban .items").css("height", (height < 300) ? 300 : height + "px");
226+
$("#dashboardSearch").css("margin-top", -marginTop + "px");
227+
$("#dashboardKanban .items").css("height", height + "px");
212228
}
213229

214230
function addItem(item) {
@@ -375,12 +391,19 @@ QCD.dashboard = (function () {
375391
});
376392
}
377393

394+
function filterKanbanReload() {
395+
let value = $("#search").val();
396+
397+
filterKanban(value);
398+
}
399+
378400
return {
379401
init: init,
380402
initOrders: initOrders,
381403
appendOrder: appendOrder,
382404
prependOrder: prependOrder,
383-
prependOperationalTask: prependOperationalTask
405+
prependOperationalTask: prependOperationalTask,
406+
filterKanbanReload: filterKanbanReload
384407
};
385408

386409
})();
@@ -467,7 +490,7 @@ const clearDrop = (event) => {
467490
const updateDropzones = () => {
468491
$('.dropzone').remove();
469492

470-
$('<div class="dropzone rounded" ondrop="drop(event)" ondragover="allowDrop(event)" ondragleave="clearDrop(event)"> &nbsp; </div>').insertAfter('.card.draggable');
493+
$('<div class="dropzone rounded" ondrop="drop(event)" ondragover="allowDrop(event)" ondragleave="clearDrop(event)"> &nbsp; </div>').insertAfter('.card .draggable');
471494

472495
$(".items:not(:has(.card.draggable))").append($('<div class="dropzone rounded" ondrop="drop(event)" ondragover="allowDrop(event)" ondragleave="clearDrop(event)"> &nbsp; </div>'));
473496
};
@@ -615,27 +638,38 @@ function createOperationalTaskDiv(operationalTasksType, operationalTask) {
615638

616639
opTaskDiv = opTaskDiv + '</div>' +
617640
(operationalTask.type == "02executionOperationInOrder" ? '<div class="card-footer">' + '<div class="progress">' + '<div class="progress-bar progress-bar-striped bg-info" role="progressbar" style="width: ' + doneInPercent + '%;" aria-valuenow="' + doneInPercent + '" aria-valuemin="0" aria-valuemax="100">' + doneInPercent + '%</div>' + '</div>' + '</div>' : '') +
618-
'</div><div> &nbsp; </div>';
641+
'</div><div class="empty"> &nbsp; </div>';
619642

620643
return opTaskDiv;
621644
}
622645

623646
function filterKanban(value) {
624-
var results = QCD.dashboardContext.getItems().filter(item => Object.keys(item).some(key => (item[key] != null) && item[key].toString().includes(value)));
647+
let keys = [ "masterOrderNumber", "orderNumber", "number", "description", "orderCategory", "productionLineNumber", "staffName", "workstationNumber", "productNumber", "orderProductNumber", "companyName" ];
648+
649+
let results = QCD.dashboardContext.getItems().filter(item => Object.keys(item).some(key => keys.includes(key) && (item[key] != null) && item[key].toString().includes(value)));
625650

626651
if (value == '') {
627652
$(".items .card").show();
653+
$(".items .empty").show();
654+
655+
if ($("#dashboardKanban #ordersPending").length) {
656+
updateDropzones();
657+
}
628658
} else {
629659
$(".items .card").hide();
660+
$(".items .empty").hide();
661+
662+
$(".dropzone").remove();
630663

631664
$.each(results, function (index, item) {
632665
$("#order" + item.id).show();
666+
$('<div class="dropzone rounded" ondrop="drop(event)" ondragover="allowDrop(event)" ondragleave="clearDrop(event)"> &nbsp; </div>').insertAfter("#order" + item.id);
633667
$("#operationalTask" + item.id).show();
634668
});
635-
}
636669

637-
if ($("#dashboardKanban #ordersPending").length) {
638-
updateDropzones();
670+
if ($("#dashboardKanban #ordersPending").length) {
671+
$(".items:not(:has(.card.draggable))").append($('<div class="dropzone rounded" ondrop="drop(event)" ondragover="allowDrop(event)" ondragleave="clearDrop(event)"> &nbsp; </div>'));
672+
}
639673
}
640674
}
641675

mes-plugins/mes-plugins-basic/src/main/resources/basic/public/js/operationalTasksDefinitionWizard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2180,7 +2180,7 @@ QCD.operationalTasksDefinitionWizard = (function () {
21802180
$("#operationalTasksDefinitionWizard").modal('hide');
21812181
$.each(data.operationalTasks, function (i, operationalTask) {
21822182
QCD.dashboard.prependOperationalTask('operationalTasksPending', operationalTask);
2183-
2183+
QCD.dashboard.filterKanbanReload();
21842184
});
21852185
showMessage('success',
21862186
QCD.translate("basic.dashboard.orderDefinitionWizard.success"),

mes-plugins/mes-plugins-basic/src/main/resources/basic/public/js/orderDefinitionWizard.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,7 @@ QCD.orderDefinitionWizard = (function () {
13191319

13201320
$("#orderDefinitionWizard").modal('hide');
13211321
QCD.dashboard.prependOrder('ordersPending', data.order);
1322+
QCD.dashboard.filterKanbanReload();
13221323
showMessage('success',
13231324
QCD.translate("basic.dashboard.orderDefinitionWizard.success"),
13241325
data.message, false);

0 commit comments

Comments
 (0)