bug fix icon add ticket.sales enables/disables
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-09-03 14:42:52 +02:00
parent 219614b44f
commit c1cca30a26
3 changed files with 13 additions and 12 deletions

View File

@ -1,3 +1,3 @@
<button type="button" ng-disabled="{{$ctrl.disabled}}">
<button type="button" ng-disabled="$ctrl.disabled">
<vn-icon icon="{{::$ctrl.icon}}">
</button>

View File

@ -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',

View File

@ -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'];