refs #4764 service
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2023-07-27 15:15:55 +02:00
parent 118f41c898
commit d01584bfb3
3 changed files with 27 additions and 52 deletions

View File

@ -311,5 +311,6 @@
"You don't have enough privileges.": "No tienes suficientes permisos.",
"This ticket is locked.": "Este ticket está bloqueado.",
"This ticket is not editable.": "Este ticket no es editable.",
"The ticket doesn't exist.": "No existe el ticket."
"The ticket doesn't exist.": "No existe el ticket.",
"There is no zone for these parameters": "There is no zone for these parameters"
}

View File

@ -26,16 +26,19 @@
<vn-card class="vn-pa-lg">
<vn-button-bar>
<vn-button
disabled="!watcher.dataChanged() || !$ctrl.hasSelectedServices() || !$ctrl.isDataSaved"
disabled="watcher.dataChanged() || !$ctrl.checkeds.length"
label="Pay"
ng-click="$ctrl.createRefund()"
vn-acl="invoicing, claimManager, salesAssistant"
vn-acl-action="remove">
</vn-button>
{{ watcher.dataChanged() }}
</vn-button-bar>
<vn-horizontal ng-repeat="service in $ctrl.services">
<vn-check tabindex="1"
ng-model="service.checked">
<vn-check
tabindex="1"
on-change="$ctrl.addChecked(service.id)"
disabled="!service.id">
</vn-check>
<vn-autocomplete vn-two vn-focus
data="ticketServiceTypes"
@ -90,15 +93,9 @@
disabled="!watcher.dataChanged()"
label="Save">
</vn-submit>
<!-- # #2680 Undo changes button bugs -->
<!-- <vn-button
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()">
</vn-button> -->
</vn-button-bar>
</form>
<!-- Create service type dialog -->
<vn-dialog class="edit"
vn-id="newServiceTypeDialog"

View File

@ -7,6 +7,7 @@ class Controller extends Section {
this.services = [];
this.getDefaultTaxClass();
this.isDataSaved = false;
this.checkeds = [];
}
getDefaultTaxClass() {
@ -48,51 +49,27 @@ class Controller extends Section {
this.$.model.save()
.then(() => this.$.model.refresh())
.then(() => this.$.watcher.notifySaved())
.then(() => {
this.isDataSaved = true;
});
}
selectedServices() {
if (!this.services) return;
return this.services.filter(service => {
return service.checked;
});
}
selectedValidServices() {
if (!this.services) return;
const selectedServices = this.selectedServices();
return selectedServices.filter(service => {
return service.id != undefined;
});
}
hasSelectedServices() {
const selected = this.selectedServices() || [];
return selected.length > 0;
.then(() => this.$.watcher.notifySaved());
}
createRefund() {
this.$.model.save()
.then(() => {
const services = this.selectedValidServices();
if (!services) return;
const servicesIds = services.map(service => service.id);
const services = this.services;
if (!services) return;
const servicesIds = services.map(service => service.id);
const params = {servicesIds: servicesIds};
const query = 'Sales/refund';
this.$http.post(query, params).then(res => {
const refundTicket = res.data;
this.vnApp.showSuccess(this.$t('The following refund ticket have been created', {
ticketId: refundTicket.id
}));
this.$state.go('ticket.card.sale', {id: refundTicket.id});
});
});
const params = {servicesIds: servicesIds, withWarehouse: false};
const query = 'Sales/refund';
this.$http.post(query, params).then(res => {
const refundTicket = res.data;
this.vnApp.showSuccess(this.$t('The following refund ticket have been created', {
ticketId: refundTicket.id
}));
this.$state.go('ticket.card.sale', {id: refundTicket.id});
});
}
addChecked(id) {
this.checkeds.push(id);
}
}