feat(ticket_basic-data): address isEditable

This commit is contained in:
Alex Moreno 2022-12-28 07:54:55 +01:00
parent c13b49c7cd
commit a5fe335e46
2 changed files with 19 additions and 7 deletions

View File

@ -7,7 +7,7 @@
<form name="form">
<vn-card class="vn-w-md vn-pa-lg">
<vn-horizontal>
<vn-autocomplete
<vn-autocomplete
vn-one
vn-id="client"
required="true"
@ -33,14 +33,15 @@
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
<vn-autocomplete
vn-one
required="true"
data="$ctrl.addresses"
label="Address"
show-field="nickname"
value-field="id"
value-field="id"
ng-model="$ctrl.addressId"
on-change="$ctrl.isEditable($ctrl.addressId)"
order="isActive DESC">
<tpl-item class="address" ng-class="::{inactive: !isActive}">
<span class="inactive" translate>{{::!isActive ? '(Inactive)' : ''}}</span>
@ -65,7 +66,7 @@
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
<vn-autocomplete
vn-one
required="true"
url="Companies"
@ -104,19 +105,19 @@
<vn-date-picker
vn-one
required="true"
label="Shipped"
label="Shipped"
ng-model="$ctrl.shipped">
</vn-date-picker>
<vn-input-time
vn-one
required="true"
label="Shipped hour"
label="Shipped hour"
ng-model="$ctrl.shipped">
</vn-input-time>
<vn-date-picker
vn-one
required="true"
label="Landed"
label="Landed"
ng-model="$ctrl.landed">
</vn-date-picker>
</vn-horizontal>

View File

@ -289,6 +289,17 @@ class Controller extends Component {
}
return {};
}
isEditable(a) {
return this.$http.get(`Tickets/${this.ticket.id}/isEditable`).then(res => {
console.log(res.data);
if (!res.data) {
return this.vnApp.showError(
this.$t(`This ticket is not editable`)
);
}
});
}
}
ngModule.vnComponent('vnTicketBasicDataStepOne', {