add restrictions in ticket descriptor
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
686203db18
commit
ebcbd5068f
|
@ -5,6 +5,7 @@
|
|||
<vn-item
|
||||
ng-click="addTurn.show()"
|
||||
vn-acl="buyer"
|
||||
ng-show="$ctrl.isEditable"
|
||||
vn-acl-action="remove"
|
||||
name="addTurn"
|
||||
translate>
|
||||
|
@ -60,7 +61,7 @@
|
|||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="makeInvoiceConfirmation.show()"
|
||||
ng-show="!$ctrl.isInvoiced"
|
||||
ng-show="$ctrl.isEditable"
|
||||
vn-acl="invoicing"
|
||||
vn-acl-action="remove"
|
||||
name="makeInvoice"
|
||||
|
|
|
@ -8,6 +8,7 @@ class Controller extends Descriptor {
|
|||
|
||||
set ticket(value) {
|
||||
this.entity = value;
|
||||
this.isTicketEditable();
|
||||
}
|
||||
|
||||
get entity() {
|
||||
|
@ -22,13 +23,14 @@ class Controller extends Descriptor {
|
|||
this.showSMSDialog();
|
||||
}
|
||||
|
||||
get isEditable() {
|
||||
try {
|
||||
return !this.ticket.tracking.state.alertLevel;
|
||||
} catch (e) {}
|
||||
|
||||
return true;
|
||||
}
|
||||
// get isEditable() {
|
||||
// try {
|
||||
// console.log('!this.ticket.tracking.state.alertLevel', !this.ticket.tracking.state.alertLevel);
|
||||
// return !this.ticket.tracking.state.alertLevel;
|
||||
// } catch (e) {}
|
||||
// console.log('!this.ticket.tracking.state.alertLevel', this.ticket.tracking);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
get isInvoiced() {
|
||||
return this.ticket.refFk !== null;
|
||||
|
@ -45,6 +47,12 @@ class Controller extends Descriptor {
|
|||
return this.ticket.stowaway || this.ticket.ship;
|
||||
}
|
||||
|
||||
isTicketEditable() {
|
||||
this.$http.get(`Tickets/${this.$state.params.id}/isEditable`).then(res => {
|
||||
this.isEditable = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
showChangeShipped() {
|
||||
this.newShipped = this.ticket.shipped;
|
||||
this.$.changeShippedDialog.show();
|
||||
|
|
|
@ -28,8 +28,10 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
|||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _$state_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpBackend.whenGET(`Tickets/${ticket.id}/canHaveStowaway`).respond(true);
|
||||
$httpBackend.whenGET(`Tickets/1/isEditable`).respond(true);
|
||||
|
||||
$state = _$state_;
|
||||
$state.params.id = 1;
|
||||
$state.getCurrentPath = () => [null, {state: {name: 'ticket'}}];
|
||||
|
||||
controller = $componentController('vnTicketDescriptor', {$element: null}, {ticket});
|
||||
|
|
Loading…
Reference in New Issue