added hasToInvoiceByAddress checkbox to client > billingData

This commit is contained in:
Carlos 2017-11-13 11:47:41 +01:00
parent c800034cc7
commit 154c06e7f4
4 changed files with 22 additions and 8 deletions

View File

@ -28,11 +28,14 @@
</vn-horizontal>
<vn-horizontal>
<vn-one>
<vn-check label="Recargo de equivalencia" field="$ctrl.client.equalizationTax" vn-acl="administrative"></vn-check>
<vn-check label="Equalization tax" field="$ctrl.client.equalizationTax" vn-acl="administrative"></vn-check>
</vn-one>
<vn-one>
<vn-check label="Vies" field="$ctrl.client.vies" vn-acl="administrative"></vn-check>
</vn-one>
<vn-one>
<vn-check label="Invoice by address" field="$ctrl.client.hasToInvoiceByAddress" vn-acl="administrative"></vn-check>
</vn-one>
</vn-horizontal>
</vn-vertical>
</vn-card>
@ -72,7 +75,7 @@
</vn-dialog>
<vn-dialog
vn-id="propagate-equalizationTax"
on-response="$ctrl.returnDialogRE(response)">
on-response="$ctrl.returnDialogEt(response)">
<tpl-body>
<vn-vertical>
<vn-one text-center translate>You changes the equivalent tax</vn-one>

View File

@ -9,9 +9,11 @@ export default class Controller {
this.billData = {};
this.copyData();
}
$onChanges() {
this.copyData();
}
copyData() {
if (this.client) {
this.billData.payMethodFk = this.client.payMethodFk;
@ -23,10 +25,12 @@ export default class Controller {
this.equalizationTax = this.client.equalizationTax;
}
}
submit() {
return this.$.watcher.submit().then(
() => this.checkPaymentChanges());
}
checkPaymentChanges() {
let equals = true;
Object.keys(this.billData).forEach(
@ -39,25 +43,26 @@ export default class Controller {
);
if (equals) {
this.checkREChanges();
this.checkEtChanges();
} else {
this.$.sendMail.show();
}
}
returnDialog(response) {
if (response === 'ACCEPT') {
this.$http.post(`/mailer/manuscript/payment-update/${this.client.id}`).then(
() => {
this.vnApp.showMessage(this.translate.instant('Notification sent!'));
this.checkREChanges();
this.checkEtChanges();
}
);
} else {
this.checkREChanges();
this.checkEtChanges();
}
}
checkREChanges() {
checkEtChanges() {
let equals = this.equalizationTax == this.client.equalizationTax;
this.equalizationTax = this.client.equalizationTax;
@ -65,7 +70,7 @@ export default class Controller {
this.$.propagateEqualizationTax.show();
}
returnDialogRE(response) {
returnDialogEt(response) {
if (response === 'ACCEPT') {
this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then(
res => {

View File

@ -8,5 +8,7 @@
"You changes the equivalent tax": "Has cambiado el recargo de equivalencia",
"Do you want to spread the change to their consignees?" : "¿Deseas propagar el cambio a sus consignatarios?",
"Yes, propagate": "Si, propagar",
"Equivalent tax spreaded": "Recargo de equivalencia propagado"
"Equivalent tax spreaded": "Recargo de equivalencia propagado",
"Invoice by address": "Facturar por consignatario",
"Equalization tax": "Recargo de equivalencia"
}

View File

@ -64,6 +64,10 @@
"type": "boolean",
"description": "The client has equalization tax"
},
"hasToInvoiceByAddress": {
"type": "boolean",
"description": "The client has to be invoiced by address"
},
"hasToInvoice": {
"type": "boolean",
"description": "Global invoicing enabled for the client"