diff --git a/client/agency/routes.json b/client/agency/routes.json
index 2a54e1e7c..b33c81fba 100644
--- a/client/agency/routes.json
+++ b/client/agency/routes.json
@@ -27,45 +27,28 @@
{
"url": "/:id",
"state": "zone.card",
+ "component": "vn-zone-card",
"abstract": true,
- "component": "vn-zone-card"
+ "description": "Detail"
},
{
- "url" : "/summary",
- "state": "zone.card.summary",
- "component": "vn-zone-summary",
- "description": "Summary",
+ "url": "/location",
+ "state": "zone.card.location",
+ "component": "vn-zone-location",
+ "description": "Location",
"params": {
"zone": "$ctrl.zone"
}
},
{
- "url": "/basic-data",
- "state": "zone.card.basicData",
- "component": "vn-zone-basic-data",
- "description": "Basic data",
+ "url": "/edit",
+ "state": "zone.card.edit",
+ "component": "vn-zone-edit",
+ "description": "Edit zone",
"params": {
"zone": "$ctrl.zone"
- },
- "menu": {
- "icon": "settings"
- }
- },
- {
- "url": "/delivery-day",
- "state": "zone.card.deliveryDay",
- "component": "vn-zone-delivery-day",
- "description": "Delivery days",
- "params": {
- "zone": "$ctrl.zone"
- },
- "menu": {
- "icon": "today"
}
}
],
- "menu": [
- {"state": "zone.card.basicData", "icon": "settings"},
- {"state": "zone.card.deliveryDay", "icon": "today"}
- ]
+ "menu": []
}
\ No newline at end of file
diff --git a/client/agency/src/zone/calendar/index.html b/client/agency/src/calendar/index.html
similarity index 100%
rename from client/agency/src/zone/calendar/index.html
rename to client/agency/src/calendar/index.html
diff --git a/client/agency/src/zone/calendar/index.js b/client/agency/src/calendar/index.js
similarity index 83%
rename from client/agency/src/zone/calendar/index.js
rename to client/agency/src/calendar/index.js
index 7d78b1126..02bfa86ee 100644
--- a/client/agency/src/zone/calendar/index.js
+++ b/client/agency/src/calendar/index.js
@@ -1,4 +1,4 @@
-import ngModule from '../../module';
+import ngModule from '../module';
class Controller {
constructor($scope) {
@@ -18,9 +18,6 @@ Controller.$inject = ['$scope'];
ngModule.component('vnZoneCalendar', {
template: require('./index.html'),
controller: Controller,
- require: {
- catalog: '^vnZoneDeliveryDay'
- },
bindings: {
zone: '<'
}
diff --git a/client/agency/src/card/index.html b/client/agency/src/card/index.html
new file mode 100644
index 000000000..3b38cfc55
--- /dev/null
+++ b/client/agency/src/card/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client/agency/src/zone/card/index.js b/client/agency/src/card/index.js
similarity index 95%
rename from client/agency/src/zone/card/index.js
rename to client/agency/src/card/index.js
index e26b0ca7a..270ab4c27 100644
--- a/client/agency/src/zone/card/index.js
+++ b/client/agency/src/card/index.js
@@ -1,4 +1,4 @@
-import ngModule from '../../module';
+import ngModule from '../module';
class Controller {
constructor($http, $stateParams) {
diff --git a/client/agency/src/zone/card/index.spec.js b/client/agency/src/card/index.spec.js
similarity index 100%
rename from client/agency/src/zone/card/index.spec.js
rename to client/agency/src/card/index.spec.js
diff --git a/client/agency/src/zone/create/index.html b/client/agency/src/create/index.html
similarity index 100%
rename from client/agency/src/zone/create/index.html
rename to client/agency/src/create/index.html
diff --git a/client/agency/src/zone/create/index.js b/client/agency/src/create/index.js
similarity index 94%
rename from client/agency/src/zone/create/index.js
rename to client/agency/src/create/index.js
index c0f8cf740..b9c2a3499 100644
--- a/client/agency/src/zone/create/index.js
+++ b/client/agency/src/create/index.js
@@ -1,4 +1,4 @@
-import ngModule from '../../module';
+import ngModule from '../module';
export default class Controller {
constructor($scope, $state) {
diff --git a/client/agency/src/zone/create/index.spec.js b/client/agency/src/create/index.spec.js
similarity index 96%
rename from client/agency/src/zone/create/index.spec.js
rename to client/agency/src/create/index.spec.js
index ca378e258..d380cfa47 100644
--- a/client/agency/src/zone/create/index.spec.js
+++ b/client/agency/src/create/index.spec.js
@@ -1,5 +1,5 @@
import './index';
-import {watcher} from '../../../../helpers/watcherHelper';
+import {watcher} from '../../../helpers/watcherHelper';
describe('Agency', () => {
describe('Component vnZoneCreate', () => {
diff --git a/client/agency/src/zone/create/locale/es.yml b/client/agency/src/create/locale/es.yml
similarity index 100%
rename from client/agency/src/zone/create/locale/es.yml
rename to client/agency/src/create/locale/es.yml
diff --git a/client/agency/src/descriptor/index.html b/client/agency/src/descriptor/index.html
new file mode 100644
index 000000000..011e3c2d9
--- /dev/null
+++ b/client/agency/src/descriptor/index.html
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/agency/src/descriptor/index.js b/client/agency/src/descriptor/index.js
new file mode 100644
index 000000000..b1a0523c7
--- /dev/null
+++ b/client/agency/src/descriptor/index.js
@@ -0,0 +1,43 @@
+import ngModule from '../module';
+
+class Controller {
+ constructor($scope, $state, $http) {
+ this.$scope = $scope;
+ this.$state = $state;
+ this.$http = $http;
+ this.moreOptions = [
+ {callback: this.editZone, name: 'Settings'},
+ {callback: this.deleteZone, name: 'Delete'}
+ ];
+ }
+
+ onMoreChange(callback) {
+ callback.call(this);
+ }
+
+ deleteZone() {
+ this.$scope.deleteZone.show();
+ }
+
+ editZone() {
+ this.$state.go('zone.card.edit', {zone: this.zone});
+ }
+
+ returnDialog(response) {
+ if (response === 'ACCEPT') {
+ this.$http.delete(`/agency/api/Zones/${this.zone.id}`).then(() => {
+ this.$state.go('zone.index');
+ });
+ }
+ }
+}
+
+Controller.$inject = ['$scope', '$state', '$http'];
+
+ngModule.component('vnZoneDescriptor', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ zone: '<'
+ }
+});
diff --git a/client/agency/src/zone/basic-data/index.html b/client/agency/src/edit/index.html
similarity index 94%
rename from client/agency/src/zone/basic-data/index.html
rename to client/agency/src/edit/index.html
index 4a2e03075..09cbc568d 100644
--- a/client/agency/src/zone/basic-data/index.html
+++ b/client/agency/src/edit/index.html
@@ -7,7 +7,7 @@
diff --git a/client/agency/src/zone/basic-data/index.js b/client/agency/src/edit/index.js
similarity index 60%
rename from client/agency/src/zone/basic-data/index.js
rename to client/agency/src/edit/index.js
index b19194084..3ff19fb1d 100644
--- a/client/agency/src/zone/basic-data/index.js
+++ b/client/agency/src/edit/index.js
@@ -1,21 +1,22 @@
-import ngModule from '../../module';
+import ngModule from '../module';
class Controller {
-
- constructor($scope) {
+ constructor($scope, $state) {
this.$scope = $scope;
+ this.$state = $state;
}
onSubmit() {
this.$scope.watcher.submit().then(() => {
+ this.$state.go('zone.card.location');
this.card.reload();
});
}
}
-Controller.$inject = ['$scope'];
+Controller.$inject = ['$scope', '$state'];
-ngModule.component('vnZoneBasicData', {
+ngModule.component('vnZoneEdit', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/client/agency/src/index.js b/client/agency/src/index.js
index f85eaab5a..78336e6ee 100644
--- a/client/agency/src/index.js
+++ b/client/agency/src/index.js
@@ -1,12 +1,12 @@
export * from './module';
// import components
-import './zone/card';
-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';
+import './index/index';
+import './summary';
+import './card';
+import './descriptor';
+import './search-panel';
+import './create';
+import './edit';
+import './location';
+import './calendar';
diff --git a/client/agency/src/zone/index/index.html b/client/agency/src/index/index.html
similarity index 91%
rename from client/agency/src/zone/index/index.html
rename to client/agency/src/index/index.html
index 547dc528d..a6b0e74e0 100644
--- a/client/agency/src/zone/index/index.html
+++ b/client/agency/src/index/index.html
@@ -31,7 +31,7 @@
-
+
{{::zone.id}}
{{::zone.name}}
{{::zone.agencyMode.name}}
@@ -58,13 +58,6 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/client/agency/src/zone/index/index.js b/client/agency/src/index/index.js
similarity index 96%
rename from client/agency/src/zone/index/index.js
rename to client/agency/src/index/index.js
index 578eefeae..ed3442871 100644
--- a/client/agency/src/zone/index/index.js
+++ b/client/agency/src/index/index.js
@@ -1,4 +1,4 @@
-import ngModule from '../../module';
+import ngModule from '../module';
export default class Controller {
constructor($scope) {
diff --git a/client/agency/src/zone/index/index.spec.js b/client/agency/src/index/index.spec.js
similarity index 100%
rename from client/agency/src/zone/index/index.spec.js
rename to client/agency/src/index/index.spec.js
diff --git a/client/agency/src/locale/es.yml b/client/agency/src/locale/es.yml
index 91952e255..58f0ef81e 100644
--- a/client/agency/src/locale/es.yml
+++ b/client/agency/src/locale/es.yml
@@ -4,10 +4,15 @@ Warehouse: Almacén
Hour: Hora (ETD)
Price: Precio
Create: Crear
+Delete: Eliminar
+Settings: Ajustes
+Delivery days: Días de envío
+Enter a new search: Introduce una nueva búsqueda
+Delete zone: Eliminar zona
+Are you sure you want to delete this zone?: ¿Estás seguro de querer eliminar esta zona?
Zones: Zonas
List: Listado
Summary: Vista previa
New zone: Nueva zona
-Basic data: Datos básicos
-Delivery days: Días de envío
\ No newline at end of file
+Edit zone: Editar zona
\ No newline at end of file
diff --git a/client/agency/src/zone/search-panel/index.html b/client/agency/src/location-search-panel/index.html
similarity index 100%
rename from client/agency/src/zone/search-panel/index.html
rename to client/agency/src/location-search-panel/index.html
diff --git a/client/agency/src/location-search-panel/index.js b/client/agency/src/location-search-panel/index.js
new file mode 100644
index 000000000..4d362e638
--- /dev/null
+++ b/client/agency/src/location-search-panel/index.js
@@ -0,0 +1,7 @@
+import ngModule from '../module';
+import SearchPanel from 'core/src/components/searchbar/search-panel';
+
+ngModule.component('vnLocationSearchPanel', {
+ template: require('./index.html'),
+ controller: SearchPanel
+});
diff --git a/client/agency/src/location/index.html b/client/agency/src/location/index.html
new file mode 100644
index 000000000..bc028604b
--- /dev/null
+++ b/client/agency/src/location/index.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+ Delivery days
+
+
+
+
+
\ No newline at end of file
diff --git a/client/agency/src/zone/delivery-day/index.js b/client/agency/src/location/index.js
similarity index 77%
rename from client/agency/src/zone/delivery-day/index.js
rename to client/agency/src/location/index.js
index 322220225..ded4b9868 100644
--- a/client/agency/src/zone/delivery-day/index.js
+++ b/client/agency/src/location/index.js
@@ -1,7 +1,6 @@
-import ngModule from '../../module';
+import ngModule from '../module';
class Controller {
-
constructor($scope) {
this.$scope = $scope;
}
@@ -9,7 +8,7 @@ class Controller {
Controller.$inject = ['$scope'];
-ngModule.component('vnZoneDeliveryDay', {
+ngModule.component('vnZoneLocation', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/client/agency/src/search-panel/index.html b/client/agency/src/search-panel/index.html
new file mode 100644
index 000000000..d3f06d8b3
--- /dev/null
+++ b/client/agency/src/search-panel/index.html
@@ -0,0 +1,40 @@
+
+
+
\ No newline at end of file
diff --git a/client/agency/src/zone/search-panel/index.js b/client/agency/src/search-panel/index.js
similarity index 83%
rename from client/agency/src/zone/search-panel/index.js
rename to client/agency/src/search-panel/index.js
index 83591a016..3e00e284b 100644
--- a/client/agency/src/zone/search-panel/index.js
+++ b/client/agency/src/search-panel/index.js
@@ -1,4 +1,4 @@
-import ngModule from '../../module';
+import ngModule from '../module';
import SearchPanel from 'core/src/components/searchbar/search-panel';
ngModule.component('vnZoneSearchPanel', {
diff --git a/client/agency/src/zone/summary/index.html b/client/agency/src/summary/index.html
similarity index 100%
rename from client/agency/src/zone/summary/index.html
rename to client/agency/src/summary/index.html
diff --git a/client/agency/src/zone/summary/index.js b/client/agency/src/summary/index.js
similarity index 94%
rename from client/agency/src/zone/summary/index.js
rename to client/agency/src/summary/index.js
index e7f3d54e7..55c46fe5f 100644
--- a/client/agency/src/zone/summary/index.js
+++ b/client/agency/src/summary/index.js
@@ -1,4 +1,4 @@
-import ngModule from '../../module';
+import ngModule from '../module';
class Controller {
constructor($http) {
diff --git a/client/agency/src/zone/card/index.html b/client/agency/src/zone/card/index.html
deleted file mode 100644
index b2d4c0522..000000000
--- a/client/agency/src/zone/card/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/client/agency/src/zone/delivery-day/index.html b/client/agency/src/zone/delivery-day/index.html
deleted file mode 100644
index 924a1511b..000000000
--- a/client/agency/src/zone/delivery-day/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
- Delivery days
-
-
-
-
-
-
-
-
-
diff --git a/client/agency/src/zone/descriptor/index.html b/client/agency/src/zone/descriptor/index.html
deleted file mode 100644
index c153161c8..000000000
--- a/client/agency/src/zone/descriptor/index.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/client/agency/src/zone/descriptor/index.js b/client/agency/src/zone/descriptor/index.js
deleted file mode 100644
index b897c5c98..000000000
--- a/client/agency/src/zone/descriptor/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import ngModule from '../../module';
-
-ngModule.component('vnZoneDescriptor', {
- template: require('./index.html'),
- bindings: {
- zone: '<'
- }
-});
diff --git a/client/agency/src/zone/summary/index.spec.js b/client/agency/src/zone/summary/index.spec.js
deleted file mode 100644
index 5a58d2a5c..000000000
--- a/client/agency/src/zone/summary/index.spec.js
+++ /dev/null
@@ -1,42 +0,0 @@
-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
deleted file mode 100644
index 097319a33..000000000
--- a/client/agency/src/zone/summary/locale/es.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-Niche: Nichos
-Barcode: Códigos de barras
\ No newline at end of file
diff --git a/client/claim/src/action/index.html b/client/claim/src/action/index.html
index fad1ad924..5ea6333d8 100644
--- a/client/claim/src/action/index.html
+++ b/client/claim/src/action/index.html
@@ -79,7 +79,7 @@
medium-grey
margin-medium-v
vn-tooltip="Remove line"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="$ctrl.deleteClaimedSale(saleClaimed.id)"
tabindex="-1">
@@ -147,6 +147,7 @@
diff --git a/client/claim/src/descriptor/index.html b/client/claim/src/descriptor/index.html
index b37eb255c..c623c078b 100644
--- a/client/claim/src/descriptor/index.html
+++ b/client/claim/src/descriptor/index.html
@@ -19,14 +19,16 @@
-
+
-
+
+
diff --git a/client/claim/src/detail/index.html b/client/claim/src/detail/index.html
index cb698afba..1343bcdff 100644
--- a/client/claim/src/detail/index.html
+++ b/client/claim/src/detail/index.html
@@ -65,7 +65,7 @@
medium-grey
margin-medium-v
vn-tooltip="Remove sale"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="$ctrl.deleteClaimedSale($index)"
tabindex="-1">
diff --git a/client/claim/src/development/index.html b/client/claim/src/development/index.html
index 11483ab72..c8af3bb5f 100644
--- a/client/claim/src/development/index.html
+++ b/client/claim/src/development/index.html
@@ -21,12 +21,6 @@
data="claimResponsibles"
order="description">
-
-
{{firstName}} {{name}}
@@ -97,7 +94,7 @@
medium-grey
margin-medium-v
vn-tooltip="Remove sale"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="model.remove($index)"
tabindex="-1"
vn-acl="salesAssistant">
diff --git a/client/claim/src/index/index.html b/client/claim/src/index/index.html
index 0b574d78d..013a781d4 100644
--- a/client/claim/src/index/index.html
+++ b/client/claim/src/index/index.html
@@ -31,7 +31,10 @@
-
+
{{::claim.id}}
@@ -48,9 +51,12 @@
icon="desktop_windows">
-
+
-
+
+ No results
+
+
Enter a new search
diff --git a/client/claim/src/search-panel/index.html b/client/claim/src/search-panel/index.html
index f38e2d332..bf0d0e3f0 100644
--- a/client/claim/src/search-panel/index.html
+++ b/client/claim/src/search-panel/index.html
@@ -39,11 +39,12 @@
+ url="/client/api/Clients/activeWorkersWithRole"
+ search-function="{firstName: $search}"
+ value-field="id"
+ where="{role: 'employee'}"
+ label="Worker">
{{firstName}} {{name}}
diff --git a/client/claim/src/summary/index.html b/client/claim/src/summary/index.html
index 75eefb56e..2388fd1af 100644
--- a/client/claim/src/summary/index.html
+++ b/client/claim/src/summary/index.html
@@ -40,7 +40,7 @@
-
+
Detail
@@ -85,7 +85,7 @@
-
+
Development
@@ -113,7 +113,7 @@
-
+
Action
diff --git a/client/client/src/address/edit/index.html b/client/client/src/address/edit/index.html
index e92608491..92c76b832 100644
--- a/client/client/src/address/edit/index.html
+++ b/client/client/src/address/edit/index.html
@@ -84,7 +84,7 @@
medium-grey
margin-medium-v
vn-tooltip="Remove note"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="$ctrl.removeObservation($index)"
tabindex="-1">
diff --git a/client/client/src/contact/index.html b/client/client/src/contact/index.html
index 56c501690..32d19cc58 100644
--- a/client/client/src/contact/index.html
+++ b/client/client/src/contact/index.html
@@ -32,7 +32,7 @@
medium-grey
margin-medium-v
vn-tooltip="Remove contact"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="model.remove($index)">
diff --git a/client/client/src/fiscal-data/index.html b/client/client/src/fiscal-data/index.html
index e526acb1d..561244586 100644
--- a/client/client/src/fiscal-data/index.html
+++ b/client/client/src/fiscal-data/index.html
@@ -100,7 +100,8 @@
+ field="$ctrl.client.isEqualizated"
+ info="In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.">
this.checkEtChanges());
@@ -37,17 +38,20 @@ export default class Controller {
let equals = this.isEqualizated == this.client.isEqualizated;
this.isEqualizated = this.client.isEqualizated;
- if (!equals)
+ if (!equals && !this.oldHasToInvoiceByAddress)
this.$.propagateIsEqualizated.show();
+ else if (!equals)
+ this.returnDialogEt('ACCEPT');
+
+ delete this.oldHasToInvoiceByAddress;
}
returnDialogEt(response) {
if (response === 'ACCEPT') {
this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then(
res => {
- if (res.data) {
+ if (res.data)
this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded'));
- }
}
);
}
diff --git a/client/client/src/fiscal-data/locale/es.yml b/client/client/src/fiscal-data/locale/es.yml
index 4b6e97e3f..a427c100d 100644
--- a/client/client/src/fiscal-data/locale/es.yml
+++ b/client/client/src/fiscal-data/locale/es.yml
@@ -1,4 +1,5 @@
Yes, notify: Sí, notificar
You changed the equalization tax: Has cambiado el recargo de equivalencia
Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios?
-Frozen: Congelado
\ No newline at end of file
+Frozen: Congelado
+In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar.
\ No newline at end of file
diff --git a/client/client/src/index/index.html b/client/client/src/index/index.html
index c82338aad..580cc49dc 100644
--- a/client/client/src/index/index.html
+++ b/client/client/src/index/index.html
@@ -23,7 +23,11 @@
client="::client">
+ ng-if="model.data.length === 0" translate>
+ No results
+
+
Enter a new search
diff --git a/client/client/src/risk/index/index.html b/client/client/src/risk/index/index.html
index 500a2f8b7..239f22ca4 100644
--- a/client/client/src/risk/index/index.html
+++ b/client/client/src/risk/index/index.html
@@ -48,7 +48,7 @@
Reference
Bank
Debit
- Credit
+ Havings
Balance
Conciliated
diff --git a/client/client/src/risk/index/locale/es.yml b/client/client/src/risk/index/locale/es.yml
index 78af91b1a..f0eb2cd52 100644
--- a/client/client/src/risk/index/locale/es.yml
+++ b/client/client/src/risk/index/locale/es.yml
@@ -3,4 +3,5 @@ Reference: Referencia
Bank: Caja
Debit: Debe
Conciliated: Conciliado
-New payment: Añadir pago
\ No newline at end of file
+New payment: Añadir pago
+Havings: Haber
\ No newline at end of file
diff --git a/client/client/src/summary/style.scss b/client/client/src/summary/style.scss
index f2d91ff62..a8a0be75b 100644
--- a/client/client/src/summary/style.scss
+++ b/client/client/src/summary/style.scss
@@ -4,6 +4,8 @@ vn-dialog {
}
}
-vn-client-summary .bold {
- font-family: vn-font-bold;
+vn-client-summary {
+ .bold {
+ font-family: vn-font-bold;
+ }
}
\ No newline at end of file
diff --git a/client/client/src/web-payment/index.html b/client/client/src/web-payment/index.html
index fcebb3df0..bc3d81c7a 100644
--- a/client/client/src/web-payment/index.html
+++ b/client/client/src/web-payment/index.html
@@ -13,18 +13,33 @@
-
+ State
Id
Amount
Payed
-
+ Confirm
+
+
+
+
+
+
+ {{::transaction.id}}
+ {{::transaction.amount | currency: '€':2}}
+ {{::transaction.created | dateTime:'dd/MM/yyyy'}}
- {{::transaction.id}}
- {{::transaction.amount | currency: '€':2}}
- {{::transaction.created | dateTime:'dd/MM/yyyy'}}
-
-
-
-
-
diff --git a/client/client/src/web-payment/index.js b/client/client/src/web-payment/index.js
index 54ba6534b..0ec1a6858 100644
--- a/client/client/src/web-payment/index.js
+++ b/client/client/src/web-payment/index.js
@@ -1,4 +1,5 @@
import ngModule from '../module';
+import './style.scss';
class Controller {
constructor($scope, $http, $stateParams) {
diff --git a/client/client/src/web-payment/locale/es.yml b/client/client/src/web-payment/locale/es.yml
index 656bfd32d..099ca359c 100644
--- a/client/client/src/web-payment/locale/es.yml
+++ b/client/client/src/web-payment/locale/es.yml
@@ -1,4 +1,6 @@
Web Payment: Pago Web
Confirmed: Confirmado
Payed: Pagado
-Confirm transaction: Confirmar transacción
\ No newline at end of file
+Confirm transaction: Confirmar transacción
+Confirm: Confirmar
+State: Estado
\ No newline at end of file
diff --git a/client/client/src/web-payment/style.scss b/client/client/src/web-payment/style.scss
new file mode 100644
index 000000000..dbbd120c9
--- /dev/null
+++ b/client/client/src/web-payment/style.scss
@@ -0,0 +1,10 @@
+@import "colors";
+
+vn-client-web-payment {
+ vn-icon[icon=clear] {
+ color: $alert01;
+ }
+ vn-icon[icon=check] {
+ color: $main-02;
+ }
+}
\ No newline at end of file
diff --git a/client/core/src/components/check/check.html b/client/core/src/components/check/check.html
index b261a53a7..b2f5558b2 100644
--- a/client/core/src/components/check/check.html
+++ b/client/core/src/components/check/check.html
@@ -2,3 +2,8 @@
{{::$ctrl.label}}
+
+ info_outline
+
\ No newline at end of file
diff --git a/client/core/src/components/check/check.js b/client/core/src/components/check/check.js
index 1f8aa7969..83a94a2df 100644
--- a/client/core/src/components/check/check.js
+++ b/client/core/src/components/check/check.js
@@ -3,11 +3,13 @@ import Input from '../../lib/input';
import './style.scss';
export default class Controller extends Input {
- constructor($element, $scope) {
+ constructor($element, $scope, $attrs) {
super($element, $scope);
componentHandler.upgradeElement(this.element.firstChild);
this.mdlElement = this.element.firstChild.MaterialCheckbox;
this.input.addEventListener('change', () => this.onChange());
+ this.hasInfo = Boolean($attrs.info);
+ this.info = $attrs.info || null;
}
set field(value) {
this._field = value;
@@ -35,7 +37,7 @@ export default class Controller extends Input {
this.$.$applyAsync();
}
}
-Controller.$inject = ['$element', '$scope', '$injector'];
+Controller.$inject = ['$element', '$scope', '$attrs'];
ngModule.component('vnCheck', {
template: require('./check.html'),
diff --git a/client/core/src/components/check/style.scss b/client/core/src/components/check/style.scss
index 3ff40e1e7..c9348d9b7 100644
--- a/client/core/src/components/check/style.scss
+++ b/client/core/src/components/check/style.scss
@@ -1,5 +1,16 @@
+@import 'colors';
+
vn-check {
+ position: relative;
& > .mdl-checkbox {
width: initial;
}
+
+ & > i {
+ padding-left: 5px;
+ position: absolute;
+ bottom: 3px;
+ color: $secondary-font-color;
+ font-size: 20px !important
+ }
}
\ No newline at end of file
diff --git a/client/core/src/components/icon-menu/style.scss b/client/core/src/components/icon-menu/style.scss
index 9695616e4..154196508 100644
--- a/client/core/src/components/icon-menu/style.scss
+++ b/client/core/src/components/icon-menu/style.scss
@@ -1,3 +1,5 @@
-vn-icon-menu{
-
+vn-icon-menu {
+ vn-drop-down {
+ font-family: 'vn-font'
+ }
}
\ No newline at end of file
diff --git a/client/item/src/barcode/index.html b/client/item/src/barcode/index.html
index 4bffdd0ff..657e946c0 100644
--- a/client/item/src/barcode/index.html
+++ b/client/item/src/barcode/index.html
@@ -28,7 +28,7 @@
vn-acl="buyer,replenisher"
pointer
vn-tooltip="Remove barcode"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="model.remove($index)">
diff --git a/client/item/src/index/index.html b/client/item/src/index/index.html
index 3626fb5c4..51561d285 100644
--- a/client/item/src/index/index.html
+++ b/client/item/src/index/index.html
@@ -23,7 +23,11 @@
item="::item">
+ ng-if="model.data.length === 0" translate>
+ No results
+
+
Enter a new search
diff --git a/client/item/src/niche/index.html b/client/item/src/niche/index.html
index e4c8342f9..8ab90e572 100644
--- a/client/item/src/niche/index.html
+++ b/client/item/src/niche/index.html
@@ -37,7 +37,7 @@
vn-acl="buyer,replenisher"
pointer
vn-tooltip="Remove niche"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="model.remove($index)">
diff --git a/client/item/src/search-panel/index.html b/client/item/src/search-panel/index.html
index 66bdefa44..614f99e40 100644
--- a/client/item/src/search-panel/index.html
+++ b/client/item/src/search-panel/index.html
@@ -67,7 +67,7 @@
medium-grey
margin-medium-v
vn-tooltip="Remove tag"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="filter.tags.splice($index, 1)"
tabindex="-1">
diff --git a/client/item/src/tags/index.html b/client/item/src/tags/index.html
index bc0b0d72f..8529ba372 100644
--- a/client/item/src/tags/index.html
+++ b/client/item/src/tags/index.html
@@ -66,7 +66,7 @@
medium-grey
margin-medium-v
vn-tooltip="Remove tag"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="model.remove($index)"
tabindex="-1">
diff --git a/client/order/src/card/index.js b/client/order/src/card/index.js
index f5c88f381..3b3e2524c 100644
--- a/client/order/src/card/index.js
+++ b/client/order/src/card/index.js
@@ -32,7 +32,7 @@ class Controller {
let json = encodeURIComponent(JSON.stringify(this.filter));
let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`;
this.$http.get(query).then(res => {
- if (res.data) {
+ if (res.data && res.data.rows) {
if (res.data.rows.length == 0)
delete res.data.rows;
this.order = res.data;
diff --git a/client/order/src/card/index.spec.js b/client/order/src/card/index.spec.js
index 3d843852a..0b9f791b2 100644
--- a/client/order/src/card/index.spec.js
+++ b/client/order/src/card/index.spec.js
@@ -26,11 +26,11 @@ describe('Order', () => {
it(`should make a query, save the data in order and call get order if the response has data`, () => {
spyOn(controller, 'getTotal');
let json = encodeURIComponent(JSON.stringify(controller.filter));
- $httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond({id: 1});
+ $httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond({rows: [1, 2, 3]});
controller.getCard();
$httpBackend.flush();
- expect(controller.order).toEqual({id: 1});
+ expect(controller.order).toEqual({rows: [1, 2, 3]});
expect(controller.getTotal).toHaveBeenCalledWith();
});
diff --git a/client/order/src/descriptor/index.js b/client/order/src/descriptor/index.js
index 3a3933d8f..4b052526c 100644
--- a/client/order/src/descriptor/index.js
+++ b/client/order/src/descriptor/index.js
@@ -6,6 +6,24 @@ class Controller {
this.translate = $translate;
}
+ set order(value) {
+ this._order = value;
+
+ if (value.isConfirmed) {
+ this._quicklinks = {
+ btnOne: {
+ icon: 'icon-ticket',
+ state: `ticket.index({q: '{"orderFk": ${value.id}}'})`,
+ tooltip: 'Order ticket list'
+ }
+ };
+ }
+ }
+
+ get order() {
+ return this._order;
+ }
+
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
diff --git a/client/order/src/descriptor/locale/es.yml b/client/order/src/descriptor/locale/es.yml
index feb0b4c55..88a0c1dda 100644
--- a/client/order/src/descriptor/locale/es.yml
+++ b/client/order/src/descriptor/locale/es.yml
@@ -5,4 +5,5 @@ State: Estado
Landed: F. entrega
Items: Articulos
Agency: Agencia
-Sales person: Comercial
\ No newline at end of file
+Sales person: Comercial
+Order ticket list: Ticket del pedido
\ No newline at end of file
diff --git a/client/order/src/index/index.html b/client/order/src/index/index.html
index d648fd4b7..6c05f0d05 100644
--- a/client/order/src/index/index.html
+++ b/client/order/src/index/index.html
@@ -56,7 +56,10 @@
-
+
+ No results
+
+
Enter a new search
diff --git a/client/order/src/line/index.html b/client/order/src/line/index.html
index e7465a1c0..732fd4276 100644
--- a/client/order/src/line/index.html
+++ b/client/order/src/line/index.html
@@ -58,7 +58,7 @@
diff --git a/client/salix/src/styles/colors.scss b/client/salix/src/styles/colors.scss
index daedb7100..e7d29c2d9 100644
--- a/client/salix/src/styles/colors.scss
+++ b/client/salix/src/styles/colors.scss
@@ -1,4 +1,4 @@
-$main-font-color :#222222;
+$main-font-color:#222222;
$secondary-font-color: #9b9b9b;
$main-header: #3d3d3d;
$hover: rgba(0, 0, 0, 0.1);
@@ -10,7 +10,11 @@ $main-01-03: rgba($main-01, 0.3);
$main-02: #a3d131;
$main-02-05: rgba($main-02, 0.5);
$main-02-03: rgba($main-02, 0.3);
+$main-03: #32b1ce;
+$main-03-05: rgba($main-03, 0.5);
+$main-03-03: rgba($main-03, 0.3);
$lines: #9b9b9b;
+$alert01: #f42121;
$color-green: #a3d131;
$color-orange: #f7931e;
diff --git a/client/salix/src/styles/summary.scss b/client/salix/src/styles/summary.scss
index f23d2ca2e..4efda84e0 100644
--- a/client/salix/src/styles/summary.scss
+++ b/client/salix/src/styles/summary.scss
@@ -1,8 +1,12 @@
@import "./colors";
.summary{
- h5 {
+ h5:not(.title) {
+ padding: 7px;
+ background-color: $main-01-03;
border-bottom: 2px solid $main-01;
+ font-family: unset !important;
+ text-transform: uppercase;
}
.title, p.title {
border: none;
diff --git a/client/ticket/src/index/index.html b/client/ticket/src/index/index.html
index 0055767a2..36af7f144 100644
--- a/client/ticket/src/index/index.html
+++ b/client/ticket/src/index/index.html
@@ -13,6 +13,7 @@
@@ -86,7 +87,10 @@
-
+
+ No results
+
+
Enter a new search
diff --git a/client/ticket/src/index/index.js b/client/ticket/src/index/index.js
index eaa31425c..d53ec2b57 100644
--- a/client/ticket/src/index/index.js
+++ b/client/ticket/src/index/index.js
@@ -9,6 +9,17 @@ export default class Controller {
this.moreOptions = [
{callback: this.goToTurns, name: 'Turns', always: true},
];
+
+ let today = new Date();
+ let offset = today.getTimezoneOffset() * 60000;
+ today.setHours(0, 0, 0, 0);
+ today.setTime(today.getTime() - offset);
+
+ let tomorrow = new Date(today);
+ tomorrow.setHours(23, 59, 59, 59);
+ tomorrow.setTime(tomorrow.getTime() - offset);
+
+ this.filter = {myTeam: true, from: today, to: tomorrow};
}
goToTurns() {
diff --git a/client/ticket/src/log/locale/es.yml b/client/ticket/src/log/locale/es.yml
deleted file mode 100644
index 75deeb63b..000000000
--- a/client/ticket/src/log/locale/es.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-Model: Modelo
-Action: Acción
-Changed by: Cambiado por
-Before: Antes
-After: Despues
-History: Historial
-insert: Crear
-delete: Eliminar
-update: Actualizar
\ No newline at end of file
diff --git a/client/ticket/src/note/index.html b/client/ticket/src/note/index.html
index e8b5b6175..85bba5dea 100644
--- a/client/ticket/src/note/index.html
+++ b/client/ticket/src/note/index.html
@@ -38,7 +38,7 @@
pointer
medium-grey
vn-tooltip="Remove note"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="model.remove($index)">
diff --git a/client/ticket/src/package/index.html b/client/ticket/src/package/index.html
index a4142e70d..06ec2aab9 100644
--- a/client/ticket/src/package/index.html
+++ b/client/ticket/src/package/index.html
@@ -43,7 +43,7 @@
pointer
medium-grey
vn-tooltip="Remove package"
- icon="remove_circle_outline"
+ icon="delete"
ng-click="model.remove($index)">
diff --git a/client/ticket/src/search-panel/index.html b/client/ticket/src/search-panel/index.html
index f65aabae5..d1492ba1c 100644
--- a/client/ticket/src/search-panel/index.html
+++ b/client/ticket/src/search-panel/index.html
@@ -78,9 +78,16 @@
field="filter.stateFk"
url="/api/States">
+
+
+
+
diff --git a/client/ticket/src/search-panel/locale/es.yml b/client/ticket/src/search-panel/locale/es.yml
index 20ef1ee23..f63f2baf9 100644
--- a/client/ticket/src/search-panel/locale/es.yml
+++ b/client/ticket/src/search-panel/locale/es.yml
@@ -8,4 +8,4 @@ Warehouse: Almacén
Sales person: Comercial
Province: Provincia
My team: Mi equipo
-My tickets: Mis tickets
\ No newline at end of file
+Order id: Id pedido
\ No newline at end of file
diff --git a/client/ticket/src/summary/index.html b/client/ticket/src/summary/index.html
index 03a23b85f..d09490a57 100644
--- a/client/ticket/src/summary/index.html
+++ b/client/ticket/src/summary/index.html
@@ -52,55 +52,156 @@
-
+
+
+
+
+ Packages
+
+
+
+ Created
+ Package
+ Quantity
+
+
+
+
+ {{package.created | dateTime: 'dd/MM/yyyy'}}
+ {{package.packaging.item.name}}
+ {{package.quantity}}
+
+
+
+ No results
+
+
+
+
+ Service
+
+
+
+ Id
+ Description
+ Quantity
+ Price
+ Tax class
+
+
+
+
+ {{::service.id}}
+ {{::service.description}}
+ {{::service.quantity}}
+ {{::service.price}}
+ {{::service.taxClass.description}}
+
+
+
+ No results
+
+
+
+
+
+
+ Purchase request
+
+
+
+ Id
+ Description
+ Created
+ Requester
+ Atender
+ Quantity
+ Price
+ Sale id
+ Ok
+
+
+
+
+ {{::request.id}}
+ {{::request.description}}
+ {{::request.created | dateTime: 'dd/MM/yyyy'}}
+ {{::request.requester.firstName}} {{::request.requester.name}}
+ {{::request.atender.firstName}} {{::request.atender.name}}
+ {{::request.quantity}}
+ {{::request.price}}
+
+
+ {{("000000"+request.saleFk).slice(-6)}}
+
+
+
+
+
+
+
+
+
+ No results
+
+
+
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index c3ca8cc21..db1bdd5c9 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -230,7 +230,7 @@ export default {
itemTags: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
tagsButton: `vn-left-menu a[ui-sref="item.card.tags"]`,
- firstRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(2) vn-icon-button[icon="remove_circle_outline"]`,
+ firstRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(2) vn-icon-button[icon="delete"]`,
firstTagSelect: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] input`,
firstTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`,
firstValueInput: `vn-item-tags vn-horizontal:nth-child(2) > vn-textfield[label="Value"] input`,
@@ -272,7 +272,7 @@ export default {
addBarcodeButton: `vn-icon[icon="add_circle"]`,
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
submitBarcodesButton: `${components.vnSubmit}`,
- firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="remove_circle_outline"]`
+ firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]`
},
itemNiches: {
nicheButton: `vn-left-menu a[ui-sref="item.card.niche"]`,
@@ -282,7 +282,7 @@ export default {
firstCodeInput: `vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input`,
secondWarehouseSelect: `vn-horizontal:nth-child(3) > vn-autocomplete[field="niche.warehouseFk"] input`,
secondCodeInput: `vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input`,
- secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-none > vn-icon[icon="remove_circle_outline"]`,
+ secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-none > vn-icon[icon="delete"]`,
thirdWarehouseSelect: `vn-horizontal:nth-child(4) > vn-autocomplete[field="niche.warehouseFk"] input`,
thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > vn-autocomplete[field="niche.warehouseFk"] vn-drop-down ul > li:nth-child(4)`,
thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Code"] input`,
@@ -343,7 +343,7 @@ export default {
},
ticketNotes: {
notesButton: `vn-left-menu a[ui-sref="ticket.card.observation"]`,
- firstNoteRemoveButton: `vn-icon[icon="remove_circle_outline"]`,
+ firstNoteRemoveButton: `vn-icon[icon="delete"]`,
addNoteButton: `vn-icon[icon="add_circle"]`,
firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`,
firstNoteSelectSecondOption: `vn-autocomplete[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`,
diff --git a/services/db/install/changes/1.0-OnlyLocal/07-fieldAcl.sql b/services/db/install/changes/1.0-OnlyLocal/07-fieldAcl.sql
index 052b33c34..0431b9cc7 100644
--- a/services/db/install/changes/1.0-OnlyLocal/07-fieldAcl.sql
+++ b/services/db/install/changes/1.0-OnlyLocal/07-fieldAcl.sql
@@ -80,4 +80,5 @@ INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`
INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('TicketWeekly', '*', '*', 'employee');
-INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('Receipt', '*', '*', 'administrative');
\ No newline at end of file
+INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('Receipt', '*', '*', 'administrative');
+INSERT INTO salix.fieldAcl (model,property,actionType,`role`) VALUES ('Zone','*','*','agency');
diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql
index 52b08ca09..df68d0f73 100644
--- a/services/db/install/dump/fixtures.sql
+++ b/services/db/install/dump/fixtures.sql
@@ -252,7 +252,6 @@ INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created
(10, 101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)),
(11, 101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -11 MONTH)),
(12, 102, 9, 800, CURDATE()),
- (13, 103, 9, 200, CURDATE()),
(14, 104, 9, 90 , CURDATE()),
(15, 105, 9, 90 , CURDATE());
@@ -1014,7 +1013,7 @@ INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `amountUnpaid`, `pay
(1, 'Cobro web', 100.50, 0.00, CURDATE(), 9, 1, 101, CURDATE(), 442, 1),
(2, 'Cobro web', 200.50, 0.00, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 9, 1, 101, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 442, 1),
(3, 'Cobro en efectivo', 300.00, 100.00, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 9, 1, 102, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 442, 0),
- (4, 'Cobro en efectivo', 400.00, -50.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0);
+ (4, 'Cobro en efectivo', -400.00, -50.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0);
INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`)
VALUES
diff --git a/services/loopback/common/methods/client/activeWorkersWithRole.js b/services/loopback/common/methods/client/activeWorkersWithRole.js
index bb0231bd6..c2f429952 100644
--- a/services/loopback/common/methods/client/activeWorkersWithRole.js
+++ b/services/loopback/common/methods/client/activeWorkersWithRole.js
@@ -37,7 +37,11 @@ module.exports = Self => {
case 'role':
return {'r.name': value};
case 'firstName':
- return {or: [{'w.firstName': {like: `%${value}%`}}, {'w.name': {like: `%${value}%`}}]};
+ return {or: [
+ {'w.firstName': {like: `%${value}%`}},
+ {'w.name': {like: `%${value}%`}},
+ {'u.name': {like: `%${value}%`}}
+ ]};
case 'id':
return {'w.id': value};
}
diff --git a/services/loopback/common/methods/order/specs/new.spec.js b/services/loopback/common/methods/order/specs/new.spec.js
index 8aa9a85d0..527192ebd 100644
--- a/services/loopback/common/methods/order/specs/new.spec.js
+++ b/services/loopback/common/methods/order/specs/new.spec.js
@@ -46,7 +46,10 @@ describe('order new()', () => {
it('should throw an error if the client isnt frozen and is active, has data checked but has a debt', async () => {
let error;
- let params = {addressFk: 123};
+ let params = {
+ addressFk: 123,
+ landed: new Date()
+ };
await app.models.Order.new(params)
.catch(e => {
diff --git a/services/loopback/common/methods/ticket/filter.js b/services/loopback/common/methods/ticket/filter.js
index 7dfc955d7..aaba6ea93 100644
--- a/services/loopback/common/methods/ticket/filter.js
+++ b/services/loopback/common/methods/ticket/filter.js
@@ -63,6 +63,10 @@ module.exports = Self => {
arg: 'myTeam',
type: 'Boolean',
description: `Whether to show only tickets for the current logged user team (For now it shows only the current user tickets)`
+ }, {
+ arg: 'orderFk',
+ type: 'Number',
+ description: `The order id filter`
}
],
returns: {
@@ -79,10 +83,16 @@ module.exports = Self => {
let conn = Self.dataSource.connector;
let worker = await Self.app.models.Worker.findOne({
- fields: ['id'],
- where: {userFk: ctx.req.accessToken.userId}
+ where: {userFk: ctx.req.accessToken.userId},
+ include: [
+ {relation: 'collegues'}
+ ]
+ });
+
+ let teamIds = [];
+ worker.collegues().forEach(collegue => {
+ teamIds.push(collegue.collegueFk);
});
- let teamIds = [worker && worker.id];
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
@@ -102,6 +112,8 @@ module.exports = Self => {
return {'a.provinceFk': value};
case 'stateFk':
return {'ts.stateFk': value};
+ case 'orderFk':
+ return {'ot.orderFk': value};
case 'myTeam':
return {'c.salesPersonFk': {inq: teamIds}};
case 'id':
@@ -136,7 +148,8 @@ module.exports = Self => {
w.name AS warehouse,
am.name AS agencyMode,
st.name AS state,
- wk.name AS salesPerson
+ wk.name AS salesPerson,
+ ot.orderFk AS orderFk
FROM ticket t
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN province p ON p.id = a.provinceFk
@@ -145,8 +158,11 @@ module.exports = Self => {
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk
- LEFT JOIN worker wk ON wk.id = c.salesPersonFk`);
- stmt.merge(conn.makeSuffix(filter));
+ LEFT JOIN worker wk ON wk.id = c.salesPersonFk
+ LEFT JOIN orderTicket ot ON ot.ticketFk = t.id`);
+ stmt.merge(conn.makeWhere(filter.where));
+ stmt.merge('GROUP BY t.id');
+ stmt.merge(conn.makePagination(filter));
stmts.push(stmt);
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems');
diff --git a/services/loopback/common/methods/ticket/summary.js b/services/loopback/common/methods/ticket/summary.js
index 27fdebbe1..e67b438ff 100644
--- a/services/loopback/common/methods/ticket/summary.js
+++ b/services/loopback/common/methods/ticket/summary.js
@@ -26,6 +26,22 @@ module.exports = Self => {
summaryObj.subTotal = getSubTotal(summaryObj.sales);
summaryObj.VAT = await models.Ticket.getVAT(ticketFk);
summaryObj.total = await models.Ticket.getTotal(ticketFk);
+ summaryObj.packagings = await models.TicketPackaging.find({
+ where: {ticketFk: ticketFk},
+ include: [{relation: 'packaging',
+ scope: {
+ fields: ['itemFk', 'name'],
+ include: {
+ relation: 'item'
+ }
+ }
+ }]
+ });
+ summaryObj.requests = await getRequests(Self, ticketFk);
+ summaryObj.services = await models.TicketService.find({
+ where: {ticketFk: ticketFk},
+ include: [{relation: 'taxClass'}]
+ });
return summaryObj;
};
@@ -98,6 +114,19 @@ module.exports = Self => {
return await Sale.find(filter);
}
+ async function getRequests(Self, ticketFk) {
+ let filter = {
+ where: {
+ ticketFk: ticketFk
+ },
+ include: [
+ {relation: 'requester'},
+ {relation: 'atender'}
+ ]
+ };
+ return await Self.app.models.TicketRequest.find(filter);
+ }
+
function getSubTotal(sales) {
let subTotal = 0.00;
diff --git a/services/loopback/common/models/worker-team-collegues.json b/services/loopback/common/models/worker-team-collegues.json
new file mode 100644
index 000000000..2e4a0a4f8
--- /dev/null
+++ b/services/loopback/common/models/worker-team-collegues.json
@@ -0,0 +1,26 @@
+{
+ "name": "WorkerTeamCollegues",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "workerTeamCollegues"
+ }
+ },
+ "properties": {
+ "workerFk": {
+ "id": true,
+ "type": "Number"
+ },
+ "collegueFk": {
+ "id": true,
+ "type": "Number"
+ }
+ },
+ "relations": {
+ "worker": {
+ "type": "belongsTo",
+ "model": "Worker",
+ "foreignKey": "workerFk"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/loopback/common/models/worker.json b/services/loopback/common/models/worker.json
index 81807e6f6..6b382a16c 100644
--- a/services/loopback/common/models/worker.json
+++ b/services/loopback/common/models/worker.json
@@ -31,6 +31,11 @@
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
+ },
+ "collegues": {
+ "type": "hasMany",
+ "model": "WorkerTeamCollegues",
+ "foreignKey": "workerFk"
}
}
}
\ No newline at end of file
diff --git a/services/loopback/server/model-config.json b/services/loopback/server/model-config.json
index 6532f6bf9..b41bad50b 100644
--- a/services/loopback/server/model-config.json
+++ b/services/loopback/server/model-config.json
@@ -165,6 +165,9 @@
"WorkerTeam": {
"dataSource": "vn"
},
+ "WorkerTeamCollegues": {
+ "dataSource": "vn"
+ },
"TicketRequest": {
"dataSource": "vn"
},