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 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,18 @@
</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>
<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
}); });
} }