This commit is contained in:
Carlos Jimenez Ruiz 2019-01-21 17:01:15 +01:00
commit 69666177b8
192 changed files with 536 additions and 6707 deletions

View File

@ -37,5 +37,8 @@
},
"WorkerTeamCollegues": {
"dataSource": "vn"
},
"Sip": {
"dataSource": "vn"
}
}

38
back/models/sip.json Normal file
View File

@ -0,0 +1,38 @@
{
"name": "Sip",
"base": "VnModel",
"options": {
"mysql": {
"table": "pbx.sip"
}
},
"properties": {
"code": {
"type": "Number",
"id": true,
"mysql": {
"columnName": "extension"
}
},
"password": {
"type": "string",
"mysql": {
"columnName": "secret"
}
},
"name": {
"type": "string",
"mysql": {
"columnName": "caller_id"
}
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "user_id"
}
}
}

View File

@ -20,12 +20,3 @@ services:
volumes:
- /containers/salix:/etc/salix
- /mnt/storage/pdfs:/var/lib/salix/pdfs
mailer:
image: registry.verdnatura.es/salix-mailer:${TAG}
restart: unless-stopped
build:
context: services/mailer
environment:
- NODE_ENV
volumes:
- /containers/vn-mailer:/etc/vn-mailer

View File

@ -2,12 +2,19 @@
import Nightmare from 'nightmare';
export default function createNightmare(width = 1280, height = 720) {
const nightmare = new Nightmare({show: process.env.E2E_SHOW, typeInterval: 10, x: 0, y: 0, waitTimeout: 2000})
.viewport(width, height);
const nightmare = new Nightmare({
show: process.env.E2E_SHOW,
typeInterval: 10,
x: 0,
y: 0,
waitTimeout: 2000
}).viewport(width, height);
nightmare.on('console', (type, message) => {
nightmare.on('console', (type, message, ...args) => {
if (type === 'error')
fail(message);
else
console[type](message, ...args);
});
nightmare.header('Accept-Language', 'en');

View File

@ -35,7 +35,7 @@ export default {
cancelButton: `vn-button[href="#!/client/index"]`
},
clientDescriptor: {
moreMenu: `vn-client-descriptor > vn-card > div vn-icon-menu > div > vn-icon`,
moreMenu: `vn-client-descriptor vn-icon-menu > div > vn-icon`,
simpleTicketButton: 'vn-client-descriptor vn-popover > div > div.content > div > div.list > ul > li'
},
clientBasicData: {
@ -189,7 +189,7 @@ export default {
cancelButton: `button[ui-sref="item.index"]`
},
itemDescriptor: {
moreMenu: `vn-item-descriptor > vn-card > div vn-icon-menu > div > vn-icon`,
moreMenu: `vn-item-descriptor vn-icon-menu > div > vn-icon`,
moreMenuRegularizeButton: `vn-item-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`,
regularizeQuantityInput: `vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input`,
regularizeWarehouseAutocomplete: `#warehouse`,
@ -303,7 +303,7 @@ export default {
createButton: `${components.vnSubmit}`
},
ticketDescriptor: {
moreMenu: `vn-ticket-descriptor > vn-card > div vn-icon-menu > div > vn-icon`,
moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`,
moreMenuAddToTurn: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`,
moreMenuDeleteTicket: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(2)`,
acceptDeleteTicketButton: `vn-ticket-descriptor button[response="ACCEPT"]`,
@ -338,7 +338,7 @@ export default {
saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover',
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]',
saleButton: `vn-left-menu a[ui-sref="ticket.card.sale"]`,
descriptorItemDiaryButton: `vn-item-descriptor > vn-card > div > vn-horizontal.quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`,
descriptorItemDiaryButton: `vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`,
newItemButton: 'vn-float-button[icon="add"]',
firstSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(1)`,
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(3) > img',

View File

@ -145,10 +145,10 @@ describe('Item regularize path', () => {
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search for the ticket with id 22 once again', async() => {
it('should search for the ticket with id 23 once again', async() => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:22')
.type(selectors.ticketsIndex.searchTicketInput, 'id:23')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
@ -158,7 +158,7 @@ describe('Item regularize path', () => {
it(`should now click on the search result to access to the ticket summary`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '22')
.waitForTextInElement(selectors.ticketsIndex.searchResult, '23')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();

View File

@ -154,7 +154,7 @@ export default class ArrayModel extends ModelProxy {
let aType = typeof a;
if (aType === typeof b)
if (aType === typeof b) {
switch (aType) {
case 'string':
return a.localeCompare(b);
@ -166,6 +166,7 @@ export default class ArrayModel extends ModelProxy {
if (a instanceof Date && b instanceof Date)
return a.getTime() - b.getTime();
}
}
if (a === undefined)
return -1;
@ -183,11 +184,12 @@ export default class ArrayModel extends ModelProxy {
let mergedWhere = [];
let wheres = [dst.where, src.where];
for (let where of wheres)
for (let where of wheres) {
if (Array.isArray(where))
mergedWhere = mergedWhere.concat(where);
else if (where)
mergedWhere.push(where);
}
switch (mergedWhere.length) {
case 0:

View File

@ -1,13 +1,13 @@
<div class="button-menu">
<button
class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored button-menu__button"
ng-click="$ctrl.onClick($event)">
class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored button-menu__button">
<vn-label vn-none translate>{{::$ctrl.label}}</vn-label>
<vn-icon vn-none icon="{{::$ctrl.icon}}"></vn-icon>
<vn-icon vn-none class="button-menu__arrow_down" icon="keyboard_arrow_down"></vn-icon>
</button>
<vn-drop-down
vn-id="drop-down"
on-select="$ctrl.onDropDownSelect(value)">
on-select="$ctrl.onDropDownSelect(value)"
ng-click="$ctrl.onDropDownClick($event)">
</vn-drop-down>
</div>

View File

@ -8,6 +8,7 @@ export default class ButtonMenu extends Input {
super($element, $scope);
this.$transclude = $transclude;
this.input = this.element.querySelector('.mdl-button');
$element.on('click', e => this.onClick(e));
}
get model() {
@ -42,11 +43,16 @@ export default class ButtonMenu extends Input {
}
onClick(event) {
if (event.defaultPrevented) return;
event.preventDefault();
this.emit('open');
this.showDropDown();
}
onDropDownClick(event) {
event.preventDefault();
}
onDropDownSelect(value) {
this.field = value;
this.emit('change', {value});
@ -70,7 +76,7 @@ export default class ButtonMenu extends Input {
'limit',
'searchFunction'
]);
this.$.dropDown.show(this.input);
this.$.dropDown.show(this.element);
}
}
ButtonMenu.$inject = ['$element', '$scope', '$transclude'];

View File

@ -1,5 +1,7 @@
vn-button-menu {
position: relative;
cursor: pointer;
.button-menu__button {
padding: 0 10px;
}

View File

@ -110,8 +110,8 @@ export default class DropDown extends Component {
show(parent, search) {
this._activeOption = -1;
this.search = search;
this.buildList();
this.$.popover.show(parent || this.parent);
this.buildList();
}
/**
@ -218,6 +218,7 @@ export default class DropDown extends Component {
}
onLoadMoreClick(event) {
if (event.defaultPrevented) return;
event.preventDefault();
this.model.loadMore();
}
@ -225,7 +226,10 @@ export default class DropDown extends Component {
onContainerClick(event) {
if (event.defaultPrevented) return;
let index = getPosition(this.ul, event);
if (index != -1) this.selectOption(index);
if (index != -1) {
event.preventDefault();
this.selectOption(index);
}
}
onDocKeyDown(event) {

View File

@ -1,14 +1,11 @@
<div class="icon-menu">
<vn-icon
pointer
class="button"
ng-click="$ctrl.onClick($event)"
vn-none
icon="{{::$ctrl.icon}}">
</vn-icon>
<vn-drop-down
vn-id="drop-down"
on-select="$ctrl.onDropDownSelect(value)">
on-select="$ctrl.onDropDownSelect(value)"
ng-click="$ctrl.onDropDownClick($event)">
</vn-drop-down>
</div>

View File

@ -1,4 +1,6 @@
vn-icon-menu {
cursor: pointer;
vn-drop-down {
font-family: 'vn-font'
}

View File

@ -6,6 +6,7 @@
left: 0;
right: 0;
bottom: 0;
color: initial;
opacity: 0;
transform: translateY(-.6em);

View File

@ -12,7 +12,7 @@ vn-app {
top: 0;
left: 0;
width: 100%;
z-index: 1;
z-index: 5;
box-shadow: 0 .1em .2em rgba(1, 1, 1, .2);
.logo {
@ -27,5 +27,29 @@ vn-app {
}
.main-view {
padding-top: 4em;
vn-main-block {
display: block;
margin: 0 auto;
padding-left: 16em;
.left-block {
position: fixed;
z-index: 5;
top: 4em;
left: 0;
bottom: 0;
width: 16em;
min-width: 16em;
background-color: white;
box-shadow: 0 .1em .2em rgba(1, 1, 1, .2);
overflow: auto;
}
.right-block {
width: 16em;
min-width: 16em;
padding-left: 1em;
}
}
}
}

View File

@ -0,0 +1,74 @@
@import "./effects";
@import "./colors";
@import "./padding";
.vn-descriptor {
box-shadow: 0 .1em .2em rgba(1, 1, 1, .2);
& > .header {
display: flex;
background: $main-01;
color: white;
justify-content: space-between;
align-items: stretch;
color: white;
& > * {
min-width: 1.8em;
@extend %clickable;
display: flex;
align-items: center;
justify-content: center;
padding: .5em;
& > vn-icon {
font-size: 1.8em;
}
}
}
& > .body {
@extend .pad-small;
& > * {
@extend .pad-small;
}
& > .icons {
display: flex;
align-items: center;
justify-content: center;
padding: 0;
& > vn-icon {
@extend .pad-small;
color: #666;
opacity: .4;
font-size: 1.5em;
&.bright {
color: $main-01;
opacity: 1;
}
}
}
& > .quicklinks {
display: flex;
align-items: center;
justify-content: center;
padding: 0;
& > a {
@extend .pad-small;
& > vn-icon {
font-size: 1.8em;
padding: 0;
& > i {
line-height: 36px
}
}
}
}
}
}

View File

@ -7,7 +7,8 @@ import './background.scss';
import './border.scss';
import './font-style.scss';
import './misc.scss';
import './summary.scss';
import './colors.scss';
import './effects.scss';
import './order-product.scss';
import './summary.scss';
import './descriptor.scss';

View File

@ -161,91 +161,6 @@ vn-tool-bar {
}
}
vn-main-block {
display: block;
margin: 0 auto;
.left-block {
position: fixed;
z-index: 1;
top: 4em;
left: 0;
bottom: 0;
width: 16em;
min-width: 16em;
background-color: white;
box-shadow: 0 .1em .2em rgba(1, 1, 1, .2);
overflow: auto;
}
& > vn-horizontal > vn-one > [ui-view] {
padding-left: 16em;
}
.right-block {
width: 16em;
min-width: 16em;
padding-left: 1em;
}
}
.vn-descriptor {
.header {
background: $main-01;
color: white;
justify-content: space-between;
align-items: stretch;
& > vn-icon {
padding: .1em;
font-size: 2.5em;
}
& > a , & > vn-icon-menu {
@extend %clickable;
display: flex;
align-items: center;
padding: .5em;
color: white;
text-decoration: none;
& > vn-icon {
font-size: 1.8em;
}
& vn-drop-down{
color: initial;
}
}
}
.footer {
text-align: center;
& > vn-icon {
color: #666;
opacity: .4;
padding: 0 5% 0 5%;
font-size: 1.5em;
}
& > vn-icon.bright {
color: $main-01;
opacity: 1;
}
}
.quicklinks {
justify-content: center;
align-items: center;
& > a {
& > vn-icon {
font-size: 1.8em;
padding: 0;
}
& > vn-icon i {
line-height: 36px
}
}
}
}
.vn-list {
max-width: 36em;
margin: 0 auto;

View File

@ -48,15 +48,6 @@
}
vn-label-value > section {
margin-bottom: .3em;
& > vn-label {
display: block;
font-size: .9em;
&::after {
content: initial;
}
}
}
}
}

View File

@ -1,4 +1,4 @@
<vn-card class="vn-descriptor">
<div class="vn-descriptor">
<vn-horizontal class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="zone.index">
<vn-icon icon="chevron_left"></vn-icon>
@ -14,7 +14,7 @@
on-change="$ctrl.onMoreChange(value)">
</vn-icon-menu>
</vn-horizontal>
<vn-vertical pad-medium>
<div class="body">
<vn-one>
<vn-label-value label="Id"
value="{{$ctrl.zone.id}}">
@ -41,9 +41,8 @@
value="{{$ctrl.zone.price | currency: '€': 2}}">
</vn-label-value>
</vn-one>
</vn-vertical>
</vn-card>
</div>
</div>
<vn-confirm
vn-id="delete-zone"
on-response="$ctrl.returnDialog(response)"

View File

@ -1,15 +1,15 @@
<vn-card class="vn-descriptor">
<vn-horizontal class="header">
<div class="vn-descriptor">
<div class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="claim.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
<vn-icon icon=""></vn-icon>
<a translate-attr="{title: 'Preview'}" ui-sref="claim.card.summary({id: $ctrl.claim.id})">
<vn-icon icon="desktop_windows"></vn-icon>
</a>
</vn-horizontal>
<vn-vertical>
<vn-auto pad-medium>
<div></div>
</div>
<div class="body">
<div class="attributes">
<h5>{{$ctrl.claim.id}}</h5>
<vn-label-value label="Client"
value="{{::$ctrl.claim.client.name}}">
@ -29,10 +29,9 @@
<vn-label-value label="Ticket" ui-sref="ticket.card.summary({id: $ctrl.claim.ticketFk})" class="link"
value="{{$ctrl.claim.ticketFk}}">
</vn-label-value>
</vn-auto>
</vn-vertical>
<vn-horizontal pad-small class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne" pad-small-right
</div>
<div class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne"
vn-tooltip="{{::$ctrl.quicklinks.btnOne.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnOne.state}}" target="_blank">
<vn-icon
@ -40,7 +39,7 @@
icon="{{::$ctrl.quicklinks.btnOne.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnTwo" pad-small-right
<a ng-if="$ctrl.quicklinks.btnTwo"
vn-tooltip="{{::$ctrl.quicklinks.btnTwo.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnTwo.state}}" target="_blank">
<vn-icon
@ -48,7 +47,7 @@
icon="{{::$ctrl.quicklinks.btnTwo.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnThree" pad-small-right
<a ng-if="$ctrl.quicklinks.btnThree"
vn-tooltip="{{::$ctrl.quicklinks.btnThree.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnThree.state}}" target="_blank">
<vn-icon
@ -56,5 +55,6 @@
icon="{{::$ctrl.quicklinks.btnThree.icon}}">
</vn-icon>
</a>
</vn-horizontal>
</vn-card>
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<vn-card class="vn-descriptor">
<vn-horizontal class="header">
<div class="vn-descriptor">
<div class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="client.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
@ -16,8 +16,9 @@
on-change="$ctrl.onMoreChange(value)"
on-open="$ctrl.onMoreOpen()">
</vn-icon-menu>
</vn-horizontal>
<div pad-medium>
</div>
<div class="body">
<div class="attributes">
<h5>{{$ctrl.client.name}}</h5>
<vn-label-value label="Id"
value="{{$ctrl.client.id}}">
@ -35,7 +36,7 @@
value="{{$ctrl.client.salesPerson.firstName}} {{$ctrl.client.salesPerson.name}}">
</vn-label-value>
</div>
<vn-horizontal pad-medium class="footer">
<div class="icons">
<vn-icon
vn-tooltip="Client inactive"
icon="icon-disabled"
@ -61,9 +62,9 @@
icon="icon-no036"
ng-class="{bright: $ctrl.client.isTaxDataChecked == false}">
</vn-icon>
</vn-horizontal>
<vn-horizontal pad-small class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne" pad-small-right
</div>
<div class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne"
vn-tooltip="{{::$ctrl.quicklinks.btnOne.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnOne.state}}" target="_blank">
<vn-icon
@ -71,7 +72,7 @@
icon="{{::$ctrl.quicklinks.btnOne.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnTwo" pad-small-right
<a ng-if="$ctrl.quicklinks.btnTwo"
vn-tooltip="{{::$ctrl.quicklinks.btnTwo.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnTwo.state}}" target="_blank">
<vn-icon
@ -79,7 +80,7 @@
icon="{{::$ctrl.quicklinks.btnTwo.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnThree" pad-small-right
<a ng-if="$ctrl.quicklinks.btnThree"
vn-tooltip="{{::$ctrl.quicklinks.btnThree.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnThree.state}}" target="_blank">
<vn-icon
@ -87,5 +88,6 @@
icon="{{::$ctrl.quicklinks.btnThree.icon}}">
</vn-icon>
</a>
</vn-horizontal>
</vn-card>
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<vn-card class="vn-descriptor">
<vn-horizontal class="header">
<div class="vn-descriptor">
<div class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="item.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
@ -16,9 +16,9 @@
on-change="$ctrl.onMoreChange(value)"
on-open="$ctrl.onMoreOpen()">
</vn-icon-menu>
</vn-horizontal>
<vn-vertical>
<vn-auto style="position: relative" text-center>
</div>
<div>
<div style="position: relative" text-center>
<img
ng-src="//verdnatura.es/vn-image-data/catalog/200x200/{{$ctrl.item.image}}"
zoom-image="//verdnatura.es/vn-image-data/catalog/1600x900/{{$ctrl.item.image}}"
@ -30,7 +30,7 @@
vn-visible-by="marketing, buyer">
</vn-float-button>
</a>
</vn-auto>
</div>
<vn-horizontal class="state">
<vn-one>
<p translate>Visible</p>
@ -41,7 +41,9 @@
<p>{{$ctrl.item.available}}</p>
</vn-one>
</vn-horizontal>
<vn-auto pad-medium>
</div>
<div class="body">
<div class="attributes">
<h5>{{$ctrl.item.id}}</h5>
<vn-label-value label="Name"
value="{{::$ctrl.item.name}}">
@ -54,11 +56,9 @@
label="{{tag.tag.name}}"
value="{{tag.value}}">
</vn-label-value>
</vn-auto>
</vn-vertical>
<vn-horizontal pad-small class="quicklinks">
<vn-horizontal pad-small class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne" pad-small-right
</div>
<div class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne"
vn-tooltip="{{::$ctrl.quicklinks.btnOne.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnOne.state}}" target="_blank">
<vn-icon
@ -66,7 +66,7 @@
icon="{{::$ctrl.quicklinks.btnOne.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnTwo" pad-small-right
<a ng-if="$ctrl.quicklinks.btnTwo"
vn-tooltip="{{::$ctrl.quicklinks.btnTwo.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnTwo.state}}" target="_blank">
<vn-icon
@ -74,7 +74,7 @@
icon="{{::$ctrl.quicklinks.btnTwo.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnThree" pad-small-right
<a ng-if="$ctrl.quicklinks.btnThree"
vn-tooltip="{{::$ctrl.quicklinks.btnThree.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnThree.state}}" target="_blank">
<vn-icon
@ -82,9 +82,9 @@
icon="{{::$ctrl.quicklinks.btnThree.icon}}">
</vn-icon>
</a>
</vn-horizontal>
</vn-card>
</div>
</div>
</div>
<vn-dialog
vn-id="regularize"
on-open="$ctrl.clearRegularizeDialog()"

View File

@ -10,7 +10,6 @@ class Controller {
getPossibleStowaways() {
this.$http.get(`/api/Tickets/${this.ticket.id}/getPossibleStowaways`)
.then(res => {
console.log(res);
this.possibleStowaways = res.data;
});
}

View File

@ -1,5 +1,5 @@
<vn-card class="vn-descriptor">
<vn-horizontal class="header">
<div class="vn-descriptor">
<div class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="ticket.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
@ -16,8 +16,9 @@
on-change="$ctrl.onMoreChange(value)"
on-open="$ctrl.onMoreOpen()">
</vn-icon-menu>
</vn-horizontal>
<div pad-medium>
</div>
<div class="body">
<div class="attributes">
<h5>{{::$ctrl.client.name}}</h5>
<vn-label-value label="Id"
value="{{$ctrl.ticket.id}}">
@ -44,7 +45,7 @@
value="{{$ctrl.ticket.nickname}}">
</vn-label-value>
</div>
<vn-horizontal pad-medium-bottom class="footer">
<div class="icons">
<vn-icon vn-one
vn-tooltip="Client inactive"
icon="icon-disabled"
@ -65,9 +66,9 @@
icon="icon-no036"
ng-class="{bright: $ctrl.ticket.client.isTaxDataChecked == false}">
</vn-icon>
</vn-horizontal>
<vn-horizontal pad-small class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne" pad-small-right
</div>
<div class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne"
vn-tooltip="{{::$ctrl.quicklinks.btnOne.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnOne.state}}" target="_blank">
<vn-icon
@ -75,7 +76,7 @@
icon="{{::$ctrl.quicklinks.btnOne.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnTwo" pad-small-right
<a ng-if="$ctrl.quicklinks.btnTwo"
vn-tooltip="{{::$ctrl.quicklinks.btnTwo.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnTwo.state}}" target="_blank">
<vn-icon
@ -83,7 +84,7 @@
icon="{{::$ctrl.quicklinks.btnTwo.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnThree" pad-small-right
<a ng-if="$ctrl.quicklinks.btnThree"
vn-tooltip="{{::$ctrl.quicklinks.btnThree.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnThree.state}}" target="_blank">
<vn-icon
@ -102,8 +103,9 @@
data="$ctrl.ticket.ship"
on-change="$ctrl.goToTicket(value)">
</vn-button-menu>
</vn-horizontal>
</vn-card>
</div>
</div>
</div>
<vn-dialog class="dialog-summary"
vn-id="addTurn">
<tpl-body>

View File

@ -28,7 +28,6 @@ class Controller {
}
changeShipped(response) {
console.log(response);
if (response === 'ACCEPT') {
let params = {shipped: this.newShipped};
this.$http.patch(`/ticket/api/Tickets/${this.ticket.id}/`, params).then(() => {

View File

@ -35,7 +35,6 @@ class Controller {
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`/api/Stowaways?filter=${json}`).then(res => {
console.log(res.data);
this.ticketStowaways = res.data;
this.$scope.dialog.show();
});

View File

@ -1,14 +1,15 @@
<vn-card class="vn-descriptor">
<vn-horizontal class="header">
<div class="vn-descriptor">
<div class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="order.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
<vn-icon icon="shopping_cart"></vn-icon>
<a translate-attr="{title: 'Preview'}" ui-sref="order.card.summary">
<vn-icon icon="desktop_windows"></vn-icon>
</a>
</vn-horizontal>
<div pad-medium>
<div></div>
</div>
<div class="body">
<div class="attributes">
<vn-label-value label="ID"
value="{{$ctrl.order.id}}">
</vn-label-value>
@ -37,8 +38,8 @@
value="{{$ctrl.order.total | currency: ' €': 2}}">
</vn-label-value>
</div>
<vn-horizontal pad-small class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne" pad-small-right
<div class="quicklinks">
<a ng-if="$ctrl.quicklinks.btnOne"
vn-tooltip="{{::$ctrl.quicklinks.btnOne.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnOne.state}}" target="_blank">
<vn-icon
@ -46,7 +47,7 @@
icon="{{::$ctrl.quicklinks.btnOne.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnTwo" pad-small-right
<a ng-if="$ctrl.quicklinks.btnTwo"
vn-tooltip="{{::$ctrl.quicklinks.btnTwo.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnTwo.state}}" target="_blank">
<vn-icon
@ -54,7 +55,7 @@
icon="{{::$ctrl.quicklinks.btnTwo.icon}}">
</vn-icon>
</a>
<a ng-if="$ctrl.quicklinks.btnThree" pad-small-right
<a ng-if="$ctrl.quicklinks.btnThree"
vn-tooltip="{{::$ctrl.quicklinks.btnThree.tooltip}}"
ui-sref="{{::$ctrl.quicklinks.btnThree.state}}" target="_blank">
<vn-icon
@ -62,5 +63,6 @@
icon="{{::$ctrl.quicklinks.btnThree.icon}}">
</vn-icon>
</a>
</vn-horizontal>
</vn-card>
</div>
</div>
</div>

View File

@ -363,9 +363,10 @@ INSERT INTO `vn`.`invoiceOut`(`id`,`ref`, `serial`, `amount`, `issued`,`clientFk
(16, 1, 1, 1, CURDATE(), CURDATE(), 101, 'address 21', 121, NULL, 0, CURDATE() ),
(17, 4, 4, 4, CURDATE(), CURDATE(), 106, 'address 26', 126, NULL, 0, CURDATE() ),
(18, 4, 4, 4, CURDATE(), CURDATE(), 107, 'address 27', 127, NULL, 0, CURDATE() ),
(19, 5, 5, 4, CURDATE() , CURDATE() , 108, 'address 28', 128, NULL, 0, CURDATE() ),
(20, 5, 5, 4, CURDATE() , CURDATE() , 108, 'address 28', 128, NULL, 0, CURDATE() ),
(21, 5, 5, 4, CURDATE() , CURDATE() , 110, 'address 29', 129, NULL, 1, CURDATE() );
(19, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ),
(20, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ),
(21, 5, 5, 4, CURDATE(), CURDATE(), 110, 'address 29', 129, NULL, 1, CURDATE() ),
(22, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 DAY) );
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES
@ -394,8 +395,9 @@ INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `crea
(17, 17, 1 , 19, CURDATE()),
(18, 18, 1 , 19, CURDATE()),
(19, 19, 13, 19, CURDATE()),
(20, 20, 15, 19, CURDATE()),
(21, 21, 3 , 19, CURDATE());
(20, 20, 13, 19, CURDATE()),
(21, 21, 3 , 19, CURDATE()),
(23, 21, 13, 19, CURDATE());
INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`)
VALUES
@ -552,7 +554,9 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
(13, 2, 8, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()),
(14, 1, 8, 'Object1 Gem1 5', 10, 2.30, 0, 0, 0, CURDATE()),
(15, 1, 19, 'Object1 Gem1 5', 10, 1.50, 0, 0, 0, CURDATE()),
(16, 2, 20, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE());
(16, 2, 20, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()),
(17, 2, 22, 'Object2 Gem2 3', 30, 2.30, 0, 0, 0, CURDATE()),
(18, 4, 22, 'Object4 Armor2 2', 20, 3.00, 0, 0, 0, CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES
@ -637,7 +641,18 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
(16, 21, 0.002),
(16, 28, 5.6),
(16, 29, -4.6),
(16, 39, 0.01);
(16, 39, 0.01),
(17, 15, 0.058),
(17, 21, 0.002),
(17, 28, 5.6),
(17, 29, -4.6),
(17, 39, 0.01),
(18, 15, 0.051),
(18, 22, -0.001),
(18, 28, 20.72),
(18, 29, -19.72),
(18, 37, 2),
(18, 39, 0.01);
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
VALUES
@ -1065,3 +1080,10 @@ INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxC
(1, 'delivery charge', 1, 2.00, 1, 1),
(2, 'training course', 1, 10.00, 1, 2),
(3, 'delivery charge', 1, 5.50, 1, 11);
INSERT INTO `pbx`.`sip`(`user_id`, `extension`, `secret`, `caller_id`)
VALUES
(1, 1010, '123456', 'employee'),
(3, 1101, '123456', 'agency'),
(5, 1102, '123456', 'administrative'),
(9, 1201, '123456', 'developer');

View File

@ -1 +0,0 @@
node_modules

View File

@ -1,6 +0,0 @@
FROM node:lts-slim
RUN npm -g install pm2
COPY . /app
WORKDIR /app
CMD ["pm2-docker", "./server/server.js"]

View File

@ -1,75 +0,0 @@
var database = require('./database.js');
let config = require('./config.js');
module.exports = {
/**
* Initialize auth.
* @param {Object} request Request object
* @param {Object} response Response object
* @param {Object} next Next object
*/
init: function(request, response, next) {
this.request = request;
this.response = response;
this.next = next;
this.validateToken();
},
/**
* Validate auth token.
*/
validateToken: function() {
let query = 'SELECT userId, ttl, created FROM salix.AccessToken WHERE id = ?';
database.pool.query(query, [this.getToken()], (error, result) => {
let token = result[0];
if (error || result.length == 0)
return this.response.status(401).send({message: 'Invalid token'});
if (this.isTokenExpired(token.created, token.ttl))
return this.response.status(401).send({message: 'Token expired'});
// Set proxy host
let proxy = config.proxy;
if (!proxy)
proxy = {
host: 'localhost',
port: 80
};
this.request.proxyHost = `http://${proxy.host}:${proxy.port}`;
this.request.user = {
id: token.userId,
token: this.getToken()
};
this.next();
});
},
/**
* Get request token.
* @return {String} Token
*/
getToken: function() {
return this.request.headers.authorization || this.request.query.token;
},
/**
* Checks if the token has expired.
* @param {String} created Creation date
* @param {Integer} ttl Ttl seconds
* @return {Boolean} %true if the token has expired
*/
isTokenExpired: function(created, ttl) {
let date = new Date(created);
let currentDate = new Date();
date.setSeconds(date.getSeconds() + ttl);
if (currentDate > date)
return true;
}
};

View File

@ -1,34 +0,0 @@
require('require-yaml');
const fs = require('fs-extra');
const packageJson = require('../package.json');
let configPath = `/etc/${packageJson.name}`;
let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
let config = require('./config/datasources.json');
let configFiles = [
`${configPath}/datasources.json`,
`${configPath}/datasources.${env}.json`
];
for (let configFile of configFiles) {
if (fs.existsSync(configFile))
Object.assign(config, require(configFile));
}
let proxyConf = {};
let proxyFiles = [
'../../nginx/config.yml',
`${configPath}/config.yml`,
`${configPath}/config.${env}.yml`
];
for (let proxyFile of proxyFiles) {
if (fs.existsSync(proxyFile))
Object.assign(proxyConf, require(proxyFile));
}
config.proxy = proxyConf;
config.package = packageJson;
config.env = env;
module.exports = config;

View File

@ -1,29 +0,0 @@
{
"app": {
"port": 3000,
"debug": false,
"defaultLanguage": "es",
"senderMail": "noreply@localhost",
"senderName": "MySender"
},
"mysql": {
"host": "localhost",
"port": 3306,
"database": "vn",
"user": "root",
"password": "root"
},
"smtp": {
"host": "localhost",
"port": 465,
"secure": true,
"auth": {
"user": "noreply",
"pass": ""
},
"tls": {
"rejectUnauthorized": false
},
"pool": true
}
}

View File

@ -1,33 +0,0 @@
var mysql = require('mysql');
let config = require('./config.js');
module.exports = {
/**
* Pool instance
*/
pool: null,
/**
* Start database pool
*/
init: function() {
this.pool = mysql.createPool(config.mysql);
this.pool.getConnection(function(error, connection) {
if (error) {
throw new Error('Can\'t connect to database: ' + error.code);
} else if (config.app.debug) {
console.log('Database connection stablished');
}
});
},
/**
* Set test environment mail.
*/
testEmail: function() {
this.pool.query('SELECT fakeEmail as email FROM vn.config', function(error, qryRs) {
config.smtp.testEmail = qryRs[0].email;
});
}
};

View File

@ -1,42 +0,0 @@
var fs = require('fs');
var config = require('./config.js');
var path = require('path');
module.exports = {
/**
* Returns template locale
* @param {String} template - Template name
* @param {String} countryCode - Language code
* @param {Object} cb - Callback
*/
load: function(template, countryCode, cb) {
var localeFile = path.join(__dirname, 'template', `${template}`, 'locale', `${countryCode}.json`);
var defaultLocaleFile = path.join(__dirname, 'template', `${template}`, 'locale', `${config.app.defaultLanguage}.json`);
fs.stat(localeFile, (error, stats) => {
if (error) {
fs.stat(defaultLocaleFile, (error, stats) => {
if (error)
return cb(new Error('Translation not found for template ' + template));
cb(null, {locale: require(defaultLocaleFile)});
});
} else {
cb(null, {locale: require(localeFile)});
}
});
},
/**
* Parse locale text
* @param {String} text - Locale text
* @param {Object} params - Locale params
* @return {String} - Returns parsed text
*/
parseText: function(text, params) {
for (var key in params) {
text = text.replace(`%${key}%`, params[key]);
}
return text;
}
};

View File

@ -1,112 +0,0 @@
var nodemailer = require('nodemailer');
var config = require('./config.js');
var template = require('./template.js');
var database = require('./database.js');
/**
* Mail module
*/
module.exports = {
transporter: null,
/**
* Load mail config.
*/
init: function() {
this.transporter = nodemailer.createTransport(config.smtp);
this.transporter.verify(function(error, success) {
if (error) {
console.error(error);
} else if (config.app.debug) {
console.log('SMTP connection stablished');
}
});
},
/**
* Send email.
* @param {Object} recipient - Mail destinatary
* @param {String} subject - Subject
* @param {String} body - Mail body
* @param {Object} attachments - Mail attachments
* @param {Object} params - Params
* @param {Object} cb - Callback
*/
send: function(recipient, subject, body, attachments, params, cb) {
let mailOptions = {
from: '"' + config.app.senderName + '" <' + config.app.senderMail + '>',
to: recipient,
subject: subject,
html: body,
attachments
};
if (config.env != 'production')
mailOptions.to = config.app.senderMail;
this.transporter.sendMail(mailOptions, (error, info) => {
try {
let status = (error ? error.message : 'OK');
this.log(params.sender, params.recipient, recipient, subject, body, params.message, status);
if (error)
return cb(new Error('Email not sent: ' + error));
if (config.app.debug)
console.log('Mail sent ' + info.messageId + ' [' + info.response + ']');
cb();
} catch (e) {
throw e;
}
});
},
/**
* Send email with template.
* @param {String} tplName - Template name
* @param {Object} params - Params object
* @param {Object} cb - Callback
*/
sendWithTemplate: function(tplName, params, cb) {
template.get(tplName, params, (error, result) => {
if (error)
return cb(error);
// Custom attachments
if (params.attachments)
params.attachments.forEach(function(attachment) {
result.attachments.push(attachment);
});
this.send(result.recipient, result.subject, result.body, result.attachments, params, error => {
if (error)
return cb(error);
cb();
});
});
},
/**
* Add mail log
* @param {Integer} senderId - Sender id
* @param {Integer} recipientId - Recipient id
* @param {String} sender - Sender email
* @param {String} subject - Mail subject
* @param {String} body - Mail body
* @param {String} plainTextBody - Mail plain text body
* @param {String} status - Mail status
*/
log: function(senderId, recipientId, sender, subject, body, plainTextBody, status) {
let qry = `INSERT INTO mail(senderFk, recipientFk, sender, replyTo, subject, body, plainTextBody, sent, status)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`;
let qryParams = [senderId, recipientId, sender, config.app.senderMail, subject, body, plainTextBody, 1, status];
database.pool.query(qry, qryParams, function(error, result) {
if (config.app.debug && error)
console.log('Mail log: ' + error);
});
}
};

View File

@ -1,288 +0,0 @@
var express = require('express');
var router = new express.Router();
var config = require('../config.js');
var mail = require('../mail.js');
var template = require('../template.js');
var httpRequest = require('request');
var auth = require('../auth.js');
// Auth middleware
var requestToken = function(request, response, next) {
auth.init(request, response, next);
};
// Printer setup
router.get('/printer-setup/:clientId', requestToken, function(request, response) {
mail.sendWithTemplate('printer-setup', {clientId: request.params.clientId}, error => {
if (error)
return response.status(400).json({message: error.message});
return response.json();
});
});
// Printer setup preview
router.get('/printer-setup/:clientId/preview', requestToken, function(request, response) {
template.get('printer-setup', {clientId: request.params.clientId, isPreview: true}, (error, result) => {
if (error)
return response.status(400).json({message: error.message});
response.send(result.body);
});
});
// Client welcome
router.get('/client-welcome/:clientId', requestToken, function(request, response) {
mail.sendWithTemplate('client-welcome', {clientId: request.params.clientId}, error => {
if (error)
return response.status(400).json({message: error.message});
return response.json();
});
});
// Client welcome preview
router.get('/client-welcome/:clientId/preview', requestToken, function(request, response) {
template.get('client-welcome', {clientId: request.params.clientId, isPreview: true}, (error, result) => {
if (error)
return response.status(400).json({message: error.message});
response.send(result.body);
});
});
// Client SEPA CORE
router.get('/sepa-core/:companyId/:clientId', requestToken, function(request, response) {
let params = {
clientId: request.params.clientId,
companyId: request.params.companyId
};
let path = `${request.proxyHost}/print/manuscript/sepa-core/${params.companyId}/${params.clientId}`;
let options = {
url: path,
method: 'GET',
headers: {
'Authorization': request.headers.authorization
}
}
let httpStream = httpRequest(options, function(error, httpResponse, body) {
if (error || httpResponse.statusCode != 200)
return response.status(400).json({message: error});
});
if (httpStream)
params.attachments = [{filename: 'sepa-core.pdf', content: httpStream}];
mail.sendWithTemplate('sepa-core', params, error => {
if (error)
return response.status(400).json({message: error.message});
return response.json();
});
});
// Client SEPA CORE preview
router.get('/sepa-core/:companyId/:clientId/preview', requestToken, function(request, response) {
let params = {
clientId: request.params.clientId,
companyId: request.params.companyId,
token: request.user.token,
isPreview: true
};
template.get('sepa-core', params, (error, result) => {
if (error)
return response.status(400).json({message: error.message});
response.send(result.body);
});
});
// First debtor letter
router.get('/letter-debtor-st/:companyId/:clientId', requestToken, function(request, response) {
let params = {
clientId: request.params.clientId,
companyId: request.params.companyId,
token: request.user.token
};
let path = `${request.proxyHost}/print/manuscript/letter-debtor/${params.companyId}/${params.clientId}`;
let options = {
url: path,
method: 'GET',
headers: {
'Authorization': request.user.token
}
}
let httpStream = httpRequest(options, function(error, httpResponse, body) {
if (error || httpResponse.statusCode != 200)
return response.status(400).json({message: error});
});
if (httpStream)
params.attachments = [{filename: 'extracto.pdf', content: httpStream}];
mail.sendWithTemplate('letter-debtor-st', params, error => {
if (error)
return response.status(400).json({message: error.message});
return response.json();
});
});
// First debtor letter preview
router.get('/letter-debtor-st/:companyId/:clientId/preview', requestToken, function(request, response) {
template.get('letter-debtor-st', {
clientId: request.params.clientId,
companyId: request.params.companyId,
token: request.user.token,
isPreview: true
}, (error, result) => {
if (error)
return response.status(400).json({message: error.message});
response.send(result.body);
});
});
// Second debtor letter
router.get('/letter-debtor-nd/:companyId/:clientId', requestToken, function(request, response) {
let params = {
clientId: request.params.clientId,
companyId: request.params.companyId,
token: request.user.token
};
let path = `${request.proxyHost}/print/manuscript/letter-debtor/${params.companyId}/${params.clientId}`;
let options = {
url: path,
method: 'GET',
headers: {
'Authorization': request.headers.authorization
}
}
let httpStream = httpRequest(options, function(error, httpResponse, body) {
if (error || httpResponse.statusCode != 200)
return response.status(400).json({message: error});
});
if (httpStream)
params.attachments = [{filename: 'extracto.pdf', content: httpStream}];
mail.sendWithTemplate('letter-debtor-nd', params, error => {
if (error)
return response.status(400).json({message: error.message});
return response.json();
});
});
// Second debtor letter preview
router.get('/letter-debtor-nd/:companyId/:clientId/preview', requestToken, function(request, response) {
template.get('letter-debtor-nd', {
clientId: request.params.clientId,
companyId: request.params.companyId,
token: request.user.token,
isPreview: true
}, (error, result) => {
if (error)
return response.status(400).json({message: error.message});
response.send(result.body);
});
});
// Payment method changes
router.get('/payment-update/:clientId', requestToken, function(request, response) {
mail.sendWithTemplate('payment-update', {clientId: request.params.clientId}, error => {
if (error)
return response.status(400).json({message: error.message});
return response.json();
});
});
// Send notification to alias creditInsurance on client deactivate
router.get('/client-deactivate/:clientId', requestToken, function(request, response) {
var params = {
alias: 'creditInsurance',
code: 'clientDeactivate',
bodyParams: {
clientId: request.params.clientId
}
};
mail.sendWithTemplate('notification-alias', params, error => {
if (error)
response.status(400).json({message: error.message});
return response.json();
});
});
module.exports = router;
// Single user notification
/* router.post('/:recipient/noticeUserSend', function(request, response) {
var params = {
recipient: request.params.recipient,
sender: request.body.sender,
category: request.body.category,
message: request.body.message
};
if (params.sender == params.recipient)
return;
let query = `SELECT COUNT(*) isEnabled
FROM noticeSubscription s
JOIN noticeCategory c ON c.id = s.noticeCategoryFk AND c.isEnabled
WHERE c.keyName = ? AND s.userFk = ?`;
database.pool.query(query, [params.category, params.recipient, params.sender], (error, result) => {
mail.sendWithTemplate('notification-notice', params, result => {
return response.json(result);
});
});
}); */
// Send notification to all user subscribed to category
/* router.post('/:category/noticeCategorySend', function(request, response) {
var params = {
sender: request.body.sender,
category: request.params.category,
message: request.body.message
};
let query = `SELECT s.userFk id FROM noticeSubscription s JOIN noticeCategory
c ON c.id = s.noticeCategoryFk AND c.isEnabled WHERE c.keyName = ? AND s.userFk != ?`;
database.pool.query(query, [params.category, params.sender], (error, result) => {
result.forEach(function(user) {
params.recipient = user.id;
mail.sendWithTemplate('notification-notice', params, result => {
return response.json(result);
});
}, this);
});
}); */
// Send system notification
/* router.post('/:recipient/noticeSystemSend', function(request, response) {
var params = {
recipient: request.params.recipient,
sender: settings.smtp().auth.id,
category: request.body.category,
message: request.body.message
};
mail.sendWithTemplate('notification-notice', params, result => {
return response.json(result);
});
}); */

View File

@ -1,49 +0,0 @@
var express = require('express');
var router = new express.Router();
var fs = require('fs');
var path = require('path');
// Mailer default page
router.get('/', function(request, response) {
response.json({});
});
// Notifications
router.use('/notification', require('./route/notification.js'));
// Serve static images
router.use('/static/:template/:image', function(request, response) {
let imagePath = path.join(__dirname, '/template/', request.params.template, '/image/', request.params.image);
fs.stat(imagePath, function(error) {
if (error)
return response.json({message: 'Image not found'});
let readStream = fs.createReadStream(imagePath);
readStream.on('open', function() {
let contentType = getContentType(imagePath);
if (contentType)
response.setHeader('Content-type', getContentType(imagePath));
readStream.pipe(response);
});
});
});
function getContentType(path) {
let types = {
png: 'image/png',
svg: 'image/svg+xml',
gif: 'image/gif',
jpeg: 'image/jpeg',
jpg: 'image/jpeg'
};
let extension = path.split('.')[1];
return types[extension];
}
module.exports = router;

View File

@ -1,234 +0,0 @@
var fs = require('fs');
var mustache = require('mustache');
var locale = require('./locale.js');
var inlineCss = require('inline-css');
var path = require('path');
module.exports = {
/**
* Get template.
* @param {String} template - Template name
* @param {Object} countryCode - Language code
* @param {Object} params - Params
* @param {Object} cb - Callback
*/
get: function(template, params, cb) {
var templatePath = path.join(__dirname, 'template', `${template}`, `index.html`);
var classPath = path.join(__dirname, 'template', `${template}`, `${template}.js`);
var stylePath = path.join(__dirname, 'template', `${template}`, 'style.css');
fs.stat(templatePath, (error, stat) => {
if (error)
return cb(new Error('Template ' + template + ' not found'));
let TemplateClass = require(classPath);
let instance = new TemplateClass();
let getRenderedStyles = (error, body) => {
if (error)
return cb(error);
this.renderStyles(stylePath, body, (error, body) => {
if (error)
return cb(error);
// Check if has a subject param
params.subject = params.subject || instance.subject;
if (params.subject == undefined) {
// Try to find a subject from Html source
let title = body.match(new RegExp('<title>(.*?)</title>', 'i'));
if (title)
params.subject = title[1];
}
this.getAttachments(template, body, params.isPreview, (error, result) => {
if (error)
return cb(error);
cb(null, {recipient: instance.recipient, subject: params.subject, body: result.body, attachments: result.attachments});
});
});
};
let getDataCb = () => {
this.render(templatePath, instance, (error, result) => getRenderedStyles(error, result));
};
instance.getData(params, (error, result) => {
if (error)
return cb(error);
locale.load(template, instance.countryCode, (error, result) => {
if (error)
return cb(error);
instance._ = result.locale;
instance.isPreview = params.isPreview;
getDataCb(null, result);
});
});
});
},
/**
* Render template
* @param {String} path - Template path
* @param {Object} data - Params
* @param {Object} cb - Callback
*/
render: function(path, data, cb) {
fs.readFile(path, 'utf8', (error, body) => {
// Find matching sub-templates
let regexp = new RegExp(/\{\{\$\.(.*?)\}\}/, 'ig');
let subTpl = body.match(regexp);
if (!subTpl) {
mustache.parse(body);
return cb(null, mustache.render(body, data));
}
let parentBody = body;
this.renderSub(parentBody, subTpl, data, regexp, (error, body) => {
if (error)
return cb(error);
mustache.parse(body);
cb(null, mustache.render(body, data));
});
});
},
/**
* Render sub-template
* @param {String} body - Raw body
* @param {Object} subTpl - Sub-template name
* @param {Object} data - Params
* @param {Object} regexp - Regexp
* @param {Object} cb - Callback
*/
renderSub: function(body, subTpl, data, regexp, cb) {
let index = 1;
subTpl.forEach(keyName => {
subTplName = keyName.replace(regexp, '$1');
this.get(subTplName, data, (error, result) => {
if (error)
return cb(error);
let subTplBody = result.body;
body = body.replace(keyName, subTplBody);
if (index === subTpl.length)
cb(null, body);
index++;
});
});
},
/**
* Render template style.
* @param {String} path - Stylesheet path
* @param {String} body - Rendered html
* @param {Object} cb - Callback
*/
renderStyles: function(stylePath, html, cb) {
// Common components
let comPath = path.join(__dirname, '../', 'static', 'css', 'component.css');
fs.readFile(comPath, 'utf8', (error, comCss) => {
fs.stat(stylePath, error => {
if (error)
return cb(new Error('Template stylesheet not found'));
fs.readFile(stylePath, 'utf8', (error, css) => {
let style = '<style>' + comCss + css + '</style>';
let body = style + html;
let options = {url: ' '};
inlineCss(body, options)
.then(function(body) {
cb(null, body);
});
});
});
});
},
/**
* Get template attachments
* @param {String} template - Template name
* @param {String} body - template body
* @param {Object} cb - Callback
*/
getAttachments: function(template, body, isPreview, cb) {
let attachments = [];
let tplAttachments = body.match(new RegExp('src="cid:(.*?)"', 'ig'));
if (!tplAttachments)
tplAttachments = {};
// Template default attachments
for (var i = 0; i < tplAttachments.length; i++) {
let src = tplAttachments[i].replace('src="cid:', '').replace('"', '').split('/');
let attachmentTpl = src[0];
let attachment = src[1];
if (isPreview) {
let attachmentPath = `/mailer/static/${attachmentTpl}/${attachment}`;
body = body.replace(tplAttachments[i], `src="${attachmentPath}"`);
} else {
let attachmentPath = path.join(__dirname, 'template', `${attachmentTpl}`, 'image', attachment);
let attachmentName = attachmentTpl + '/' + attachment;
attachments.push({filename: attachmentName, path: attachmentPath, cid: attachmentName});
}
}
if (isPreview)
return cb(null, {body: body, attachments: attachments});
// Template attachment files
let attachmentsPath = path.join(__dirname, 'template', `${template}`, 'attachment.json');
fs.stat(attachmentsPath, (error, stats) => {
if (error)
return cb(null, {body: body, attachments: attachments});
let attachObj = require(attachmentsPath);
for (var i = 0; i < attachObj.length; i++) {
let filename = attachObj[i];
let attachmentPath = path.join(__dirname, 'template', `${template}`, 'attachment', filename);
attachments.push({filename: filename, path: attachmentPath, cid: filename});
}
this.checkAttachments(attachments, error => {
if (error)
return cb(error);
cb(null, {body: body, attachments: attachments});
});
});
},
/**
* Check all template attachments
* @param {Object} attachments - Attachments object
* @param {Object} cb - Callback
*/
checkAttachments: function(attachments, cb) {
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
fs.stat(attachment.path, error => {
if (error)
return cb(new Error(`Could not load attachment file ${attachment.path}`));
});
}
cb();
}
};

View File

@ -1,46 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class ClientWelcome {
getData(params, cb) {
let query = `SELECT
c.id clientId,
CONCAT(w.name, ' ', w.firstName) name,
w.phone AS phone,
CONCAT(wu.name, '@verdnatura.es') AS email,
u.name AS userName,
LOWER(ct.code) countryCode,
c.email recipient
FROM client c
JOIN account.user u ON u.id = c.id
LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN account.user wu ON wu.id = w.userFk
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ?`;
database.pool.query(query, [params.clientId], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
get salesPersonName() {
if (this.name)
return `<div>${this._.salesPersonNameText}: <strong>${this.name}</strong></div>`;
}
get salesPersonPhone() {
if (this.phone)
return `<div>${this._.salesPersonPhoneText}: <strong>${format.phone(this.phone)}</strong></div>`;
}
get salesPersonEmail() {
if (this.email)
return `<div>${this._.salesPersonEmailText}: ` +
`<strong><a href="mailto:${this.email}" target="_blank" style="color:#8dba25">${this.email}</strong></div>`;
}
};

View File

@ -1,67 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Header block -->
{{$.header}}
<!-- Header block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p>{{_.dear}}</p>
<p>{{{_.bodyDescription}}}</p>
<p>
<div>{{_.clientNumber}} <strong>{{clientId}}</strong></div>
<div>{{_.user}} <strong>{{userName}}</strong></div>
<div>{{_.password}} <strong>********</strong> {{{_.passwordResetText}}}</div>
</p>
<h1>{{_.sectionHowToBuyTitle}}</h1>
<p>{{_.sectionHowToBuyDescription}}</p>
<ol>
<li>{{_.sectionHowToBuyRequeriment1}}</li>
<li>{{_.sectionHowToBuyRequeriment2}}</li>
<li>{{_.sectionHowToBuyRequeriment3}}</li>
</ol>
<p>{{_.sectionHowToBuyStock}}</p>
<p>{{_.sectionHowToBuyDelivery}}</p>
<h1>{{_.sectionHowToPayTitle}}</h1>
<p>{{_.sectionHowToPayDescription}}</p>
<ul>
<li>{{{_.sectionHowToPayOption1}}}</li>
<li>{{{_.sectionHowToPayOption2}}}</li>
</ul>
<h1>{{_.sectionToConsiderTitle}}</h1>
<p>{{_.sectionToConsiderDescription}}</p>
<h3>{{_.sectionClaimsPolicyTitle}}</h3>
<p>{{_.sectionClaimsPolicyDescription}}</p>
<p>{{{_.doubtsText}}}</p>
<p>
{{{salesPersonName}}}
{{{salesPersonPhone}}}
{{{salesPersonEmail}}}
</p>
</div>
<!-- Mail body block end -->
<!-- Footer block -->
{{$.footer}}
<!-- Footer block end -->
</div>
</div>
</body>
</html>

View File

@ -1,29 +0,0 @@
{
"subject": "¡Le damos la bienvenida!",
"title": "¡LE DAMOS LA BIENVENIDA!",
"dear": "Estimado cliente,",
"bodyDescription": "Sus datos para poder comprar en la web de verdnatura (<a href=\"https://www.verdnatura.es\" title=\"Visitar Verdnatura\" target=\"_blank\">https://www.verdnatura.es</a>) o en nuestras aplicaciones para <a href=\"https://goo.gl/3hC2mG\" title=\"App Store\" target=\"_blank\">iOS</a> y <a href=\"https://goo.gl/8obvLc\" title=\"Google Play\" target=\"_blank\">Android</a> (<a href=\"https://www.youtube.com/watch?v=gGfEtFm8qkw\" target=\"_blank\"><strong>Ver tutorial de uso</strong></a>), son:",
"clientNumber": "Identificador de cliente:",
"user": "Usuario:",
"password": "Contraseña:",
"passwordResetText": "(<a href=\"https://verdnatura.es\">Haga clic en \"¿Has olvidado tu contraseña?\"</a>)",
"sectionHowToBuyTitle": "Cómo hacer un pedido",
"sectionHowToBuyDescription": "Para realizar un pedido en nuestra web, debe configurarlo indicando:",
"sectionHowToBuyRequeriment1": "Si quiere recibir el pedido (por agencia o por nuestro propio reparto) o si lo prefiere recoger en alguno de nuestros almacenes.",
"sectionHowToBuyRequeriment2": "La fecha en la que quiera recibir el pedido (se preparará el día anterior).",
"sectionHowToBuyRequeriment3": "La dirección de entrega o el almacén donde quiera recoger el pedido.",
"sectionHowToBuyStock": "En nuestra web y aplicaciones puedes visualizar el stock disponible de flor cortada, verdes, plantas, complementos y artificial. Tenga en cuenta que dicho stock puede variar en función de la fecha seleccionada al configurar el pedido. Es importante CONFIRMAR los pedidos para que la mercancía quede reservada.",
"sectionHowToBuyDelivery": "El reparto se realiza de lunes a sábado según la zona en la que se encuentre. Por regla general, los pedidos que se entregan por agencia, deben estar confirmados y pagados antes de las 17h del día en que se preparan (el día anterior a recibirlos), aunque esto puede variar si el pedido se envía a través de nuestro reparto y según la zona.",
"sectionHowToPayTitle": "Cómo pagar",
"sectionHowToPayDescription": "Las formas de pago admitidas en Verdnatura son:",
"sectionHowToPayOption1": "Con <strong>tarjeta</strong> a través de nuestra plataforma web (al confirmar el pedido).",
"sectionHowToPayOption2": "Mediante <strong>giro bancario mensual</strong>, modalidad que hay que solicitar y tramitar.",
"sectionToConsiderTitle": "Cosas a tener en cuenta",
"sectionToConsiderDescription": "Verdnatura vende EXCLUSIVAMENTE a profesionales, por lo que debe remitirnos el Modelo 036 ó 037, para comprobar que está dado/a de alta en el epígrafe correspondiente al comercio de flores.",
"sectionClaimsPolicyTitle": "POLÍTICA DE RECLAMACIONES",
"sectionClaimsPolicyDescription": "Verdnatura aceptará las reclamaciones que se realicen dentro de los dos días naturales siguientes a la recepción del pedido (incluyendo el mismo día de la recepción). Pasado este plazo no se aceptará ninguna reclamación.",
"doubtsText": "Cualquier duda que le surja, no dude en consultarla, <strong>¡estamos para atenderle!</strong>",
"salesPersonNameText": "Soy tu comercial y mi nombre es",
"salesPersonPhoneText": "Teléfono y whatsapp",
"salesPersonEmailText": "Dirección de e-mail"
}

View File

@ -1,4 +0,0 @@
<svg fill="#000000" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg">
<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>

Before

Width:  |  Height:  |  Size: 205 B

View File

@ -1,4 +0,0 @@
<svg fill="#000000" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M11.5 9C10.12 9 9 10.12 9 11.5s1.12 2.5 2.5 2.5 2.5-1.12 2.5-2.5S12.88 9 11.5 9zM20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-3.21 14.21l-2.91-2.91c-.69.44-1.51.7-2.39.7C9.01 16 7 13.99 7 11.5S9.01 7 11.5 7 16 9.01 16 11.5c0 .88-.26 1.69-.7 2.39l2.91 2.9-1.42 1.42z"/>
</svg>

Before

Width:  |  Height:  |  Size: 461 B

View File

@ -1,21 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class Footer {
getData(params, cb) {
let query = `SELECT
socialName,
LOWER(ct.code) countryCode
FROM client c
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ?`;
database.pool.query(query, [params.clientId], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1,42 +0,0 @@
<!-- Action button block -->
<div class="buttons">
<a href="https://www.verdnatura.es" target="_blank"><div class="btn">
<span class="text">{{_.actionButton}}</span>
<span class="icon"><img src="cid:footer/action.png"/></span>
</div></a><a href="https://goo.gl/forms/j8WSL151ZW6QtlT72" target="_blank"><div class="btn">
<span class="text">{{_.infoButton}}</span>
<span class="icon"><img src="cid:footer/info.png"/></span>
</div></a>
</div>
<!-- Action button block -->
<!-- Networks block -->
<div class="footer">
<a href="https://www.facebook.com/Verdnatura" target="_blank">
<img src="cid:footer/facebook.png" alt="Facebook"/>
</a>
<a href="https://www.twitter.com/Verdnatura" target="_blank">
<img src="cid:footer/twitter.png" alt="Twitter"/>
</a>
<a href="https://www.youtube.com/Verdnatura" target="_blank">
<img src="cid:footer/youtube.png" alt="Youtube"/>
</a>
<a href="https://www.pinterest.com/Verdnatura" target="_blank">
<img src="cid:footer/pinterest.png" alt="Pinterest"/>
</a>
<a href="https://www.instagram.com/Verdnatura" target="_blank">
<img src="cid:footer/instagram.png" alt="Instagram"/>
</a>
<a href="https://www.linkedin.com/company/verdnatura" target="_blank">
<img src="cid:footer/linkedin.png" alt="Linkedin"/>
</a>
</div>
<!-- Networks block end -->
<!-- Privacy block -->
<div class="privacy">
<p>{{_.fiscalAddress}}</p>
<p>{{_.privacy}}</p>
<p>{{_.privacyLaw}}</p>
</div>
<!-- Privacy block end -->

View File

@ -1,7 +0,0 @@
{
"actionButton": "Visita nuestra Web",
"infoButton": "Ayúdanos a mejorar",
"fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es",
"privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.",
"privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación."
}

View File

@ -1,7 +0,0 @@
{
"actionButton": "Visitez notre site web",
"infoButton": "Aidez-nous à améliorer",
"fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es",
"privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.",
"privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación."
}

View File

@ -1,54 +0,0 @@
.buttons {
background-color: #FFF;
text-align: center;
width: 100%
}
.buttons a {
text-decoration: none;
font-size: 18px;
color: #fff
}
.buttons .btn {
background-color: #333;
min-width: 300px;
height: 72px;
display: inline-block;
text-align: center
}
.buttons .btn .text {
display: inline-block;
padding-top: 22px
}
.buttons .btn .icon {
background-color: #95d831;
text-align: center;
padding-top: 22px;
float: right;
height: 50px;
width: 70px
}
.footer {
background-color: #555;
text-align: center;
padding: 20px 0
}
.footer a {
text-decoration: none;
margin-right: 5px
}
.footer a img {
margin: 0
}
.privacy {
padding: 20px 0;
font-size: 10px;
font-weight: 100
}

View File

@ -1,21 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class Header {
getData(params, cb) {
let query = `SELECT
c.name AS clientName,
LOWER(ct.code) countryCode
FROM client c
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ?`;
database.pool.query(query, [params.clientId], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@ -1,3 +0,0 @@
<div>
<a href="https://www.verdnatura.es"/><img src="cid:header/logo.png" alt="VerdNatura"/></a>
</div>

View File

@ -1,3 +0,0 @@
.banner img {
width: 100%
}

View File

@ -1,87 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Header block -->
{{$.header}}
<!-- Header block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p>{{_.dear}}</p>
<p>{{_.bodyDescription}}</p>
<p>{{_.termLimits}}</p>
<p>
{{_.payMethod}}
<ol>
<li>{{_.payMethodOption1}}</li>
<li>{{_.payMethodOption2}}</li>
</ol>
</p>
<p>
{{_.legalActions}}
<ol type="a">
<li>{{_.legalActionsOption1}}</li>
<li>{{_.legalActionsOption2}}</li>
<li>{{_.legalActionsOption3}}</li>
</ol>
</p>
<p>{{_.contact}}</p>
<p>{{_.waitingForNews}}</p>
<p>{{_.conclusion}}</p>
<p>
<div class="row">
<div class="text">{{bankName}}</div>
<div class="control">{{iban}}</div>
<div class="description">
<div class="line"><span>{{_.accountTransferData}}</span></div>
</div>
</div>
</p>
{{#isPreview}}
<a href="/print/manuscript/letter-debtor/{{companyId}}/{{clientId}}/preview?token={{token}}" target="_blank" title="Ver adjunto">
<div class="attachment">
<div class="attachment-icon">
<img src="cid:default/preview.svg" alt="Ver adjunto"/>
</div>
<span>Ver adjunto</span>
</div>
</a>
<a href="/print/manuscript/letter-debtor/{{companyId}}/{{clientId}}?token={{token}}" target="_blank" title="Descargar adjunto">
<div class="attachment">
<div class="attachment-icon">
<img src="cid:default/download.svg" alt="Descargar adjunto"/>
</div>
<span>Descargar PDF</span>
</div>
</a>
{{/isPreview}}
</div>
<!-- Mail body block end -->
<!-- Footer block -->
{{$.footer}}
<!-- Footer block end -->
</div>
</div>
</body>
</html>

View File

@ -1,39 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class LetterDebtorNd {
getData(params, cb) {
let query = `SELECT
sa.iban,
be.name AS bankName,
LOWER(ct.code) countryCode,
c.email recipient
FROM client c
JOIN company AS cny
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
JOIN bankEntity be ON be.id = sa.bankEntityFk
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ? AND cny.id = ?`;
this.clientId = params.clientId;
this.companyId = params.companyId;
this.token = params.token;
database.pool.query(query, [params.clientId, params.companyId], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
get previewAttachments() {
if (this.isPreview)
return `<a href="/print/manuscript/letter-debtor/${this.companyId}/${this.clientId}/preview?token=${this.token}" target="_blank" title="Ver extracto.pdf">` +
'<div class="attachment"><div class="attachment-icon"><img src="cid:attachment.png" alt="Descargar adjunto"/></div>' +
'<span>extracto.pdf</span></div></a>';
}
};

View File

@ -1,18 +0,0 @@
{
"subject": "Reiteración de aviso por saldo deudor",
"title": "AVISO REITERADO",
"dear": "Estimado cliente,",
"bodyDescription": "Nos dirigimos a Vd. nuevamente para informarle que sigue pendiente su deuda con nuestra empresa, tal y como puede comprobar en el extracto adjunto.",
"termLimits": "Dado que los plazos de pago acordados están ampliamente superados, no procede mayor dilación en la liquidación del importe adeudado.",
"payMethod": "Para ello dispone de las siguientes formas de pago:",
"payMethodOption1": "Pago online desde nuestra web",
"payMethodOption2": "Ingreso o transferencia al número de cuenta que detallamos al pie de esta carta, indicando el número de cliente.",
"legalActions": "En caso de no ser atendido este apremio de pago, nos veremos obligados a iniciar las acciones legales que procedan, entre las que están:",
"legalActionsOption1": "Inclusión en ficheros negativos sobre solvencia patrimonial y crédito.",
"legalActionsOption2": "Reclamación judicial",
"legalActionsOption3": "Cesión de deuda a una empresa de gestión de cobro",
"contact": "Para consultas, puede ponerse en contacto con nosotros en el 96 324 21 00.",
"waitingForNews": "En espera de sus noticias",
"conclusion": "Gracias por su atención.",
"accountTransferData": "Datos para transferencia bancaria"
}

View File

@ -1,69 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Header block -->
{{$.header}}
<!-- Header block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p>{{_.dear}}</p>
<p>{{_.bodyDescription}}</p>
<p>{{_.viewExtract}}</p>
<p>{{_.validData}}</p>
<p>{{_.payMethod}}</p>
<p>{{_.conclusion}}</p>
<p>
<div class="row">
<div class="text">{{bankName}}</div>
<div class="control">{{iban}}</div>
<div class="description">
<div class="line"><span>{{_.accountTransferData}}</span></div>
</div>
</div>
</p>
{{#isPreview}}
<a href="/print/manuscript/letter-debtor/{{companyId}}/{{clientId}}/preview?token={{token}}" target="_blank" title="Ver adjunto">
<div class="attachment">
<div class="attachment-icon">
<img src="cid:default/preview.svg" alt="Ver adjunto"/>
</div>
<span>Ver adjunto</span>
</div>
</a>
<a href="/print/manuscript/letter-debtor/{{companyId}}/{{clientId}}?token={{token}}" target="_blank" title="Descargar adjunto">
<div class="attachment">
<div class="attachment-icon">
<img src="cid:default/download.svg" alt="Descargar adjunto"/>
</div>
<span>Descargar PDF</span>
</div>
</a>
{{/isPreview}}
</div>
<!-- Mail body block end -->
<!-- Footer block -->
{{$.footer}}
<!-- Footer block end -->
</div>
</div>
</body>
</html>

View File

@ -1,39 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class LetterDebtorSt {
getData(params, cb) {
let query = `SELECT
sa.iban,
be.name AS bankName,
LOWER(ct.code) countryCode,
c.email recipient
FROM client c
JOIN company AS cny
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
JOIN bankEntity be ON be.id = sa.bankEntityFk
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ? AND cny.id = ?`;
this.clientId = params.clientId;
this.companyId = params.companyId;
this.token = params.token;
database.pool.query(query, [params.clientId, params.companyId], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
get previewAttachments() {
if (this.isPreview)
return `<a href="/print/manuscript/letter-debtor/${this.companyId}/${this.clientId}/preview?token=${this.token}" target="_blank" title="Ver extracto.pdf">` +
'<div class="attachment"><div class="attachment-icon"><img src="cid:attachment.png" alt="Descargar adjunto"/></div>' +
'<span>extracto.pdf</span></div></a>';
}
};

View File

@ -1,11 +0,0 @@
{
"subject": "Aviso inicial por saldo deudor",
"title": "AVISO INICIAL",
"dear": "Estimado cliente,",
"bodyDescription": "Por el presente escrito le comunicamos que, según nuestros datos contables, su cuenta tiene un saldo pendiente de liquidar.",
"viewExtract": "Le solicitamos compruebe que el extracto adjunto corresponde con los datos de que Vd. dispone. Nuestro departamento de administración le aclarará gustosamente cualquier duda que pueda tener, e igualmente le facilitará cualquier documento que solicite.",
"validData": "Si al comprobar los datos aportados resultaran correctos, le rogamos proceda a regularizar su situación.",
"payMethod": "Si no desea desplazarse personalmente hasta nuestras oficinas, puede realizar el pago mediante transferencia bancaria a la cuenta que figura al pie del comunicado, indicando su número de cliente, o bien puede realizar el pago online desde nuestra página web.",
"conclusion": "De antemano le agradecemos su amable colaboración.",
"accountTransferData": "Datos para transferencia bancaria"
}

View File

@ -1,33 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Header block -->
{{$.header}}
<!-- Header block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p>{{_.hello}} <strong>#{{alias}}</strong></p>
<p>{{message}}</p>
</div>
<!-- Mail body block end -->
<!-- Footer block -->
{{$.footer}}
<!-- Footer block end -->
</div>
</div>
</body>
</html>

View File

@ -1,11 +0,0 @@
{
"subject": "Has recibido una nueva notificación",
"title": "Nueva notificación",
"hello": "Hola,",
"notificationCode": {
"clientDeactivate": {
"subject": "Gestionar baja de contrato",
"message": "El cliente con id %clientId% está clasificado, por favor, gestione la baja del contrato primero."
}
}
}

View File

@ -1,29 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var locale = require(path.join(__dirname, '../../locale.js'));
module.exports = class NotificationAlias {
getData(params, cb) {
this.params = params;
let query = `SELECT alias, CONCAT(alias, '@verdnatura.es') AS recipient
FROM account.mailAlias
WHERE alias = ?`;
database.pool.query(query, [params.alias], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
get subject() {
return this._.notificationCode[this.params.code].subject;
}
get message() {
return locale.parseText(this._.notificationCode[this.params.code].message, this.params.bodyParams);
}
};

View File

@ -1,76 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div style="width: 600px;margin: 0 auto;font-family: arial, sans-serif;font-size: 16px;color: #555">
<!-- Banner block -->
<div>
<a href="https://www.verdnatura.es"/><img src="cid:header.png" alt="VerdNatura" style="margin:0"/></a>
</div>
<!-- Banner block end -->
<!-- Title block -->
<div style="padding: 35px 0;background-color:#95d831;text-align: center">
<h1 style="margin: 0;font-size: 32px;color: #333;">{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div style="padding: 20px 0">
<p style="text-align: justify">Hola, {{recipientName}}</p>
<p style="text-align: justify">{{_.bodyDescription}} <strong>{{senderName}}</strong>:</p>
<p style="text-align: justify;font-size: 22px">"{{message}}"<p>
<p style="text-align: justify">{{_.noticeDescription}} <strong>'{{categoryName}}'</strong>. {{_.unsubscribe}}</p>
</div>
<!-- Mail body block end -->
<!-- Action button block -->
<div style="background-color: #333;overflow:hidden">
<a href="https://www.verdnatura.es" target="_blank" style="display:block;float:left;width:300px;height:72px;color:#fff;font-size:22px;text-decoration:none">
<div style="float:left;width:230px;padding:22px 0;height:72px;text-align:center">{{_.actionButton}}</div>
<div style="background-color:#95d831;text-align:center;float:right;padding-top:22px;height:50px;width:70px"><img style="margin:0" src="cid:action.png"/></div>
</a>
<a href="https://goo.gl/forms/j8WSL151ZW6QtlT72" target="_blank" style="display:block;float:left;width:300px;height:72px;color:#fff;font-size:22px;text-decoration:none">
<div style="float:left;width:230px;padding:22px 0;height:72px;text-align:center">{{_.infoButton}}</div>
<div style="background-color:#95d831;text-align:center;float:right;padding-top:22px;height:50px;width:70px"><img style="margin:0" src="cid:info.png"/></div>
</a>
</div>
<!-- Action button block end-->
<!-- Networks block -->
<div style="padding:20px 0;background-color:#555;text-align:center">
<a href="https://www.facebook.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:facebook.png" alt="Visita nuestro Facebook" style="margin:0"/>
</a>
<a href="https://www.twitter.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:twitter.png" alt="Visita nuestro Twitter" style="margin:0"/>
</a>
<a href="https://www.youtube.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:youtube.png" alt="Visita nuestro canal de Youtube" style="margin:0"/>
</a>
<a href="https://www.pinterest.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:pinterest.png" alt="Visita nuestro Pinterest" style="margin:0"/>
</a>
<a href="https://www.instagram.com/Verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:instagram.png" alt="Visita nuestro Instagram" style="margin:0"/>
</a>
<a href="https://www.linkedin.com/company/verdnatura" target="_blank" style="text-decoration:none;margin-right: 10px">
<img src="cid:linkedin.png" alt="Visita nuestro Linkedin" style="width:50px;margin:0"/>
</a>
</div>
<!-- Networks block end -->
<!-- Privacy block -->
<div style="padding:20px 0;font-size:10px;font-weight:100">
<p style="text-align: justify">{{_.fiscalAddress}}</p>
<p style="text-align: justify">{{_.privacy}}</p>
<p style="text-align: justify">{{_.privacyLaw}}</p>
</div>
<!-- Privacy block end -->
</div>
</body>
</html>

View File

@ -1,13 +0,0 @@
{
"subject": "Has recibido una nueva notificación",
"title": "Nueva notificación",
"hello": "Hola",
"bodyDescription": "Has recibido la siguiente notificación de",
"noticeDescription": "Recibes esta notificación porque estás suscrito a",
"unsubscribe": "Puedes dejar de recibir estas notificaciones desde 'Notificaciones > Configuración' en cualquier aplicación de VerdNatura.",
"actionButton": "Visita nuestra Web",
"infoButton": "Ayúdanos a mejorar",
"fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es",
"privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.",
"privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación."
}

View File

@ -1,28 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
module.exports = class NotificationNotice {
getData(params, cb) {
let query = `SELECT
LOWER(ct.code) countryCode,
c.email recipient,
nc.name categoryName,
recipient.name recipientName,
sender.name senderName
FROM client c
JOIN account.user recipient ON recipient.id = c.id
JOIN country ct ON ct.id = c.countryFk
JOIN noticeCategory nc ON nc.keyName = ?
JOIN account.user sender ON sender.id = ?
WHERE c.id = ?`;
database.pool.query(query, [params.category, params.sender, params.recipient], (error, result) => {
if (error || result.length == 0)
return cb({status: 'REJECT', data: {message: 'No data found', error: error}});
Object.assign(this, result[0]);
this.message = params.message;
cb({status: 'ACCEPT', data: {}});
});
}
};

View File

@ -1,39 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Header block -->
{{$.header}}
<!-- Header block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p>{{_.dear}}</p>
<p>{{_.bodyDescription}}</p>
<p>
<div>{{_.paymentMethod}} <strong>{{payMethodName}}</strong></div>
{{{paymentDay}}}
</p>
<p>{{paymentAdvice}}</p>
<p>{{_.notifyError}}</p>
</div>
<!-- Mail body block end -->
<!-- Footer block -->
{{$.footer}}
<!-- Footer block end -->
</div>
</div>
</body>
</html>

View File

@ -1,13 +0,0 @@
{
"subject": "Cambios en las condiciones de pago",
"title": "Cambio en las condiciones",
"dear": "Estimado cliente,",
"bodyDescription": "Le informamos que han cambiado las condiciones de pago de su cuenta. A continuación le indicamos las nuevas condiciones:",
"paymentMethod": "Método de pago:",
"paymentDay": "Día de pago:",
"everyMonth": "de cada mes",
"cardPaymentAdvice": "Su modo de pago actual implica que deberá abonar el importe de los pedidos realizados en el mismo día para que se puedan enviar.",
"accountPaymentAdviceBefore": "Su modo de pago actual implica que se le pasará un cargo a la cuenta",
"accountPaymentAdviceAfter": "por el importe pendiente, al vencimiento establecido en las condiciones.",
"notifyError": "En el caso de detectar algún error en los datos indicados o para cualquier aclaración, debe dirigirse a su comercial."
}

View File

@ -1,13 +0,0 @@
{
"subject": "Changement des C.G.V",
"title": "Changement des C.G.V",
"dear": "Chèr client,",
"bodyDescription": "Nous vous informons que les conditions de paiement ont changé. Voici les nouvelles conditions:",
"paymentMethod": "Méthode de paiement:",
"paymentDay": "Date paiement:",
"everyMonth": "de chaque mois",
"cardPaymentAdvice": "Avec votre mode de règlement vous devrez payer le montant des commandes avant son départ.",
"accountPaymentAdviceBefore": "Avec ce mode de règlement nous vous passerons un prélèvement automatique sur votre compte bancaire",
"accountPaymentAdviceAfter": "pour le montant dû, au date à terme établi en nos conditions.",
"notifyError": "Pour tout renseignement contactez votre commercial.."
}

View File

@ -1,43 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class PaymentUpdate {
getData(params, cb) {
let query = `SELECT
pm.id payMethodFk,
pm.name payMethodName,
c.dueDay,
c.iban,
LOWER(ct.code) countryCode,
c.email recipient
FROM client c
JOIN payMethod pm ON pm.id = c.payMethodFk
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ?`;
this.clientId = params.clientId;
database.pool.query(query, [params.clientId], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
get paymentDay() {
if (this.payMethodFk != 5)
return `<div>${this._.paymentDay} <strong>${this.dueDay} ${this._.everyMonth}</strong></div>`;
}
get paymentAdvice() {
switch (this.payMethodFk) {
case 4:
return `${this._.accountPaymentAdviceBefore} ${format.partialAccountAddress(this.iban)} ${this._.accountPaymentAdviceAfter}`;
case 5:
return this._.cardPaymentAdvice;
}
}
};

View File

@ -1,68 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Header block -->
{{$.header}}
<!-- Header block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p>{{_.dear}}</p>
<p>{{_.bodyDescription}}</p>
<p>{{{_.followGuide}}}</p>
<p>{{{_.downloadFrom}}}</p>
<h1>{{_.sectionQLabelTitle}}</h1>
<p>{{_.sectionQLabelDescription}}</p>
<ol>
<li>{{_.sectionQLabelStep1}}</li>
<li>{{_.sectionQLabelStep2}}</li>
<li>{{_.sectionQLabelStep3}}</li>
<li>{{{_.sectionQLabelStep4}}}</li>
<li>{{_.sectionQLabelStep5}}</li>
<li>{{_.sectionQLabelStep6}}</li>
<li>{{_.sectionQLabelStep7}}</li>
<li>{{_.sectionQLabelStep8}}</li>
<li>{{{_.sectionQLabelStep9}}}</li>
<li>{{_.sectionQLabelStep10}}</li>
<li>{{_.sectionQLabelStep11}}</li>
<li>{{_.sectionQLabelStep12}}</li>
<li>{{_.sectionQLabelStep13}}</li>
<li>{{_.sectionQLabelStep14}}</li>
<li>{{_.sectionQLabelStep15}}</li>
</ol>
<h1>{{_.sectionHelpTitle}}</h1>
<p >{{_.sectionHelpDescription}}</p>
<p>{{{_.sectionHelpDownloadRemoteSupport}}}</p>
<p>
{{{salesPersonName}}}
{{{salesPersonPhone}}}
{{{salesPersonEmail}}}
</p>
</div>
<!-- Mail body block end -->
<!-- Footer block -->
{{$.footer}}
<!-- Footer block end -->
</div>
</div>
</body>
</html>

View File

@ -1,31 +0,0 @@
{
"subject": "Instalación y configuración de impresora",
"title": "¡GRACIAS POR SU CONFIANZA!",
"dear": "Estimado cliente,",
"bodyDescription": "Siga las intrucciones especificadas en este correo para llevar a cabo la instalación de la impresora.",
"followGuide": "Puede utilizar como guía, el video del montaje del ribon y la cinta <a href=\"https:\//www.youtube.com/watch?v=qhb0kgQF3o8\" title=\"Youtube\" target=\"_blank\" style=\"color:#8dba25\">https://www.youtube.com/watch?v=qhb0kgQF3o8</a>. También necesitará el QLabel, el programa para imprimir las cintas.",
"downloadFrom": "Puede descargarlo desde este enlace <a href=\"http://ww.godexintl.com/es1/download/downloads/Download/2996\" title=\"Descargar QLabel\" target=\"_blank\" style=\"color:#8dba25\">http://ww.godexintl.com/es1/download/downloads/Download/2996</a>",
"sectionQLabelTitle": "Utilización de QLabel",
"sectionQLabelDescription": "Para utilizar el programa de impresión de cintas siga estos pasos:",
"sectionQLabelStep1": "Abra el programa QLabel.",
"sectionQLabelStep2": "Haga clic en el icono de la barra superior superior de la \"carpeta\".",
"sectionQLabelStep3": "Seleccione el archivo plantilla llamado \"model.ezp\".",
"sectionQLabelStep4": "Haga clic <strong>encima del texto</strong> con el boton secundario del ratón.",
"sectionQLabelStep5": "Elija la primera opcion \"setup\".",
"sectionQLabelStep6": "Cambie el texto para imprimir.",
"sectionQLabelStep7": "Haga clic en el boton \"Ok\".",
"sectionQLabelStep8": "Desplácese con el raton para ver la medida máxima.",
"sectionQLabelStep9": "Haga clic <strong>encima del texto</strong> con el botón secundario del ratón.",
"sectionQLabelStep10": "Elija la primera opcion \"Setup printer\".",
"sectionQLabelStep11": "Haga clic en la primera pestalla \"Label Setup\".",
"sectionQLabelStep12": "Modifique la propidad \"Paper Height\".",
"sectionQLabelStep13": "Haga clic en el boton \"Ok\".",
"sectionQLabelStep14": "Haga clic sobre el icono de la impresora.",
"sectionQLabelStep15": "Haga clic en \"Print\".",
"sectionHelpTitle": "¿Necesita ayuda?",
"sectionHelpDescription": "Si necesita ayuda, descárguese nuestro programa de soporte para poder conectarnos remotamente a su equipo y hacerle la instalación. Proporciónenos un horario de contacto para atenderle, y contactaremos con usted.",
"sectionHelpDownloadRemoteSupport": "Puede descargarse el programa desde este enlace <a href=\"http://soporte.verdnatura.es\" title=\"Soporte Verdnatura\" target=\"_blank\" style=\"color:#8dba25\">http://soporte.verdnatura.es</a>.",
"salesPersonNameText": "Soy su comercial y mi nombre es",
"salesPersonPhoneText": "Teléfono y whatsapp",
"salesPersonEmailText": "Dirección de e-mail"
}

View File

@ -1,46 +0,0 @@
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class PrinterSetup {
getData(params, cb) {
let query = `SELECT
CONCAT(w.name, ' ', w.firstName) name,
w.phone AS phone,
CONCAT(u.name, '@verdnatura.es') AS email,
LOWER(ct.code) countryCode,
c.email recipient
FROM client c
LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = w.userFk
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ?`;
this.clientId = params.clientId;
this.isPreview = params.isPreview;
database.pool.query(query, [params.clientId], (error, result) => {
if (error || result.length == 0)
return cb(new Error('No template data found'));
Object.assign(this, result[0]);
cb();
});
}
get salesPersonName() {
if (this.name)
return `<div>${this._.salesPersonNameText}: <strong>${this.name}</strong></div>`;
}
get salesPersonPhone() {
if (this.phone)
return `<div>${this._.salesPersonPhoneText}: <strong>${format.phone(this.phone)}</strong></div>`;
}
get salesPersonEmail() {
if (this.email)
return `<div>${this._.salesPersonEmailText}: ` +
`<strong><a href="mailto:${this.email}" target="_blank" style="color:#8dba25">${this.email}</strong></div>`;
}
};

View File

@ -1,54 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{_.subject}}</title>
<meta charset="utf8"/>
</head>
<body>
<div class="wrapper">
<div class="container">
<!-- Header block -->
{{$.header}}
<!-- Header block end -->
<!-- Title block -->
<div class="title">
<h1>{{_.title}}</h1>
</div>
<!-- Title block end -->
<!-- Mail body block -->
<div class="body">
<p>{{_.dear}}</p>
<p>{{_.bodyDescription}}</p>
<p>{{_.conclusion}}</p>
{{#isPreview}}
<a href="/print/manuscript/sepa-core/{{companyId}}/{{clientId}}/preview?token={{token}}" target="_blank" title="Ver adjunto">
<div class="attachment">
<div class="attachment-icon">
<img src="cid:default/preview.svg" alt="Ver adjunto"/>
</div>
<span>Ver adjunto</span>
</div>
</a>
<a href="/print/manuscript/sepa-core/{{companyId}}/{{clientId}}?token={{token}}" target="_blank" title="Descargar adjunto">
<div class="attachment">
<div class="attachment-icon">
<img src="cid:default/download.svg" alt="Descargar adjunto"/>
</div>
<span>Descargar PDF</span>
</div>
</a>
{{/isPreview}}
</div>
<!-- Mail body block end -->
<!-- Footer block -->
{{$.footer}}
<!-- Footer block end -->
</div>
</div>
</body>
</html>

View File

@ -1,7 +0,0 @@
{
"subject": "Solicitud de domiciliación bancaria",
"title": "CAMBIOS EN SU FORMA DE PAGO",
"dear": "Estimado cliente,",
"bodyDescription": "Para poder tramitar su solicitud de cambio de su forma de pago a giro bancario, le adjuntamos los documentos correspondientes a la Ley de Pago, que tiene que cumplimentar y enviarnos.",
"conclusion": "Gracias por su atención."
}

Some files were not shown because too many files have changed in this diff Show More