feat(monitor_ticket): classColor in db
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
2480f37e24
commit
78b3df0b6a
|
@ -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');
|
|
@ -190,6 +190,7 @@ module.exports = Self => {
|
||||||
z.hour AS zoneLanding,
|
z.hour AS zoneLanding,
|
||||||
z.name AS zoneName,
|
z.name AS zoneName,
|
||||||
z.id AS zoneFk,
|
z.id AS zoneFk,
|
||||||
|
st.classColor,
|
||||||
TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour,
|
TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour,
|
||||||
TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour,
|
TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour,
|
||||||
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour
|
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
ng-show="::!ticket.refFk"
|
ng-show="::!ticket.refFk"
|
||||||
class="chip {{::$ctrl.stateColor(ticket)}}">
|
class="chip {{::ticket.classColor}}">
|
||||||
{{::ticket.state}}
|
{{::ticket.state}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -118,17 +118,6 @@ export default class Controller extends Section {
|
||||||
return 'success';
|
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) {
|
totalPriceColor(ticket) {
|
||||||
const total = parseInt(ticket.totalWithVat);
|
const total = parseInt(ticket.totalWithVat);
|
||||||
if (total > 0 && total < 50)
|
if (total > 0 && total < 50)
|
||||||
|
|
|
@ -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()', () => {
|
describe('totalPriceColor()', () => {
|
||||||
it('should return "warning" when the ticket amount is less than 50€', () => {
|
it('should return "warning" when the ticket amount is less than 50€', () => {
|
||||||
const result = controller.totalPriceColor({totalWithVat: '8.50'});
|
const result = controller.totalPriceColor({totalWithVat: '8.50'});
|
||||||
|
|
Loading…
Reference in New Issue