dev #1731

Merged
jgallego merged 105 commits from dev into test 2023-08-31 09:13:29 +00:00
7 changed files with 30 additions and 14 deletions
Showing only changes of commit 7dd5a5ac8e - Show all commits

View File

@ -0,0 +1,3 @@
INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId)
VALUES
('Worker', 'search', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -17,10 +17,9 @@ import './style.scss';
* @event change Thrown when value is changed
*/
export default class Autocomplete extends Field {
constructor($element, $, $compile, $transclude) {
super($element, $, $compile);
constructor($element, $, $transclude) {
super($element, $, $transclude);
this.$transclude = $transclude;
this.$compile = $compile;
this._selection = null;
this.input = this.element.querySelector('input');
}
@ -282,7 +281,7 @@ export default class Autocomplete extends Field {
this.refreshSelection();
}
}
Autocomplete.$inject = ['$element', '$scope', '$compile', '$transclude'];
Autocomplete.$inject = ['$element', '$scope', '$transclude'];
ngModule.vnComponent('vnAutocomplete', {
template: require('./index.html'),

View File

@ -3,8 +3,8 @@ import FormInput from '../form-input';
import './style.scss';
export default class Field extends FormInput {
constructor($element, $scope) {
super($element, $scope);
constructor($element, $scope, $transclude) {
super($element, $scope, $transclude);
this.prefix = null;
this.suffix = null;
@ -197,7 +197,7 @@ export default class Field extends FormInput {
});
}
}
Field.$inject = ['$element', '$scope'];
Field.$inject = ['$element', '$scope', '$transclude'];
ngModule.vnComponent('vnField', {
template: require('./index.html'),

View File

@ -8,7 +8,7 @@ export default class WorkerAutocomplete extends Autocomplete {
label: 'Worker',
url: 'Workers/search',
fields: ['id', 'name', 'nickname'],
searchFunction: function($search) {
searchFunction: function({$search}) {
return {and: [
{active: {neq: false}},
{or: [

View File

@ -12,10 +12,9 @@ export default class Component extends EventEmitter {
* @param {HTMLElement} $element The main component element
* @param {$rootScope.Scope} $scope The element scope
* @param {Function} $transclude The transclusion function
* @param {Function} $location The location function
*/
constructor($element, $scope, $transclude, $location) {
super($element, $scope, $transclude, $location);
constructor($element, $scope, $transclude) {
super();
this.$ = $scope;
if (!$element) return;
@ -165,7 +164,7 @@ export default class Component extends EventEmitter {
$transclude.$$boundTransclude.$$slots[slot];
}
}
Component.$inject = ['$element', '$scope', '$location', '$state'];
Component.$inject = ['$element', '$scope', '$transclude'];
/*
* Automatically adds the most used services to the prototype, so they are

View File

@ -83,4 +83,3 @@ export default class EventEmitter {
}
}
}
EventEmitter.$inject = ['$element', '$scope'];

View File

@ -19,6 +19,22 @@ module.exports = Self => {
Self.search = async filter => {
const $ = Self.app.models;
return await $.VnUser.find(filter);
let {where} = filter;
const users = where && await $.VnUser.find({
fields: ['id'],
where
});
const workers = await Self.find({
fields: ['id'],
where: {
businessFk: {neq: null},
id: users ? {inq: users.map(u => u.id)} : undefined
}
});
where = {id: {inq: workers.map(w => w.id)}};
return await $.VnUser.find(Object.assign({}, filter, {where}));
};
};