Send invoice to specific email address from descriptor option #739

Merged
carlosjr merged 4 commits from 3010-send_invoice into dev 2021-09-24 07:54:01 +00:00
2 changed files with 16 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,18 @@
</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>
<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
});
}