Merge branch 'dev' into test
This commit is contained in:
commit
c11b32a091
|
@ -12,10 +12,10 @@
|
||||||
<vn-title>Address</vn-title>
|
<vn-title>Address</vn-title>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-check label="enabled" field="$ctrl.address.isEnabled"></vn-check>
|
<vn-check label="Enabled" field="$ctrl.address.isEnabled"></vn-check>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-check label="Is equalizated" field="$ctrl.address.isEqualizated"></vn-check>
|
<vn-check label="Is equalizated" field="$ctrl.address.isEqualizated" vn-acl="administrative"></vn-check>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
|
|
@ -6,24 +6,24 @@
|
||||||
<vn-title vn-one>Addresses</vn-title>
|
<vn-title vn-one>Addresses</vn-title>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal ng-repeat="i in index.model track by i.id" class="pad-medium-top" style="align-items: center;">
|
<vn-horizontal ng-repeat="i in index.model track by i.id" class="pad-medium-top" style="align-items: center;">
|
||||||
<vn-auto style="border-radius: .5em;" class="pad-small border-solid"
|
<vn-one border-radius class="pad-small border-solid"
|
||||||
ng-class="{'bg-dark-item': i.isDefaultAddress,'bg-opacity-item': !i.isEnabled && !i.isDefaultAddress}">
|
ng-class="{'bg-dark-item': i.isDefaultAddress,'bg-opacity-item': !i.isEnabled && !i.isDefaultAddress}">
|
||||||
<vn-horizontal style="align-items: center;">
|
<vn-horizontal style="align-items: center;">
|
||||||
<vn-none pad-medium-h style="color:#FFA410;">
|
<vn-none pad-medium-h style="color:#FFA410;">
|
||||||
<i class="material-icons" ng-if="i.isDefaultAddress">star</i>
|
<i class="material-icons" ng-if="i.isDefaultAddress">star</i>
|
||||||
<i class="material-icons pointer" ng-if="!i.isDefaultAddress&&i.isEnabled" vn-tooltip="Set as default" tooltip-position="left" ng-click="$ctrl.setDefault(i.id)">star_border</i>
|
<i class="material-icons pointer" ng-if="!i.isDefaultAddress&&i.isEnabled" vn-tooltip="Set as default" tooltip-position="left" ng-click="$ctrl.setDefault(i.id)">star_border</i>
|
||||||
</vn-none>
|
</vn-none>
|
||||||
<vn-auto>
|
<vn-one>
|
||||||
<div><b>{{::i.consignee}}</b></div>
|
<div><b>{{::i.consignee}}</b></div>
|
||||||
<div>{{::i.street}}</div>
|
<div>{{::i.street}}</div>
|
||||||
<div>{{::i.city}}, {{::i.province}}</div>
|
<div>{{::i.city}}, {{::i.province}}</div>
|
||||||
<div>{{::i.phone}}, {{::i.mobile}}</div>
|
<div>{{::i.phone}}, {{::i.mobile}}</div>
|
||||||
</vn-auto>
|
</vn-one>
|
||||||
<a vn-empty ui-sref="clientCard.addresses.edit({addressId: {{i.id}}})">
|
<a vn-auto ui-sref="clientCard.addresses.edit({addressId: {{i.id}}})">
|
||||||
<vn-icon-button icon="edit"></vn-icon-button>
|
<vn-icon-button icon="edit"></vn-icon-button>
|
||||||
</a>
|
</a>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-auto>
|
</vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
actions="$ctrl.client = edit.model"
|
actions="$ctrl.client = edit.model"
|
||||||
options="mgEdit">
|
options="mgEdit">
|
||||||
</mg-ajax>
|
</mg-ajax>
|
||||||
<vn-empty style="min-width: 18em; padding-left: 1em; padding-bottom: 1em;">
|
<vn-auto style="min-width: 18em; padding-left: 1em; padding-bottom: 1em;">
|
||||||
<vn-descriptor
|
<vn-descriptor
|
||||||
client="$ctrl.client"
|
client="$ctrl.client"
|
||||||
active="$ctrl.client.active"
|
active="$ctrl.client.active"
|
||||||
class="display-block" >
|
class="display-block" >
|
||||||
</vn-descriptor>
|
</vn-descriptor>
|
||||||
<vn-left-menu></vn-left-menu>
|
<vn-left-menu></vn-left-menu>
|
||||||
</vn-empty>
|
|
||||||
<vn-auto>
|
|
||||||
<vn-vertical style="max-width: 70em; margin: 0 auto;" ui-view></vn-vertical>
|
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
|
<vn-one>
|
||||||
|
<vn-vertical style="max-width: 70em; margin: 0 auto;" ui-view></vn-vertical>
|
||||||
|
</vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -20,13 +20,20 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Email" field="$ctrl.client.email" info="You can save multiple emails by chaining them using comma without spaces, example: user@domain.com,user2@domain.com the first email will be considered as the main"></vn-textfield>
|
<vn-textfield vn-one label="Email" field="$ctrl.client.email" info="You can save multiple emails by chaining them using comma without spaces, example: user@domain.com,user2@domain.com the first email will be considered as the main"></vn-textfield>
|
||||||
<vn-one></vn-one>
|
<vn-autocomplete vn-one
|
||||||
|
field="$ctrl.client.salesPersonFk"
|
||||||
|
url="/client/api/Clients/activeSalesPerson"
|
||||||
|
show-field="name"
|
||||||
|
value-field="id"
|
||||||
|
select-fields="surname"
|
||||||
|
label="Salesperson"
|
||||||
|
filter-search="{where: {or: [{name: {regexp: 'search'}}, {surname: {regexp: 'search'}}]}}"
|
||||||
|
></vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
<vn-submit label="Create and edit"></vn-submit>
|
<vn-submit label="Create"></vn-submit>
|
||||||
<vn-button label="Create" ng-click="watcher.submitBack()"></vn-button>
|
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal margin-small-bottom>
|
<vn-horizontal margin-small-bottom>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-check label="Equalization tax" field="$ctrl.client.equalizationTax" vn-acl="administrative" vn-acl="administrative"></vn-check>
|
<vn-check label="Equalization tax" field="$ctrl.client.equalizationTax" vn-acl="administrative"></vn-check>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-check label="Invoice by address" field="$ctrl.client.hasToInvoiceByAddress" vn-acl="administrative" vn-acl="administrative"></vn-check>
|
<vn-check label="Invoice by address" field="$ctrl.client.hasToInvoiceByAddress" vn-acl="administrative"></vn-check>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one></vn-one>
|
<vn-one></vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
<vn-check label="Invoice by mail" field="$ctrl.client.invoiceByEmail" vn-acl="administrative"></vn-check>
|
<vn-check label="Invoice by mail" field="$ctrl.client.invoiceByEmail" vn-acl="administrative"></vn-check>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-check label="Vies" field="$ctrl.client.vies" vn-acl="administrative" vn-acl="administrative"></vn-check>
|
<vn-check label="Vies" field="$ctrl.client.vies" vn-acl="administrative"></vn-check>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
<div style="max-width: 40em; margin: 0 auto;">
|
<div style="max-width: 40em; margin: 0 auto;">
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<vn-horizontal pad-medium>
|
<vn-horizontal pad-medium>
|
||||||
<vn-searchbar vn-auto
|
<vn-searchbar vn-one
|
||||||
index="index"
|
index="index"
|
||||||
on-search="$ctrl.search(index)"
|
on-search="$ctrl.search(index)"
|
||||||
advanced="true"
|
advanced="true"
|
||||||
popover="vn-client-search-panel">
|
popover="vn-client-search-panel"
|
||||||
|
ignore-keys = "['page', 'size', 'search']"
|
||||||
|
>
|
||||||
</vn-searchbar>
|
</vn-searchbar>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -18,19 +18,19 @@ describe('Client', () => {
|
||||||
expect(controller.model).toEqual({});
|
expect(controller.model).toEqual({});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('search()', () => {
|
// describe('search()', () => {
|
||||||
it(`should set model's search to the search input`, () => {
|
// it(`should set model's search to the search input`, () => {
|
||||||
controller.model.search = 'batman';
|
// controller.model.search = 'batman';
|
||||||
let index = {
|
// let index = {
|
||||||
filter: {},
|
// filter: {},
|
||||||
accept: () => {
|
// accept: () => {
|
||||||
return 'accepted';
|
// return 'accepted';
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
controller.search(index);
|
// controller.search(index);
|
||||||
|
|
||||||
expect(index.filter.search).toBe('batman');
|
// expect(index.filter.search).toBe('batman');
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,5 +10,6 @@
|
||||||
"Postcode": "Código postal",
|
"Postcode": "Código postal",
|
||||||
"Province": "Provincia",
|
"Province": "Provincia",
|
||||||
"Save": "Guardar",
|
"Save": "Guardar",
|
||||||
"Pay method" : "Forma de pago"
|
"Pay method" : "Forma de pago",
|
||||||
|
"Address": "Consignatario"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
<vn-card ng-show="$ctrl.observations.length" pad-medium>
|
<vn-card ng-show="$ctrl.observations.length" pad-medium>
|
||||||
<vn-vertical pad-large>
|
<vn-vertical pad-large>
|
||||||
<vn-title>Notes</vn-title>
|
<vn-title>Notes</vn-title>
|
||||||
<vn-horizontal ng-repeat="n in $ctrl.observations" margin-small-bottom style="align-items: center;">
|
<vn-one
|
||||||
<vn-auto style="border-radius: .3em;" class="pad-small border-solid">
|
ng-repeat="n in $ctrl.observations"
|
||||||
<div class="notes-date">{{::n.created | date:'dd/MM/yyyy HH:mm'}}</div>
|
pad-small border-solid
|
||||||
<div class="notes-date">{{::n.employee.name}}</div>
|
border-radius
|
||||||
<div>{{::n.text}}</div>
|
margin-small-bottom style="align-items: center;">
|
||||||
</vn-auto>
|
<vn-horizontal>
|
||||||
</vn-horizontal>
|
<vn-one >{{::n.employee.name}} {{::n.employee.surname}}</vn-one>
|
||||||
|
<vn-auto>{{::n.created | date:'dd/MM/yyyy HH:mm'}}</vn-auto>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<b>{{::n.text}}</b>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-one>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-float-button
|
<vn-float-button
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
.notes-date {
|
|
||||||
font-family: raleway-bold;
|
|
||||||
}
|
|
|
@ -16,26 +16,26 @@ describe('Client', () => {
|
||||||
controller = $componentController('vnClientSearchPanel', {sessionStorage: sessionStorage});
|
controller = $componentController('vnClientSearchPanel', {sessionStorage: sessionStorage});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('onSearch()', () => {
|
// describe('onSearch()', () => {
|
||||||
it('should call setStorageValue() and onSubmit()', () => {
|
// it('should call setStorageValue() and onSubmit()', () => {
|
||||||
spyOn(controller, 'setStorageValue');
|
// spyOn(controller, 'setStorageValue');
|
||||||
spyOn(controller, 'onSubmit');
|
// spyOn(controller, 'onSubmit');
|
||||||
controller.setStorageValue();
|
// controller.setStorageValue();
|
||||||
controller.onSubmit();
|
// controller.onSubmit();
|
||||||
|
|
||||||
expect(controller.setStorageValue).toHaveBeenCalledWith();
|
// expect(controller.setStorageValue).toHaveBeenCalledWith();
|
||||||
expect(controller.onSubmit).toHaveBeenCalledWith();
|
// expect(controller.onSubmit).toHaveBeenCalledWith();
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
describe('$onChanges()', () => {
|
// describe('$onChanges()', () => {
|
||||||
it('should set filter properties using the search values', () => {
|
// it('should set filter properties using the search values', () => {
|
||||||
expect(controller.filter).not.toBeDefined();
|
// expect(controller.filter).not.toBeDefined();
|
||||||
spyOn(sessionStorage, 'get').and.returnValue({data: 'data'});
|
// spyOn(sessionStorage, 'get').and.returnValue({data: 'data'});
|
||||||
controller.$onChanges();
|
// controller.$onChanges();
|
||||||
|
|
||||||
expect(controller.filter).toBe(sessionStorage.get({data: 'data'}));
|
// expect(controller.filter).toBe(sessionStorage.get({data: 'data'}));
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,14 @@ function index(mgIndex) {
|
||||||
}
|
}
|
||||||
module.factory('vnIndex', index);
|
module.factory('vnIndex', index);
|
||||||
|
|
||||||
|
nonAuto.$inject = ['mgIndex'];
|
||||||
|
function nonAuto(mgIndex) {
|
||||||
|
return Object.assign({}, mgIndex, {
|
||||||
|
auto: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
module.factory('vnIndexNonAuto', nonAuto);
|
||||||
|
|
||||||
successFactoryCreate.$inject = ['mgSuccessFactoryCreate'];
|
successFactoryCreate.$inject = ['mgSuccessFactoryCreate'];
|
||||||
function successFactoryCreate(create) {
|
function successFactoryCreate(create) {
|
||||||
return Object.assign({}, create, {
|
return Object.assign({}, create, {
|
||||||
|
|
|
@ -1,33 +1,30 @@
|
||||||
<mg-ajax path="/production/api/States/list" options="vnIndex as states" actions="$ctrl.states = states.model;"></mg-ajax>
|
<mg-ajax path="/production/api/States/list" options="vnIndex as states" actions="$ctrl.states = states.model;"></mg-ajax>
|
||||||
|
<mg-ajax path="/production/api/FakeProductions/list" options="vnIndexNonAuto as index"></mg-ajax>
|
||||||
<vn-card margin-large>
|
<vn-card margin-large>
|
||||||
<vn-vertical pad-medium>
|
<vn-vertical pad-medium>
|
||||||
<vn-horizontal vn-one margin-large-bottom class="locator-header">
|
<vn-horizontal vn-one margin-large-bottom class="locator-header">
|
||||||
<vn-title vn-one><span translate>Finder</span></vn-title>
|
<vn-title vn-one><span translate>Finder</span></vn-title>
|
||||||
|
|
||||||
<form vn-two vn-horizontal class="filterPanel" ng-submit="$ctrl.searchTickets()">
|
<vn-searchbar vn-two
|
||||||
<vn-textfield vn-one label="Filtro" model="$ctrl.search"></vn-textfield>
|
index="index"
|
||||||
<vn-icon
|
on-search="$ctrl.searchTickets(index.filter)"
|
||||||
vn-none
|
advanced="true"
|
||||||
margin-medium-right
|
popover="vn-production-filter-panel"
|
||||||
pad-medium-top
|
ignore-keys = "['page', 'size', 'search', 'warehouseFk']"
|
||||||
icon="keyboard_arrow_down"
|
>
|
||||||
ng-click="$ctrl.moreFilters($event)">
|
</vn-searchbar>
|
||||||
</vn-icon>
|
|
||||||
<vn-button vn-none pad-small-top label="Filtrar" ng-click="$ctrl.searchTickets()"></vn-button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<vn-one vn-horizontal>
|
<vn-one vn-horizontal>
|
||||||
<vn-one></vn-one>
|
<vn-one></vn-one>
|
||||||
<vn-autocomplete vn-two
|
<vn-autocomplete vn-two
|
||||||
initial-value="$ctrl.filter.warehouseFk"
|
initial-value="$ctrl.filter.warehouseFk"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
field="$ctrl.filter.warehouseFk"
|
field="$ctrl.filter.warehouseFk"
|
||||||
url="/production/api/Warehouses/production"
|
url="/production/api/Warehouses/production"
|
||||||
on-change = "$ctrl.onChangeWareHouse(item)"
|
on-change = "$ctrl.onChangeWareHouse(item)"
|
||||||
label="Store">
|
label="Store"
|
||||||
</vn-autocomplete>
|
></vn-autocomplete>
|
||||||
<vn-icon-button vn-none pad-ten-top margin-medium-left icon="refresh" ng-click="$ctrl.refreshTickets()"></vn-icon-button>
|
<vn-icon-button vn-none pad-ten-top margin-medium-left icon="refresh" ng-click="$ctrl.refreshTickets()"></vn-icon-button>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -2,11 +2,10 @@ import ngModule from '../module';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
export default class ProductionIndex {
|
export default class ProductionIndex {
|
||||||
constructor($element, $scope, $http, vnPopover, aclConstant) {
|
constructor($element, $scope, $http, aclConstant) {
|
||||||
this.$element = $element;
|
this.$element = $element;
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
this.vnPopover = vnPopover;
|
|
||||||
this.filter = {};
|
this.filter = {};
|
||||||
this.tickets = [];
|
this.tickets = [];
|
||||||
this.states = [];
|
this.states = [];
|
||||||
|
@ -23,17 +22,6 @@ export default class ProductionIndex {
|
||||||
this.filter.warehouseFk = this.userProfile.warehouseId;
|
this.filter.warehouseFk = this.userProfile.warehouseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
get search() {
|
|
||||||
return this._search;
|
|
||||||
}
|
|
||||||
set search(value) {
|
|
||||||
this._search = value;
|
|
||||||
this.filter.q = value;
|
|
||||||
if (!value) {
|
|
||||||
this.searchTickets();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get checkAll() {
|
get checkAll() {
|
||||||
return this._checkAll;
|
return this._checkAll;
|
||||||
}
|
}
|
||||||
|
@ -72,55 +60,21 @@ export default class ProductionIndex {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
moreFilters(event) {
|
|
||||||
this.child = this.vnPopover.showComponent('vn-production-filter-panel', this.$, this.$element[0].querySelector('.filterPanel'));
|
|
||||||
var childCtrl = angular.element(this.child).isolateScope().$ctrl;
|
|
||||||
childCtrl.filter = Object.assign({}, this.filter);
|
|
||||||
childCtrl.data = Object.assign({}, {states: this.states}, {hourItems: this.hourItems});
|
|
||||||
childCtrl.onSubmit = filter => this.onChildSubmit(filter);
|
|
||||||
childCtrl.onCancel = () => this.onChildCancel();
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
onChildSubmit(filter) {
|
|
||||||
let newFilter = {};
|
|
||||||
Object.keys(filter).forEach(
|
|
||||||
field => {
|
|
||||||
if (filter[field] !== null) {
|
|
||||||
newFilter[field] = filter[field];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.searchTickets(newFilter);
|
|
||||||
this.onChildCancel();
|
|
||||||
}
|
|
||||||
onChildCancel() {
|
|
||||||
angular.element(this.child).scope().$destroy();
|
|
||||||
angular.element(this.child).remove();
|
|
||||||
delete this.child;
|
|
||||||
}
|
|
||||||
searchTickets(filter) {
|
searchTickets(filter) {
|
||||||
this.filter = Object.assign({}, this.filter, filter || {});
|
this.$.index.filter.filter = Object.assign({}, this.filter, filter || {});
|
||||||
let filters = Object.assign({}, {
|
|
||||||
where: this.filter
|
|
||||||
}, {
|
|
||||||
page: 1,
|
|
||||||
limit: 1000
|
|
||||||
});
|
|
||||||
this.checkAll = 0;
|
this.checkAll = 0;
|
||||||
this.$http.get('/production/api/FakeProductions/list?filter=' + JSON.stringify(filters)).then(
|
this.$.index.accept().then(
|
||||||
json => {
|
json => {
|
||||||
this.tickets = json.data.tickets;
|
this.tickets = json.tickets;
|
||||||
this.footer.lines = json.data.lines;
|
this.footer.lines = json.lines;
|
||||||
this.footer.meters = json.data.m3;
|
this.footer.meters = json.m3;
|
||||||
this.footer.total = json.data.total;
|
this.footer.total = json.total;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
refreshTickets() {
|
refreshTickets() {
|
||||||
this.filter = {};
|
this.filter = {};
|
||||||
this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId;
|
this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId;
|
||||||
this.search = null;
|
|
||||||
}
|
}
|
||||||
onChangeWareHouse(warehouse) {
|
onChangeWareHouse(warehouse) {
|
||||||
if (warehouse && warehouse != this.filter.warehouseFk) {
|
if (warehouse && warehouse != this.filter.warehouseFk) {
|
||||||
|
@ -141,7 +95,7 @@ export default class ProductionIndex {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductionIndex.$inject = ['$element', '$scope', '$http', 'vnPopover', 'aclConstant'];
|
ProductionIndex.$inject = ['$element', '$scope', '$http', 'aclConstant'];
|
||||||
|
|
||||||
ngModule.component('vnProductionIndex', {
|
ngModule.component('vnProductionIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
actions="$ctrl.route = edit.model"
|
actions="$ctrl.route = edit.model"
|
||||||
options="mgEdit">
|
options="mgEdit">
|
||||||
</mg-ajax>
|
</mg-ajax>
|
||||||
<vn-empty style="min-width: 18em; padding-left: 1em; padding-bottom: 1em;">
|
<vn-one style="min-width: 18em; padding-left: 1em; padding-bottom: 1em;">
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<vn-vertical class="margin-medium" pad-medium-top pad-medium-bottom>
|
<vn-vertical class="margin-medium" pad-medium-top pad-medium-bottom>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-left-menu></vn-left-menu>
|
<vn-left-menu></vn-left-menu>
|
||||||
</vn-empty>
|
</vn-one>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<vn-vertical style="max-width: 70em; margin: 0 auto;" ui-view></vn-vertical>
|
<vn-vertical style="max-width: 70em; margin: 0 auto;" ui-view></vn-vertical>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<vn-vertical full-height class="bg-content">
|
<vn-vertical full-height class="bg-content">
|
||||||
<vn-topbar vn-empty>
|
<vn-topbar vn-auto>
|
||||||
<a ui-sref="home" title="{{'Home' | translate}}">
|
<a ui-sref="home" title="{{'Home' | translate}}">
|
||||||
<img class="logo" src="./logo.svg" alt="Logo" ></img>
|
<img class="logo" src="./logo.svg" alt="Logo" ></img>
|
||||||
</a>
|
</a>
|
||||||
<vn-spinner enable="$root.loading"></vn-spinner>
|
<vn-spinner enable="$root.loading"></vn-spinner>
|
||||||
<vn-main-menu></vn-main-menu>
|
<vn-main-menu></vn-main-menu>
|
||||||
</vn-topbar>
|
</vn-topbar>
|
||||||
<vn-vertical vn-auto ui-view scrollable class="main-view">
|
<vn-vertical vn-one ui-view scrollable class="main-view">
|
||||||
<vn-home></vn-home>
|
<vn-home></vn-home>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
<vn-snackbar vn-id="snackbar"></vn-snackbar>
|
<vn-snackbar vn-id="snackbar"></vn-snackbar>
|
||||||
|
|
|
@ -23,7 +23,7 @@ export default class Controller {
|
||||||
if (this.stringSearch) {
|
if (this.stringSearch) {
|
||||||
// find pattern key:value or key:(extra value) and returns array
|
// find pattern key:value or key:(extra value) and returns array
|
||||||
find = toFind.match(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi);
|
find = toFind.match(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi);
|
||||||
// remove pattern key:value or key:(extra value) from string
|
// remove pattern key:value or key:(extra value) from string and returns string
|
||||||
this.index.filter.search = (toFind.replace(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi, '')).trim();
|
this.index.filter.search = (toFind.replace(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi, '')).trim();
|
||||||
if (find)
|
if (find)
|
||||||
for (let i = 0; i < find.length; i++) {
|
for (let i = 0; i < find.length; i++) {
|
||||||
|
@ -40,7 +40,8 @@ export default class Controller {
|
||||||
let keys = Object.keys(filter);
|
let keys = Object.keys(filter);
|
||||||
if (keys.length) {
|
if (keys.length) {
|
||||||
keys.forEach(k => {
|
keys.forEach(k => {
|
||||||
if (k !== 'page' && k !== 'size' && k !== 'search') {
|
let ignore = (this.ignoreKeys && this.ignoreKeys instanceof Array && this.ignoreKeys.indexOf(k) !== -1);
|
||||||
|
if (!ignore) {
|
||||||
let value = filter[k];
|
let value = filter[k];
|
||||||
|
|
||||||
if (typeof value === 'string' && value.indexOf(' ') !== -1) {
|
if (typeof value === 'string' && value.indexOf(' ') !== -1) {
|
||||||
|
@ -110,7 +111,8 @@ ngModule.component('vnSearchbar', {
|
||||||
onSearch: '&',
|
onSearch: '&',
|
||||||
advanced: '=',
|
advanced: '=',
|
||||||
popover: '@',
|
popover: '@',
|
||||||
label: '@?'
|
label: '@?',
|
||||||
|
ignoreKeys: '<?'
|
||||||
},
|
},
|
||||||
controller: Controller
|
controller: Controller
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,3 +43,9 @@ html [border-dashed-right], .border-dashed-right {
|
||||||
html [border-dashed-bottom], .border-dashed-bottom {
|
html [border-dashed-bottom], .border-dashed-bottom {
|
||||||
border-bottom: $border-thin dashed $border-color;
|
border-bottom: $border-thin dashed $border-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Border Radius */
|
||||||
|
|
||||||
|
html [border-radius], .border-radius {
|
||||||
|
border-radius: .3em;
|
||||||
|
}
|
|
@ -61,12 +61,8 @@ html [vn-twelve]{
|
||||||
flex-basis: 0.000000001px;
|
flex-basis: 0.000000001px;
|
||||||
}
|
}
|
||||||
html [vn-auto], vn-auto, .vn-auto {
|
html [vn-auto], vn-auto, .vn-auto {
|
||||||
flex: 1;
|
|
||||||
flex-basis: auto;
|
flex-basis: auto;
|
||||||
}
|
}
|
||||||
html [vn-empty], vn-empty, .vn-empty {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
html [vn-none], vn-none, .vn-none {
|
html [vn-none], vn-none, .vn-none {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex: none;
|
flex: none;
|
||||||
|
|
|
@ -42,10 +42,10 @@ module.exports = function(Client) {
|
||||||
|
|
||||||
let currentDate = new Date();
|
let currentDate = new Date();
|
||||||
|
|
||||||
if (data && client.active && (data.ended >= currentDate || data.ended == null)) {
|
if (data && client.active && (data.ended >= currentDate || data.ended == null)) {
|
||||||
let host = ctx.req.headers.host.split(':')[0];
|
let referer = ctx.req.headers.referer;
|
||||||
var options = {
|
var options = {
|
||||||
url: `http://${host}:5000/mailer/notification/client-deactivate/${client.id}`,
|
url: `${referer}/mailer/notification/client-deactivate/${client.id}`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
|
|
|
@ -29,9 +29,9 @@ module.exports = function(Client) {
|
||||||
&& instance.dueDay == ctx.data.dueDay)
|
&& instance.dueDay == ctx.data.dueDay)
|
||||||
ctx.data.dueDay = 5;
|
ctx.data.dueDay = 5;
|
||||||
|
|
||||||
if (instance.fi && ctx.data.equalizationTax && !canMarkEqualizationTax(instance)){
|
if (instance.fi && ctx.data.equalizationTax && !canMarkEqualizationTax(instance)) {
|
||||||
next(generateErrorEqualizationTax());
|
next(generateErrorEqualizationTax());
|
||||||
} else if (instance.equalizationTax !== undefined && instance.equalizationTax && ctx.data.fi && canMarkEqualizationTax(ctx.data)){
|
} else if (instance.equalizationTax !== undefined && instance.equalizationTax && ctx.data.fi && canMarkEqualizationTax(ctx.data)) {
|
||||||
next(generateErrorEqualizationTax());
|
next(generateErrorEqualizationTax());
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -38,7 +38,8 @@ module.exports = function(Client) {
|
||||||
fi: data.fi,
|
fi: data.fi,
|
||||||
socialName: data.socialName,
|
socialName: data.socialName,
|
||||||
id: account.id,
|
id: account.id,
|
||||||
email: data.email
|
email: data.email,
|
||||||
|
salesPersonFk: data.salesPersonFk
|
||||||
};
|
};
|
||||||
|
|
||||||
Client.create(client, {transaction}, (error, newClient) => {
|
Client.create(client, {transaction}, (error, newClient) => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = (Client) => {
|
module.exports = Client => {
|
||||||
Client.remoteMethod('activeSalesPerson', {
|
Client.remoteMethod('activeSalesPerson', {
|
||||||
description: 'returns actives employees with salesperson role',
|
description: 'returns actives employees with salesperson role',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
|
@ -23,17 +23,17 @@ module.exports = (Client) => {
|
||||||
Client.activeSalesPerson = (filter, callback) => {
|
Client.activeSalesPerson = (filter, callback) => {
|
||||||
let skip = filter.skip || 0;
|
let skip = filter.skip || 0;
|
||||||
let limit = filter.limit || 10;
|
let limit = filter.limit || 10;
|
||||||
let where = getCondition(filter.where);
|
let where = getCondition(filter.where, limit, skip);
|
||||||
|
|
||||||
let query = `SELECT em.id, em.name, em.surname
|
let query = `SELECT em.id, em.name, em.surname
|
||||||
FROM Employee em
|
FROM Employee em
|
||||||
JOIN Account ac ON em.userFk = ac.id
|
JOIN Account ac ON em.userFk = ac.id
|
||||||
JOIN Role ON Role.id = ac.roleFK
|
JOIN Role ON Role.id = ac.roleFK
|
||||||
WHERE ac.active AND Role.\`name\`='salesPerson' ${where.cond}
|
WHERE ac.active AND Role.\`name\`='salesPerson' ${where.sql}
|
||||||
ORDER BY em.name ASC
|
ORDER BY em.name ASC
|
||||||
LIMIT ? OFFSET ?`;
|
LIMIT ? OFFSET ?`;
|
||||||
|
|
||||||
Client.rawSql(query, [where.value, parseInt(limit, 10), parseInt(skip, 10)], callback)
|
Client.rawSql(query, where.params, callback)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
callback(null, formatSalesPerson(response));
|
callback(null, formatSalesPerson(response));
|
||||||
})
|
})
|
||||||
|
@ -42,10 +42,21 @@ module.exports = (Client) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function getCondition(where) {
|
function getCondition(where, limit, skip) {
|
||||||
let out = {};
|
let out = {
|
||||||
out.cond = (typeof where === 'object' && where.name && where.name.regexp) ? `AND em.name regexp ?` : '?';
|
sql: '',
|
||||||
out.value = (typeof where === 'object' && where.name && where.name.regexp) ? where.name.regexp : '';
|
params: []
|
||||||
|
};
|
||||||
|
if (where && where.or) {
|
||||||
|
out.sql = `AND (em.name regexp ? OR em.surname regexp ?)`;
|
||||||
|
where.or.forEach(val => {
|
||||||
|
Object.keys(val).forEach(key => {
|
||||||
|
out.params.push(val[key].regexp);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
out.params.push(parseInt(limit, 10));
|
||||||
|
out.params.push(parseInt(skip, 10));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ router.get('/client-welcome/:clientId', function(request, response, next) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sepa core
|
// Sepa core
|
||||||
router.post('/sepa-core/:clientId', function(request, response, next) {
|
/* router.post('/sepa-core/:clientId', function(request, response, next) {
|
||||||
var options = {
|
var options = {
|
||||||
url: 'http://localhost:3008/manuscript/sepa-core/7422',
|
url: 'http://localhost:3008/manuscript/sepa-core/7422',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -79,7 +79,7 @@ router.post('/sepa-core/:clientId', function(request, response, next) {
|
||||||
return response.status(400).json({message: error.message});
|
return response.status(400).json({message: error.message});
|
||||||
|
|
||||||
return response.json();
|
return response.json();
|
||||||
}); */
|
});
|
||||||
});
|
}); */
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -64,10 +64,10 @@ var settings = require('../settings.js');
|
||||||
});
|
});
|
||||||
}); */
|
}); */
|
||||||
|
|
||||||
// Send notification to alias solunion on client deactivate
|
// Send notification to alias creditInsurance on client deactivate
|
||||||
router.post('/client-deactivate/:clientId', function(request, response) {
|
router.post('/client-deactivate/:clientId', function(request, response) {
|
||||||
var params = {
|
var params = {
|
||||||
alias: 'solunion',
|
alias: 'creditInsurance',
|
||||||
code: 'clientDeactivate',
|
code: 'clientDeactivate',
|
||||||
bodyParams: {
|
bodyParams: {
|
||||||
clientId: request.params.clientId
|
clientId: request.params.clientId
|
||||||
|
|
|
@ -3,10 +3,10 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
Self.list = function(ctx, filter, callback) {
|
Self.list = function(ctx, filter, callback) {
|
||||||
let daysTickets = 0;
|
let daysTickets = 0;
|
||||||
let warehouseFk = filter.where.warehouseFk;
|
let warehouseFk = filter.warehouseFk;
|
||||||
delete filter.limit;
|
delete filter.limit;
|
||||||
delete filter.page;
|
delete filter.page;
|
||||||
delete filter.where.warehouseFk;
|
delete filter.warehouseFk;
|
||||||
|
|
||||||
let call = `call salix.production_control_source(? , ?)`;
|
let call = `call salix.production_control_source(? , ?)`;
|
||||||
var params = [warehouseFk, daysTickets];
|
var params = [warehouseFk, daysTickets];
|
||||||
|
@ -25,17 +25,19 @@ module.exports = function(Self) {
|
||||||
onFinish(err);
|
onFinish(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
reBuildFilter();
|
buildWhereObject();
|
||||||
|
|
||||||
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
|
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
|
||||||
let query = `SELECT * FROM tmp.production ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
|
let query = `SELECT * FROM tmp.production ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
|
||||||
conn.query(query, where.params, onFinish);
|
conn.query(query, where.params, onFinish);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reBuildFilter() {
|
function buildWhereObject() {
|
||||||
if (filter.where && filter.where.q) {
|
let newFilter = {};
|
||||||
let regexQ = new RegExp(filter.where.q);
|
if (filter.q) {
|
||||||
delete filter.where.q;
|
let regexQ = new RegExp(filter.q);
|
||||||
let newFilter = {
|
delete filter.q;
|
||||||
|
newFilter = {
|
||||||
and: [
|
and: [
|
||||||
{
|
{
|
||||||
or: [
|
or: [
|
||||||
|
@ -46,17 +48,20 @@ module.exports = function(Self) {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Object.keys(filter.where).length) {
|
if (Object.keys(filter).length) {
|
||||||
Object.keys(filter.where).forEach(
|
Object.keys(filter).forEach(
|
||||||
key => {
|
key => {
|
||||||
let field = {};
|
let field = {};
|
||||||
field[key] = filter.where[key];
|
field[key] = filter[key];
|
||||||
newFilter.and.push(field);
|
newFilter.and.push(field);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
filter.where = newFilter;
|
} else if (Object.keys(filter).length) {
|
||||||
|
newFilter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filter.where = newFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFinish(err, results) {
|
function onFinish(err, results) {
|
||||||
|
|
Loading…
Reference in New Issue