diff --git a/client/ticket/src/component/component.html b/client/ticket/src/component/component.html index 679d42332..06bbfd932 100644 --- a/client/ticket/src/component/component.html +++ b/client/ticket/src/component/component.html @@ -1,4 +1,4 @@ - + diff --git a/client/ticket/src/component/component.js b/client/ticket/src/component/component.js index 7772ac694..92e20852e 100644 --- a/client/ticket/src/component/component.js +++ b/client/ticket/src/component/component.js @@ -1,7 +1,14 @@ import ngModule from '../module'; import './style.scss'; +import FilterTicketList from '../filter-ticket-list'; + +class Controller extends FilterTicketList { + constructor($scope, $timeout, $stateParams) { + super($scope, $timeout, $stateParams); + this.$scope = $scope; + this.onOrder('itemFk', 'ASC'); + } -class Controller { total() { let sum; if (this.sales) { @@ -36,6 +43,8 @@ class Controller { } } +Controller.$inject = ['$scope', '$timeout', '$state']; + ngModule.component('vnTicketComponents', { template: require('./component.html'), controller: Controller, diff --git a/services/loopback/common/models/state.js b/services/loopback/common/models/state.js index 400cf1dda..06e1ac92d 100644 --- a/services/loopback/common/models/state.js +++ b/services/loopback/common/models/state.js @@ -7,7 +7,7 @@ module.exports = Self => { * @param {Integer} stateId The user id * @return {Boolean} %true if user has the role, %false otherwise */ - Self.isAlertLevel0 = async function(stateId) { + Self.isAlertLevelZero = async function(stateId) { let result = await Self.rawSql( `SELECT alertLevel FROM vn.state diff --git a/services/ticket/common/models/ticket-tracking.js b/services/ticket/common/models/ticket-tracking.js index 7f9e9c94b..464436daa 100644 --- a/services/ticket/common/models/ticket-tracking.js +++ b/services/ticket/common/models/ticket-tracking.js @@ -10,10 +10,10 @@ module.exports = function(Self) { let isEmployee = await models.Account.hasRole(userId, 'employee'); let isProduction = await models.Account.hasRole(userId, 'production'); - let isAlertLevel0 = await models.State.isAlertLevel0(ctx.instance.stateFk); + let isAlertLevelZero = await models.State.isAlertLevelZero(ctx.instance.stateFk); let ticketAlertLevel = await models.TicketState.findOne({where: {id: ctx.instance.ticketFk}, fields: ["alertLevel"]}); - if ((!isProduction && !isAlertLevel0) || !isEmployee || (isEmployee && ticketAlertLevel != 0 && !isProduction)) + if ((!isProduction && !isAlertLevelZero) || !isEmployee || (isEmployee && ticketAlertLevel != 0 && !isProduction)) throw new Error("You don't have enough privileges to do that"); let user = await models.Worker.findOne({where: {userFk: userId}});