Merge branch 'dev' of http://git.verdnatura.es/salix into dev
This commit is contained in:
commit
d40597deef
|
@ -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",
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -7,5 +7,7 @@ Create: Crear
|
|||
|
||||
Zones: Zonas
|
||||
List: Listado
|
||||
Summary: Vista previa
|
||||
New zone: Nueva zona
|
||||
Basic data: Datos básicos
|
||||
Delivery days: Días de envío
|
|
@ -4,7 +4,7 @@
|
|||
<vn-icon icon="chevron_left"></vn-icon>
|
||||
</a>
|
||||
<vn-icon icon="my_location"></vn-icon>
|
||||
<a translate-attr="{title: 'Preview'}" ui-sref="order.card.summary">
|
||||
<a translate-attr="{title: 'Preview'}" ui-sref="zone.card.summary">
|
||||
<vn-icon icon="desktop_windows"></vn-icon>
|
||||
</a>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
<vn-th field="agencyModeFk">Agency</vn-th>
|
||||
<vn-th field="warehouseFK">Warehouse</vn-th>
|
||||
<vn-th field="hour">Hour</vn-th>
|
||||
<vn-th field="price">Price</vn-th>
|
||||
<vn-th field="price" number>Price</vn-th>
|
||||
<vn-th></vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
|
@ -37,6 +38,13 @@
|
|||
<vn-td>{{::zone.warehouse.name}}</vn-td>
|
||||
<vn-td>{{::zone.hour | date: 'HH:mm'}}</vn-td>
|
||||
<vn-td number>{{::zone.price | currency:'€':2}}</vn-td>
|
||||
<vn-td>
|
||||
<vn-icon-button
|
||||
ng-click="$ctrl.preview($event, zone)"
|
||||
vn-tooltip="Preview"
|
||||
icon="desktop_windows">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||
|
@ -50,6 +58,13 @@
|
|||
</vn-pagination>
|
||||
</div>
|
||||
|
||||
<vn-dialog class="dialog-summary"
|
||||
vn-id="dialog">
|
||||
<tpl-body>
|
||||
<vn-zone-summary vn-id="summary"></vn-zone-summary>
|
||||
</tpl-body>
|
||||
</vn-dialog>
|
||||
|
||||
<a ui-sref="zone.create" vn-tooltip="New zone" vn-bind="+" fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
|
@ -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'];
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<vn-card class="summary">
|
||||
<vn-vertical pad-medium>
|
||||
<vn-horizontal>
|
||||
<vn-one margin-medium>
|
||||
<vn-vertical name="basicData">
|
||||
<h5 translate>Basic data</h5>
|
||||
<vn-label-value label="Name"
|
||||
value="{{$ctrl.zone.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Warehouse"
|
||||
value="{{$ctrl.zone.warehouse.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Agency"
|
||||
value="{{$ctrl.zone.agencyMode.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Estimated hour (ETD)"
|
||||
value="{{$ctrl.zone.hour | date: 'HH:mm'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Price"
|
||||
value="{{$ctrl.zone.price | currency: '€': 2}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Bonus"
|
||||
value="{{$ctrl.zone.price | currency: '€': 2}}">
|
||||
</vn-label-value>
|
||||
</vn-vertical>
|
||||
</vn-one>
|
||||
<vn-one margin-medium></vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
|
@ -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: '<'
|
||||
}
|
||||
});
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,2 @@
|
|||
Niche: Nichos
|
||||
Barcode: Códigos de barras
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
FROM vn-loopback:latest
|
||||
|
||||
COPY route /app
|
||||
COPY agency /app
|
||||
WORKDIR /app
|
||||
CMD ["pm2-docker", "./server/server.js"]
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<body>
|
||||
<vn-app></vn-app>
|
||||
<script type="text/javascript"
|
||||
src="/static/routes.js">
|
||||
src="/static/routes.js?<%= version %>">
|
||||
</script>
|
||||
<% for (let jsFile of assets('salix', ['vendor'])) { %>
|
||||
<script type="text/javascript" src="<%= jsFile %>"></script>
|
||||
|
|
Loading…
Reference in New Issue