diff --git a/front/core/components/icon-button/icon-button.html b/front/core/components/icon-button/icon-button.html index 53bb1378e5..a3c30ed848 100644 --- a/front/core/components/icon-button/icon-button.html +++ b/front/core/components/icon-button/icon-button.html @@ -1,3 +1,3 @@ - \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/isEditable.js b/modules/ticket/back/methods/ticket/isEditable.js index b3d9bb17c9..c31d99304d 100644 --- a/modules/ticket/back/methods/ticket/isEditable.js +++ b/modules/ticket/back/methods/ticket/isEditable.js @@ -3,10 +3,10 @@ module.exports = Self => { description: 'Check if a ticket is editable', accessType: 'READ', accepts: [{ - arg: 'ticketFk', + arg: 'id', type: 'number', required: true, - description: 'ticketFk', + description: 'the ticket id', http: {source: 'path'} }], returns: { @@ -14,20 +14,20 @@ module.exports = Self => { root: true }, http: { - path: `/:ticketFk/isEditable`, + path: `/:id/isEditable`, verb: 'get' } }); - Self.isEditable = async(ctx, ticketFk) => { + Self.isEditable = async(ctx, id) => { const accessToken = ctx.req.accessToken; const userId = accessToken.userId; let state = await Self.app.models.TicketState.findOne({ - where: {ticketFk: ticketFk} + where: {ticketFk: id} }); let isProductionBoss = await Self.app.models.Account.hasRole(userId, 'productionBoss'); let alertLevel = state ? state.alertLevel : null; - let ticket = await Self.app.models.Ticket.findById(ticketFk, { + let ticket = await Self.app.models.Ticket.findById(id, { fields: ['isDeleted', 'clientFk', 'refFk'], include: [{ relation: 'client', diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 706ef9d5ff..6bb1988071 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -20,11 +20,6 @@ class Controller { this._sales = []; this.imagesPath = '//verdnatura.es/vn-image-data/catalog'; } - isTicketEditable() { - this.$http.get(`/api/Tickets/${this.$state.params.id}/isEditable`).then(res => { - this.isEditable = res.data; - }); - } get ticket() { return this._ticket; @@ -486,6 +481,12 @@ class Controller { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); }); } + + isTicketEditable() { + this.$http.get(`/api/Tickets/${this.$state.params.id}/isEditable`).then(res => { + this.isEditable = res.data; + }); + } } Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];