bug fix icon add ticket.sales enables/disables
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
parent
219614b44f
commit
c1cca30a26
|
@ -1,3 +1,3 @@
|
||||||
<button type="button" ng-disabled="{{$ctrl.disabled}}">
|
<button type="button" ng-disabled="$ctrl.disabled">
|
||||||
<vn-icon icon="{{::$ctrl.icon}}">
|
<vn-icon icon="{{::$ctrl.icon}}">
|
||||||
</button>
|
</button>
|
|
@ -3,10 +3,10 @@ module.exports = Self => {
|
||||||
description: 'Check if a ticket is editable',
|
description: 'Check if a ticket is editable',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [{
|
accepts: [{
|
||||||
arg: 'ticketFk',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'ticketFk',
|
description: 'the ticket id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -14,20 +14,20 @@ module.exports = Self => {
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/:ticketFk/isEditable`,
|
path: `/:id/isEditable`,
|
||||||
verb: 'get'
|
verb: 'get'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.isEditable = async(ctx, ticketFk) => {
|
Self.isEditable = async(ctx, id) => {
|
||||||
const accessToken = ctx.req.accessToken;
|
const accessToken = ctx.req.accessToken;
|
||||||
const userId = accessToken.userId;
|
const userId = accessToken.userId;
|
||||||
let state = await Self.app.models.TicketState.findOne({
|
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 isProductionBoss = await Self.app.models.Account.hasRole(userId, 'productionBoss');
|
||||||
let alertLevel = state ? state.alertLevel : null;
|
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'],
|
fields: ['isDeleted', 'clientFk', 'refFk'],
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
|
|
|
@ -20,11 +20,6 @@ class Controller {
|
||||||
this._sales = [];
|
this._sales = [];
|
||||||
this.imagesPath = '//verdnatura.es/vn-image-data/catalog';
|
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() {
|
get ticket() {
|
||||||
return this._ticket;
|
return this._ticket;
|
||||||
|
@ -486,6 +481,12 @@ class Controller {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
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'];
|
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
|
||||||
|
|
Loading…
Reference in New Issue