dev #1731

Merged
jgallego merged 105 commits from dev into test 2023-08-31 09:13:29 +00:00
3 changed files with 18 additions and 10 deletions
Showing only changes of commit 954c2f5435 - Show all commits

View File

@ -7,6 +7,8 @@ export default class WorkerAutocomplete extends Autocomplete {
}
$onInit() {
super.$onInit();
let url = 'Workers/search';
if (this.departments) {
const parameter = encodeURIComponent(JSON.stringify(this.departments));
@ -17,11 +19,11 @@ export default class WorkerAutocomplete extends Autocomplete {
url: url,
searchFunction: function({$search}) {
return {and: [
{'u.active': {neq: false}},
{'active': {neq: false}},
{or: [
{'u.name': $search},
{'u.nickname': {like: '%' + $search + '%'}},
{'w.code': {like: $search + '%'}}
{'name': $search},
{'nickname': {like: '%' + $search + '%'}},
{'code': {like: $search + '%'}}
]}
]};
},

View File

@ -34,6 +34,9 @@
where="{role: 'salesPerson'}"
label="Attended by">
</vn-autocomplete>
<vn-worker-autocomplete
ng-model="$ctrl.claim.workerFk">
</vn-worker-autocomplete>
<vn-autocomplete
ng-model="$ctrl.claim.claimStateFk"
data="claimStates"

View File

@ -40,12 +40,15 @@ module.exports = Self => {
filter = mergeFilters(filter, {where});
}
const stmt = new ParameterizedSQL(
`SELECT DISTINCT w.id, w.code, u.name, u.nickname
FROM worker w
JOIN account.user u ON u.id = w.id
JOIN business b ON b.workerFk = w.id
JOIN department d ON d.id = b.departmentFk`);
const stmt = new ParameterizedSQL(`
SELECT *
FROM(
SELECT DISTINCT w.id, w.code, u.name, u.nickname, u.active
FROM worker w
JOIN account.user u ON u.id = w.id
JOIN business b ON b.workerFk = w.id
JOIN department d ON d.id = b.departmentFk
) w`);
stmt.merge(conn.makeSuffix(filter));
return conn.executeStmt(stmt);