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