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-horizontal> <vn-horizontal>
<vn-one> <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-one> <vn-one>
<vn-check label="Vies" field="$ctrl.client.vies" vn-acl="administrative"></vn-check> <vn-check label="Vies" field="$ctrl.client.vies" vn-acl="administrative"></vn-check>
</vn-one> </vn-one>
<vn-one>
<vn-check label="Invoice by address" field="$ctrl.client.hasToInvoiceByAddress" vn-acl="administrative"></vn-check>
</vn-one>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
@ -72,7 +75,7 @@
</vn-dialog> </vn-dialog>
<vn-dialog <vn-dialog
vn-id="propagate-equalizationTax" vn-id="propagate-equalizationTax"
on-response="$ctrl.returnDialogRE(response)"> on-response="$ctrl.returnDialogEt(response)">
<tpl-body> <tpl-body>
<vn-vertical> <vn-vertical>
<vn-one text-center translate>You changes the equivalent tax</vn-one> <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.billData = {};
this.copyData(); this.copyData();
} }
$onChanges() { $onChanges() {
this.copyData(); this.copyData();
} }
copyData() { copyData() {
if (this.client) { if (this.client) {
this.billData.payMethodFk = this.client.payMethodFk; this.billData.payMethodFk = this.client.payMethodFk;
@ -23,10 +25,12 @@ export default class Controller {
this.equalizationTax = this.client.equalizationTax; this.equalizationTax = this.client.equalizationTax;
} }
} }
submit() { submit() {
return this.$.watcher.submit().then( return this.$.watcher.submit().then(
() => this.checkPaymentChanges()); () => this.checkPaymentChanges());
} }
checkPaymentChanges() { checkPaymentChanges() {
let equals = true; let equals = true;
Object.keys(this.billData).forEach( Object.keys(this.billData).forEach(
@ -39,25 +43,26 @@ export default class Controller {
); );
if (equals) { if (equals) {
this.checkREChanges(); this.checkEtChanges();
} else { } else {
this.$.sendMail.show(); this.$.sendMail.show();
} }
} }
returnDialog(response) { returnDialog(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
this.$http.post(`/mailer/manuscript/payment-update/${this.client.id}`).then( this.$http.post(`/mailer/manuscript/payment-update/${this.client.id}`).then(
() => { () => {
this.vnApp.showMessage(this.translate.instant('Notification sent!')); this.vnApp.showMessage(this.translate.instant('Notification sent!'));
this.checkREChanges(); this.checkEtChanges();
} }
); );
} else { } else {
this.checkREChanges(); this.checkEtChanges();
} }
} }
checkREChanges() { checkEtChanges() {
let equals = this.equalizationTax == this.client.equalizationTax; let equals = this.equalizationTax == this.client.equalizationTax;
this.equalizationTax = this.client.equalizationTax; this.equalizationTax = this.client.equalizationTax;
@ -65,7 +70,7 @@ export default class Controller {
this.$.propagateEqualizationTax.show(); this.$.propagateEqualizationTax.show();
} }
returnDialogRE(response) { returnDialogEt(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then( this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then(
res => { res => {

View File

@ -8,5 +8,7 @@
"You changes the equivalent tax": "Has cambiado el recargo de equivalencia", "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?", "Do you want to spread the change to their consignees?" : "¿Deseas propagar el cambio a sus consignatarios?",
"Yes, propagate": "Si, propagar", "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", "type": "boolean",
"description": "The client has equalization tax" "description": "The client has equalization tax"
}, },
"hasToInvoiceByAddress": {
"type": "boolean",
"description": "The client has to be invoiced by address"
},
"hasToInvoice": { "hasToInvoice": {
"type": "boolean", "type": "boolean",
"description": "Global invoicing enabled for the client" "description": "Global invoicing enabled for the client"