5334-editDepartment #1521

Merged
carlossa merged 84 commits from 5334-editDepartment into dev 2023-07-06 07:09:06 +00:00
5 changed files with 37 additions and 44 deletions
Showing only changes of commit 4c7c7f5c96 - Show all commits

View File

@ -51,40 +51,29 @@ module.exports = Self => {
Self.filter = async(ctx, filter) => {
let conn = Self.dataSource.connector;
console.log('ENTRY');
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {'d.id': value}
? {'id': value}
: {or: [
{'d.code': {like: `%${value}%`}},
{'d.name': {like: `%${value}%`}}
{'code': {like: `%${value}%`}},
{'name': {like: `%${value}%`}}
]};
case 'id':
return {'d.id': value};
return {'id': value};
case 'code':
return {'d.code': value};
return {'code': value};
case 'name':
return {'d.name': {like: `%${value}%`}};
return {'name': {like: `%${value}%`}};
}
});
filter = mergeFilters(ctx.args.filter, {where});
let stmts = [];
let stmt;
stmt = new ParameterizedSQL(
`SELECT id, code, name
FROM department d`
);
stmt.merge(conn.makeSuffix(filter));
let itemsIndex = stmts.push(stmt) - 1;
let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql);
return itemsIndex === 0 ? result : result[itemsIndex];
console.log(filter);
const departments = await Self.app.models.Department.find(filter);
console.log(departments);
return departments;
};
};
Outdated
Review

Aci pq no has gastat loopback?

Aci pq no has gastat loopback?

View File

@ -36,16 +36,20 @@
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Boss department"
ng-model="$ctrl.department.workerFk">
</vn-textfield>
<vn-textfield
vn-one
label="Self-consumption customer"
ng-model="$ctrl.department.clientFk">
</vn-textfield>
<vn-autocomplete
carlossa marked this conversation as resolved Outdated
Outdated
Review

Deberia ser Autocomplete

Deberia ser Autocomplete
ng-model="$ctrl.department.workerFk"
url="Workers/activeWithInheritedRole"
show-field="nickname"
search-function="{firstName: $search}"
label="Boss department">
Outdated
Review

Deberia ser Autocomplete

Deberia ser Autocomplete
</vn-autocomplete>
<vn-autocomplete
ng-model="$ctrl.department.clientFk"
url="Clients/"
show-field="name"
search-function="{firstName: $search}"
label="Self-consumption customer">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-check

View File

@ -29,10 +29,14 @@
value="{{$ctrl.department.worker.firstName}} {{$ctrl.department.worker.secondName}}">
</vn-label-value>
</div>
<vn-icon-button vn-anchor="{state: 'worker.index', params: {q: {departmentFk: $ctrl.$params.id}}}"
vn-tooltip="Department workers"
icon="icon-ticket">
</vn-icon-button>
<div class="quicklinks">
<div ng-transclude="btnOne">
<vn-quick-link vn-anchor="{state: 'worker.index', params: {q: {departmentFk: $ctrl.$params.id} } }"
vn-tooltip="Department workers"
alexm marked this conversation as resolved Outdated
Outdated
Review

Si pots una indentacio cap a dins

Si pots una indentacio cap a dins

A mi me apareix bé ja que ho tinc tot en la mateixa linea

A mi me apareix bé ja que ho tinc tot en la mateixa linea
icon="icon-ticket">
</vn-quick-link>
</div>
</div>
</slot-body>
</vn-descriptor-content>
<vn-popup vn-id="summary">
@ -44,8 +48,3 @@
on-accept="$ctrl.deleteDepartment()"
carlossa marked this conversation as resolved Outdated


Este es el que hi havia en el projecte es sol gastar Are you sure,
posal així per tindreu tot igual

<vn-confirm vn-id="deleteNode" on-accept="$ctrl.onRemoveResponse()" question="Delete department" message="Are you sure you want to delete it?"> </vn-confirm> Este es el que hi havia en el projecte es sol gastar Are you sure, posal així per tindreu tot igual
question="You are going to delete this department">
carlossa marked this conversation as resolved Outdated
Outdated
Review

Este codi si no vas a gastarlo, borral

Este codi si no vas a gastarlo, borral
</vn-confirm>
<!-- Upload photo dialog -->
<!-- <vn-upload-photo
vn-id="uploadPhoto"
on-response="$ctrl.onUploadResponse()">
</vn-upload-photo>

View File

@ -7,7 +7,7 @@
<vn-portal slot="topbar">
<vn-searchbar
vn-focus
panel="vn-worker-search-panel"
panel="vn-worker-department-search-panel"
info="Search workers by id, firstName, lastName or user name"
model="model"
base-state="worker.department">

View File

@ -3,7 +3,7 @@
"name": "Workers",
"icon" : "icon-worker",
"validations" : true,
"dependencies": ["account", "worker"],
"dependencies": ["account"],
Outdated
Review

Lo de worker igual ja no cal, prova a llevarlo

Lo de worker igual ja no cal, prova a llevarlo
"menus": {
"main": [
{"state": "worker.index", "icon": "icon-worker"},
@ -124,7 +124,8 @@
"url": "/department?q",
"state": "worker.department",
Outdated
Review

El ACL es deuria mantindre

El ACL es deuria mantindre
"component": "vn-worker-department",
"description":"Departments"
"description":"Departments",
"acl":["hr"]
Outdated
Review

Aci "acl" employee. Revisa que les modificacions estiguen ben possats els acls per a hr

Aci "acl" employee. Revisa que les modificacions estiguen ben possats els acls per a hr
}, {
carlossa marked this conversation as resolved
Review

Department deuria tindre ACLs en les seues seccions? @jgallego

Department deuria tindre ACLs en les seues seccions? @jgallego
Review

Si, editar rrhh, visualizar employee.

Si, editar rrhh, visualizar employee.
"url": "/:id",
"state": "worker.department.card",