diff --git a/.eslintignore b/.eslintignore
index 597f2d8a1..b512c09d4 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,2 +1 @@
-node_modules
-services/nginx/*
\ No newline at end of file
+node_modules
\ No newline at end of file
diff --git a/README.md b/README.md
index ab7cf3f36..a3394cc84 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,6 @@ Required applications.
* Visual Studio Code
* Node.js = 8.15.0
-* NGINX
* Docker
In Visual Studio Code we use the ESLint extension. Open Visual Studio Code, press Ctrl+P and paste the following command.
@@ -44,12 +43,6 @@ Launch application in developer environment.
$ gulp
```
-Also you can run backend and frontend as separately gulp tasks (including NGINX).
-```
-$ gulp front
-$ gulp back
-```
-
Manually reset fixtures.
```
$ gulp docker
diff --git a/back/model-config.json b/back/model-config.json
index fa412618d..f69b9d7d0 100644
--- a/back/model-config.json
+++ b/back/model-config.json
@@ -11,6 +11,9 @@
"Company": {
"dataSource": "vn"
},
+ "Delivery": {
+ "dataSource": "vn"
+ },
"Message": {
"dataSource": "vn"
},
@@ -46,6 +49,12 @@
},
"PersonDepartment": {
"dataSource": "vn"
+ },
+ "Route": {
+ "dataSource": "vn"
+ },
+ "Vehicle": {
+ "dataSource": "vn"
}
}
diff --git a/modules/route/back/models/delivery.json b/back/models/delivery.json
similarity index 100%
rename from modules/route/back/models/delivery.json
rename to back/models/delivery.json
diff --git a/modules/route/back/models/route.json b/back/models/route.json
similarity index 100%
rename from modules/route/back/models/route.json
rename to back/models/route.json
diff --git a/modules/route/back/models/vehicle.json b/back/models/vehicle.json
similarity index 100%
rename from modules/route/back/models/vehicle.json
rename to back/models/vehicle.json
diff --git a/front/core/components/treeview/child.html b/front/core/components/treeview/child.html
index 2b3f1e60f..437e7ca7d 100644
--- a/front/core/components/treeview/child.html
+++ b/front/core/components/treeview/child.html
@@ -1,5 +1,5 @@
- -
+
-
-
diff --git a/front/core/components/treeview/index.js b/front/core/components/treeview/index.js
index 69cbb4f26..6449ec450 100644
--- a/front/core/components/treeview/index.js
+++ b/front/core/components/treeview/index.js
@@ -74,7 +74,7 @@ export default class Treeview extends Component {
for (let i = 0; i < childs.length; i++) {
childs[i].included = false;
- if ((node.selected || node.included && this.hasCheckedParents(childs[i])) && !childs[i].selected)
+ if (((node.selected || node.included && this.hasCheckedParents(childs[i])) && !childs[i].selected) && !node.excluded)
childs[i].included = true;
this.repaintDesc(childs[i]);
@@ -107,6 +107,13 @@ export default class Treeview extends Component {
}
onSelection(item) {
+ let canBeExcluded = this.hasCheckedChilds(item) || this.hasCheckedParents(item);
+
+ if (!item.selected && item.included && canBeExcluded)
+ item.excluded = true;
+ else
+ item.excluded = false;
+
item.selected = !item.selected;
if (item.selected && item.included)
diff --git a/front/module-import.js b/front/module-import.js
index 8929b5fda..575787ee8 100755
--- a/front/module-import.js
+++ b/front/module-import.js
@@ -1,7 +1,18 @@
export default function moduleImport(moduleName) {
- return import(
- /* webpackInclude: /modules\/[a-z0-9-]+\/front\/index.js$/ */
- `../modules/${moduleName}/front/index.js`
- );
-}
\ No newline at end of file
+ // FIXME: Webpack watches module backend files when using dynamic import
+ //return import(
+ // /* webpackInclude: /modules\/[a-z0-9-]+\/front\/index.js$/ */
+ // '../modules/'+ moduleName +'/front/index.js'
+ //);
+
+ switch(moduleName) {
+ case 'client' : return import('client/front');
+ case 'item' : return import('item/front');
+ case 'ticket' : return import('ticket/front');
+ case 'order' : return import('order/front');
+ case 'claim' : return import('claim/front');
+ case 'agency' : return import('agency/front');
+ case 'travel' : return import('travel/front');
+ }
+}
diff --git a/gulpfile.js b/gulpfile.js
index e3bd4dda3..f100e66ad 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -42,10 +42,13 @@ backOnly.description = `Starts backend service`;
function backWatch(done) {
const nodemon = require('gulp-nodemon');
- let sleepBin = isWindows ? 'timeout' : 'sleep';
+
+ // XXX: Workaround to avoid nodemon bug
+ // https://github.com/remy/nodemon/issues/1346
+ let sleepBin = isWindows ? '' : 'sleep 1 &&';
nodemon({
- exec: `${sleepBin} 1 && node --inspect ./node_modules/gulp/bin/gulp.js`,
+ exec: `${sleepBin} node --inspect ./node_modules/gulp/bin/gulp.js`,
args: ['backOnly'],
watch: backSources,
done: done
diff --git a/modules/agency/back/methods/zone-included/toggleIsIncluded.js b/modules/agency/back/methods/zone-included/toggleIsIncluded.js
index dd9e89d28..766c51835 100644
--- a/modules/agency/back/methods/zone-included/toggleIsIncluded.js
+++ b/modules/agency/back/methods/zone-included/toggleIsIncluded.js
@@ -23,13 +23,30 @@ module.exports = Self => {
});
Self.toggleIsIncluded = async(zoneFk, geoFk) => {
+ const models = Self.app.models;
+ const geo = await models.ZoneTreeview.findById(geoFk);
const isIncluded = await Self.findOne({
where: {zoneFk, geoFk}
});
+ const hasCheckedParents = await Self.rawSql(
+ `SELECT id
+ FROM vn.zoneTreeview zt
+ JOIN vn.zoneIncluded zi ON zi.geoFk = zt.id
+ WHERE zt.lft < ? AND zt.rgt > ?`, [geo.lft, geo.rgt]
+ );
+ const hasCheckedChilds = await Self.rawSql(
+ `SELECT id
+ FROM vn.zoneTreeview zt
+ JOIN vn.zoneIncluded zi ON zi.geoFk = zt.id
+ WHERE zt.lft > ? AND zt.rgt < ?`, [geo.lft, geo.rgt]
+ );
+
+ const isExcluded = hasCheckedParents.length || hasCheckedChilds.length;
+
if (isIncluded)
return Self.destroyAll({zoneFk, geoFk});
else
- return Self.upsert({zoneFk, geoFk});
+ return Self.upsert({zoneFk, geoFk, isIncluded: isExcluded});
};
};
diff --git a/modules/agency/back/methods/zone-treeview/getLeaves.js b/modules/agency/back/methods/zone-treeview/getLeaves.js
index 06a878411..08774aa6c 100644
--- a/modules/agency/back/methods/zone-treeview/getLeaves.js
+++ b/modules/agency/back/methods/zone-treeview/getLeaves.js
@@ -78,7 +78,8 @@ module.exports = Self => {
pt.depth,
pt.sons,
ti.id IS NOT NULL hasCheckedChilds,
- zi.geoFk IS NOT NULL AS selected
+ zi.geoFk IS NOT NULL AS selected,
+ zi.isIncluded AS excluded
FROM zoneTreeview pt
LEFT JOIN vn.zoneIncluded zi
ON zi.geoFk = pt.id AND zi.zoneFk = ?
diff --git a/modules/agency/front/summary/index.html b/modules/agency/front/summary/index.html
index 9d4ad04e8..ea565b21b 100644
--- a/modules/agency/front/summary/index.html
+++ b/modules/agency/front/summary/index.html
@@ -1,8 +1,6 @@
+
{{$ctrl.summary.name}}
-
- {{$ctrl.summary.name}}
-
this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
);
}
diff --git a/modules/client/front/billing-data/index.html b/modules/client/front/billing-data/index.html
index dbda9c3d2..300919acc 100644
--- a/modules/client/front/billing-data/index.html
+++ b/modules/client/front/billing-data/index.html
@@ -39,7 +39,7 @@
fields="['name']"
initial-data="$ctrl.client.bankEntityFk"
on-change="$ctrl.autofillBic()"
- search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}"
+ search-function="{or: [{bic: {like: $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"
value-field="id"
show-field="bic"
vn-acl="salesAssistant"
diff --git a/modules/item/front/create/index.html b/modules/item/front/create/index.html
index d2ad459db..544a10848 100644
--- a/modules/item/front/create/index.html
+++ b/modules/item/front/create/index.html
@@ -23,7 +23,7 @@
fields="['code', 'name']"
value-field="id"
field="$ctrl.item.typeFk"
- search-function="{or: [{code: {like: '%'+ $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}">
+ search-function="{or: [{code: {like: $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}">
{{::code}}
{{::name}}
@@ -35,7 +35,7 @@
show-field="description"
value-field="id"
field="$ctrl.item.intrastatFk"
- search-function="{or: [{id: {like: '%'+ $search +'%'}}, {description: {like: '%'+ $search +'%'}}]}">
+ search-function="{or: [{id: {like: $search +'%'}}, {description: {like: '%'+ $search +'%'}}]}">
{{::id}}
{{::description}}
diff --git a/modules/item/front/data/index.html b/modules/item/front/data/index.html
index ba1f69d0d..329b3d21c 100644
--- a/modules/item/front/data/index.html
+++ b/modules/item/front/data/index.html
@@ -34,7 +34,7 @@
show-field="description"
value-field="id"
field="$ctrl.item.intrastatFk"
- search-function="{or: [{id: {regexp: $search}}, {description: {regexp: $search}}]}"
+ search-function="{or: [{id: {like: $search +'%'}}, {description: {like: '%'+ $search +'%'}}]}"
initial-data="$ctrl.item.intrastat">
{{::id}}
diff --git a/modules/item/front/tags/index.html b/modules/item/front/tags/index.html
index 62962144d..00b606c6a 100644
--- a/modules/item/front/tags/index.html
+++ b/modules/item/front/tags/index.html
@@ -47,7 +47,7 @@
ng-show="tag.selection.isFree === false"
vn-three
url="{{$ctrl.sourceTables[itemTag.id].url}}"
- search-function="{name: {regexp: $search}}"
+ search-function="{name: {like: '%'+ $search +'%'}}"
label="Value"
field="itemTag.value"
show-field="{{$ctrl.sourceTables[itemTag.id].field}}"
diff --git a/modules/order/front/basic-data/index.html b/modules/order/front/basic-data/index.html
index dea685afd..f52fbfc42 100644
--- a/modules/order/front/basic-data/index.html
+++ b/modules/order/front/basic-data/index.html
@@ -12,7 +12,7 @@
vn-one
url="/api/Clients"
label="Client"
- search-function="{or: [{id: {regexp: $search}}, {name: {regexp: $search}}]}"
+ search-function="{or: [{id: $search}, {name: {regexp: $search}}]}"
show-field="name"
value-field="id"
field="$ctrl.order.clientFk"
diff --git a/modules/order/front/create/card.html b/modules/order/front/create/card.html
index e3d14bc5a..0b0f8822a 100644
--- a/modules/order/front/create/card.html
+++ b/modules/order/front/create/card.html
@@ -3,7 +3,7 @@
vn-id="client"
url="/api/Clients"
label="Client"
- search-function="{or: [{id: {regexp: $search}}, {name: {regexp: $search}}]}"
+ search-function="{or: [{id: $search}, {name: {like: '%'+ $search +'%'}}]}"
show-field="name"
value-field="id"
field="$ctrl.clientFk"
diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json
deleted file mode 100644
index 670dd69bf..000000000
--- a/modules/route/back/model-config.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "Delivery": {
- "dataSource": "vn"
- },
- "Route": {
- "dataSource": "vn"
- },
- "Vehicle": {
- "dataSource": "vn"
- }
-}
diff --git a/modules/route/front/index.js b/modules/route/front/index.js
deleted file mode 100644
index 20a96c9a5..000000000
--- a/modules/route/front/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from './module';
diff --git a/modules/route/front/locale/en.yml b/modules/route/front/locale/en.yml
deleted file mode 100644
index 6659ba5dc..000000000
--- a/modules/route/front/locale/en.yml
+++ /dev/null
@@ -1 +0,0 @@
-Routes: Routes
\ No newline at end of file
diff --git a/modules/route/front/locale/es.yml b/modules/route/front/locale/es.yml
deleted file mode 100644
index 63efa8289..000000000
--- a/modules/route/front/locale/es.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-Routes: Rutas
-List: Listado
-Enter a new search: Introduce una nueva búsqueda
\ No newline at end of file
diff --git a/modules/route/front/module.js b/modules/route/front/module.js
deleted file mode 100644
index bd7b1516b..000000000
--- a/modules/route/front/module.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import {ng} from 'core/vendor';
-
-export default ng.module('route', ['vnCore']);
diff --git a/modules/route/front/routes.json b/modules/route/front/routes.json
deleted file mode 100644
index 95da1e143..000000000
--- a/modules/route/front/routes.json
+++ /dev/null
@@ -1,22 +0,0 @@
-/* {
- "module": "route",
- "name": "Routes",
- "icon" : "local_shipping",
- "validations" : true,
- "routes": [
- {
- "url": "/route",
- "state": "route",
- "abstract": true,
- "component": "ui-view",
- "description": "Routes"
- },
- {
- "url": "/index?q",
- "state": "route.index",
- "component": "vn-route-index",
- "description": "Routes",
- "acl": ["developer"]
- }
- ]
-} */
\ No newline at end of file
diff --git a/modules/ticket/front/create/card.html b/modules/ticket/front/create/card.html
index f55fb2787..34a21bcff 100644
--- a/modules/ticket/front/create/card.html
+++ b/modules/ticket/front/create/card.html
@@ -3,7 +3,7 @@
vn-id="client"
url="/api/Clients"
label="Client"
- search-function="{or: [{id: {regexp: $search}}, {name: {regexp: $search}}]}"
+ search-function="{or: [{id: $search}, {name: {like: '%'+ $search +'%'}}]}"
show-field="name"
value-field="id"
field="$ctrl.clientFk"
diff --git a/modules/ticket/front/package/index.html b/modules/ticket/front/package/index.html
index f6d9dfd2d..c32c131ec 100644
--- a/modules/ticket/front/package/index.html
+++ b/modules/ticket/front/package/index.html
@@ -21,7 +21,7 @@
label="Package"
show-field="name"
value-field="packagingFk"
- search-function="{or: [{itemFk: {like: '%'+ $search +'%'}}, {'name': {like: '%'+ $search +'%'}}]}"
+ search-function="{or: [{itemFk: $search}, {'name': {like: '%'+ $search +'%'}}]}"
field="package.packagingFk">
{{itemFk}} : {{name}}
diff --git a/print/common/css/layout.css b/print/common/css/layout.css
index 3f540622e..294593142 100644
--- a/print/common/css/layout.css
+++ b/print/common/css/layout.css
@@ -120,8 +120,7 @@
font-weight: bold
}
-
-.grid .row.inline > div {
+.grid .row.inline > section {
float: left;
}
@@ -129,11 +128,13 @@
border: 1px solid #DDD;
margin-bottom: 10px;
position: relative;
- padding:10px
+ padding:20px
}
.panel .header {
- font-weight: bold
+ background-color: #FFF;
+ font-weight: bold;
+ margin-top: -20px
}
.box {
diff --git a/print/common/css/misc.css b/print/common/css/misc.css
new file mode 100644
index 000000000..d1e7edf27
--- /dev/null
+++ b/print/common/css/misc.css
@@ -0,0 +1,15 @@
+.uppercase {
+ text-transform: uppercase
+}
+
+.centered {
+ text-align: center
+}
+
+.number {
+ text-align: right
+}
+
+.gray {
+ color: #555
+}
\ No newline at end of file
diff --git a/print/lib/emailEngine.js b/print/lib/emailEngine.js
index 86342bb36..2ccff4f87 100644
--- a/print/lib/emailEngine.js
+++ b/print/lib/emailEngine.js
@@ -88,7 +88,7 @@ module.exports = {
const componentPath = `${this.path}/${orgComponent.name}`;
let fileSrc = componentPath + file;
- if (file.slice(0, 4) === 'http' || file.slice(0, 4) === 'https')
+ if (file.slice(0, 4) === 'http' || file.slice(0, 5) === 'https')
fileSrc = file;
const fileName = file.split('/').pop();
diff --git a/print/lib/router.js b/print/lib/router.js
index 30fd0d347..69b02b702 100644
--- a/print/lib/router.js
+++ b/print/lib/router.js
@@ -14,7 +14,7 @@ module.exports = app => {
function registerReport(name) {
if (!name) throw new Error('Report name required');
- app.get(`/report/${name}`, (request, response, next) => {
+ app.get(`/api/report/${name}`, (request, response, next) => {
reportEngine.toPdf(name, request).then(stream => {
response.setHeader('Content-Disposition', `attachment; filename="${name}.pdf"`);
response.setHeader('Content-type', 'application/pdf');
@@ -33,7 +33,7 @@ module.exports = app => {
function registerEmail(name) {
if (!name) throw new Error('Email name required');
- app.get(`/email/${name}`, (request, response, next) => {
+ app.get(`/api/email/${name}`, (request, response, next) => {
emailEngine.render(name, request).then(rendered => {
response.send(rendered.html);
}).catch(e => {
@@ -41,7 +41,7 @@ module.exports = app => {
});
});
- app.post(`/email/${name}`, (request, response, next) => {
+ app.post(`/api/email/${name}`, (request, response, next) => {
emailEngine.toEmail(name, request).then(() => {
response.status(200).json({status: 200});
}).catch(e => {
@@ -60,6 +60,6 @@ module.exports = app => {
registerReport(route.name);
const staticPath = this.path + `/${route.name}/assets`;
- app.use(`/assets`, express.static(staticPath));
+ app.use(`/api/assets`, express.static(staticPath));
});
};
diff --git a/print/report/email-footer/assets/css/style.css b/print/report/email-footer/assets/css/style.css
index cf0242f36..9d47b193e 100644
--- a/print/report/email-footer/assets/css/style.css
+++ b/print/report/email-footer/assets/css/style.css
@@ -1,34 +1,39 @@
+@media (max-width: 400px) {
+ .buttons a {
+ display: block;
+ width: 100%
+ }
+}
+
.buttons {
- background-color: #FFF;
- text-align: center;
width: 100%
}
.buttons a {
+ display: inline-block;
+ box-sizing: border-box;
text-decoration: none;
- font-size: 18px;
- color: #fff
+ font-size: 16px;
+ color: #fff;
+ width: 50%
}
.buttons .btn {
background-color: #333;
- min-width: 300px;
- height: 72px;
- display: inline-block;
text-align: center
}
.buttons .btn .text {
display: inline-block;
- padding-top: 22px
+ padding: 22px 0
}
.buttons .btn .icon {
background-color: #95d831;
+ box-sizing: border-box;
text-align: center;
- padding-top: 22px;
+ padding: 16.5px 0;
float: right;
- height: 50px;
width: 70px
}
diff --git a/print/report/email-footer/index.html b/print/report/email-footer/index.html
index fb992f15e..dd7853591 100644
--- a/print/report/email-footer/index.html
+++ b/print/report/email-footer/index.html
@@ -1,16 +1,16 @@