diff --git a/client/agency/routes.json b/client/agency/routes.json
index 57ab41d91..7604cdb6b 100644
--- a/client/agency/routes.json
+++ b/client/agency/routes.json
@@ -30,6 +30,15 @@
"abstract": true,
"component": "vn-zone-card"
},
+ {
+ "url" : "/summary",
+ "state": "zone.card.summary",
+ "component": "vn-zone-summary",
+ "description": "Summary",
+ "params": {
+ "zone": "$ctrl.zone"
+ }
+ },
{
"url": "/basic-data",
"state": "zone.card.basicData",
diff --git a/client/agency/src/index.js b/client/agency/src/index.js
index 02303ecd7..f85eaab5a 100644
--- a/client/agency/src/index.js
+++ b/client/agency/src/index.js
@@ -6,6 +6,7 @@ import './zone/descriptor';
import './zone/search-panel';
import './zone/index';
import './zone/create';
+import './zone/summary';
import './zone/basic-data';
import './zone/delivery-day';
import './zone/calendar';
diff --git a/client/agency/src/locale/es.yml b/client/agency/src/locale/es.yml
index 0d1ddbe88..91952e255 100644
--- a/client/agency/src/locale/es.yml
+++ b/client/agency/src/locale/es.yml
@@ -7,5 +7,7 @@ Create: Crear
Zones: Zonas
List: Listado
+Summary: Vista previa
New zone: Nueva zona
-Basic data: Datos básicos
\ No newline at end of file
+Basic data: Datos básicos
+Delivery days: Días de envío
\ No newline at end of file
diff --git a/client/agency/src/zone/descriptor/index.html b/client/agency/src/zone/descriptor/index.html
index 3f6d6e234..c153161c8 100644
--- a/client/agency/src/zone/descriptor/index.html
+++ b/client/agency/src/zone/descriptor/index.html
@@ -4,7 +4,7 @@
-
+
diff --git a/client/agency/src/zone/index/index.html b/client/agency/src/zone/index/index.html
index 59840c522..cae870c3f 100644
--- a/client/agency/src/zone/index/index.html
+++ b/client/agency/src/zone/index/index.html
@@ -26,7 +26,8 @@
Agency
Warehouse
Hour
- Price
+ Price
+
@@ -37,6 +38,13 @@
{{::zone.warehouse.name}}
{{::zone.hour | date: 'HH:mm'}}
{{::zone.price | currency:'€':2}}
+
+
+
+
@@ -50,6 +58,13 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/agency/src/zone/index/index.js b/client/agency/src/zone/index/index.js
index 052271e46..578eefeae 100644
--- a/client/agency/src/zone/index/index.js
+++ b/client/agency/src/zone/index/index.js
@@ -22,6 +22,13 @@ export default class Controller {
return {[param]: value};
}
}
+
+ preview(event, zone) {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ this.$scope.summary.zone = zone;
+ this.$scope.dialog.show();
+ }
}
Controller.$inject = ['$scope'];
diff --git a/client/agency/src/zone/summary/index.html b/client/agency/src/zone/summary/index.html
new file mode 100644
index 000000000..c860d2bb1
--- /dev/null
+++ b/client/agency/src/zone/summary/index.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+ Basic data
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/agency/src/zone/summary/index.js b/client/agency/src/zone/summary/index.js
new file mode 100644
index 000000000..e7f3d54e7
--- /dev/null
+++ b/client/agency/src/zone/summary/index.js
@@ -0,0 +1,35 @@
+import ngModule from '../../module';
+
+class Controller {
+ constructor($http) {
+ this.$http = $http;
+ }
+
+ get zone() {
+ return this._zone;
+ }
+
+ set zone(value) {
+ this._zone = value;
+
+ if (!value) return;
+
+ this.getSummary();
+ }
+
+ getSummary() {
+ this.$http.get(`/agency/api/Zones/${this.zone.id}`).then(response => {
+ this.summary = response.data;
+ });
+ }
+}
+
+Controller.$inject = ['$http'];
+
+ngModule.component('vnZoneSummary', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ zone: '<'
+ }
+});
diff --git a/client/agency/src/zone/summary/index.spec.js b/client/agency/src/zone/summary/index.spec.js
new file mode 100644
index 000000000..5a58d2a5c
--- /dev/null
+++ b/client/agency/src/zone/summary/index.spec.js
@@ -0,0 +1,42 @@
+import './index.js';
+
+describe('Agency', () => {
+ describe('Component summary', () => {
+ let $componentController;
+ let controller;
+ let $httpBackend;
+
+ beforeEach(() => {
+ angular.mock.module('agency');
+ });
+
+ beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_) => {
+ $componentController = _$componentController_;
+ $httpBackend = _$httpBackend_;
+ $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
+ controller = $componentController('vnZoneSummary');
+ controller.zone = {id: 1};
+ }));
+
+ describe('getSummary()', () => {
+ it("should perform a query to set summary", () => {
+ let data = {name: 'Zone One', price: 0};
+ $httpBackend.when('GET', `/agency/api/Zones/1`).respond(200, data);
+ $httpBackend.expect('GET', `/agency/api/Zones/1`);
+ controller.getSummary();
+ $httpBackend.flush();
+
+ expect(controller.summary).toEqual(data);
+ });
+ });
+
+ describe('setter zone()', () => {
+ it("should call getSummary and define summary property", () => {
+ spyOn(controller, 'getSummary');
+ controller.zone = {id: 1};
+
+ expect(controller.getSummary).toHaveBeenCalledWith();
+ });
+ });
+ });
+});
diff --git a/client/agency/src/zone/summary/locale/es.yml b/client/agency/src/zone/summary/locale/es.yml
new file mode 100644
index 000000000..097319a33
--- /dev/null
+++ b/client/agency/src/zone/summary/locale/es.yml
@@ -0,0 +1,2 @@
+Niche: Nichos
+Barcode: Códigos de barras
\ No newline at end of file
diff --git a/client/item/routes.json b/client/item/routes.json
index b66d9212e..efb317211 100644
--- a/client/item/routes.json
+++ b/client/item/routes.json
@@ -124,7 +124,8 @@
"params": {
"item": "$ctrl.item"
}
- }, {
+ },
+ {
"url" : "/diary?warehouseFk",
"state": "item.card.diary",
"component": "vn-item-diary",
@@ -136,7 +137,8 @@
"icon": "icon-transaction"
},
"acl": ["employee"]
- }, {
+ },
+ {
"url" : "/last-entries",
"state": "item.card.last-entries",
"component": "vn-item-last-entries",
diff --git a/client/item/src/summary/index.spec.js b/client/item/src/summary/index.spec.js
index 92f374a78..47a7ec51a 100644
--- a/client/item/src/summary/index.spec.js
+++ b/client/item/src/summary/index.spec.js
@@ -20,12 +20,13 @@ describe('Item', () => {
describe('getSummary()', () => {
it("should perform a query to set summary", () => {
- $httpBackend.when('GET', `/item/api/Items/1/getSummary`).respond(200, 24);
+ let data = {id: 1, name: 'Gem of mind'};
+ $httpBackend.when('GET', `/item/api/Items/1/getSummary`).respond(200, data);
$httpBackend.expect('GET', `/item/api/Items/1/getSummary`);
controller.getSummary();
$httpBackend.flush();
- expect(controller.summary).toEqual(24);
+ expect(controller.summary).toEqual(data);
});
});
diff --git a/package.json b/package.json
index 00ac7403e..2c54f8e88 100644
--- a/package.json
+++ b/package.json
@@ -21,8 +21,6 @@
"material-design-lite": "^1.3.0",
"mg-crud": "^1.1.2",
"npm": "^5.10.0",
- "object-diff": "0.0.4",
- "object.pick": "^1.3.0",
"oclazyload": "^0.6.3",
"require-yaml": "0.0.1",
"validator": "^6.2.1"
diff --git a/services/agency/Dockerfile b/services/agency/Dockerfile
index f2b9fb18b..611cb8fbb 100644
--- a/services/agency/Dockerfile
+++ b/services/agency/Dockerfile
@@ -1,5 +1,5 @@
FROM vn-loopback:latest
-COPY route /app
+COPY agency /app
WORKDIR /app
CMD ["pm2-docker", "./server/server.js"]
diff --git a/services/claim/package.json b/services/claim/package.json
index 38498ed25..052261802 100644
--- a/services/claim/package.json
+++ b/services/claim/package.json
@@ -8,7 +8,9 @@
"posttest": "npm run lint && nsp check"
},
"dependencies": {
- "vn-loopback": "file:../loopback"
+ "vn-loopback": "file:../loopback",
+ "object-diff": "0.0.4",
+ "object.pick": "^1.3.0"
},
"repository": {
"type": "git",
diff --git a/services/loopback/server/server.js b/services/loopback/server/server.js
index f8678de06..b1ccdb6aa 100644
--- a/services/loopback/server/server.js
+++ b/services/loopback/server/server.js
@@ -53,9 +53,12 @@ function vnBoot(app, rootDir, rootModule) {
app.use(loopback.static(path.resolve(rootDir, '../client')));
}
+ const buildVersion = new Date().getTime();
+
app.renderIndex = async res => {
res.render(`${viewDir}/index.ejs`, {
- assets: assets
+ assets: assets,
+ version: buildVersion
});
function assets(main, deps) {
diff --git a/services/salix/client/index.ejs b/services/salix/client/index.ejs
index ef808d0e7..9e6517c22 100644
--- a/services/salix/client/index.ejs
+++ b/services/salix/client/index.ejs
@@ -8,7 +8,7 @@
<% for (let jsFile of assets('salix', ['vendor'])) { %>