Compare commits

...

5 Commits

9 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,47 @@
DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterInsert`;
USE `vn`;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterInsert`
AFTER INSERT ON `zoneIncluded`
FOR EACH ROW
BEGIN
INSERT INTO zoneLog
SET `action` = 'insert',
`changedModel` = 'zoneIncluded',
`changedModelId` = OLD.zoneFk,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;
DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterUpdate`;
USE `vn`;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterUpdate`
AFTER UPDATE ON `zoneIncluded`
FOR EACH ROW
BEGIN
INSERT INTO zoneLog
SET `action` = 'update',
`changedModel` = 'zoneIncluded',
`changedModelId` = OLD.zoneFk,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;
-- DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterDelete`;
-- USE `vn`;
-- DELIMITER $$
-- CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterDelete`
-- AFTER DELETE ON `zoneIncluded`
-- FOR EACH ROW
-- BEGIN
-- INSERT INTO zoneLog
-- SET `action` = 'delete',
-- `changedModel` = 'zoneIncluded',
-- `changedModelId` = OLD.zoneFk,
-- `userFk` = account.myUser_getId();
-- END$$
-- DELIMITER ;

View File

@ -0,0 +1,7 @@
CREATE TABLE `vn`.`zoneIncludedCheck` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`zoneFK` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`inclusion_FK`,`zoneFK`),
CONSTRAINT `inclusion_FK` FOREIGN KEY (`zoneFK`) REFERENCES `zoneIncluded` (`id`) ON UPDATE CASCADE,
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

View File

@ -0,0 +1,2 @@
DELETE FROM bs.nightTask
WHERE `procedure` ='zone_getCollisions';

View File

@ -0,0 +1 @@
DROP PROCEDURE vn.zone_getCollisions;

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,2 @@
subject: Colisión de zona detectada
title: "La zona {0} ha sido registrada en más de un sitio"

View File

@ -0,0 +1,5 @@
SELECT
z.name
FROM vn.zoneIncluded zI
LEFT JOIN vn.zone z ON z.Id = zI.zoneFk
WHERE zI.id = ?;

View File

@ -0,0 +1,8 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('subject') }}</h1>
<p>{{ $t('title', [this.zoneIncluded.name]) }}</p>
</div>
</div>
</email-body>

View File

@ -0,0 +1,27 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'zone-included',
async serverPrefetch() {
this.zoneIncluded = await this.fetchZoneIncluded(this.id);
},
methods: {
fetchZoneIncluded(id) {
return this.findOneFromDef('zoneIncluded', [id]);
},
},
components: {
'email-body': emailBody.build(),
},
props: {
id: {
type: Number,
required: true
},
url: {
type: String,
required: true
}
}
};