This commit is contained in:
Joan 2018-12-13 08:54:22 +01:00
commit 7fea1fe2ac
88 changed files with 654 additions and 327 deletions

View File

@ -27,45 +27,28 @@
{ {
"url": "/:id", "url": "/:id",
"state": "zone.card", "state": "zone.card",
"component": "vn-zone-card",
"abstract": true, "abstract": true,
"component": "vn-zone-card" "description": "Detail"
}, },
{ {
"url" : "/summary", "url": "/location",
"state": "zone.card.summary", "state": "zone.card.location",
"component": "vn-zone-summary", "component": "vn-zone-location",
"description": "Summary", "description": "Location",
"params": { "params": {
"zone": "$ctrl.zone" "zone": "$ctrl.zone"
} }
}, },
{ {
"url": "/basic-data", "url": "/edit",
"state": "zone.card.basicData", "state": "zone.card.edit",
"component": "vn-zone-basic-data", "component": "vn-zone-edit",
"description": "Basic data", "description": "Edit zone",
"params": { "params": {
"zone": "$ctrl.zone" "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": [ "menu": []
{"state": "zone.card.basicData", "icon": "settings"},
{"state": "zone.card.deliveryDay", "icon": "today"}
]
} }

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($scope) { constructor($scope) {
@ -18,9 +18,6 @@ Controller.$inject = ['$scope'];
ngModule.component('vnZoneCalendar', { ngModule.component('vnZoneCalendar', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
require: {
catalog: '^vnZoneDeliveryDay'
},
bindings: { bindings: {
zone: '<' zone: '<'
} }

View File

@ -0,0 +1,11 @@
<vn-main-block>
<vn-vertical margin-medium>
<vn-zone-descriptor zone="$ctrl.zone"></vn-zone-descriptor>
<vn-horizontal>
<vn-one ui-view></vn-one>
<vn-auto class="right-block">
<vn-zone-calendar zone="$ctrl.zone"></vn-zone-calendar>
</vn-auto>
</vn-horizontal>
</vn-vertical>
</vn-main-block>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($http, $stateParams) { constructor($http, $stateParams) {

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
export default class Controller { export default class Controller {
constructor($scope, $state) { constructor($scope, $state) {

View File

@ -1,5 +1,5 @@
import './index'; import './index';
import {watcher} from '../../../../helpers/watcherHelper'; import {watcher} from '../../../helpers/watcherHelper';
describe('Agency', () => { describe('Agency', () => {
describe('Component vnZoneCreate', () => { describe('Component vnZoneCreate', () => {

View File

@ -0,0 +1,54 @@
<vn-card margin-medium-v class="vn-descriptor">
<vn-horizontal class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="zone.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
<vn-icon icon="my_location"></vn-icon>
<vn-icon-menu
vn-id="more-button"
icon="more_vert"
show-filter="false"
value-field="callback"
translate-fields="['name']"
data="$ctrl.moreOptions"
on-change="$ctrl.onMoreChange(value)">
</vn-icon-menu>
</vn-horizontal>
<vn-horizontal pad-medium>
<vn-one>
<vn-label-value label="Id"
value="{{::$ctrl.zone.id}}">
</vn-label-value>
<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-one>
<vn-one>
<vn-label-value label="Estimated hour (ETD)"
value="{{::$ctrl.zone.hour | date: 'HH:mm'}}">
</vn-label-value>
<vn-label-value label="Traveling days"
value="{{::$ctrl.zone.travelingDays}}">
</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-one>
</vn-horizontal>
</vn-card>
<vn-confirm
vn-id="delete-zone"
on-response="$ctrl.returnDialog(response)"
question="Delete zone"
message="Are you sure you want to delete this zone?">
</vn-confirm>

View File

@ -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: '<'
}
});

View File

@ -7,7 +7,7 @@
</vn-watcher> </vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()"> <form name="form" ng-submit="$ctrl.onSubmit()">
<vn-card pad-large> <vn-card pad-large>
<vn-title>Basic data</vn-title> <vn-title>Edit zone</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-two vn-focus <vn-textfield vn-two vn-focus
label="Name" label="Name"
@ -63,5 +63,6 @@
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Save"></vn-submit> <vn-submit label="Save"></vn-submit>
<vn-button ui-sref="zone.card.location" label="Cancel"></vn-button>
</vn-button-bar> </vn-button-bar>
</form> </form>

View File

@ -1,21 +1,22 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($scope, $state) {
constructor($scope) {
this.$scope = $scope; this.$scope = $scope;
this.$state = $state;
} }
onSubmit() { onSubmit() {
this.$scope.watcher.submit().then(() => { this.$scope.watcher.submit().then(() => {
this.$state.go('zone.card.location');
this.card.reload(); this.card.reload();
}); });
} }
} }
Controller.$inject = ['$scope']; Controller.$inject = ['$scope', '$state'];
ngModule.component('vnZoneBasicData', { ngModule.component('vnZoneEdit', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
bindings: { bindings: {

View File

@ -1,12 +1,12 @@
export * from './module'; export * from './module';
// import components // import components
import './zone/card'; import './index/index';
import './zone/descriptor'; import './summary';
import './zone/search-panel'; import './card';
import './zone/index'; import './descriptor';
import './zone/create'; import './search-panel';
import './zone/summary'; import './create';
import './zone/basic-data'; import './edit';
import './zone/delivery-day'; import './location';
import './zone/calendar'; import './calendar';

View File

@ -31,7 +31,7 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="zone in zones" ui-sref="zone.card.basicData({id: zone.id})" class=clickable> <vn-tr ng-repeat="zone in zones" ui-sref="zone.card.location({id: zone.id})" class=clickable>
<vn-td number>{{::zone.id}}</vn-td> <vn-td number>{{::zone.id}}</vn-td>
<vn-td>{{::zone.name}}</vn-td> <vn-td>{{::zone.name}}</vn-td>
<vn-td>{{::zone.agencyMode.name}}</vn-td> <vn-td>{{::zone.agencyMode.name}}</vn-td>
@ -58,13 +58,6 @@
</vn-pagination> </vn-pagination>
</div> </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> <a ui-sref="zone.create" vn-tooltip="New zone" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>
</a> </a>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
export default class Controller { export default class Controller {
constructor($scope) { constructor($scope) {

View File

@ -4,10 +4,15 @@ Warehouse: Almacén
Hour: Hora (ETD) Hour: Hora (ETD)
Price: Precio Price: Precio
Create: Crear 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 Zones: Zonas
List: Listado List: Listado
Summary: Vista previa Summary: Vista previa
New zone: Nueva zona New zone: Nueva zona
Basic data: Datos básicos Edit zone: Editar zona
Delivery days: Días de envío

View File

@ -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
});

View File

@ -0,0 +1,18 @@
<vn-crud-model
vn-id="model"
url="/agency/api/ZoneGeos"
data="geos">
</vn-crud-model>
<vn-vertical vn-one>
<vn-card pad-large>
<vn-title>Delivery days</vn-title>
<vn-searchbar
panel="vn-calendar-search-panel"
model="model"
expr-builder="$ctrl.exprBuilder(param, value)"
vn-focus>
</vn-searchbar>
<vn-treeview model="model"></vn-treeview>
</vn-card>
</vn-vertical>

View File

@ -1,7 +1,6 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($scope) { constructor($scope) {
this.$scope = $scope; this.$scope = $scope;
} }
@ -9,7 +8,7 @@ class Controller {
Controller.$inject = ['$scope']; Controller.$inject = ['$scope'];
ngModule.component('vnZoneDeliveryDay', { ngModule.component('vnZoneLocation', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
bindings: { bindings: {

View File

@ -0,0 +1,40 @@
<div pad-large style="min-width: 30em">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield
vn-one
label="General search"
model="filter.search"
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Name"
model="filter.name">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="Agency"
field="filter.agencyModeFk"
url="/agency/api/AgencyModes"
show-field="name"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
vn-one
label="Warehouse"
field="filter.warehouseFk"
url="/agency/api/Warehouses"
show-field="name"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>
</div>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
import SearchPanel from 'core/src/components/searchbar/search-panel'; import SearchPanel from 'core/src/components/searchbar/search-panel';
ngModule.component('vnZoneSearchPanel', { ngModule.component('vnZoneSearchPanel', {

View File

@ -1,4 +1,4 @@
import ngModule from '../../module'; import ngModule from '../module';
class Controller { class Controller {
constructor($http) { constructor($http) {

View File

@ -1,11 +0,0 @@
<vn-main-block>
<vn-horizontal>
<vn-auto class="left-block">
<vn-zone-descriptor zone="$ctrl.zone"></vn-zone-descriptor>
<vn-left-menu></vn-left-menu>
</vn-auto>
<vn-one>
<vn-vertical margin-medium ui-view></vn-vertical>
</vn-one>
</vn-horizontal>
</vn-main-block>

View File

@ -1,19 +0,0 @@
<vn-crud-model
vn-id="model"
url="/agency/api/ZoneGeos"
data="geos">
</vn-crud-model>
<vn-horizontal>
<vn-vertical vn-one>
<vn-card pad-large>
<vn-title>Delivery days</vn-title>
<vn-treeview model="model"></vn-treeview>
</vn-card>
</vn-vertical>
<vn-auto class="right-block">
<vn-zone-calendar zone="$ctrl.zone"></vn-zone-calendar>
</vn-auto>
</vn-horizontal>

View File

@ -1,34 +0,0 @@
<vn-card margin-medium-v class="vn-descriptor">
<vn-horizontal class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="zone.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
<vn-icon icon="my_location"></vn-icon>
<a translate-attr="{title: 'Preview'}" ui-sref="zone.card.summary">
<vn-icon icon="desktop_windows"></vn-icon>
</a>
</vn-horizontal>
<div pad-medium>
<vn-label-value label="Id"
value="{{$ctrl.zone.id}}">
</vn-label-value>
<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>
</div>
</vn-card>

View File

@ -1,8 +0,0 @@
import ngModule from '../../module';
ngModule.component('vnZoneDescriptor', {
template: require('./index.html'),
bindings: {
zone: '<'
}
});

View File

@ -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();
});
});
});
});

View File

@ -1,2 +0,0 @@
Niche: Nichos
Barcode: Códigos de barras

View File

@ -79,7 +79,7 @@
medium-grey medium-grey
margin-medium-v margin-medium-v
vn-tooltip="Remove line" vn-tooltip="Remove line"
icon="remove_circle_outline" icon="delete"
ng-click="$ctrl.deleteClaimedSale(saleClaimed.id)" ng-click="$ctrl.deleteClaimedSale(saleClaimed.id)"
tabindex="-1"> tabindex="-1">
</vn-icon-button> </vn-icon-button>
@ -147,6 +147,7 @@
<vn-crud-model <vn-crud-model
vn-id="lastTicketsModel" vn-id="lastTicketsModel"
url="/claim/api/Tickets" url="/claim/api/Tickets"
limit="20"
data="lastTickets" auto-load="false"> data="lastTickets" auto-load="false">
</vn-crud-model> </vn-crud-model>
<!-- Transfer Popover --> <!-- Transfer Popover -->

View File

@ -26,7 +26,9 @@
<vn-label-value label="Attended by" <vn-label-value label="Attended by"
value="{{$ctrl.claim.worker.firstName}} {{$ctrl.claim.worker.name}}"> value="{{$ctrl.claim.worker.firstName}} {{$ctrl.claim.worker.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Ticket" ui-sref="ticket.card.summary({id: $ctrl.claim.ticketFk})" class="link"
value="{{$ctrl.claim.ticketFk}}">
</vn-label-value>
</vn-auto> </vn-auto>
</vn-vertical> </vn-vertical>
<vn-horizontal pad-small class="quicklinks"> <vn-horizontal pad-small class="quicklinks">

View File

@ -65,7 +65,7 @@
medium-grey medium-grey
margin-medium-v margin-medium-v
vn-tooltip="Remove sale" vn-tooltip="Remove sale"
icon="remove_circle_outline" icon="delete"
ng-click="$ctrl.deleteClaimedSale($index)" ng-click="$ctrl.deleteClaimedSale($index)"
tabindex="-1"> tabindex="-1">
</vn-icon-button> </vn-icon-button>

View File

@ -21,12 +21,6 @@
data="claimResponsibles" data="claimResponsibles"
order="description"> order="description">
</vn-crud-model> </vn-crud-model>
<vn-crud-model
url="/client/api/Clients/activeWorkersWithRole"
where="{role: 'salesPerson'}"
data="activeSalesPersons"
order="firstName">
</vn-crud-model>
<vn-crud-model <vn-crud-model
url="claim/api/ClaimRedeliveries" url="claim/api/ClaimRedeliveries"
data="claimRedeliveries" data="claimRedeliveries"
@ -78,8 +72,11 @@
vn-one vn-one
label="Worker" label="Worker"
field="claimDevelopment.workerFk" field="claimDevelopment.workerFk"
data="activeSalesPersons" url="/client/api/Clients/activeWorkersWithRole"
search-function="{firstName: $search}"
where="{role: 'employee'}"
show-field="firstName" show-field="firstName"
value-field="id"
vn-acl="salesAssistant"> vn-acl="salesAssistant">
<tpl-item>{{firstName}} {{name}}</tpl-item> <tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
@ -97,7 +94,7 @@
medium-grey medium-grey
margin-medium-v margin-medium-v
vn-tooltip="Remove sale" vn-tooltip="Remove sale"
icon="remove_circle_outline" icon="delete"
ng-click="model.remove($index)" ng-click="model.remove($index)"
tabindex="-1" tabindex="-1"
vn-acl="salesAssistant"> vn-acl="salesAssistant">

View File

@ -31,7 +31,10 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="claim in claims" ui-sref="claim.card.summary({id: claim.id})" class=clickable> <a
ng-repeat="claim in claims"
class="{{::$ctrl.compareDate(ticket.shipped)}} clickable vn-tr"
ui-sref="claim.card.summary({id: claim.id})">
<vn-td number>{{::claim.id}}</vn-td> <vn-td number>{{::claim.id}}</vn-td>
<vn-td> <vn-td>
<span class="link" ng-click="$ctrl.showDescriptor($event, claim.client.id)"> <span class="link" ng-click="$ctrl.showDescriptor($event, claim.client.id)">
@ -48,9 +51,12 @@
icon="desktop_windows"> icon="desktop_windows">
</vn-icon-button> </vn-icon-button>
</vn-td> </vn-td>
</vn-tr> </a>
</vn-tbody> </vn-tbody>
<vn-empty-rows ng-if="!model.data || model.data.length === 0" translate> <vn-empty-rows ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
<vn-empty-rows ng-if="model.data === null" translate>
Enter a new search Enter a new search
</vn-empty-rows> </vn-empty-rows>
</vn-table> </vn-table>

View File

@ -39,11 +39,12 @@
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
label="Worker"
field="filter.workerFk" field="filter.workerFk"
url="/claim/api/Workers" url="/client/api/Clients/activeWorkersWithRole"
show-field="firstName" search-function="{firstName: $search}"
value-field="id"> value-field="id"
where="{role: 'employee'}"
label="Worker">
<tpl-item>{{firstName}} {{name}}</tpl-item> <tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>

View File

@ -40,7 +40,7 @@
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-one margin-medium> <vn-one margin-medium-v>
<h5 translate>Detail</h5> <h5 translate>Detail</h5>
<vn-table model="model"> <vn-table model="model">
<vn-thead> <vn-thead>
@ -85,7 +85,7 @@
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-one margin-medium> <vn-one margin-medium-v>
<h5 translate>Development</h5> <h5 translate>Development</h5>
<vn-table model="model"> <vn-table model="model">
<vn-thead> <vn-thead>
@ -113,7 +113,7 @@
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-one margin-medium> <vn-one margin-medium-v>
<h5 translate>Action</h5> <h5 translate>Action</h5>
<vn-table model="model"> <vn-table model="model">
<vn-thead> <vn-thead>

View File

@ -84,7 +84,7 @@
medium-grey medium-grey
margin-medium-v margin-medium-v
vn-tooltip="Remove note" vn-tooltip="Remove note"
icon="remove_circle_outline" icon="delete"
ng-click="$ctrl.removeObservation($index)" ng-click="$ctrl.removeObservation($index)"
tabindex="-1"> tabindex="-1">
</vn-icon-button> </vn-icon-button>

View File

@ -32,7 +32,7 @@
medium-grey medium-grey
margin-medium-v margin-medium-v
vn-tooltip="Remove contact" vn-tooltip="Remove contact"
icon="remove_circle_outline" icon="delete"
ng-click="model.remove($index)"> ng-click="model.remove($index)">
</vn-icon> </vn-icon>
</vn-none> </vn-none>

View File

@ -100,7 +100,8 @@
<vn-check <vn-check
vn-one vn-one
label="Is equalizated" label="Is equalizated"
field="$ctrl.client.isEqualizated"> 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.">
</vn-check> </vn-check>
<vn-check <vn-check
vn-one vn-one

View File

@ -15,10 +15,9 @@ export default class Controller {
} }
copyData() { copyData() {
if (this.client) { if (this.client)
this.isEqualizated = this.client.isEqualizated; this.isEqualizated = this.client.isEqualizated;
} }
}
buyerHaspermissions() { buyerHaspermissions() {
if (!this.client) return true; if (!this.client) return true;
@ -26,8 +25,10 @@ export default class Controller {
} }
submit() { submit() {
if (this.isEqualizated != this.client.isEqualizated) if (this.isEqualizated != this.client.isEqualizated) {
this.oldHasToInvoiceByAddress = this.client.hasToInvoiceByAddress;
this.client.hasToInvoiceByAddress = false; this.client.hasToInvoiceByAddress = false;
}
return this.$.watcher.submit().then( return this.$.watcher.submit().then(
() => this.checkEtChanges()); () => this.checkEtChanges());
@ -37,18 +38,21 @@ export default class Controller {
let equals = this.isEqualizated == this.client.isEqualizated; let equals = this.isEqualizated == this.client.isEqualizated;
this.isEqualizated = this.client.isEqualizated; this.isEqualizated = this.client.isEqualizated;
if (!equals) if (!equals && !this.oldHasToInvoiceByAddress)
this.$.propagateIsEqualizated.show(); this.$.propagateIsEqualizated.show();
else if (!equals)
this.returnDialogEt('ACCEPT');
delete this.oldHasToInvoiceByAddress;
} }
returnDialogEt(response) { returnDialogEt(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then( this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then(
res => { res => {
if (res.data) { if (res.data)
this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded')); this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded'));
} }
}
); );
} }
} }

View File

@ -2,3 +2,4 @@ Yes, notify: Sí, notificar
You changed the equalization tax: Has cambiado el recargo de equivalencia 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? Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios?
Frozen: Congelado 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.

View File

@ -23,7 +23,11 @@
client="::client"> client="::client">
</vn-item-client> </vn-item-client>
<vn-empty-rows class="vn-list-item" style="text-align: center" <vn-empty-rows class="vn-list-item" style="text-align: center"
ng-if="!model.data || model.data.length === 0" translate> ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
<vn-empty-rows class="vn-list-item" style="text-align: center"
ng-if="model.data === null" translate>
Enter a new search Enter a new search
</vn-empty-rows> </vn-empty-rows>
</vn-card> </vn-card>

View File

@ -48,7 +48,7 @@
<vn-th>Reference</vn-th> <vn-th>Reference</vn-th>
<vn-th>Bank</vn-th> <vn-th>Bank</vn-th>
<vn-th>Debit</vn-th> <vn-th>Debit</vn-th>
<vn-th>Credit</vn-th> <vn-th>Havings</vn-th>
<vn-th>Balance</vn-th> <vn-th>Balance</vn-th>
<vn-th>Conciliated</vn-th> <vn-th>Conciliated</vn-th>
</vn-tr> </vn-tr>

View File

@ -4,3 +4,4 @@ Bank: Caja
Debit: Debe Debit: Debe
Conciliated: Conciliado Conciliated: Conciliado
New payment: Añadir pago New payment: Añadir pago
Havings: Haber

View File

@ -4,6 +4,8 @@ vn-dialog {
} }
} }
vn-client-summary .bold { vn-client-summary {
.bold {
font-family: vn-font-bold; font-family: vn-font-bold;
}
} }

View File

@ -13,18 +13,33 @@
<vn-table model="model"> <vn-table model="model">
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th></vn-th> <vn-th>State</vn-th>
<vn-th field="id">Id</vn-th> <vn-th field="id">Id</vn-th>
<vn-th field="amount" number>Amount</vn-th> <vn-th field="amount" number>Amount</vn-th>
<vn-th field="created" default-order="DESC">Payed</vn-th> <vn-th field="created" default-order="DESC">Payed</vn-th>
<vn-th></vn-th> <vn-th>Confirm</vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="transaction in transactions"> <vn-tr ng-repeat="transaction in transactions">
<vn-td style="width: 3em; text-align: center">
<vn-icon
vn-tooltip="{{$ctrl.getFormattedMessage(transaction)}}"
ng-show="::((transaction.errorMessage || transaction.responseMessage) && !transaction.isConfirmed)"
icon="clear">
</vn-icon>
<vn-icon
vn-tooltip="Confirmed"
ng-show="::(transaction.isConfirmed)"
icon="check">
</vn-icon>
</vn-td>
<vn-td>{{::transaction.id}}</vn-td>
<vn-td number>{{::transaction.amount | currency: '€':2}}</vn-td>
<vn-td>{{::transaction.created | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td style="width: 3em; text-align: center"> <vn-td style="width: 3em; text-align: center">
<vn-icon-button <vn-icon-button
icon="check" icon="done_all"
vn-acl="administrative" vn-acl="administrative"
vn-acl-action="remove" vn-acl-action="remove"
vn-tooltip="Confirm transaction" vn-tooltip="Confirm transaction"
@ -32,17 +47,6 @@
ng-click="$ctrl.confirm(transaction)"> ng-click="$ctrl.confirm(transaction)">
</vn-icon-button> </vn-icon-button>
</vn-td> </vn-td>
<vn-td>{{::transaction.id}}</vn-td>
<vn-td number>{{::transaction.amount | currency: '€':2}}</vn-td>
<vn-td>{{::transaction.created | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td style="width: 1px">
<vn-icon orange
vn-tooltip="{{$ctrl.getFormattedMessage(transaction)}}"
ng-show="::(transaction.errorMessage || transaction.responseMessage)"
icon="warning">
</vn-icon>
</vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
<vn-empty-rows ng-if="model.data.length === 0" translate> <vn-empty-rows ng-if="model.data.length === 0" translate>

View File

@ -1,4 +1,5 @@
import ngModule from '../module'; import ngModule from '../module';
import './style.scss';
class Controller { class Controller {
constructor($scope, $http, $stateParams) { constructor($scope, $http, $stateParams) {

View File

@ -2,3 +2,5 @@ Web Payment: Pago Web
Confirmed: Confirmado Confirmed: Confirmado
Payed: Pagado Payed: Pagado
Confirm transaction: Confirmar transacción Confirm transaction: Confirmar transacción
Confirm: Confirmar
State: Estado

View File

@ -0,0 +1,10 @@
@import "colors";
vn-client-web-payment {
vn-icon[icon=clear] {
color: $alert01;
}
vn-icon[icon=check] {
color: $main-02;
}
}

View File

@ -2,3 +2,8 @@
<input type="checkbox" class="mdl-checkbox__input"/> <input type="checkbox" class="mdl-checkbox__input"/>
<span class="mdl-checkbox__label" translate>{{::$ctrl.label}}</span> <span class="mdl-checkbox__label" translate>{{::$ctrl.label}}</span>
</label> </label>
<i class="material-icons"
ng-if="$ctrl.hasInfo"
vn-tooltip="{{$ctrl.info}}">
info_outline
</i>

View File

@ -3,11 +3,13 @@ import Input from '../../lib/input';
import './style.scss'; import './style.scss';
export default class Controller extends Input { export default class Controller extends Input {
constructor($element, $scope) { constructor($element, $scope, $attrs) {
super($element, $scope); super($element, $scope);
componentHandler.upgradeElement(this.element.firstChild); componentHandler.upgradeElement(this.element.firstChild);
this.mdlElement = this.element.firstChild.MaterialCheckbox; this.mdlElement = this.element.firstChild.MaterialCheckbox;
this.input.addEventListener('change', () => this.onChange()); this.input.addEventListener('change', () => this.onChange());
this.hasInfo = Boolean($attrs.info);
this.info = $attrs.info || null;
} }
set field(value) { set field(value) {
this._field = value; this._field = value;
@ -35,7 +37,7 @@ export default class Controller extends Input {
this.$.$applyAsync(); this.$.$applyAsync();
} }
} }
Controller.$inject = ['$element', '$scope', '$injector']; Controller.$inject = ['$element', '$scope', '$attrs'];
ngModule.component('vnCheck', { ngModule.component('vnCheck', {
template: require('./check.html'), template: require('./check.html'),

View File

@ -1,5 +1,16 @@
@import 'colors';
vn-check { vn-check {
position: relative;
& > .mdl-checkbox { & > .mdl-checkbox {
width: initial; width: initial;
} }
& > i {
padding-left: 5px;
position: absolute;
bottom: 3px;
color: $secondary-font-color;
font-size: 20px !important
}
} }

View File

@ -1,3 +1,5 @@
vn-icon-menu{ vn-icon-menu {
vn-drop-down {
font-family: 'vn-font'
}
} }

View File

@ -28,7 +28,7 @@
vn-acl="buyer,replenisher" vn-acl="buyer,replenisher"
pointer pointer
vn-tooltip="Remove barcode" vn-tooltip="Remove barcode"
icon="remove_circle_outline" icon="delete"
ng-click="model.remove($index)"> ng-click="model.remove($index)">
</vn-icon> </vn-icon>
</vn-none> </vn-none>

View File

@ -23,7 +23,11 @@
item="::item"> item="::item">
</vn-item-product> </vn-item-product>
<vn-empty-rows class="vn-list-item" style="text-align: center" <vn-empty-rows class="vn-list-item" style="text-align: center"
ng-if="!model.data || model.data.length === 0" translate> ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
<vn-empty-rows class="vn-list-item" style="text-align: center"
ng-if="model.data === null" translate>
Enter a new search Enter a new search
</vn-empty-rows> </vn-empty-rows>
</vn-card> </vn-card>

View File

@ -37,7 +37,7 @@
vn-acl="buyer,replenisher" vn-acl="buyer,replenisher"
pointer pointer
vn-tooltip="Remove niche" vn-tooltip="Remove niche"
icon="remove_circle_outline" icon="delete"
ng-click="model.remove($index)"> ng-click="model.remove($index)">
</vn-icon> </vn-icon>
</vn-none> </vn-none>

View File

@ -67,7 +67,7 @@
medium-grey medium-grey
margin-medium-v margin-medium-v
vn-tooltip="Remove tag" vn-tooltip="Remove tag"
icon="remove_circle_outline" icon="delete"
ng-click="filter.tags.splice($index, 1)" ng-click="filter.tags.splice($index, 1)"
tabindex="-1"> tabindex="-1">
</vn-icon-button> </vn-icon-button>

View File

@ -66,7 +66,7 @@
medium-grey medium-grey
margin-medium-v margin-medium-v
vn-tooltip="Remove tag" vn-tooltip="Remove tag"
icon="remove_circle_outline" icon="delete"
ng-click="model.remove($index)" ng-click="model.remove($index)"
tabindex="-1"> tabindex="-1">
</vn-icon-button> </vn-icon-button>

View File

@ -32,7 +32,7 @@ class Controller {
let json = encodeURIComponent(JSON.stringify(this.filter)); let json = encodeURIComponent(JSON.stringify(this.filter));
let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`; let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`;
this.$http.get(query).then(res => { this.$http.get(query).then(res => {
if (res.data) { if (res.data && res.data.rows) {
if (res.data.rows.length == 0) if (res.data.rows.length == 0)
delete res.data.rows; delete res.data.rows;
this.order = res.data; this.order = res.data;

View File

@ -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`, () => { it(`should make a query, save the data in order and call get order if the response has data`, () => {
spyOn(controller, 'getTotal'); spyOn(controller, 'getTotal');
let json = encodeURIComponent(JSON.stringify(controller.filter)); 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(); controller.getCard();
$httpBackend.flush(); $httpBackend.flush();
expect(controller.order).toEqual({id: 1}); expect(controller.order).toEqual({rows: [1, 2, 3]});
expect(controller.getTotal).toHaveBeenCalledWith(); expect(controller.getTotal).toHaveBeenCalledWith();
}); });

View File

@ -6,6 +6,24 @@ class Controller {
this.translate = $translate; 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 = {}) { set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks); this._quicklinks = Object.assign(value, this._quicklinks);
} }

View File

@ -6,3 +6,4 @@ Landed: F. entrega
Items: Articulos Items: Articulos
Agency: Agencia Agency: Agencia
Sales person: Comercial Sales person: Comercial
Order ticket list: Ticket del pedido

View File

@ -56,7 +56,10 @@
</vn-td> </vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
<vn-empty-rows ng-if="!model.data || model.data.length === 0" translate> <vn-empty-rows ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
<vn-empty-rows ng-if="model.data === null" translate>
Enter a new search Enter a new search
</vn-empty-rows> </vn-empty-rows>
</vn-table> </vn-table>

View File

@ -58,7 +58,7 @@
<vn-icon-button <vn-icon-button
medium-grey medium-grey
vn-tooltip="Remove item" vn-tooltip="Remove item"
icon="remove_circle_outline" icon="delete"
ng-click="$ctrl.removeRow($index)" ng-click="$ctrl.removeRow($index)"
tabindex="-1"> tabindex="-1">
</vn-icon-button> </vn-icon-button>

View File

@ -1,4 +1,4 @@
$main-font-color :#222222; $main-font-color:#222222;
$secondary-font-color: #9b9b9b; $secondary-font-color: #9b9b9b;
$main-header: #3d3d3d; $main-header: #3d3d3d;
$hover: rgba(0, 0, 0, 0.1); $hover: rgba(0, 0, 0, 0.1);
@ -10,7 +10,11 @@ $main-01-03: rgba($main-01, 0.3);
$main-02: #a3d131; $main-02: #a3d131;
$main-02-05: rgba($main-02, 0.5); $main-02-05: rgba($main-02, 0.5);
$main-02-03: rgba($main-02, 0.3); $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; $lines: #9b9b9b;
$alert01: #f42121;
$color-green: #a3d131; $color-green: #a3d131;
$color-orange: #f7931e; $color-orange: #f7931e;

View File

@ -1,8 +1,12 @@
@import "./colors"; @import "./colors";
.summary{ .summary{
h5 { h5:not(.title) {
padding: 7px;
background-color: $main-01-03;
border-bottom: 2px solid $main-01; border-bottom: 2px solid $main-01;
font-family: unset !important;
text-transform: uppercase;
} }
.title, p.title { .title, p.title {
border: none; border: none;

View File

@ -13,6 +13,7 @@
<vn-searchbar <vn-searchbar
panel="vn-ticket-search-panel" panel="vn-ticket-search-panel"
on-search="model.applyFilter(null, $params);" on-search="model.applyFilter(null, $params);"
filter="$ctrl.filter"
vn-focus> vn-focus>
</vn-searchbar> </vn-searchbar>
</vn-three> </vn-three>
@ -86,7 +87,10 @@
</vn-td> </vn-td>
</a> </a>
</vn-tbody> </vn-tbody>
<vn-empty-rows ng-if="!model.data || model.data.length === 0" translate> <vn-empty-rows ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
<vn-empty-rows ng-if="model.data === null" translate>
Enter a new search Enter a new search
</vn-empty-rows> </vn-empty-rows>
</vn-table> </vn-table>

View File

@ -9,6 +9,17 @@ export default class Controller {
this.moreOptions = [ this.moreOptions = [
{callback: this.goToTurns, name: 'Turns', always: true}, {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() { goToTurns() {

View File

@ -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

View File

@ -38,7 +38,7 @@
pointer pointer
medium-grey medium-grey
vn-tooltip="Remove note" vn-tooltip="Remove note"
icon="remove_circle_outline" icon="delete"
ng-click="model.remove($index)"> ng-click="model.remove($index)">
</vn-icon> </vn-icon>
</vn-auto> </vn-auto>

View File

@ -43,7 +43,7 @@
pointer pointer
medium-grey medium-grey
vn-tooltip="Remove package" vn-tooltip="Remove package"
icon="remove_circle_outline" icon="delete"
ng-click="model.remove($index)"> ng-click="model.remove($index)">
</vn-icon> </vn-icon>
</vn-one> </vn-one>

View File

@ -78,9 +78,16 @@
field="filter.stateFk" field="filter.stateFk"
url="/api/States"> url="/api/States">
</vn-autocomplete> </vn-autocomplete>
<vn-textfield
vn-one
label="Order id"
model="filter.orderFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-check <vn-check
vn-one vn-one
label="My tickets" label="My team"
field="filter.myTeam"> field="filter.myTeam">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>

View File

@ -8,4 +8,4 @@ Warehouse: Almacén
Sales person: Comercial Sales person: Comercial
Province: Provincia Province: Provincia
My team: Mi equipo My team: Mi equipo
My tickets: Mis tickets Order id: Id pedido

View File

@ -52,6 +52,8 @@
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-one margin-medium-v>
<h5 translate>Sale</h5>
<table class="vn-grid"> <table class="vn-grid">
<thead> <thead>
<tr> <tr>
@ -101,6 +103,105 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</vn-one>
</vn-horizontal>
<vn-horizontal>
<vn-one margin-medium-v ng-if="$ctrl.summary.packagings.length != 0">
<h5 translate>Packages</h5>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th number>Created</vn-th>
<vn-th number>Package</vn-th>
<vn-th number>Quantity</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="package in $ctrl.summary.packagings">
<vn-td number>{{package.created | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{package.packaging.item.name}}</vn-td>
<vn-td number>{{package.quantity}}</vn-td>
</vn-tr>
</vn-tbody>
<vn-empty-rows ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
</vn-table>
</vn-one>
<vn-one margin-medium ng-if="$ctrl.summary.services.length != 0">
<h5 translate>Service</h5>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th number>Id</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th number>Price</vn-th>
<vn-th>Tax class</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="service in $ctrl.summary.services">
<vn-td number>{{::service.id}}</vn-td>
<vn-td>{{::service.description}}</vn-td>
<vn-td number>{{::service.quantity}}</vn-td>
<vn-td number>{{::service.price}}</vn-td>
<vn-td>{{::service.taxClass.description}}</vn-td>
</vn-tr>
</vn-tbody>
<vn-empty-rows ng-if="$ctrl.summary.services.length === 0" translate>
No results
</vn-empty-rows>
</vn-table>
</vn-one>
</vn-horizontal>
<vn-horizontal ng-if="$ctrl.summary.requests.length != 0">
<vn-one margin-medium-v>
<h5 translate>Purchase request</h5>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th number>Id</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Created</vn-th>
<vn-th>Requester</vn-th>
<vn-th>Atender</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Sale id</vn-th>
<vn-th number>Ok</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="request in $ctrl.summary.requests">
<vn-td number>{{::request.id}}</vn-td>
<vn-td>{{::request.description}}</vn-td>
<vn-td number>{{::request.created | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::request.requester.firstName}} {{::request.requester.name}}</vn-td>
<vn-td>{{::request.atender.firstName}} {{::request.atender.name}}</vn-td>
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price}}</vn-td>
<vn-td number>
<span
ng-show="::request.saleFk"
ng-click="$ctrl.showDescriptor($event, request.sale)"
pointer class="link">
{{("000000"+request.saleFk).slice(-6)}}
</span>
</vn-td>
<vn-td number>
<vn-check vn-one
field="::request.isOk"
disabled="true">
</vn-check>
</vn-td>
</vn-tr>
</vn-tbody>
<vn-empty-rows ng-if="$ctrl.summary.requests.length === 0" translate>
No results
</vn-empty-rows>
</vn-table>
</vn-one>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>

View File

@ -230,7 +230,7 @@ export default {
itemTags: { itemTags: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
tagsButton: `vn-left-menu a[ui-sref="item.card.tags"]`, 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`, 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)`, 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`, 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"]`, addBarcodeButton: `vn-icon[icon="add_circle"]`,
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`, thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
submitBarcodesButton: `${components.vnSubmit}`, 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: { itemNiches: {
nicheButton: `vn-left-menu a[ui-sref="item.card.niche"]`, 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`, firstCodeInput: `vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input`,
secondWarehouseSelect: `vn-horizontal:nth-child(3) > vn-autocomplete[field="niche.warehouseFk"] input`, secondWarehouseSelect: `vn-horizontal:nth-child(3) > vn-autocomplete[field="niche.warehouseFk"] input`,
secondCodeInput: `vn-horizontal:nth-child(3) > vn-textfield[label="Code"] 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`, 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)`, 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`, thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Code"] input`,
@ -343,7 +343,7 @@ export default {
}, },
ticketNotes: { ticketNotes: {
notesButton: `vn-left-menu a[ui-sref="ticket.card.observation"]`, 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"]`, addNoteButton: `vn-icon[icon="add_circle"]`,
firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`, firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`,
firstNoteSelectSecondOption: `vn-autocomplete[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`, firstNoteSelectSecondOption: `vn-autocomplete[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`,

View File

@ -81,3 +81,4 @@ 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 ('TicketWeekly', '*', '*', 'employee');
INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('Receipt', '*', '*', 'administrative'); INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES ('Receipt', '*', '*', 'administrative');
INSERT INTO salix.fieldAcl (model,property,actionType,`role`) VALUES ('Zone','*','*','agency');

View File

@ -252,7 +252,6 @@ INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created
(10, 101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)), (10, 101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)),
(11, 101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -11 MONTH)), (11, 101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -11 MONTH)),
(12, 102, 9, 800, CURDATE()), (12, 102, 9, 800, CURDATE()),
(13, 103, 9, 200, CURDATE()),
(14, 104, 9, 90 , CURDATE()), (14, 104, 9, 90 , CURDATE()),
(15, 105, 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), (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), (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), (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`) INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`)
VALUES VALUES

View File

@ -37,7 +37,11 @@ module.exports = Self => {
case 'role': case 'role':
return {'r.name': value}; return {'r.name': value};
case 'firstName': 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': case 'id':
return {'w.id': value}; return {'w.id': value};
} }

View File

@ -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 () => { it('should throw an error if the client isnt frozen and is active, has data checked but has a debt', async () => {
let error; let error;
let params = {addressFk: 123}; let params = {
addressFk: 123,
landed: new Date()
};
await app.models.Order.new(params) await app.models.Order.new(params)
.catch(e => { .catch(e => {

View File

@ -63,6 +63,10 @@ module.exports = Self => {
arg: 'myTeam', arg: 'myTeam',
type: 'Boolean', type: 'Boolean',
description: `Whether to show only tickets for the current logged user team (For now it shows only the current user tickets)` 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: { returns: {
@ -79,10 +83,16 @@ module.exports = Self => {
let conn = Self.dataSource.connector; let conn = Self.dataSource.connector;
let worker = await Self.app.models.Worker.findOne({ 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) => { let where = buildFilter(ctx.args, (param, value) => {
switch (param) { switch (param) {
@ -102,6 +112,8 @@ module.exports = Self => {
return {'a.provinceFk': value}; return {'a.provinceFk': value};
case 'stateFk': case 'stateFk':
return {'ts.stateFk': value}; return {'ts.stateFk': value};
case 'orderFk':
return {'ot.orderFk': value};
case 'myTeam': case 'myTeam':
return {'c.salesPersonFk': {inq: teamIds}}; return {'c.salesPersonFk': {inq: teamIds}};
case 'id': case 'id':
@ -136,7 +148,8 @@ module.exports = Self => {
w.name AS warehouse, w.name AS warehouse,
am.name AS agencyMode, am.name AS agencyMode,
st.name AS state, st.name AS state,
wk.name AS salesPerson wk.name AS salesPerson,
ot.orderFk AS orderFk
FROM ticket t FROM ticket t
LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN province p ON p.id = a.provinceFk 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 ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk`); LEFT JOIN worker wk ON wk.id = c.salesPersonFk
stmt.merge(conn.makeSuffix(filter)); 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(stmt);
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems'); stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems');

View File

@ -26,6 +26,22 @@ module.exports = Self => {
summaryObj.subTotal = getSubTotal(summaryObj.sales); summaryObj.subTotal = getSubTotal(summaryObj.sales);
summaryObj.VAT = await models.Ticket.getVAT(ticketFk); summaryObj.VAT = await models.Ticket.getVAT(ticketFk);
summaryObj.total = await models.Ticket.getTotal(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; return summaryObj;
}; };
@ -98,6 +114,19 @@ module.exports = Self => {
return await Sale.find(filter); 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) { function getSubTotal(sales) {
let subTotal = 0.00; let subTotal = 0.00;

View File

@ -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"
}
}
}

View File

@ -31,6 +31,11 @@
"type": "belongsTo", "type": "belongsTo",
"model": "Account", "model": "Account",
"foreignKey": "userFk" "foreignKey": "userFk"
},
"collegues": {
"type": "hasMany",
"model": "WorkerTeamCollegues",
"foreignKey": "workerFk"
} }
} }
} }

View File

@ -165,6 +165,9 @@
"WorkerTeam": { "WorkerTeam": {
"dataSource": "vn" "dataSource": "vn"
}, },
"WorkerTeamCollegues": {
"dataSource": "vn"
},
"TicketRequest": { "TicketRequest": {
"dataSource": "vn" "dataSource": "vn"
}, },