dev #1731
|
@ -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 + '%'}}
|
||||
]}
|
||||
]};
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue