Added options to invoiceOut
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2021-10-07 10:04:50 +02:00
parent 1ec20e250c
commit 82a14088d0
8 changed files with 67 additions and 57 deletions

View File

@ -26,7 +26,7 @@ class Email {
* @param {Object} params The email parameters * @param {Object} params The email parameters
* @return {Promise} Promise resolved when it's sent * @return {Promise} Promise resolved when it's sent
*/ */
sendCSV(template, params) { sendCsv(template, params) {
return this.$http.get(`csv/${template}/send`, {params}) return this.$http.get(`csv/${template}/send`, {params})
.then(() => this.vnApp.showMessage(this.$t('Notification sent!'))); .then(() => this.vnApp.showMessage(this.$t('Notification sent!')));
} }

View File

@ -28,7 +28,7 @@ class Report {
* @param {String} report The report name * @param {String} report The report name
* @param {Object} params The report parameters * @param {Object} params The report parameters
*/ */
showCSV(report, params) { showCsv(report, params) {
params = Object.assign({ params = Object.assign({
authorization: this.vnToken.token authorization: this.vnToken.token
}, params); }, params);

View File

@ -18,7 +18,7 @@
Show as PDF Show as PDF
</a> </a>
<vn-item <vn-item
ng-click="$ctrl.showInvoiceCSV()" ng-click="$ctrl.showCsvInvoice()"
translate> translate>
Show as CSV Show as CSV
</vn-item> </vn-item>
@ -34,12 +34,12 @@
<vn-menu vn-id="sendInvoiceMenu"> <vn-menu vn-id="sendInvoiceMenu">
<vn-list> <vn-list>
<vn-item <vn-item
ng-click="invoiceConfirmation.show({email: $ctrl.invoiceOut.client.email})" ng-click="sendPdfConfirmation.show({email: $ctrl.invoiceOut.client.email})"
translate> translate>
Send PDF Send PDF
</vn-item> </vn-item>
<vn-item <vn-item
ng-click="confirmDeliveryNoteCSV.show({email: $ctrl.ticket.client.email})" ng-click="sendCsvConfirmation.show({email: $ctrl.invoiceOut.client.email})"
translate> translate>
Send CSV Send CSV
</vn-item> </vn-item>
@ -136,15 +136,32 @@
message="You are going to regenerate the invoice PDF document"> message="You are going to regenerate the invoice PDF document">
</vn-confirm> </vn-confirm>
<!-- Send invoice confirmation popup --> <!-- Send PDF invoice confirmation popup -->
<vn-dialog class="edit" <vn-dialog
vn-id="invoiceConfirmation" vn-id="sendPdfConfirmation"
on-accept="$ctrl.sendInvoice($data)" on-accept="$ctrl.sendPdfInvoice($data)"
message="Send invoice PDF"> message="Send PDF invoice">
<tpl-body> <tpl-body>
<span translate>Are you sure you want to send it?</span> <span translate>Are you sure you want to send it?</span>
<vn-textfield vn-one <vn-textfield vn-one
ng-model="invoiceConfirmation.data.email"> ng-model="sendPdfConfirmation.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>
<!-- Send CSV invoice confirmation popup -->
<vn-dialog
vn-id="sendCsvConfirmation"
on-accept="$ctrl.sendCsvInvoice($data)"
message="Send CSV invoice">
<tpl-body>
<span translate>Are you sure you want to send it?</span>
<vn-textfield vn-one
ng-model="sendCsvConfirmation.data.email">
</vn-textfield> </vn-textfield>
</tpl-body> </tpl-body>
<tpl-buttons> <tpl-buttons>

View File

@ -22,7 +22,7 @@ class Controller extends Descriptor {
.then(() => this.vnApp.showSuccess(this.$t('InvoiceOut booked'))); .then(() => this.vnApp.showSuccess(this.$t('InvoiceOut booked')));
} }
createInvoicePdf() { createPdfInvoice() {
const invoiceId = this.invoiceOut.id; const invoiceId = this.invoiceOut.id;
return this.$http.post(`InvoiceOuts/${invoiceId}/createPdf`) return this.$http.post(`InvoiceOuts/${invoiceId}/createPdf`)
.then(() => { .then(() => {
@ -60,14 +60,14 @@ class Controller extends Descriptor {
.then(res => this.entity = res.data); .then(res => this.entity = res.data);
} }
showInvoiceCSV() { showCsvInvoice() {
this.vnReport.showCSV('invoice', { this.vnReport.showCsv('invoice', {
recipientId: this.invoiceOut.client.id, recipientId: this.invoiceOut.client.id,
invoiceId: this.id, invoiceId: this.id,
}); });
} }
sendInvoice($data) { sendPdfInvoice($data) {
return this.vnEmail.send('invoice', { return this.vnEmail.send('invoice', {
recipientId: this.invoiceOut.client.id, recipientId: this.invoiceOut.client.id,
recipient: $data.email, recipient: $data.email,
@ -75,11 +75,11 @@ class Controller extends Descriptor {
}); });
} }
sendDeliveryNoteCSV($data) { sendCsvInvoice($data) {
return this.vnEmail.sendCSV('delivery-note', { return this.vnEmail.sendCsv('invoice', {
recipientId: this.ticket.client.id, recipientId: this.invoiceOut.client.id,
recipient: $data.email, recipient: $data.email,
ticketId: this.id invoiceId: this.id
}); });
} }
} }

View File

@ -4,8 +4,8 @@ Client card: Ficha del cliente
Invoice ticket list: Listado de tickets de la factura Invoice ticket list: Listado de tickets de la factura
Show invoice...: Ver factura... Show invoice...: Ver factura...
Send invoice...: Enviar factura... Send invoice...: Enviar factura...
Send invoice PDF: Enviar factura en PDF Send PDF invoice: Enviar factura en PDF
Send invoice CSV: Enviar factura en CSV Send CSV invoice: Enviar factura en CSV
Delete Invoice: Eliminar factura Delete Invoice: Eliminar factura
Clone Invoice: Clonar factura Clone Invoice: Clonar factura
InvoiceOut deleted: Factura eliminada InvoiceOut deleted: Factura eliminada

View File

@ -16,16 +16,16 @@
<vn-item class="dropdown" <vn-item class="dropdown"
vn-click-stop="showDeliveryNoteMenu.show($event, 'left')" vn-click-stop="showDeliveryNoteMenu.show($event, 'left')"
translate> translate>
Show Delivery Note Show Delivery Note...
<vn-menu vn-id="showDeliveryNoteMenu"> <vn-menu vn-id="showDeliveryNoteMenu">
<vn-list> <vn-list>
<vn-item <vn-item
ng-click="$ctrl.showDeliveryNote()" ng-click="$ctrl.showPdfDeliveryNote()"
translate> translate>
Show as PDF Show as PDF
</vn-item> </vn-item>
<vn-item <vn-item
ng-click="$ctrl.showDeliveryNoteCSV()" ng-click="$ctrl.showCsvDeliveryNote()"
translate> translate>
Show as CSV Show as CSV
</vn-item> </vn-item>
@ -35,17 +35,17 @@
<vn-item class="dropdown" <vn-item class="dropdown"
vn-click-stop="sendDeliveryNoteMenu.show($event, 'left')" vn-click-stop="sendDeliveryNoteMenu.show($event, 'left')"
translate> translate>
Send Delivery Note Send Delivery Note...
<vn-menu vn-id="sendDeliveryNoteMenu"> <vn-menu vn-id="sendDeliveryNoteMenu">
<vn-list> <vn-list>
<vn-item <vn-item
ng-click="confirmDeliveryNote.show({email: $ctrl.ticket.client.email})" ng-click="sendPdfConfirmation.show({email: $ctrl.ticket.client.email})"
translate> translate>
Send PDF Send PDF
</vn-item> </vn-item>
<vn-item <vn-item
ng-click="confirmDeliveryNoteCSV.show({email: $ctrl.ticket.client.email})" ng-click="sendCsvConfirmation.show({email: $ctrl.ticket.client.email})"
translate> translate>
Send CSV Send CSV
</vn-item> </vn-item>
@ -109,7 +109,7 @@
Make invoice Make invoice
</vn-item> </vn-item>
<vn-item <vn-item
ng-click="createInvoicePdfConfirmation.show()" ng-click="createPdfConfirmation.show()"
ng-show="$ctrl.isInvoiced" ng-show="$ctrl.isInvoiced"
vn-acl="invoicing" vn-acl="invoicing"
vn-acl-action="remove" vn-acl-action="remove"
@ -165,22 +165,15 @@
</div> </div>
</vn-popup> </vn-popup>
<!-- Send delivery note confirmation popup --> <!-- Send PDF delivery note confirmation popup -->
<!-- <vn-confirm
vn-id="confirmDeliveryNote"
on-accept="$ctrl.sendDeliveryNote()"
question="Are you sure you want to send it?"
message="Send Delivery Note">
</vn-confirm> -->
<vn-dialog <vn-dialog
vn-id="confirmDeliveryNote" vn-id="sendPdfConfirmation"
on-accept="$ctrl.sendDeliveryNote($data)" on-accept="$ctrl.sendPdfDeliveryNote($data)"
message="Send Delivery Note PDF"> message="Send PDF Delivery Note">
<tpl-body> <tpl-body>
<span translate>Are you sure you want to send it?</span> <span translate>Are you sure you want to send it?</span>
<vn-textfield vn-one <vn-textfield vn-one
ng-model="confirmDeliveryNote.data.email"> ng-model="sendPdfConfirmation.data.email">
</vn-textfield> </vn-textfield>
</tpl-body> </tpl-body>
<tpl-buttons> <tpl-buttons>
@ -189,15 +182,15 @@
</tpl-buttons> </tpl-buttons>
</vn-dialog> </vn-dialog>
<!-- Send delivery note CSV confirmation popup --> <!-- Send CSV delivery note confirmation popup -->
<vn-dialog <vn-dialog
vn-id="confirmDeliveryNoteCSV" vn-id="sendCsvConfirmation"
on-accept="$ctrl.sendDeliveryNoteCSV($data)" on-accept="$ctrl.sendCsvDeliveryNote($data)"
message="Send Delivery Note CSV"> message="Send CSV Delivery Note">
<tpl-body> <tpl-body>
<span translate>Are you sure you want to send it?</span> <span translate>Are you sure you want to send it?</span>
<vn-textfield vn-one <vn-textfield vn-one
ng-model="confirmDeliveryNoteCSV.data.email"> ng-model="sendCsvConfirmation.data.email">
</vn-textfield> </vn-textfield>
</tpl-body> </tpl-body>
<tpl-buttons> <tpl-buttons>
@ -271,8 +264,8 @@
<!-- Create invoice PDF confirmation dialog --> <!-- Create invoice PDF confirmation dialog -->
<vn-confirm <vn-confirm
vn-id="createInvoicePdfConfirmation" vn-id="createPdfConfirmation"
on-accept="$ctrl.createInvoicePdf()" on-accept="$ctrl.createPdfInvoice()"
question="Are you sure you want to regenerate the invoice PDF document?" question="Are you sure you want to regenerate the invoice PDF document?"
message="You are going to regenerate the invoice PDF document"> message="You are going to regenerate the invoice PDF document">
</vn-confirm> </vn-confirm>

View File

@ -111,21 +111,21 @@ class Controller extends Section {
}); });
} }
showDeliveryNote() { showPdfDeliveryNote() {
this.vnReport.show('delivery-note', { this.vnReport.show('delivery-note', {
recipientId: this.ticket.client.id, recipientId: this.ticket.client.id,
ticketId: this.id, ticketId: this.id,
}); });
} }
showDeliveryNoteCSV() { showCsvDeliveryNote() {
this.vnReport.showCSV('delivery-note', { this.vnReport.showCsv('delivery-note', {
recipientId: this.ticket.client.id, recipientId: this.ticket.client.id,
ticketId: this.id, ticketId: this.id,
}); });
} }
sendDeliveryNote($data) { sendPdfDeliveryNote($data) {
return this.vnEmail.send('delivery-note', { return this.vnEmail.send('delivery-note', {
recipientId: this.ticket.client.id, recipientId: this.ticket.client.id,
recipient: $data.email, recipient: $data.email,
@ -133,8 +133,8 @@ class Controller extends Section {
}); });
} }
sendDeliveryNoteCSV($data) { sendCsvDeliveryNote($data) {
return this.vnEmail.sendCSV('delivery-note', { return this.vnEmail.sendCsv('delivery-note', {
recipientId: this.ticket.client.id, recipientId: this.ticket.client.id,
recipient: $data.email, recipient: $data.email,
ticketId: this.id ticketId: this.id

View File

@ -1,8 +1,8 @@
Show Delivery Note: Ver albarán Show Delivery Note...: Ver albarán...
Send Delivery Note: Enviar albarán Send Delivery Note...: Enviar albarán...
Show as PDF: Ver como PDF Show as PDF: Ver como PDF
Show as CSV: Ver como CSV Show as CSV: Ver como CSV
Send PDF: Enviar PDF Send PDF: Enviar PDF
Send CSV: Enviar CSV Send CSV: Enviar CSV
Send Delivery Note CSV: Enviar albarán en CSV Send CSV Delivery Note: Enviar albarán en CSV
Send Delivery Note PDF: Enviar albarán en PDF Send PDF Delivery Note: Enviar albarán en PDF