diff --git a/client/client/src/card/card.js b/client/client/src/card/card.js
index 560ca8f9e..9660ce3ce 100644
--- a/client/client/src/card/card.js
+++ b/client/client/src/card/card.js
@@ -1,5 +1,5 @@
import ngModule from '../module';
-import './style.scss';
+
export default class Controller {
constructor() {
this.client = null;
diff --git a/client/client/src/card/style.scss b/client/client/src/card/style.scss
deleted file mode 100644
index 74c5695c6..000000000
--- a/client/client/src/card/style.scss
+++ /dev/null
@@ -1,12 +0,0 @@
-vn-main-block {
- display:block;
- max-width: 1920px;
- width:100%;
- margin: 0 auto;
-
- .left-block {
- min-width: 18em;
- padding-left: 1em;
- padding-bottom: 1em;
- }
-}
diff --git a/client/core/src/lib/app.js b/client/core/src/lib/app.js
index 3b58309b4..5851357d8 100644
--- a/client/core/src/lib/app.js
+++ b/client/core/src/lib/app.js
@@ -12,7 +12,7 @@ export default class App {
this.$rootScope = $rootScope;
}
show(message) {
- if (this.snackbar) this.snackbar.show({message: message});
+ if (this.snackbar) this.snackbar.show({message: message, timeout: 400});
}
showMessage(message) {
this.show(message);
diff --git a/client/core/src/lib/fullEmpty.js b/client/core/src/lib/fullEmpty.js
new file mode 100644
index 000000000..64d82cdad
--- /dev/null
+++ b/client/core/src/lib/fullEmpty.js
@@ -0,0 +1,9 @@
+import {module} from '../module';
+
+const isFullEmpty = item => {
+ return (!item && item !== 0) || (typeof item === 'object' && !Object.keys(item).length);
+};
+
+export default isFullEmpty;
+export const NAME = 'isFullEmpty';
+module.value(NAME, isFullEmpty);
diff --git a/client/core/src/textfield/style.scss b/client/core/src/textfield/style.scss
index b8d155777..0f9d95c8e 100644
--- a/client/core/src/textfield/style.scss
+++ b/client/core/src/textfield/style.scss
@@ -7,13 +7,18 @@ vn-textfield {
width: auto;
top: 0px;
right: -6px;
- margin: 22px 0px;
- background: transparent;
+ margin: 21px 0px;
+ background: white;
+ opacity: 1;
z-index: 9999;
+ color: #aaa;
}
.material-icons {
font-size: 18px;
float: right;
margin-right: 5px;
}
+ .material-icons:hover {
+ color: rgba(0,0,0, .87);
+ }
}
\ No newline at end of file
diff --git a/client/core/src/watcher/watcher.js b/client/core/src/watcher/watcher.js
index d259f6f39..83012eca4 100644
--- a/client/core/src/watcher/watcher.js
+++ b/client/core/src/watcher/watcher.js
@@ -3,6 +3,7 @@ import Component from '../lib/component';
import getModifiedData from '../lib/modified';
import copyObject from '../lib/copy';
import isEqual from '../lib/equals';
+import isFullEmpty from '../lib/fullEmpty';
/**
* Component that checks for changes on a specific model property and
@@ -95,7 +96,7 @@ export default class Watcher extends Component {
let changedData = getModifiedData(this.data, this.orgData);
if (this.save) {
- this.save.model = changedData;
+ this.save.model = this.copyInNewObject(changedData);
return new Promise((resolve, reject) => {
this.save.accept().then(
json => this.writeData({data: json}, resolve),
@@ -154,7 +155,7 @@ export default class Watcher extends Component {
if (data && typeof data === 'object') {
Object.keys(data).forEach(
val => {
- if (data[val] !== "" && data[val] !== undefined && data[val] !== null) {
+ if (!isFullEmpty(data[val])) {
if (typeof data[val] === 'object') {
newCopy[val] = this.copyInNewObject(data[val]);
} else {
diff --git a/client/item/index.js b/client/item/index.js
new file mode 100644
index 000000000..c94fde7de
--- /dev/null
+++ b/client/item/index.js
@@ -0,0 +1 @@
+export * from './src/item';
diff --git a/client/item/routes.json b/client/item/routes.json
new file mode 100644
index 000000000..e703ed1de
--- /dev/null
+++ b/client/item/routes.json
@@ -0,0 +1,49 @@
+{
+ "module": "item",
+ "name": "Items",
+ "icon": "/static/images/icon_item.png",
+ "routes": [
+ {
+ "url": "/item",
+ "state": "item",
+ "abstract": true,
+ "component": "ui-view"
+ },
+ {
+ "url": "/list",
+ "state": "item.index",
+ "component": "vn-item-list"
+ }, {
+ "url": "/create",
+ "state": "item.create",
+ "component": "vn-item-create"
+ }, {
+ "url": "/:id",
+ "state": "item.card",
+ "abstract": true,
+ "component": "vn-item-card"
+ }, {
+ "url" : "/data",
+ "state": "item.card.data",
+ "component": "vn-item-data",
+ "params": {
+ "item": "$ctrl.item"
+ },
+ "menu": {
+ "description": "Basic data",
+ "icon": "folder"
+ }
+ }, {
+ "url" : "/image",
+ "state": "item.card.image",
+ "component": "vn-item-image",
+ "params": {
+ "item": "$ctrl.item"
+ },
+ "menu": {
+ "description": "Images",
+ "icon": "image"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/client/item/src/card/item-card.html b/client/item/src/card/item-card.html
new file mode 100644
index 000000000..179272d51
--- /dev/null
+++ b/client/item/src/card/item-card.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+ {{$ctrl.item.name}}
+
+
+
+
+
+
+
+
+
+
diff --git a/client/item/src/card/item-card.js b/client/item/src/card/item-card.js
new file mode 100644
index 000000000..063910369
--- /dev/null
+++ b/client/item/src/card/item-card.js
@@ -0,0 +1,32 @@
+import ngModule from '../module';
+
+class ItemCard {
+ constructor($http, $state) {
+ this.$http = $http;
+ this.$state = $state;
+ this.item = {};
+ }
+
+ $onInit() {
+ let filter = {
+ include: [
+ {relation: "itemType"},
+ {relation: "origin"},
+ {relation: "ink"},
+ {relation: "producer"},
+ {relation: "intrastat"}
+ ]
+ };
+ this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`).then(
+ res => {
+ this.item = res.data;
+ }
+ );
+ }
+}
+ItemCard.$inject = ['$http', '$state'];
+
+ngModule.component('vnItemCard', {
+ template: require('./item-card.html'),
+ controller: ItemCard
+});
diff --git a/client/item/src/create/item-create.html b/client/item/src/create/item-create.html
new file mode 100644
index 000000000..9e8b35e35
--- /dev/null
+++ b/client/item/src/create/item-create.html
@@ -0,0 +1,66 @@
+
+
+
+
diff --git a/client/item/src/create/item-create.js b/client/item/src/create/item-create.js
new file mode 100644
index 000000000..7723370e1
--- /dev/null
+++ b/client/item/src/create/item-create.js
@@ -0,0 +1,18 @@
+import ngModule from '../module';
+
+class ItemCreate {
+ constructor() {
+ this.item = {};
+ }
+
+ onSubmit() {
+ this.$.watcher.submit().then(
+ json => this.$state.go('item.card.basic', {id: json.data.id})
+ );
+ }
+}
+
+ngModule.component('vnItemCreate', {
+ template: require('./item-create.html'),
+ controller: ItemCreate
+});
diff --git a/client/item/src/data/item-data.html b/client/item/src/data/item-data.html
new file mode 100644
index 000000000..17c64e329
--- /dev/null
+++ b/client/item/src/data/item-data.html
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
diff --git a/client/item/src/data/item-data.js b/client/item/src/data/item-data.js
new file mode 100644
index 000000000..6046e8dbc
--- /dev/null
+++ b/client/item/src/data/item-data.js
@@ -0,0 +1,8 @@
+import ngModule from '../module';
+
+ngModule.component('vnItemData', {
+ template: require('./item-data.html'),
+ bindings: {
+ item: '<'
+ }
+});
diff --git a/client/item/src/filter-panel/filter-panel.html b/client/item/src/filter-panel/filter-panel.html
new file mode 100644
index 000000000..607e7e7cc
--- /dev/null
+++ b/client/item/src/filter-panel/filter-panel.html
@@ -0,0 +1,58 @@
+
+
+
diff --git a/client/item/src/filter-panel/filter-panel.js b/client/item/src/filter-panel/filter-panel.js
new file mode 100644
index 000000000..608918b51
--- /dev/null
+++ b/client/item/src/filter-panel/filter-panel.js
@@ -0,0 +1,16 @@
+import ngModule from '../module';
+
+class ItemFilterPanel {
+ constructor() {
+ this.onSubmit = () => {};
+ }
+
+ onSearch() {
+ this.onSubmit(this.filter);
+ }
+}
+
+ngModule.component('vnItemFilterPanel', {
+ template: require('./filter-panel.html'),
+ controller: ItemFilterPanel
+});
diff --git a/client/item/src/filter-panel/locale/es.json b/client/item/src/filter-panel/locale/es.json
new file mode 100644
index 000000000..e7bc89814
--- /dev/null
+++ b/client/item/src/filter-panel/locale/es.json
@@ -0,0 +1,5 @@
+{
+ "Ink": "Tinta",
+ "Origin": "Origen",
+ "Producer": "Productor"
+}
\ No newline at end of file
diff --git a/client/item/src/item.js b/client/item/src/item.js
new file mode 100644
index 000000000..9bdb719a3
--- /dev/null
+++ b/client/item/src/item.js
@@ -0,0 +1,7 @@
+export * from './module';
+
+import './list/list';
+import './filter-panel/filter-panel';
+import './create/item-create';
+import './card/item-card';
+import './data/item-data';
diff --git a/client/item/src/list/item-product.html b/client/item/src/list/item-product.html
new file mode 100644
index 000000000..f4fd431d1
--- /dev/null
+++ b/client/item/src/list/item-product.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Id : {{$ctrl.item.id}}
+ Name : {{$ctrl.item.name}}
+ Description : {{$ctrl.item.description}}
+ Size : {{$ctrl.item.size}}
+ Type : {{$ctrl.item.itemType.name}}
+
+
+
diff --git a/client/item/src/list/item-product.js b/client/item/src/list/item-product.js
new file mode 100644
index 000000000..4f7c7b4e7
--- /dev/null
+++ b/client/item/src/list/item-product.js
@@ -0,0 +1,8 @@
+import ngModule from '../module';
+
+ngModule.component('vnItemProduct', {
+ template: require('./item-product.html'),
+ bindings: {
+ item: '<'
+ }
+});
diff --git a/client/item/src/list/list.html b/client/item/src/list/list.html
new file mode 100644
index 000000000..00f498d4e
--- /dev/null
+++ b/client/item/src/list/list.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/item/src/list/list.js b/client/item/src/list/list.js
new file mode 100644
index 000000000..db48692d8
--- /dev/null
+++ b/client/item/src/list/list.js
@@ -0,0 +1,17 @@
+import ngModule from '../module';
+import './item-product';
+import './style.css';
+
+class ItemList {
+ constructor() {
+ this.model = {};
+ }
+ search(index) {
+ index.accept();
+ }
+}
+
+ngModule.component('vnItemList', {
+ template: require('./list.html'),
+ controller: ItemList
+});
diff --git a/client/item/src/list/style.css b/client/item/src/list/style.css
new file mode 100644
index 000000000..ca53151b9
--- /dev/null
+++ b/client/item/src/list/style.css
@@ -0,0 +1,20 @@
+vn-item-product {
+ display: block;
+}
+a.item-product-link {
+ display: block;
+ text-decoration: none;
+ color: inherit;
+}
+a.item-product-link:hover {
+ color: white;
+ background-color: #424242;
+}
+
+vn-item-product img {
+ max-width: 150px;
+}
+
+.vn-item-product-name {
+ font-family: vn-font-bold;
+}
diff --git a/client/item/src/locale/es.json b/client/item/src/locale/es.json
new file mode 100644
index 000000000..e51c46008
--- /dev/null
+++ b/client/item/src/locale/es.json
@@ -0,0 +1,8 @@
+{
+ "Items": "Artículos",
+ "Item": "Artículo",
+ "Category": "Categoría",
+ "Description": "Descripción",
+ "Size": "Tamaño",
+ "Type": "Tipo"
+}
\ No newline at end of file
diff --git a/client/item/src/module.js b/client/item/src/module.js
new file mode 100644
index 000000000..b44509fb2
--- /dev/null
+++ b/client/item/src/module.js
@@ -0,0 +1,5 @@
+import {ng} from 'vendor';
+import 'core';
+
+const ngModule = ng.module('item', ['vnCore']);
+export default ngModule;
diff --git a/client/modules.json b/client/modules.json
index 62c5e11a1..d7dd0f7ce 100644
--- a/client/modules.json
+++ b/client/modules.json
@@ -5,5 +5,6 @@
"client": [],
"production": [],
"route": [],
- "locator": []
+ "locator": [],
+ "item": []
}
diff --git a/client/salix/src/locale/es.json b/client/salix/src/locale/es.json
index 0ee929eab..338feede8 100644
--- a/client/salix/src/locale/es.json
+++ b/client/salix/src/locale/es.json
@@ -13,6 +13,7 @@
"Production" : "Producción",
"Modules access" : "Acceso a módulos",
"Locator": "Localizador",
+ "Items": "Artículos",
"name": "Nombre",
"credit": "Crédito",
"phone": "Teléfono",
diff --git a/client/salix/src/spliting.js b/client/salix/src/spliting.js
index 697bcef98..b1a2a4d19 100644
--- a/client/salix/src/spliting.js
+++ b/client/salix/src/spliting.js
@@ -43,3 +43,14 @@ export const locator = () => {
};
core.splitingRegister.register('locator', locator);
+
+export const item = () => {
+ return new Promise(resolve => {
+ require.ensure([], () => {
+ require('item');
+ resolve('item');
+ }, 'item');
+ });
+};
+
+core.splitingRegister.register('item', item);
diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss
index ddfe20a05..8d4fd271f 100644
--- a/client/salix/src/styles/misc.scss
+++ b/client/salix/src/styles/misc.scss
@@ -99,3 +99,17 @@ html [pointer], .pointer{
html [noDrop], .noDrop{
cursor: no-drop;
}
+
+vn-main-block {
+ display:block;
+ max-width: 1920px;
+ width:100%;
+ margin: 0 auto;
+
+ .left-block {
+ max-width: 20em;
+ min-width: 18em;
+ padding-left: 1em;
+ padding-bottom: 1em;
+ }
+}
diff --git a/docker-compose.yml b/docker-compose.yml
index b8d64389b..4dcb065b7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -87,7 +87,19 @@ services:
expose:
- "3006"
ports:
- - "3006:3006"
+ - "3006:3006"
+ item:
+ environment:
+ - NODE_ENV=${NODE_ENV}
+ container_name: "${BRANCH_NAME}-item"
+ image: "item:${TAG}"
+ build:
+ context: ./services
+ dockerfile: /item/Dockerfile
+ expose:
+ - "3007"
+ ports:
+ - "3007:3007"
nginx:
container_name: "${BRANCH_NAME}-nginx"
image: "nginx:${TAG}"
diff --git a/services/item/Dockerfile b/services/item/Dockerfile
new file mode 100644
index 000000000..73be20777
--- /dev/null
+++ b/services/item/Dockerfile
@@ -0,0 +1,15 @@
+FROM node:6.9.1
+
+COPY item /app
+
+COPY loopback /loopback
+
+WORKDIR /app
+
+RUN npm install
+
+RUN npm -g install pm2
+
+CMD ["pm2-docker", "./server/server.js"]
+
+EXPOSE 3007
diff --git a/services/item/common/methods/item/filter.js b/services/item/common/methods/item/filter.js
new file mode 100644
index 000000000..5db641a04
--- /dev/null
+++ b/services/item/common/methods/item/filter.js
@@ -0,0 +1,31 @@
+module.exports = Self => {
+ Self.installMethod('filter', filterParams);
+
+ function filterParams(params) {
+ let filter = {
+ where: {},
+ skip: (params.page - 1) * params.size,
+ limit: params.size,
+ order: params.order || 'relevancy DESC',
+ include: {
+ relation: "itemType",
+ scope: {
+ fields: ["id", "name"]
+ }
+ }
+ };
+
+ delete params.page;
+ delete params.size;
+ delete params.order;
+
+ if (params.itemSize) {
+ filter.where.size = params.itemSize;
+ delete params.itemSize;
+ }
+
+ Object.assign(filter.where, params);
+
+ return filter;
+ }
+};
diff --git a/services/item/common/models/ink.json b/services/item/common/models/ink.json
new file mode 100644
index 000000000..5cb80693d
--- /dev/null
+++ b/services/item/common/models/ink.json
@@ -0,0 +1,23 @@
+{
+ "name": "Ink",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "ink",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "name": {
+ "type": "String"
+ },
+ "showOrder": {
+ "type": "number"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/intrastat.json b/services/item/common/models/intrastat.json
new file mode 100644
index 000000000..615c16a1e
--- /dev/null
+++ b/services/item/common/models/intrastat.json
@@ -0,0 +1,32 @@
+{
+ "name": "Intrastat",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "intrastat",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "description": {
+ "type": "String"
+ }
+ },
+ "relations": {
+ "taxGroup": {
+ "type": "belongsTo",
+ "model": "TaxGroup",
+ "foreignKey": "taxGroupFk"
+ },
+ "taxCode": {
+ "type": "belongsTo",
+ "model": "TaxCode",
+ "foreignKey": "taxCodeFk"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/item-type.json b/services/item/common/models/item-type.json
new file mode 100644
index 000000000..d1f45c0db
--- /dev/null
+++ b/services/item/common/models/item-type.json
@@ -0,0 +1,23 @@
+{
+ "name": "ItemType",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "itemType",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "name": {
+ "type": "String"
+ },
+ "life": {
+ "type": "Number"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/item.js b/services/item/common/models/item.js
new file mode 100644
index 000000000..4c8019af3
--- /dev/null
+++ b/services/item/common/models/item.js
@@ -0,0 +1,3 @@
+module.exports = function(Self) {
+ require('../methods/item/filter.js')(Self);
+};
diff --git a/services/item/common/models/item.json b/services/item/common/models/item.json
new file mode 100644
index 000000000..0e396c0bf
--- /dev/null
+++ b/services/item/common/models/item.json
@@ -0,0 +1,74 @@
+{
+ "name": "Item",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "item",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "name": {
+ "type": "String"
+ },
+ "size": {
+ "type": "Number"
+ },
+ "category": {
+ "type": "String"
+ },
+ "stems": {
+ "type": "Number"
+ },
+ "description": {
+ "type": "String"
+ },
+ "isOnOffer": {
+ "type": "Boolean"
+ },
+ "isBargain": {
+ "type": "Boolean"
+ },
+ "comment": {
+ "type": "String"
+ },
+ "relevancy": {
+ "type": "Number"
+ },
+ "image": {
+ "type": "String"
+ }
+ },
+ "relations": {
+ "itemType": {
+ "type": "belongsTo",
+ "model": "ItemType",
+ "foreignKey": "typeFk"
+ },
+ "ink": {
+ "type": "belongsTo",
+ "model": "Ink",
+ "foreignKey": "inkFk"
+ },
+ "origin": {
+ "type": "belongsTo",
+ "model": "Origin",
+ "foreignKey": "originFk"
+ },
+ "producer": {
+ "type": "belongsTo",
+ "model": "Producer",
+ "foreignKey": "producerFk"
+ },
+ "intrastat": {
+ "type": "belongsTo",
+ "model": "Intrastat",
+ "foreignKey": "intrastatFk"
+ }
+ }
+ }
\ No newline at end of file
diff --git a/services/item/common/models/origin.json b/services/item/common/models/origin.json
new file mode 100644
index 000000000..9ebeb98f8
--- /dev/null
+++ b/services/item/common/models/origin.json
@@ -0,0 +1,23 @@
+{
+ "name": "Origin",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "origin",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "code": {
+ "type": "String"
+ },
+ "name": {
+ "type": "String"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/producer.json b/services/item/common/models/producer.json
new file mode 100644
index 000000000..f4628b988
--- /dev/null
+++ b/services/item/common/models/producer.json
@@ -0,0 +1,20 @@
+{
+ "name": "Producer",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "producer",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "name": {
+ "type": "String"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/tax-code.json b/services/item/common/models/tax-code.json
new file mode 100644
index 000000000..93a426a07
--- /dev/null
+++ b/services/item/common/models/tax-code.json
@@ -0,0 +1,47 @@
+{
+ "name": "TaxCode",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "taxCode",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "dated": {
+ "type": "date"
+ },
+ "code": {
+ "type": "String"
+ },
+ "rate": {
+ "type": "number"
+ },
+ "equalizationTax": {
+ "type": "number"
+ },
+ "type": {
+ "type": "String"
+ },
+ "isActive": {
+ "type": "Boolean"
+ }
+ },
+ "relations": {
+ "taxType": {
+ "type": "belongsTo",
+ "model": "TaxType",
+ "foreignKey": "taxTypeFk"
+ },
+ "link": {
+ "type": "belongsTo",
+ "model": "Link",
+ "foreignKey": "linkFk"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/tax-group.json b/services/item/common/models/tax-group.json
new file mode 100644
index 000000000..e2fdd5a3b
--- /dev/null
+++ b/services/item/common/models/tax-group.json
@@ -0,0 +1,23 @@
+{
+ "name": "TaxGroup",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "taxGroup",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "description": {
+ "type": "String"
+ },
+ "code": {
+ "type": "String"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/tax-type.json b/services/item/common/models/tax-type.json
new file mode 100644
index 000000000..527e90f39
--- /dev/null
+++ b/services/item/common/models/tax-type.json
@@ -0,0 +1,36 @@
+{
+ "name": "TaxType",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "taxType",
+ "database": "vn"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "nickname": {
+ "type": "String"
+ },
+ "serial": {
+ "type": "String"
+ },
+ "TIPOOPE": {
+ "type": "String"
+ },
+ "description": {
+ "type": "String"
+ }
+ },
+ "relations": {
+ "country": {
+ "type": "belongsTo",
+ "model": "Country",
+ "foreignKey": "countryFk"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/package.json b/services/item/package.json
new file mode 100644
index 000000000..7a9c9b48a
--- /dev/null
+++ b/services/item/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "vn-item",
+ "version": "1.0.0",
+ "main": "server/server.js",
+ "scripts": {
+ "lint": "eslint .",
+ "start": "node .",
+ "posttest": "npm run lint && nsp check"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://git.verdnatura.es/salix"
+ },
+ "license": "GPL-3.0",
+ "description": "vn-item",
+ "dependencies": {
+ "uuid": "^3.1.0"
+ }
+}
diff --git a/services/item/server/config.json b/services/item/server/config.json
new file mode 100644
index 000000000..f52e73b1d
--- /dev/null
+++ b/services/item/server/config.json
@@ -0,0 +1,3 @@
+{
+ "port": 3007
+}
diff --git a/services/item/server/model-config.json b/services/item/server/model-config.json
new file mode 100644
index 000000000..9258f7f1c
--- /dev/null
+++ b/services/item/server/model-config.json
@@ -0,0 +1,57 @@
+{
+ "user": {
+ "dataSource": "salix"
+ },
+ "AccessToken": {
+ "dataSource": "salix",
+ "relations": {
+ "user": {
+ "type": "belongsTo",
+ "model": "user",
+ "foreignKey": "userId"
+ }
+ }
+ },
+ "ACL": {
+ "dataSource": "salix"
+ },
+ "RoleMapping": {
+ "dataSource": "salix"
+ },
+ "Role": {
+ "dataSource": "salix"
+ },
+ "Account": {
+ "dataSource": "salix"
+ },
+ "Item": {
+ "dataSource": "vn"
+ },
+ "ItemType": {
+ "dataSource": "vn"
+ },
+ "Ink": {
+ "dataSource": "vn"
+ },
+ "Origin": {
+ "dataSource": "vn"
+ },
+ "Producer": {
+ "dataSource": "vn"
+ },
+ "Intrastat": {
+ "dataSource": "vn"
+ },
+ "TaxGroup": {
+ "dataSource": "vn"
+ },
+ "TaxCode": {
+ "dataSource": "vn"
+ },
+ "TaxType": {
+ "dataSource": "vn"
+ },
+ "Country": {
+ "dataSource": "salix"
+ }
+}
diff --git a/services/item/server/server.js b/services/item/server/server.js
new file mode 100644
index 000000000..f0493dcd9
--- /dev/null
+++ b/services/item/server/server.js
@@ -0,0 +1,4 @@
+var vnLoopback = require('../../loopback/server/server.js');
+
+var app = module.exports = vnLoopback.loopback();
+vnLoopback.boot(app, __dirname, module);
diff --git a/services/mailer/application/config.js b/services/mailer/application/config.js
index ab30f576b..f4e90f14a 100644
--- a/services/mailer/application/config.js
+++ b/services/mailer/application/config.js
@@ -1,15 +1,20 @@
var path = require('path');
-var fs = require('fs');
-var config = {};
+let defaultFile = 'datasources.json';
-let devConfigPath = path.join(__dirname, '/config/datasources.development.json');
-let configPath = path.join(__dirname, '/config/datasources.json');
+function getFile(fileName) {
+ return require(path.join(__dirname, `/config/${fileName}`));
+}
try {
- config = Object.assign(require(configPath), require(devConfigPath));
+ let envFile = 'datasources.development.json';
+
+ if (process.env.NODE_ENV === 'test')
+ envFile = 'datasources.test.json';
+
+ config = getFile(envFile);
} catch (e) {
if (e.code == 'MODULE_NOT_FOUND')
- config = require(configPath);
+ config = getFile(defaultFile);
}
config.proxy = require('../../nginx/config.json');
diff --git a/services/mailer/application/config/datasources.test.json b/services/mailer/application/config/datasources.test.json
index 69943439d..d3a2d8b33 100644
--- a/services/mailer/application/config/datasources.test.json
+++ b/services/mailer/application/config/datasources.test.json
@@ -4,14 +4,14 @@
"debug": false,
"defaultLanguage": "es",
"senderMail": "noreply@localhost",
- "senderName": ""
+ "senderName": "VerdNatura"
},
"mysql": {
"host": "localhost",
"port": 3306,
- "user": "reports",
+ "user": "root",
"password": "",
- "database": ""
+ "database": "vn"
},
"smtp": {
"host": "localhost",
diff --git a/services/mailer/application/mail.js b/services/mailer/application/mail.js
index 3980e5128..04af6b007 100644
--- a/services/mailer/application/mail.js
+++ b/services/mailer/application/mail.js
@@ -12,15 +12,17 @@ module.exports = {
* Load mail config.
*/
init: function() {
+
this.transporter = nodemailer.createTransport(config.smtp);
this.transporter.verify(function(error, success) {
if (error) {
- throw new Error(error);
+ console.error(error);
} else if (config.app.debug) {
console.log('SMTP connection stablished');
}
});
+
},
/**
diff --git a/services/mailer/application/route/notification.js b/services/mailer/application/route/notification.js
index bd7a81f11..810fbdf88 100644
--- a/services/mailer/application/route/notification.js
+++ b/services/mailer/application/route/notification.js
@@ -4,10 +4,15 @@ 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.post('/printer-setup/:clientId', function(request, response) {
+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});
@@ -17,7 +22,7 @@ router.post('/printer-setup/:clientId', function(request, response) {
});
// Printer setup preview
-router.get('/printer-setup/:clientId', function(request, response) {
+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});
@@ -27,7 +32,7 @@ router.get('/printer-setup/:clientId', function(request, response) {
});
// Client welcome
-router.post('/client-welcome/:clientId', function(request, response) {
+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});
@@ -37,7 +42,7 @@ router.post('/client-welcome/:clientId', function(request, response) {
});
// Client welcome preview
-router.get('/client-welcome/:clientId', function(request, response) {
+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});
@@ -47,8 +52,13 @@ router.get('/client-welcome/:clientId', function(request, response) {
});
// Client SEPA CORE
-router.post('/sepa-core/:clientId', function(request, response) {
- let path = `${request.proxyHost}/print/manuscript/sepa-core/${request.params.clientId}`;
+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',
@@ -59,25 +69,75 @@ router.post('/sepa-core/:clientId', function(request, response) {
let httpStream = httpRequest(options, function(error, httpResponse, body) {
if (error || httpResponse.statusCode != 200)
- return response.status(400).json({message: error.message});
+ return response.status(400).json({message: error});
});
if (httpStream)
- mail.sendWithTemplate('sepa-core', {
- clientId: request.params.clientId,
- attachments: [{filename: 'sepa-core.pdf', content: httpStream}]
- }, error => {
- if (error)
- return response.status(400).json({message: error.message});
-
- return response.json();
+ 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/:clientId', function(request, response) {
- template.get('sepa-core', {
+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.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-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) => {
@@ -88,6 +148,85 @@ router.get('/sepa-core/:clientId', function(request, response) {
});
});
+// 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 = {
@@ -146,34 +285,4 @@ router.get('/sepa-core/:clientId', function(request, response) {
mail.sendWithTemplate('notification-notice', params, result => {
return response.json(result);
});
-}); */
-
-// Payment method changes
-router.post('/payment-update/:clientId', 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.post('/client-deactivate/:clientId', 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;
+}); */
\ No newline at end of file
diff --git a/services/mailer/application/router.js b/services/mailer/application/router.js
index ed5794bbe..161271820 100644
--- a/services/mailer/application/router.js
+++ b/services/mailer/application/router.js
@@ -1,5 +1,7 @@
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) {
@@ -9,4 +11,20 @@ router.get('/', function(request, response) {
// 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() {
+ readStream.pipe(response);
+ });
+ });
+});
+
module.exports = router;
diff --git a/services/mailer/application/template.js b/services/mailer/application/template.js
index d2c13f222..1e9c92fde 100644
--- a/services/mailer/application/template.js
+++ b/services/mailer/application/template.js
@@ -15,7 +15,7 @@ module.exports = {
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}`, 'static', 'css', 'style.css');
+ var stylePath = path.join(__dirname, 'template', `${template}`, 'style.css');
fs.stat(templatePath, (error, stat) => {
if (error)
@@ -65,6 +65,8 @@ module.exports = {
return cb(error);
instance._ = result.locale;
+ instance.isPreview = params.isPreview;
+
getDataCb(null, result);
});
});
@@ -173,14 +175,17 @@ module.exports = {
// Template default attachments
for (var i = 0; i < tplAttachments.length; i++) {
- let name = tplAttachments[i].replace('src="cid:', '').replace('"', '');
+ let src = tplAttachments[i].replace('src="cid:', '').replace('"', '').split('/');
+ let attachmentTpl = src[0];
+ let attachment = src[1];
if (isPreview) {
- let attachmentPath = `/mailer/static/images/${name}`;
+ let attachmentPath = `/mailer/static/${attachmentTpl}/${attachment}`;
body = body.replace(tplAttachments[i], `src="${attachmentPath}"`);
} else {
- let attachmentPath = path.join(__dirname, '../static', 'images', name);
- attachments.push({filename: name, path: attachmentPath, cid: name});
+ let attachmentPath = path.join(__dirname, 'template', `${attachmentTpl}`, 'image', attachment);
+ let attachmentName = attachmentTpl + '/' + attachment;
+ attachments.push({filename: attachmentName, path: attachmentPath, cid: attachmentName});
}
}
diff --git a/services/mailer/application/template/client-welcome/client-welcome.js b/services/mailer/application/template/client-welcome/client-welcome.js
index 469e74386..7cf435d0e 100644
--- a/services/mailer/application/template/client-welcome/client-welcome.js
+++ b/services/mailer/application/template/client-welcome/client-welcome.js
@@ -14,10 +14,11 @@ module.exports = class ClientWelcome {
c.email recipient
FROM client c
JOIN account.user u ON u.id = c.id
- LEFT JOIN worker w ON w.id = c.workerFk
+ 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'));
diff --git a/services/mailer/application/template/client-welcome/index.html b/services/mailer/application/template/client-welcome/index.html
index a8a711c8e..6d25bcd7e 100644
--- a/services/mailer/application/template/client-welcome/index.html
+++ b/services/mailer/application/template/client-welcome/index.html
@@ -22,8 +22,9 @@
{{_.dear}}
{{{_.bodyDescription}}}
+
{{_.clientNumber}} {{clientId}}
{{_.user}} {{userName}}
- {{_.password}} ******** {{_.passwordResetText}}
+ {{_.password}} ******** {{{_.passwordResetText}}}
{{_.sectionHowToBuyTitle}}
diff --git a/services/mailer/application/template/client-welcome/locale/es.json b/services/mailer/application/template/client-welcome/locale/es.json
index b1149d62b..95a903e5c 100644
--- a/services/mailer/application/template/client-welcome/locale/es.json
+++ b/services/mailer/application/template/client-welcome/locale/es.json
@@ -3,9 +3,10 @@
"title": "¡LE DAMOS LA BIENVENIDA!",
"dear": "Estimado cliente,",
"bodyDescription": "Sus datos para poder comprar en la web de verdnatura (https://www.verdnatura.es ) o en nuestras aplicaciones para iOS y Android (Ver tutorial de uso ), son:",
+ "clientNumber": "Identificador de cliente:",
"user": "Usuario:",
"password": "Contraseña:",
- "passwordResetText": "(Va a recibir un correo para establecer la contraseña)",
+ "passwordResetText": "(Haga clic en \"¿Has olvidado tu contraseñ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.",
diff --git a/services/mailer/application/template/client-welcome/static/css/style.css b/services/mailer/application/template/client-welcome/style.css
similarity index 100%
rename from services/mailer/application/template/client-welcome/static/css/style.css
rename to services/mailer/application/template/client-welcome/style.css
diff --git a/services/mailer/application/template/default/image/download.svg b/services/mailer/application/template/default/image/download.svg
new file mode 100644
index 000000000..b05bc05c8
--- /dev/null
+++ b/services/mailer/application/template/default/image/download.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/services/mailer/application/template/default/image/preview.svg b/services/mailer/application/template/default/image/preview.svg
new file mode 100644
index 000000000..09a2a6bca
--- /dev/null
+++ b/services/mailer/application/template/default/image/preview.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/services/mailer/application/template/footer/footer.js b/services/mailer/application/template/footer/footer.js
index 3b4020bf4..555e70b10 100644
--- a/services/mailer/application/template/footer/footer.js
+++ b/services/mailer/application/template/footer/footer.js
@@ -5,7 +5,8 @@ var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class Footer {
getData(params, cb) {
let query = `SELECT
- socialName
+ socialName,
+ LOWER(ct.code) countryCode
FROM client c
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ?`;
diff --git a/services/mailer/application/template/footer/static/image/action.png b/services/mailer/application/template/footer/image/action.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/action.png
rename to services/mailer/application/template/footer/image/action.png
diff --git a/services/mailer/application/template/footer/static/image/facebook.png b/services/mailer/application/template/footer/image/facebook.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/facebook.png
rename to services/mailer/application/template/footer/image/facebook.png
diff --git a/services/mailer/application/template/footer/static/image/header.png b/services/mailer/application/template/footer/image/header.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/header.png
rename to services/mailer/application/template/footer/image/header.png
diff --git a/services/mailer/application/template/footer/static/image/info.png b/services/mailer/application/template/footer/image/info.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/info.png
rename to services/mailer/application/template/footer/image/info.png
diff --git a/services/mailer/application/template/footer/static/image/instagram.png b/services/mailer/application/template/footer/image/instagram.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/instagram.png
rename to services/mailer/application/template/footer/image/instagram.png
diff --git a/services/mailer/application/template/footer/static/image/linkedin.png b/services/mailer/application/template/footer/image/linkedin.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/linkedin.png
rename to services/mailer/application/template/footer/image/linkedin.png
diff --git a/services/mailer/application/template/footer/static/image/pinterest.png b/services/mailer/application/template/footer/image/pinterest.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/pinterest.png
rename to services/mailer/application/template/footer/image/pinterest.png
diff --git a/services/mailer/application/template/footer/static/image/twitter.png b/services/mailer/application/template/footer/image/twitter.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/twitter.png
rename to services/mailer/application/template/footer/image/twitter.png
diff --git a/services/mailer/application/template/footer/static/image/youtube.png b/services/mailer/application/template/footer/image/youtube.png
similarity index 100%
rename from services/mailer/application/template/footer/static/image/youtube.png
rename to services/mailer/application/template/footer/image/youtube.png
diff --git a/services/mailer/application/template/footer/index.html b/services/mailer/application/template/footer/index.html
index e52f7a695..484f5c2b8 100644
--- a/services/mailer/application/template/footer/index.html
+++ b/services/mailer/application/template/footer/index.html
@@ -2,10 +2,10 @@
@@ -13,22 +13,22 @@
diff --git a/services/mailer/application/template/footer/static/css/style.css b/services/mailer/application/template/footer/style.css
similarity index 100%
rename from services/mailer/application/template/footer/static/css/style.css
rename to services/mailer/application/template/footer/style.css
diff --git a/services/mailer/application/template/header/header.js b/services/mailer/application/template/header/header.js
index 82c78e003..a6d1d6194 100644
--- a/services/mailer/application/template/header/header.js
+++ b/services/mailer/application/template/header/header.js
@@ -5,7 +5,8 @@ var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class Header {
getData(params, cb) {
let query = `SELECT
- c.name AS clientName
+ c.name AS clientName,
+ LOWER(ct.code) countryCode
FROM client c
JOIN country ct ON ct.id = c.countryFk
WHERE c.id = ?`;
diff --git a/services/mailer/application/template/header/static/image/header.png b/services/mailer/application/template/header/image/logo.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/header.png
rename to services/mailer/application/template/header/image/logo.png
diff --git a/services/mailer/application/template/header/index.html b/services/mailer/application/template/header/index.html
index c5234bbc8..6e4fcf8a4 100644
--- a/services/mailer/application/template/header/index.html
+++ b/services/mailer/application/template/header/index.html
@@ -1,3 +1,3 @@
-
+
diff --git a/services/mailer/application/template/header/static/image/logo.png b/services/mailer/application/template/header/static/image/logo.png
deleted file mode 100644
index 55e26fec6..000000000
Binary files a/services/mailer/application/template/header/static/image/logo.png and /dev/null differ
diff --git a/services/mailer/application/template/header/static/css/style.css b/services/mailer/application/template/header/style.css
similarity index 100%
rename from services/mailer/application/template/header/static/css/style.css
rename to services/mailer/application/template/header/style.css
diff --git a/services/mailer/application/template/letter-debtor-nd/attachment.json b/services/mailer/application/template/letter-debtor-nd/attachment.json
new file mode 100644
index 000000000..0637a088a
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-nd/attachment.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/services/mailer/application/template/letter-debtor-nd/index.html b/services/mailer/application/template/letter-debtor-nd/index.html
new file mode 100644
index 000000000..aa4379519
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-nd/index.html
@@ -0,0 +1,87 @@
+
+
+
+ {{_.subject}}
+
+
+
+
+
+
+ {{$.header}}
+
+
+
+
+
{{_.title}}
+
+
+
+
+
+
{{_.dear}}
+
+
{{_.bodyDescription}}
+
{{_.termLimits}}
+
+ {{_.payMethod}}
+
+
+ {{_.payMethodOption1}}
+ {{_.payMethodOption2}}
+
+
+
+ {{_.legalActions}}
+
+ {{_.legalActionsOption1}}
+ {{_.legalActionsOption2}}
+ {{_.legalActionsOption3}}
+
+
+
+
{{_.contact}}
+
+
{{_.waitingForNews}}
+
{{_.conclusion}}
+
+
+
+
{{bankName}}
+
{{iban}}
+
+
{{_.accountTransferData}}
+
+
+
+
+ {{#isPreview}}
+
+
+
+
+
+
Ver adjunto
+
+
+
+
+
+
+
+
+
Descargar PDF
+
+
+ {{/isPreview}}
+
+
+
+
+
+ {{$.footer}}
+
+
+
+
+
\ No newline at end of file
diff --git a/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js b/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js
new file mode 100644
index 000000000..be0f996e1
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js
@@ -0,0 +1,39 @@
+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 `` +
+ ' ';
+ }
+};
diff --git a/services/mailer/application/template/letter-debtor-nd/locale/es.json b/services/mailer/application/template/letter-debtor-nd/locale/es.json
new file mode 100644
index 000000000..1f8790eba
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-nd/locale/es.json
@@ -0,0 +1,18 @@
+{
+ "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"
+}
\ No newline at end of file
diff --git a/services/mailer/application/template/notification-alias/static/css/style.css b/services/mailer/application/template/letter-debtor-nd/style.css
similarity index 100%
rename from services/mailer/application/template/notification-alias/static/css/style.css
rename to services/mailer/application/template/letter-debtor-nd/style.css
diff --git a/services/mailer/application/template/letter-debtor-st/attachment.json b/services/mailer/application/template/letter-debtor-st/attachment.json
new file mode 100644
index 000000000..0637a088a
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-st/attachment.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/services/mailer/application/template/letter-debtor-st/index.html b/services/mailer/application/template/letter-debtor-st/index.html
new file mode 100644
index 000000000..a3b07e677
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-st/index.html
@@ -0,0 +1,69 @@
+
+
+
+ {{_.subject}}
+
+
+
+
+
+
+ {{$.header}}
+
+
+
+
+
{{_.title}}
+
+
+
+
+
+
{{_.dear}}
+
+
{{_.bodyDescription}}
+
{{_.viewExtract}}
+
{{_.validData}}
+
{{_.payMethod}}
+
{{_.conclusion}}
+
+
+
+
{{bankName}}
+
{{iban}}
+
+
{{_.accountTransferData}}
+
+
+
+
+ {{#isPreview}}
+
+
+
+
+
+
Ver adjunto
+
+
+
+
+
+
+
+
+
Descargar PDF
+
+
+ {{/isPreview}}
+
+
+
+
+
+ {{$.footer}}
+
+
+
+
+
\ No newline at end of file
diff --git a/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js b/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js
new file mode 100644
index 000000000..43ccb7a25
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js
@@ -0,0 +1,39 @@
+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 `` +
+ ' ';
+ }
+};
diff --git a/services/mailer/application/template/letter-debtor-st/locale/es.json b/services/mailer/application/template/letter-debtor-st/locale/es.json
new file mode 100644
index 000000000..558b18753
--- /dev/null
+++ b/services/mailer/application/template/letter-debtor-st/locale/es.json
@@ -0,0 +1,11 @@
+{
+ "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"
+}
\ No newline at end of file
diff --git a/services/mailer/application/template/payment-update/static/css/style.css b/services/mailer/application/template/letter-debtor-st/style.css
similarity index 100%
rename from services/mailer/application/template/payment-update/static/css/style.css
rename to services/mailer/application/template/letter-debtor-st/style.css
diff --git a/services/mailer/application/template/printer-setup/static/css/style.css b/services/mailer/application/template/notification-alias/style.css
similarity index 100%
rename from services/mailer/application/template/printer-setup/static/css/style.css
rename to services/mailer/application/template/notification-alias/style.css
diff --git a/services/mailer/application/template/payment-update/payment-update.js b/services/mailer/application/template/payment-update/payment-update.js
index 187d21b73..565fd8a74 100644
--- a/services/mailer/application/template/payment-update/payment-update.js
+++ b/services/mailer/application/template/payment-update/payment-update.js
@@ -4,8 +4,7 @@ var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class PaymentUpdate {
getData(params, cb) {
- let query = `SELECT
- c.id clientId,
+ let query = `SELECT
pm.id payMethodFk,
pm.name payMethodName,
c.dueDay,
@@ -13,9 +12,12 @@ module.exports = class PaymentUpdate {
LOWER(ct.code) countryCode,
c.email recipient
FROM client c
- JOIN payMethod pm ON pm.id = c.paymentMethodFk
+ 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'));
diff --git a/services/mailer/application/template/sepa-core/static/css/style.css b/services/mailer/application/template/payment-update/style.css
similarity index 100%
rename from services/mailer/application/template/sepa-core/static/css/style.css
rename to services/mailer/application/template/payment-update/style.css
diff --git a/services/mailer/application/template/printer-setup/printer-setup.js b/services/mailer/application/template/printer-setup/printer-setup.js
index 6dece0d23..d17add406 100644
--- a/services/mailer/application/template/printer-setup/printer-setup.js
+++ b/services/mailer/application/template/printer-setup/printer-setup.js
@@ -4,19 +4,21 @@ var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class PrinterSetup {
getData(params, cb) {
- let query = `SELECT
- c.id clientId,
+ 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.workerFk
+ 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'));
diff --git a/services/mailer/application/template/printer-setup/style.css b/services/mailer/application/template/printer-setup/style.css
new file mode 100644
index 000000000..e69de29bb
diff --git a/services/mailer/application/template/sepa-core/index.html b/services/mailer/application/template/sepa-core/index.html
index 0e9c34d04..1acdae3fc 100644
--- a/services/mailer/application/template/sepa-core/index.html
+++ b/services/mailer/application/template/sepa-core/index.html
@@ -22,7 +22,26 @@
{{_.dear}}
{{_.bodyDescription}}
{{_.conclusion}}
- {{{previewAttachments}}}
+
+ {{#isPreview}}
+
+
+
+
+
+
Ver adjunto
+
+
+
+
+
+
+
+
+
Descargar PDF
+
+
+ {{/isPreview}}
diff --git a/services/mailer/application/template/sepa-core/sepa-core.js b/services/mailer/application/template/sepa-core/sepa-core.js
index 04fd71df7..ec19dd29b 100644
--- a/services/mailer/application/template/sepa-core/sepa-core.js
+++ b/services/mailer/application/template/sepa-core/sepa-core.js
@@ -5,19 +5,19 @@ var format = require(path.join(__dirname, '../../util/format.js'));
module.exports = class SepaCore {
getData(params, cb) {
let query = `SELECT
- c.id clientId,
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.workerFk
+ 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.isPreview = params.isPreview;
+ this.clientId = params.clientId;
+ this.companyId = params.companyId;
this.token = params.token;
database.pool.query(query, [params.clientId], (error, result) => {
@@ -29,11 +29,4 @@ module.exports = class SepaCore {
cb();
});
}
-
- get previewAttachments() {
- if (this.isPreview)
- return `` +
- ' ';
- }
};
diff --git a/services/mailer/application/template/sepa-core/style.css b/services/mailer/application/template/sepa-core/style.css
new file mode 100644
index 000000000..e69de29bb
diff --git a/services/mailer/server/server.js b/services/mailer/server/server.js
index 50320a391..457a61ddf 100644
--- a/services/mailer/server/server.js
+++ b/services/mailer/server/server.js
@@ -13,13 +13,8 @@ app.use(bodyParser.urlencoded({extended: true}));
app.use('/static', express.static(path.join(__dirname, '../static')));
-// Auth middleware
-var requestToken = function(request, response, next) {
- auth.init(request, response, next);
-};
-
// Load routes
-app.use('/', requestToken, require('../application/router.js'));
+app.use('/', require('../application/router.js'));
app.start = function() {
var listener = app.listen(config.app.port, function() {
diff --git a/services/mailer/static/css/component.css b/services/mailer/static/css/component.css
index 10805e562..b4c018d79 100644
--- a/services/mailer/static/css/component.css
+++ b/services/mailer/static/css/component.css
@@ -1,137 +1,221 @@
-img {
- margin: 0
-}
-
-p {
- text-align: justify
-}
-
-.wrapper {
- background-color: #EEE
-}
-
-.container {
- font-family: arial, sans-serif;
- max-width: 600px;
- min-width: 320px;
- font-size: 16px;
- margin: 0 auto;
- color: #555
-}
-
-.title {
- background-color: #95d831;
- text-align: center;
- padding: 35px 0
-}
-
-.title h1 {
- font-size: 32px;
- color: #333;
- margin: 0
-}
-
-.body {
- background-color:#FFF;
- padding: 20px
-}
-
-.body a {
- color: #8dba25
-}
-
-.body h1 {
- color: #999
-}
-
-.body h3 {
- font-size: 16px
-}
-
-.panel {
- border: 1px solid #DDD;
- margin-bottom: 10px;
- padding:10px
-}
-
-.row {
- margin-bottom: 15px;
- overflow: hidden;
- content: '';
- clear: both
-}
-
-.row .text {
- margin-bottom: 5px
-}
-
-.row .control {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box
-}
-
-.row .description {
- font-size: 8px;
- color: #999
-}
-
-.row .v-align {
- padding-top: 5px;
- line-height: 21px
-}
-
-.row:last-child {
- margin-bottom: 0
-}
-
-.row.inline .text {
- margin-bottom: 0;
- width: 40%;
- float: left
-}
-
-.row.inline .control {
- font-weight: bold;
- padding-left: 20px;
- color: #000;
- width: 60%;
- float: left
-}
-
-.box {
- border-top: 1px solid #CCC;
- border-right: 1px solid #CCC;
- border-bottom: 1px solid #CCC;
- font-weight: bold;
- text-align: center;
- padding-top: 4px;
- width: 25px;
- height: 21px;
- color: #000;
- float: left
-}
-
-.row .control .box:first-child {
- border-left: 1px solid #CCC;
-}
-
-.attachment {
- overflow: hidden;
- margin-top: 10px
-}
-
-.attachment:after {
- content: ' ';
- display: block;
- clear: both
-}
-
-.attachment-icon {
- float: left
-}
-
-.attachment span {
- padding: 16px 0 0 10px;
- float: left
+body {
+ padding: 0;
+ margin: 0
+}
+
+img {
+ margin: 0
+}
+
+p {
+ text-align: justify
+}
+
+.wrapper {
+ background-color: #EEE
+}
+
+.container {
+ font-family: arial, sans-serif;
+ max-width: 600px;
+ min-width: 320px;
+ font-size: 16px;
+ margin: 0 auto;
+ color: #555
+}
+
+.title {
+ background-color: #95d831;
+ text-align: center;
+ padding: 35px 0
+}
+
+.title h1 {
+ font-size: 32px;
+ color: #333;
+ margin: 0
+}
+
+.body {
+ background-color:#FFF;
+ padding: 20px
+}
+
+.body a {
+ color: #8dba25
+}
+
+.body h1 {
+ color: #999
+}
+
+.body h3 {
+ font-size: 16px
+}
+
+.panel {
+ border: 1px solid #DDD;
+ margin-bottom: 10px;
+ position: relative;
+ padding:10px
+}
+
+.row {
+ margin-bottom: 15px;
+ overflow: hidden
+}
+
+.row .text {
+ margin-bottom: 5px
+}
+
+.row .control {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box
+}
+
+.row .text, .row .control {
+ overflow: hidden
+}
+
+.row .description {
+ position: relative;
+ padding-top: 2px;
+ overflow: hidden;
+ font-size: 11px;
+ display: block;
+ color: #999
+}
+
+.row .line {
+ border-bottom: 1px solid #DDD;
+ border-right: 1px solid #DDD;
+ border-left: 1px solid #DDD;
+ margin-top: 10px;
+ color: #999;
+ padding: 5px
+}
+
+.row .description span {
+ background-color: #FFF;
+ margin: -5px 0 0 50px;
+ display: block;
+ padding: 5px;
+ float: left
+}
+
+.row:last-child {
+ margin-bottom: 0
+}
+
+.row.inline .text {
+ margin-bottom: 0;
+ width: 40%;
+ float: left
+}
+
+.row.inline .control {
+ font-weight: bold;
+ padding-left: 20px;
+ color: #000;
+ width: 60%;
+ float: left
+}
+
+.row.inline .description {
+ position: static;
+ overflow: visible
+}
+
+.box {
+ border-top: 1px solid #CCC;
+ border-right: 1px solid #CCC;
+ border-bottom: 1px solid #CCC;
+ font-weight: bold;
+ text-align: center;
+ padding-top: 4px;
+ width: 25px;
+ height: 21px;
+ color: #000;
+ float: left
+}
+
+.box.crossed {
+ font-weight: 100;
+ font-size: 16px
+}
+
+.row .control .box:first-child {
+ border-left: 1px solid #CCC;
+}
+
+.font.small {
+ font-size: 10px
+}
+
+.font.verticalAlign {
+ height: 27px;
+ line-height: 27px
+}
+
+.font.centered {
+ height: 27px;
+ line-height: 27px;
+ text-align: center
+}
+
+.verticalText {
+ -moz-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ position: absolute;
+ text-align: center;
+ font-size: .65em;
+ width: 200px;
+ right: -115px;
+ top: 50%
+}
+
+.attachment {
+ overflow: hidden;
+ margin-top: 10px
+}
+
+.attachment-icon {
+ float: left
+}
+
+.attachment span {
+ padding: 16px 0 0 10px;
+ float: left
+}
+
+.columns {
+ overflow: hidden
+}
+
+.columns .size100 {
+ width: 100%;
+ float: left
+}
+
+.columns .size75 {
+ width: 75%;
+ float: left
+}
+
+.columns .size50 {
+ width: 50%;
+ float: left
+}
+
+.columns .size33 {
+ width: 33.33%;
+ float: left
+}
+
+.columns .size25 {
+ width: 25%;
+ float: left
}
\ No newline at end of file
diff --git a/services/mailer/static/images/attachment.png b/services/mailer/static/images/attachment.png
deleted file mode 100644
index 78efe4f95..000000000
Binary files a/services/mailer/static/images/attachment.png and /dev/null differ
diff --git a/services/nginx/conf-dev.conf b/services/nginx/conf-dev.conf
index b35bd3757..104bd704f 100644
--- a/services/nginx/conf-dev.conf
+++ b/services/nginx/conf-dev.conf
@@ -46,6 +46,9 @@ http {
location ~ ^/print(?:/(.*))?$ {
proxy_pass http://127.0.0.1:3006/$1$is_args$args;
}
+ location ~ ^/item(?:/(.*))?$ {
+ proxy_pass http://127.0.0.1:3007/$1$is_args$args;
+ }
# Este tiene que ser el último
location ~ ^(?:/(.*))?$ {
proxy_pass http://127.0.0.1:3001/$1$is_args$args;
diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf
index eab866aaa..9e8843344 100644
--- a/services/nginx/conf-prod.conf
+++ b/services/nginx/conf-prod.conf
@@ -41,6 +41,9 @@ http {
location ~ ^/print(?:/(.*))?$ {
proxy_pass http://print:3006/$1$is_args$args;
}
+ location ~ ^/item(?:/(.*))?$ {
+ proxy_pass http://item:3007/$1$is_args$args;
+ }
# Este tiene que ser el último
location ~ ^(?:/(.*))?$ {
proxy_pass http://salix:3001/$1$is_args$args;
diff --git a/services/nginx/static/images/icon_item.png b/services/nginx/static/images/icon_item.png
new file mode 100644
index 000000000..ff660fb23
Binary files /dev/null and b/services/nginx/static/images/icon_item.png differ
diff --git a/services/print/application/config.js b/services/print/application/config.js
index 1442e85ed..c46f236f8 100644
--- a/services/print/application/config.js
+++ b/services/print/application/config.js
@@ -1,15 +1,20 @@
var path = require('path');
-var fs = require('fs');
-var config = {};
+let defaultFile = 'datasources.json';
-let devConfigPath = path.join(__dirname, '/config/datasources.development.json');
-let configPath = path.join(__dirname, '/config/datasources.json');
+function getFile(fileName) {
+ return require(path.join(__dirname, `/config/${fileName}`));
+}
try {
- config = Object.assign(require(configPath), require(devConfigPath));
+ let envFile = 'datasources.development.json';
+
+ if (process.env.NODE_ENV === 'test')
+ envFile = 'datasources.test.json';
+
+ config = getFile(envFile);
} catch (e) {
if (e.code == 'MODULE_NOT_FOUND')
- config = require(configPath);
+ config = getFile(defaultFile);
}
config.proxy = require('../../nginx/config.json');
diff --git a/services/print/application/config/datasources.test.json b/services/print/application/config/datasources.test.json
index 92965aa5a..d51ae1fa2 100644
--- a/services/print/application/config/datasources.test.json
+++ b/services/print/application/config/datasources.test.json
@@ -7,9 +7,9 @@
"mysql": {
"host": "localhost",
"port": 3306,
- "user": "reports",
+ "user": "root",
"password": "",
- "database": ""
+ "database": "vn"
},
"pdf": {
"footer": {
diff --git a/services/print/application/route/manuscript.js b/services/print/application/route/manuscript.js
index 90662b646..091ffa4c3 100644
--- a/services/print/application/route/manuscript.js
+++ b/services/print/application/route/manuscript.js
@@ -4,22 +4,93 @@ var template = require('../template.js');
var config = require('../config.js');
var pdf = require('html-pdf');
var path = require('path');
+var auth = require('../auth.js');
+
+// Auth middleware
+var requestToken = function(request, response, next) {
+ auth.init(request, response, next);
+};
// Sepa core
-router.post('/sepa-core/:clientId', function(request, response, next) {
- template.get('sepa-core', {clientId: request.params.clientId}, (error, result) => {
+router.get('/sepa-core/:companyId/:clientId', requestToken, function(request, response, next) {
+ let params = {
+ clientId: request.params.clientId,
+ companyId: request.params.companyId
+ };
+
+ template.get('sepa-core', params, (error, result) => {
if (error)
return response.status(400).json({message: error.message});
- pdf.create(result.body).toStream(function(error, stream) {
+ pdf.create(result.body, config.pdf).toStream(function(error, stream) {
if (error)
throw Error(error);
+ response.setHeader('Content-Disposition', 'attachment; filename="sepa-core.pdf"');
+ response.setHeader('Content-type', 'application/pdf');
stream.pipe(response);
});
});
});
+// Sepa core html preview
+router.get('/sepa-core/:companyId/:clientId/preview', requestToken, function(request, response, next) {
+ let params = {
+ clientId: request.params.clientId,
+ companyId: request.params.companyId,
+ isPreview: true
+ };
+
+ template.get('sepa-core', params, (error, result) => {
+ if (error)
+ return response.status(400).json({message: error.message});
+
+ response.send(result.body);
+ });
+ });
+
+ // Debtor letter
+router.get('/letter-debtor/:companyId/:clientId', requestToken, function(request, response, next) {
+ let params = {
+ clientId: request.params.clientId,
+ companyId: request.params.companyId
+ };
+
+ template.get('letter-debtor', params, (error, result) => {
+ if (error)
+ return response.status(400).json({message: error.message});
+
+ pdf.create(result.body, config.pdf).toStream(function(error, stream) {
+ if (error)
+ throw Error(error);
+
+ response.setHeader('Content-Disposition', 'attachment; filename="extracto.pdf"');
+ response.setHeader('Content-type', 'application/pdf');
+ stream.pipe(response);
+ });
+ });
+ });
+
+ // Debtor letter html preview
+router.get('/letter-debtor/:companyId/:clientId/preview', requestToken, function(request, response, next) {
+ let params = {
+ clientId: request.params.clientId,
+ companyId: request.params.companyId,
+ isPreview: true
+ };
+
+ template.get('letter-debtor', params, (error, result) => {
+ if (error)
+ return response.status(400).json({message: error.message});
+
+ response.send(result.body);
+ });
+ });
+
+
+module.exports = router;
+
+
// store pdf
/* router.post('/sepa-core/:clientId', function(request, response, next) {
template.get('sepa-core', {recipient: request.params.clientId}, (error, result) => {
@@ -35,32 +106,4 @@ router.post('/sepa-core/:clientId', function(request, response, next) {
});
});
});
- */
-// Sepa core preview
-router.get('/sepa-core/:clientId', function(request, response, next) {
- template.get('sepa-core', {clientId: request.params.clientId}, (error, result) => {
- if (error)
- return response.status(400).json({message: error.message});
-
- let options = config.pdf;
- pdf.create(result.body, options).toStream(function(error, stream) {
- if (error)
- throw Error(error);
-
- response.setHeader('Content-Disposition', 'inline; filename="sepa-core.pdf"');
- response.setHeader('Content-type', 'application/pdf');
- stream.pipe(response);
- });
- });
-});
-
-router.get('/sepa-core-view/:clientId', function(request, response, next) {
- template.get('sepa-core', {clientId: request.params.clientId}, (error, result) => {
- if (error)
- return response.status(400).json({message: error.message});
-
- response.send(result.body);
- });
- });
-
-module.exports = router;
+ */
\ No newline at end of file
diff --git a/services/print/application/router.js b/services/print/application/router.js
index 58e9a3694..a9ebe1acf 100644
--- a/services/print/application/router.js
+++ b/services/print/application/router.js
@@ -1,5 +1,7 @@
var express = require('express');
var router = new express.Router();
+var fs = require('fs');
+var path = require('path');
// Default page
router.get('/', function(request, response) {
@@ -9,4 +11,21 @@ router.get('/', function(request, response) {
// Manuscripts
router.use('/manuscript', require('./route/manuscript.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() {
+ readStream.pipe(response);
+ });
+ });
+});
+
+
module.exports = router;
diff --git a/services/print/application/template.js b/services/print/application/template.js
index 9bc968c74..9974ebcf5 100644
--- a/services/print/application/template.js
+++ b/services/print/application/template.js
@@ -4,6 +4,7 @@ var locale = require('./locale.js');
var inlineCss = require('inline-css');
var path = require('path');
+
module.exports = {
/**
* Get template.
@@ -15,7 +16,7 @@ module.exports = {
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}`, 'static', 'css', 'style.css');
+ var stylePath = path.join(__dirname, 'template', `${template}`, 'style.css');
fs.stat(templatePath, (error, stat) => {
if (error)
@@ -43,7 +44,7 @@ module.exports = {
params.subject = title[1];
}
- this.renderImages(template, body, (error, body) => {
+ this.renderImages(template, body, params.isPreview, (error, body) => {
if (error)
return cb(error);
@@ -53,7 +54,7 @@ module.exports = {
};
let getDataCb = () => {
- this.render(templatePath, instance, (error, result) => getRenderedStyles(error, result));
+ this.render(templatePath, params, instance, (error, result) => getRenderedStyles(error, result));
};
instance.getData(params, (error, result) => {
@@ -65,6 +66,7 @@ module.exports = {
return cb(error);
instance._ = result.locale;
+ instance.isPreview = params.isPreview;
getDataCb(null, result);
});
});
@@ -77,7 +79,7 @@ module.exports = {
* @param {Object} data - Params
* @param {Object} cb - Callback
*/
- render: function(path, data, cb) {
+ render: function(path, params, data, cb) {
fs.readFile(path, 'utf8', (error, body) => {
// Find matching sub-templates
let regexp = new RegExp(/\{\{\$\.(.*?)\}\}/, 'ig');
@@ -89,7 +91,7 @@ module.exports = {
}
let parentBody = body;
- this.renderSub(parentBody, subTpl, data, regexp, (error, body) => {
+ this.renderSub(parentBody, subTpl, params, regexp, (error, body) => {
if (error)
return cb(error);
@@ -99,13 +101,13 @@ module.exports = {
});
},
- renderSub: function(body, subTpl, data, regexp, cb) {
+ renderSub: function(body, subTpl, params, regexp, cb) {
let index = 1;
subTpl.forEach(keyName => {
subTplName = keyName.replace(regexp, '$1');
- this.get(subTplName, data, (error, result) => {
+ this.get(subTplName, params, (error, result) => {
if (error)
return cb(error);
@@ -140,7 +142,7 @@ module.exports = {
let style = '';
let body = style + html;
let options = {url: ' '};
-
+
inlineCss(body, options)
.then(function(body) {
cb(null, body);
@@ -156,7 +158,7 @@ module.exports = {
* @param {String} body - template body
* @param {Object} cb - Callback
*/
- renderImages: function(template, body, cb) {
+ renderImages: function(template, body, isPreview, cb) {
let tplImages = body.match(new RegExp('src="cid:(.*?)"', 'ig'));
if (!tplImages)
@@ -164,10 +166,17 @@ module.exports = {
// Template default attachments
for (var i = 0; i < tplImages.length; i++) {
- let name = tplImages[i].replace('src="cid:', '').replace('"', '');
+ let src = tplImages[i].replace('src="cid:', '').replace('"', '').split('/');
+ let attachmentTpl = src[0];
+ let attachment = src[1];
- let imagePath = path.join(__dirname, 'template', `${template}`, 'static', 'image', name);
- body = body.replace(tplImages[i], `src="file:///${imagePath}"`);
+ if (isPreview) {
+ let imagePath = `/print/static/${attachmentTpl}/${attachment}`;
+ body = body.replace(tplImages[i], `src="${imagePath}"`);
+ } else {
+ let imagePath = path.join(__dirname, 'template', attachmentTpl, 'image', attachment);
+ body = body.replace(tplImages[i], `src="file:///${imagePath}"`);
+ }
}
cb(null, body);
diff --git a/services/mailer/application/template/header/static/image/action.png b/services/print/application/template/footer/image/action.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/action.png
rename to services/print/application/template/footer/image/action.png
diff --git a/services/mailer/application/template/header/static/image/facebook.png b/services/print/application/template/footer/image/facebook.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/facebook.png
rename to services/print/application/template/footer/image/facebook.png
diff --git a/services/mailer/application/template/header/static/image/info.png b/services/print/application/template/footer/image/info.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/info.png
rename to services/print/application/template/footer/image/info.png
diff --git a/services/mailer/application/template/header/static/image/instagram.png b/services/print/application/template/footer/image/instagram.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/instagram.png
rename to services/print/application/template/footer/image/instagram.png
diff --git a/services/mailer/application/template/header/static/image/linkedin.png b/services/print/application/template/footer/image/linkedin.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/linkedin.png
rename to services/print/application/template/footer/image/linkedin.png
diff --git a/services/mailer/application/template/header/static/image/pinterest.png b/services/print/application/template/footer/image/pinterest.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/pinterest.png
rename to services/print/application/template/footer/image/pinterest.png
diff --git a/services/mailer/application/template/header/static/image/twitter.png b/services/print/application/template/footer/image/twitter.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/twitter.png
rename to services/print/application/template/footer/image/twitter.png
diff --git a/services/mailer/application/template/header/static/image/youtube.png b/services/print/application/template/footer/image/youtube.png
similarity index 100%
rename from services/mailer/application/template/header/static/image/youtube.png
rename to services/print/application/template/footer/image/youtube.png
diff --git a/services/print/application/template/footer/static/image/action.png b/services/print/application/template/footer/static/image/action.png
deleted file mode 100644
index 2cd16c453..000000000
Binary files a/services/print/application/template/footer/static/image/action.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/facebook.png b/services/print/application/template/footer/static/image/facebook.png
deleted file mode 100644
index 7ab54c538..000000000
Binary files a/services/print/application/template/footer/static/image/facebook.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/header.png b/services/print/application/template/footer/static/image/header.png
deleted file mode 100644
index 3c063ae44..000000000
Binary files a/services/print/application/template/footer/static/image/header.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/info.png b/services/print/application/template/footer/static/image/info.png
deleted file mode 100644
index fb75cbc4e..000000000
Binary files a/services/print/application/template/footer/static/image/info.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/instagram.png b/services/print/application/template/footer/static/image/instagram.png
deleted file mode 100644
index 66550c4a5..000000000
Binary files a/services/print/application/template/footer/static/image/instagram.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/linkedin.png b/services/print/application/template/footer/static/image/linkedin.png
deleted file mode 100644
index 0d191e5ae..000000000
Binary files a/services/print/application/template/footer/static/image/linkedin.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/logo.png b/services/print/application/template/footer/static/image/logo.png
deleted file mode 100644
index 55e26fec6..000000000
Binary files a/services/print/application/template/footer/static/image/logo.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/logo.svg b/services/print/application/template/footer/static/image/logo.svg
deleted file mode 100644
index 51baf46d3..000000000
--- a/services/print/application/template/footer/static/image/logo.svg
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-image/svg+xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/services/print/application/template/footer/static/image/pinterest.png b/services/print/application/template/footer/static/image/pinterest.png
deleted file mode 100644
index 4d7b28ef8..000000000
Binary files a/services/print/application/template/footer/static/image/pinterest.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/twitter.png b/services/print/application/template/footer/static/image/twitter.png
deleted file mode 100644
index c4a8ab0c1..000000000
Binary files a/services/print/application/template/footer/static/image/twitter.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/image/youtube.png b/services/print/application/template/footer/static/image/youtube.png
deleted file mode 100644
index 11871deb5..000000000
Binary files a/services/print/application/template/footer/static/image/youtube.png and /dev/null differ
diff --git a/services/print/application/template/footer/static/css/style.css b/services/print/application/template/footer/style.css
similarity index 89%
rename from services/print/application/template/footer/static/css/style.css
rename to services/print/application/template/footer/style.css
index 8bd10148d..aeddc6f0a 100644
--- a/services/print/application/template/footer/static/css/style.css
+++ b/services/print/application/template/footer/style.css
@@ -8,6 +8,7 @@ img {
max-width: 90%;
margin: 0 auto;
font-size: 9px;
+ margin: 30px;
color: #555
}
diff --git a/services/mailer/application/template/footer/static/image/logo.svg b/services/print/application/template/header/image/logo.svg
similarity index 100%
rename from services/mailer/application/template/footer/static/image/logo.svg
rename to services/print/application/template/header/image/logo.svg
diff --git a/services/print/application/template/header/index.html b/services/print/application/template/header/index.html
index 30c2a21f1..44e8e52d7 100644
--- a/services/print/application/template/header/index.html
+++ b/services/print/application/template/header/index.html
@@ -1,5 +1,5 @@
{{_.toCompleteBySupplier}}
diff --git a/services/print/application/template/sepa-core/sepa-core.js b/services/print/application/template/sepa-core/sepa-core.js
index 74e08fd31..304e327da 100644
--- a/services/print/application/template/sepa-core/sepa-core.js
+++ b/services/print/application/template/sepa-core/sepa-core.js
@@ -10,7 +10,7 @@ module.exports = class SepaCore {
LOWER(ct.code) AS countryCode,
c.email AS recipient,
c.socialName AS clientName,
- c.postalAddress AS clientStreet,
+ c.street AS clientStreet,
c.postcode AS clientPostCode,
c.city AS clientCity,
p.name AS clientProvince,
diff --git a/services/print/application/template/sepa-core/static/image/action.png b/services/print/application/template/sepa-core/static/image/action.png
deleted file mode 100644
index 2cd16c453..000000000
Binary files a/services/print/application/template/sepa-core/static/image/action.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/facebook.png b/services/print/application/template/sepa-core/static/image/facebook.png
deleted file mode 100644
index 7ab54c538..000000000
Binary files a/services/print/application/template/sepa-core/static/image/facebook.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/header.png b/services/print/application/template/sepa-core/static/image/header.png
deleted file mode 100644
index 3c063ae44..000000000
Binary files a/services/print/application/template/sepa-core/static/image/header.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/info.png b/services/print/application/template/sepa-core/static/image/info.png
deleted file mode 100644
index fb75cbc4e..000000000
Binary files a/services/print/application/template/sepa-core/static/image/info.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/instagram.png b/services/print/application/template/sepa-core/static/image/instagram.png
deleted file mode 100644
index 66550c4a5..000000000
Binary files a/services/print/application/template/sepa-core/static/image/instagram.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/linkedin.png b/services/print/application/template/sepa-core/static/image/linkedin.png
deleted file mode 100644
index 0d191e5ae..000000000
Binary files a/services/print/application/template/sepa-core/static/image/linkedin.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/logo.png b/services/print/application/template/sepa-core/static/image/logo.png
deleted file mode 100644
index 55e26fec6..000000000
Binary files a/services/print/application/template/sepa-core/static/image/logo.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/logo.svg b/services/print/application/template/sepa-core/static/image/logo.svg
deleted file mode 100644
index 51baf46d3..000000000
--- a/services/print/application/template/sepa-core/static/image/logo.svg
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
image/svg+xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/services/print/application/template/sepa-core/static/image/pinterest.png b/services/print/application/template/sepa-core/static/image/pinterest.png
deleted file mode 100644
index 4d7b28ef8..000000000
Binary files a/services/print/application/template/sepa-core/static/image/pinterest.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/twitter.png b/services/print/application/template/sepa-core/static/image/twitter.png
deleted file mode 100644
index c4a8ab0c1..000000000
Binary files a/services/print/application/template/sepa-core/static/image/twitter.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/static/image/youtube.png b/services/print/application/template/sepa-core/static/image/youtube.png
deleted file mode 100644
index 11871deb5..000000000
Binary files a/services/print/application/template/sepa-core/static/image/youtube.png and /dev/null differ
diff --git a/services/print/application/template/sepa-core/style.css b/services/print/application/template/sepa-core/style.css
new file mode 100644
index 000000000..5b1e628d6
--- /dev/null
+++ b/services/print/application/template/sepa-core/style.css
@@ -0,0 +1,22 @@
+img {
+ margin: 0
+}
+
+.body {
+ font-family: arial, sans-serif;
+ max-width: 90%;
+ margin: 0 auto;
+ font-size: 14px;
+ color: #000
+}
+
+body .title {
+ text-align: center;
+ padding-bottom: 20px
+}
+
+body .title h1 {
+ font-size: 16px;
+ color: #333;
+ margin: 0
+}
\ No newline at end of file
diff --git a/services/print/server/server.js b/services/print/server/server.js
index 9ef4074ea..c94a4f834 100644
--- a/services/print/server/server.js
+++ b/services/print/server/server.js
@@ -10,13 +10,8 @@ var path = require('path');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
-// Auth middleware
-var requestToken = function(request, response, next) {
- auth.init(request, response, next);
-};
-
// Load routes
-app.use('/', requestToken, require('../application/router.js'));
+app.use('/', require('../application/router.js'));
app.start = function() {
var listener = app.listen(config.app.port, function() {
diff --git a/services/print/static/css/component.css b/services/print/static/css/component.css
index e7fc24b0a..2b2b8e157 100644
--- a/services/print/static/css/component.css
+++ b/services/print/static/css/component.css
@@ -1,170 +1,203 @@
-body {
- margin: 0 auto;
- width: 210mm
-}
-
-.panel {
- border: 1px solid #DDD;
- margin-bottom: 10px;
- position: relative;
- padding:10px
-}
-
-.row {
- margin-bottom: 15px;
- overflow: hidden
-}
-
-.row .text {
- margin-bottom: 5px
-}
-
-.row .control {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box
-}
-
-.row .text, .row .control {
- overflow: hidden
-}
-
-.row .description {
- position: relative;
- padding-top: 2px;
- overflow: hidden;
- font-size: 8px;
- display: block;
- color: #999
-}
-
-.row .line {
- border-bottom: 1px solid #DDD;
- border-right: 1px solid #DDD;
- border-left: 1px solid #DDD;
- margin-top: 10px;
- color: #999;
- padding: 5px
-}
-
-.row .description span {
- background-color: #FFF;
- margin: -5px 0 0 50px;
- display: block;
- padding: 5px;
- float: left
-}
-
-.row:last-child {
- margin-bottom: 0
-}
-
-.row.inline .text {
- margin-bottom: 0;
- width: 40%;
- float: left
-}
-
-.row.inline .control {
- font-weight: bold;
- padding-left: 20px;
- color: #000;
- width: 60%;
- float: left
-}
-
-.row.inline .description {
- position: static;
- overflow: visible
-}
-
-.box {
- border-top: 1px solid #CCC;
- border-right: 1px solid #CCC;
- border-bottom: 1px solid #CCC;
- font-weight: bold;
- text-align: center;
- padding-top: 4px;
- width: 25px;
- height: 21px;
- color: #000;
- float: left
-}
-
-.box.crossed {
- font-weight: 100;
- font-size: 16px
-}
-
-.row .control .box:first-child {
- border-left: 1px solid #CCC;
-}
-
-p {
- text-align: justify
-}
-
-.font.small {
- font-size: 10px
-}
-
-.font.verticalAlign {
- height: 27px;
- line-height: 27px
-}
-
-.font.centered {
- height: 27px;
- line-height: 27px;
- text-align: center
-}
-
-.verticalText {
- -moz-transform: rotate(90deg);
- -webkit-transform: rotate(90deg);
- transform: rotate(90deg);
- position: absolute;
- text-align: center;
- font-size: .65em;
- width: 200px;
- right: -115px;
- top: 50%
-}
-
-.columns:after {
- display: block;
- content: ' ';
- clear: both
-}
-
-.columns .size100 {
- width: 100%;
- float: left
-}
-
-.columns .size75 {
- width: 75%;
- float: left
-}
-
-.columns .size50 {
- width: 50%;
- float: left
-}
-
-.columns .size33 {
- width: 33.33%;
- float: left
-}
-
-.columns .size25 {
- width: 25%;
- float: left
-}
-
-
-
-
-
-
-
+body {
+ margin: 0 auto;
+ width: 210mm
+}
+
+img {
+ margin: 0
+}
+
+p {
+ text-align: justify
+}
+
+.panel {
+ border: 1px solid #DDD;
+ margin-bottom: 10px;
+ position: relative;
+ padding:10px
+}
+
+.row {
+ margin-bottom: 15px;
+ overflow: hidden
+}
+
+.row.small {
+ margin-bottom: 5px
+}
+
+.row .text {
+ margin-bottom: 5px
+}
+
+.row .control {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box
+}
+
+.row .text, .row .control {
+ overflow: hidden
+}
+
+.row .description {
+ position: relative;
+ padding-top: 2px;
+ overflow: hidden;
+ font-size: 9px;
+ display: block;
+ color: #999
+}
+
+.row .line {
+ border-bottom: 1px solid #DDD;
+ border-right: 1px solid #DDD;
+ border-left: 1px solid #DDD;
+ margin-top: 10px;
+ color: #999;
+ padding: 5px
+}
+
+.row .description span {
+ background-color: #FFF;
+ margin: -5px 0 0 50px;
+ display: block;
+ padding: 5px;
+ float: left
+}
+
+.row:last-child {
+ margin-bottom: 0
+}
+
+.row.inline .text {
+ margin-bottom: 0;
+ width: 40%;
+ float: left
+}
+
+.row.inline .control {
+ font-weight: bold;
+ padding-left: 20px;
+ color: #000;
+ width: 60%;
+ float: left
+}
+
+.row.inline .description {
+ position: static;
+ overflow: visible
+}
+
+.box {
+ border-top: 1px solid #CCC;
+ border-right: 1px solid #CCC;
+ border-bottom: 1px solid #CCC;
+ font-weight: bold;
+ text-align: center;
+ padding-top: 4px;
+ width: 25px;
+ height: 21px;
+ color: #000;
+ float: left
+}
+
+.box.crossed {
+ font-weight: 100;
+ font-size: 16px
+}
+
+.row .control .box:first-child {
+ border-left: 1px solid #CCC;
+}
+
+.font.small {
+ font-size: 10px
+}
+
+.font.gray {
+ color: #555
+}
+
+.font.verticalAlign {
+ height: 27px;
+ line-height: 27px
+}
+
+.font.centered {
+ height: 27px;
+ line-height: 27px;
+ text-align: center
+}
+
+.verticalText {
+ -moz-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ position: absolute;
+ text-align: center;
+ font-size: .65em;
+ width: 200px;
+ right: -115px;
+ top: 50%
+}
+
+.columns {
+ overflow: hidden
+}
+
+.columns .size100 {
+ width: 100%;
+ float: left
+}
+
+.columns .size75 {
+ width: 75%;
+ float: left
+}
+
+.columns .size50 {
+ width: 50%;
+ float: left
+}
+
+.columns .size33 {
+ width: 33.33%;
+ float: left
+}
+
+.columns .size25 {
+ width: 25%;
+ float: left
+}
+
+.pull-left {
+ float: left
+}
+
+.pull-right {
+ float: right
+}
+
+
+.grid {
+ border-bottom: 3px solid #888888
+}
+
+.grid .row {
+ padding: 5px;
+ margin-bottom: 0
+}
+
+.grid .header {
+ border-bottom: 1px solid #808080;
+ border-top: 1px solid #808080;
+ background-color: #c0c0c0;
+}
+
+
+.grid .row.inline > div {
+ float: left;
+}
+