Merge pull request '3026 - Send invoice PDF' (#694) from 3026-send_invoice into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #694
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2021-07-20 08:04:46 +00:00
commit 7563287e58
19 changed files with 164 additions and 9 deletions

View File

@ -21,7 +21,7 @@ class Controller extends ModuleCard {
}, { }, {
relation: 'client', relation: 'client',
scope: { scope: {
fields: ['id', 'socialName', 'name'] fields: ['id', 'socialName', 'name', 'email']
} }
} }
] ]

View File

@ -9,6 +9,12 @@
translate> translate>
Show invoice PDF Show invoice PDF
</a> </a>
<vn-item
ng-click="invoiceConfirmation.show()"
name="sendInvoice"
translate>
Send invoice PDF
</vn-item>
<vn-item <vn-item
ng-click="deleteConfirmation.show()" ng-click="deleteConfirmation.show()"
vn-acl="invoicing" vn-acl="invoicing"
@ -97,4 +103,12 @@
on-accept="$ctrl.createInvoicePdf()" on-accept="$ctrl.createInvoicePdf()"
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>
<!-- Send invoice confirmation popup -->
<vn-confirm
vn-id="invoiceConfirmation"
on-accept="$ctrl.sendInvoice()"
question="Are you sure you want to send it?"
message="Send invoice PDF">
</vn-confirm> </vn-confirm>

View File

@ -59,6 +59,14 @@ class Controller extends Descriptor {
return this.getData(`InvoiceOuts/${this.id}`, {filter}) return this.getData(`InvoiceOuts/${this.id}`, {filter})
.then(res => this.entity = res.data); .then(res => this.entity = res.data);
} }
sendInvoice() {
return this.vnEmail.send('invoice', {
recipientId: this.invoiceOut.client.id,
recipient: this.invoiceOut.client.email,
invoiceId: this.id
});
}
} }
ngModule.vnComponent('vnInvoiceOutDescriptor', { ngModule.vnComponent('vnInvoiceOutDescriptor', {

View File

@ -3,6 +3,7 @@ Volume: Volumen
Client card: Ficha del cliente 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 PDF: Ver factura en PDF Show invoice PDF: Ver factura en PDF
Send invoice PDF: Enviar factura en PDF
Delete Invoice: Eliminar factura Delete Invoice: Eliminar factura
InvoiceOut deleted: Factura eliminada InvoiceOut deleted: Factura eliminada
Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura?

View File

@ -1,7 +1,7 @@
buttons: buttons:
webAcccess: Visit our website webAcccess: Visit our website
info: Help us to improve info: Help us to improve
fiscalAddress: VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla fiscalAddress: VERDNATURA LEVANTE SL, B97367486 C/ Fenollar, 2. 46680 ALGEMESI
· www.verdnatura.es · clientes@verdnatura.es · www.verdnatura.es · clientes@verdnatura.es
disclaimer: '- NOTICE - This message is private and confidential, and should be used disclaimer: '- NOTICE - This message is private and confidential, and should be used
exclusively by the person receiving it. If you have received this message by mistake, exclusively by the person receiving it. If you have received this message by mistake,

View File

@ -1,7 +1,7 @@
buttons: buttons:
webAcccess: Visitez notre site web webAcccess: Visitez notre site web
info: Aidez-nous à améliorer info: Aidez-nous à améliorer
fiscalAddress: VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla fiscalAddress: VERDNATURA LEVANTE SL, B97367486 C/ Fenollar, 2. 46680 ALGEMESI
· www.verdnatura.es · clientes@verdnatura.es · www.verdnatura.es · clientes@verdnatura.es
disclaimer: "- AVIS - Ce message est privé et confidentiel et doit être utilisé disclaimer: "- AVIS - Ce message est privé et confidentiel et doit être utilisé
exclusivement par le destinataire. Si vous avez reçu ce message par erreur, exclusivement par le destinataire. Si vous avez reçu ce message par erreur,

View File

@ -1,7 +1,7 @@
buttons: buttons:
webAcccess: Visite o nosso site webAcccess: Visite o nosso site
info: Ajude-nos a melhorar info: Ajude-nos a melhorar
fiscalAddress: VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla fiscalAddress: VERDNATURA LEVANTE SL, B97367486 C/ Fenollar, 2. 46680 ALGEMESI
· www.verdnatura.es · clientes@verdnatura.es · www.verdnatura.es · clientes@verdnatura.es
disclaimer: '- AVISO - Esta mensagem é privada e confidencial e deve ser usada exclusivamente disclaimer: '- AVISO - Esta mensagem é privada e confidencial e deve ser usada exclusivamente
pela pessoa que a recebe. Se você recebeu esta mensagem por engano, notifique o remetente e pela pessoa que a recebe. Se você recebeu esta mensagem por engano, notifique o remetente e

View File

@ -1,5 +1,5 @@
subject: Vossa nota de entrega subject: Sua nota de entrega
title: Vossa nota de entrega title: Sua nota de entrega
dear: Estimado cliente dear: Estimado cliente
description: Já está disponível sua nota de entrega correspondente a encomenda numero <strong>{0}</strong>. <br/> description: Já está disponível sua nota de entrega correspondente a encomenda numero <strong>{0}</strong>. <br/>
Para ver-lo faça um clique <a href="https://www.verdnatura.es/#!form=ecomerce/ticket&ticket={0}">neste link</a>. Para ver-lo faça um clique <a href="https://www.verdnatura.es/#!form=ecomerce/ticket&ticket={0}">neste link</a>.

View File

@ -1,5 +1,5 @@
subject: Vossa nota de entrega subject: Sua nota de entrega
title: Vossa nota de entrega title: Sua nota de entrega
dear: Estimado cliente dear: Estimado cliente
description: Já está disponível sua nota de entrega correspondente a encomenda {0}. <br/> description: Já está disponível sua nota de entrega correspondente a encomenda {0}. <br/>
Podes descarregar-la fazendo um clique no arquivo anexado ao e-mail. Podes descarregar-la fazendo um clique no arquivo anexado ao e-mail.

View File

@ -0,0 +1,8 @@
const Stylesheet = require(`${appPath}/core/stylesheet`);
module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,6 @@
[
{
"filename": "invoice.pdf",
"component": "invoice"
}
]

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html v-bind:lang="$i18n.locale">
<head>
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">
<title>{{ $t('subject') }}</title>
</head>
<body>
<table class="grid">
<tbody>
<tr>
<td>
<!-- Empty block -->
<div class="grid-row">
<div class="grid-block empty"></div>
</div>
<!-- Header block -->
<div class="grid-row">
<div class="grid-block">
<email-header v-bind="$props"></email-header>
</div>
</div>
<!-- Block -->
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p>{{$t('dear')}},</p>
<p v-html="$t('description', [invoice.ref, invoice.ticketFk])"></p>
<p v-html="$t('poll')"></p>
<p v-html="$t('help')"></p>
<p v-html="$t('conclusion')"></p>
</div>
</div>
<!-- Footer block -->
<div class="grid-row">
<div class="grid-block">
<email-footer v-bind="$props"></email-footer>
</div>
</div>
<!-- Empty block -->
<div class="grid-row">
<div class="grid-block empty"></div>
</div>
</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,25 @@
const Component = require(`${appPath}/core/component`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
module.exports = {
name: 'invoice',
async serverPrefetch() {
this.invoice = await this.fetchInvoice(this.invoiceId);
},
methods: {
fetchInvoice(invoiceId) {
return this.findOneFromDef('invoice', [invoiceId]);
},
},
components: {
'email-header': emailHeader.build(),
'email-footer': emailFooter.build()
},
props: {
invoiceId: {
type: String,
required: true
}
}
};

View File

@ -0,0 +1,9 @@
subject: Your invoice
title: Your invoice
dear: Dear client
description: The invoice <strong>{0}</strong> from the order <strong>{1}</strong> is now available. <br/>
You can download it by clicking on the attachment of this email.
poll: If you wish, you can answer our satisfaction survey to
help us provide better service. Your opinion is very important for us!
help: Any questions that arise, do not hesitate to consult it, <strong>we are here to assist you!</strong>
conclusion: Thanks for your attention!

View File

@ -0,0 +1,10 @@
subject: Tu factura
title: Tu factura
dear: Estimado cliente
description: Ya está disponible la factura <strong>{0}</strong> correspondiente al pedido <strong>{1}</strong>. <br/>
Puedes descargarla haciendo clic en el adjunto de este correo.
poll: Si lo deseas, puedes responder a nuestra encuesta de satisfacción para
ayudarnos a prestar un mejor servicio. ¡Tu opinión es muy importante para nosotros!
help: Cualquier duda que te surja, no dudes en consultarla, <strong>¡estamos para
atenderte!</strong>
conclusion: ¡Gracias por tu atención!

View File

@ -0,0 +1,9 @@
subject: Votre facture
title: Votre facture
dear: Cher client,
description: Le facture <strong>{0}</strong> correspondant à la commande <strong>{1}</strong> est maintenant disponible.<br/>
Vous pouvez le télécharger en cliquant sur la pièce jointe dans cet email.
poll: Si vous le souhaitez, vous pouvez répondre à notre questionaire de satisfaction
pour nous aider à améliorer notre service. Votre avis est très important pour nous!
help: N'hésitez pas nous envoyer toute doute ou question, <strong>nous sommes là pour vous aider!</strong>
conclusion: Merci pour votre attention!

View File

@ -0,0 +1,9 @@
subject: Sua fatura
title: Sua fatura
dear: Estimado cliente
description: Já está disponível sua fatura <strong>{0}</strong> correspondente a encomenda {1}. <br/>
Podes descarregar-la fazendo um clique no arquivo anexado ao e-mail.
poll: Si o deseja, podes responder nosso questionário de satiscação para ajudar-nos a prestar-vos um melhor serviço. Tua opinião é muito importante para nós!
help: Cualquer dúvida que surja, no hesites em consultar-la, <strong>Estamos aqui para
atender-te!</strong>
conclusion: Obrigado por tua atenção!

View File

@ -0,0 +1,7 @@
SELECT
io.ref,
t.id AS ticketFk
FROM invoiceOut io
JOIN ticket t ON t.refFk = io.ref
JOIN client c ON c.id = io.clientFk
WHERE io.id = ?

View File

@ -21,7 +21,7 @@
<div class="signature"> <div class="signature">
<img v-bind:src="getReportSrc('signature.png')"> <img v-bind:src="getReportSrc('signature.png')">
<p class="centered">{{$t('payed', [ <p class="centered">{{$t('payed', [
'Silla', 'Algemesí',
receipt.payed.getDate(), receipt.payed.getDate(),
$t('months')[receipt.payed.getMonth()], $t('months')[receipt.payed.getMonth()],
receipt.payed.getFullYear()]) receipt.payed.getFullYear()])