Merge pull request 'fixes #5513 Crear back para añadir funcionalidad de Embalajes de la app' (!1605) from 5513-back-embalaje into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1605
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Alexandre Riera 2023-06-16 05:15:43 +00:00
commit a866b92b8c
8 changed files with 49 additions and 4 deletions

View File

@ -2736,7 +2736,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
(1, 'print-email', 'notification fixture one'),
(2, 'invoice-electronic', 'A electronic invoice has been generated'),
(3, 'not-main-printer-configured', 'A printer distinct than main has been configured'),
(4, 'supplier-pay-method-update', 'A supplier pay method has been updated');
(4, 'supplier-pay-method-update', 'A supplier pay method has been updated'),
(5, 'modified-entry', 'An entry has been modified');
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
VALUES

View File

@ -46,7 +46,7 @@ module.exports = Self => {
}
try {
let buy = await models.Buy.findOne({where: {entryFk: args.id}}, myOptions);
let buy = await models.Buy.findOne({where: {entryFk: args.id, itemFk: args.item}}, myOptions);
if (buy)
await buy.updateAttribute('printedStickers', args.printedStickers, myOptions);
else {

View File

@ -26,14 +26,14 @@ module.exports = Self => {
Self.getItemsPackaging = async(id, entry) => {
return Self.rawSql(`
WITH entryTmp AS (
SELECT i.id, SUM(b.quantity) quantity
SELECT i.id, SUM(b.quantity) quantity, SUM(b.printedStickers) printedStickers
FROM vn.entry e
JOIN vn.buy b ON b.entryFk = e.id
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.item i ON i.id = b.itemFk
WHERE e.id = ? AND e.supplierFk = ?
GROUP BY i.id
) SELECT i.id, i.name, et.quantity, SUM(b.quantity) quantityTotal
) SELECT i.id, i.name, et.quantity, SUM(b.quantity) quantityTotal, et.printedStickers
FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk
JOIN vn.entry e ON e.id = b.entryFk

View File

@ -0,0 +1,11 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,3 @@
subject: Modified entry
title: Modified entry
description: From Warehouse the following packaging entry has been created/modified

View File

@ -0,0 +1,3 @@
subject: Entrada modificada
title: Entrada modificada
description: Desde Almacén se ha creado/modificado la siguiente entrada de embalajes

View File

@ -0,0 +1,11 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p>
{{ $t('description') }}:
<a :href="url">{{ url }}</a>
</p>
</div>
</div>
</email-body>

View File

@ -0,0 +1,16 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'modified-entry',
components: {
'email-body': emailBody.build(),
},
props: {
url: {
type: String,
required: true
}
}
};