diff --git a/db/changes/10420/00-state.sql b/db/changes/10420/00-state.sql new file mode 100644 index 000000000..590be6964 --- /dev/null +++ b/db/changes/10420/00-state.sql @@ -0,0 +1,26 @@ +ALTER TABLE `vn`.`state` ADD classColor varchar(12) NULL; + +UPDATE `vn`.`state` s + SET s.classColor = 'warning' + WHERE s.alertLevel = 1; + +UPDATE `vn`.`state` s + SET s.classColor = 'alert' + WHERE s.alertLevel = 0; + +UPDATE `vn`.`state` s + SET s.classColor = 'success' + WHERE s.code LIKE 'OK'; + +UPDATE `vn`.`state` s + SET s.classColor = 'notice' + WHERE s.code LIKE 'FREE'; + +UPDATE `vn`.`state` s + SET s.classColor = 'success' + WHERE s.order >= 4 + AND (s.alertLevel = 0 OR s.alertLevel = 1); + +UPDATE `vn`.`state` s + SET s.classColor = 'warning' + WHERE s.code IN ('PREVIOUS_PREPARATION', 'PREPARED', 'ON_PREPARATION', 'ON_CHECKING', 'CHECKED'); diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index 1f1d4d88a..1fc405bf3 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -190,6 +190,7 @@ module.exports = Self => { z.hour AS zoneLanding, z.name AS zoneName, z.id AS zoneFk, + st.classColor, TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour, TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour, TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index 23253259a..76b9219ee 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -171,7 +171,7 @@ + class="chip {{::ticket.classColor}}"> {{::ticket.state}} diff --git a/modules/monitor/front/index/tickets/index.js b/modules/monitor/front/index/tickets/index.js index 2614fd2dc..58b56bbc5 100644 --- a/modules/monitor/front/index/tickets/index.js +++ b/modules/monitor/front/index/tickets/index.js @@ -118,17 +118,6 @@ export default class Controller extends Section { return 'success'; } - stateColor(ticket) { - if (ticket.alertLevelCode === 'OK') - return 'success'; - else if (ticket.alertLevelCode === 'FREE') - return 'notice'; - else if (ticket.alertLevel === 1) - return 'warning'; - else if (ticket.alertLevel === 0) - return 'alert'; - } - totalPriceColor(ticket) { const total = parseInt(ticket.totalWithVat); if (total > 0 && total < 50) diff --git a/modules/monitor/front/index/tickets/index.spec.js b/modules/monitor/front/index/tickets/index.spec.js index fb507dbbc..5d42743c1 100644 --- a/modules/monitor/front/index/tickets/index.spec.js +++ b/modules/monitor/front/index/tickets/index.spec.js @@ -89,32 +89,6 @@ describe('Component vnMonitorSalesTickets', () => { }); }); - describe('stateColor()', () => { - it('should return "success" when the alertLevelCode property is "OK"', () => { - const result = controller.stateColor({alertLevelCode: 'OK'}); - - expect(result).toEqual('success'); - }); - - it('should return "notice" when the alertLevelCode property is "FREE"', () => { - const result = controller.stateColor({alertLevelCode: 'FREE'}); - - expect(result).toEqual('notice'); - }); - - it('should return "warning" when the alertLevel property is "1', () => { - const result = controller.stateColor({alertLevel: 1}); - - expect(result).toEqual('warning'); - }); - - it('should return "alert" when the alertLevel property is "0"', () => { - const result = controller.stateColor({alertLevel: 0}); - - expect(result).toEqual('alert'); - }); - }); - describe('totalPriceColor()', () => { it('should return "warning" when the ticket amount is less than 50€', () => { const result = controller.totalPriceColor({totalWithVat: '8.50'});