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 Show invoice PDF
</a> </a>
<vn-item <vn-item
ng-click="invoiceConfirmation.show()" ng-click="invoiceConfirmation.show({email: $ctrl.invoiceOut.client.email})"
name="sendInvoice" name="sendInvoice"
translate> translate>
Send invoice PDF Send invoice PDF
@ -106,9 +106,19 @@
</vn-confirm> </vn-confirm>
<!-- Send invoice confirmation popup --> <!-- Send invoice confirmation popup -->
<vn-confirm
<vn-dialog class="edit"
vn-id="invoiceConfirmation" vn-id="invoiceConfirmation"
on-accept="$ctrl.sendInvoice()" on-accept="$ctrl.sendInvoice($data)"
question="Are you sure you want to send it?"
message="Send invoice PDF"> 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); .then(res => this.entity = res.data);
} }
sendInvoice() { sendInvoice($data) {
return this.vnEmail.send('invoice', { return this.vnEmail.send('invoice', {
recipientId: this.invoiceOut.client.id, recipientId: this.invoiceOut.client.id,
recipient: this.invoiceOut.client.email, recipient: $data.email,
invoiceId: this.id invoiceId: this.id
}); });
} }