refs #5244 feat: carga valor inicial
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-07-12 13:12:51 +02:00
parent bd85cf4e90
commit 954c2f5435
3 changed files with 18 additions and 10 deletions

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
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`);
JOIN department d ON d.id = b.departmentFk
) w`);
stmt.merge(conn.makeSuffix(filter));
return conn.executeStmt(stmt);