refactor(invoice): send invoice to specific email address from descriptor option
gitea/salix/pipeline/head This commit looks good Details

Refs: 3010
This commit is contained in:
Joan Sanchez 2021-09-20 13:59:57 +02:00
parent 8ab67f0ba5
commit a0ac55bc3e
2 changed files with 17 additions and 7 deletions

View File

@ -10,7 +10,7 @@
Show invoice PDF
</a>
<vn-item
ng-click="invoiceConfirmation.show()"
ng-click="invoiceConfirmation.show({email: $ctrl.invoiceOut.client.email})"
name="sendInvoice"
translate>
Send invoice PDF
@ -106,9 +106,19 @@
</vn-confirm>
<!-- Send invoice confirmation popup -->
<vn-confirm
<vn-dialog class="edit"
vn-id="invoiceConfirmation"
on-accept="$ctrl.sendInvoice()"
question="Are you sure you want to send it?"
on-accept="$ctrl.sendInvoice($data)"
message="Send invoice PDF">
</vn-confirm>
<tpl-body class="upload-photo">
<span translate>Are you sure you want to send it?</span>
<vn-textfield vn-one
ng-model="invoiceConfirmation.data.email">
</vn-textfield>
</tpl-body>
<tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Confirm</button>
</tpl-buttons>
</vn-dialog>

View File

@ -60,10 +60,10 @@ class Controller extends Descriptor {
.then(res => this.entity = res.data);
}
sendInvoice() {
sendInvoice($data) {
return this.vnEmail.send('invoice', {
recipientId: this.invoiceOut.client.id,
recipient: this.invoiceOut.client.email,
recipient: $data.email,
invoiceId: this.id
});
}