From 87e1caa4eb53ac07840755ae1057b5966e5861e6 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 15 May 2023 10:43:06 +0200 Subject: [PATCH] refs #5334 department seccion --- .../front/department/basic-data/index.html | 101 +++++++++++++++++ .../front/department/basic-data/index.js | 27 +++++ .../front/department/basic-data/locale/es.yml | 9 ++ .../front/department/{ => index}/index.html | 3 +- .../front/department/{ => index}/index.js | 2 +- modules/worker/front/department/routes.json | 103 ++++++++++++++++++ .../front/department/summary/index.html | 73 +++++++++++++ .../worker/front/department/summary/index.js | 74 +++++++++++++ .../front/department/summary/locale/es.yml | 4 + modules/worker/front/index.js | 2 +- modules/worker/front/routes.json | 2 +- 11 files changed, 396 insertions(+), 4 deletions(-) create mode 100644 modules/worker/front/department/basic-data/index.html create mode 100644 modules/worker/front/department/basic-data/index.js create mode 100644 modules/worker/front/department/basic-data/locale/es.yml rename modules/worker/front/department/{ => index}/index.html (93%) rename modules/worker/front/department/{ => index}/index.js (98%) create mode 100644 modules/worker/front/department/routes.json create mode 100644 modules/worker/front/department/summary/index.html create mode 100644 modules/worker/front/department/summary/index.js create mode 100644 modules/worker/front/department/summary/locale/es.yml diff --git a/modules/worker/front/department/basic-data/index.html b/modules/worker/front/department/basic-data/index.html new file mode 100644 index 000000000..d89d88f2e --- /dev/null +++ b/modules/worker/front/department/basic-data/index.html @@ -0,0 +1,101 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/worker/front/department/basic-data/index.js b/modules/worker/front/department/basic-data/index.js new file mode 100644 index 000000000..ea75d7b97 --- /dev/null +++ b/modules/worker/front/department/basic-data/index.js @@ -0,0 +1,27 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +class Controller extends Section { + constructor($element, $) { + super($element, $); + this.maritalStatus = [ + {code: 'M', name: this.$t('Married')}, + {code: 'S', name: this.$t('Single')} + ]; + } + onSubmit() { + return this.$.watcher.submit() + .then(() => this.card.reload()); + } +} + +ngModule.vnComponent('vnWorkerBasicData', { + template: require('./index.html'), + controller: Controller, + bindings: { + worker: '<' + }, + require: { + card: '^vnWorkerCard' + } +}); diff --git a/modules/worker/front/department/basic-data/locale/es.yml b/modules/worker/front/department/basic-data/locale/es.yml new file mode 100644 index 000000000..edf08de90 --- /dev/null +++ b/modules/worker/front/department/basic-data/locale/es.yml @@ -0,0 +1,9 @@ +Marital status: Estado civil +Origin country: País origen +Education level: Nivel educación +SSN: NSS +Married: Casado/a +Single: Soltero/a +Business phone: Teléfono de empresa +Mobile extension: Extensión móvil +Locker: Taquilla diff --git a/modules/worker/front/department/index.html b/modules/worker/front/department/index/index.html similarity index 93% rename from modules/worker/front/department/index.html rename to modules/worker/front/department/index/index.html index df8630104..9afa90e13 100644 --- a/modules/worker/front/department/index.html +++ b/modules/worker/front/department/index/index.html @@ -12,7 +12,8 @@ sort-func="$ctrl.onSort($a, $b)" on-drop="$ctrl.onDrop($dropped, $dragged)" on-drag-start="$ctrl.onDragStart(item)" - on-drag-end="$ctrl.onDragEnd(item)"> + on-drag-end="$ctrl.onDragEnd(item)" + ui-sref="department.card.summary(item)"> {{::item.name}} diff --git a/modules/worker/front/department/index.js b/modules/worker/front/department/index/index.js similarity index 98% rename from modules/worker/front/department/index.js rename to modules/worker/front/department/index/index.js index 15904a963..178299362 100644 --- a/modules/worker/front/department/index.js +++ b/modules/worker/front/department/index/index.js @@ -1,4 +1,4 @@ -import ngModule from '../module'; +import ngModule from '../../module'; import Section from 'salix/components/section'; class Controller extends Section { diff --git a/modules/worker/front/department/routes.json b/modules/worker/front/department/routes.json new file mode 100644 index 000000000..f6fd46367 --- /dev/null +++ b/modules/worker/front/department/routes.json @@ -0,0 +1,103 @@ +{ + "module": "deparment", + "name": "Departments", + "icon" : "work", + "validations" : true, + "dependencies": ["account"], + "menus": { + "main": [ + {"state": "deparment.index", "icon": "icon-worker"} + ], + "card": [ + {"state": "department.card.basicData", "icon": "settings"}, + { + "icon": "icon-wiki", + "external":true, + "url": "http://wiki.verdnatura.es", + "description": "Wikipedia" + }, + {"state": "worker.card.workerLog", "icon": "history"} + ] + }, + "routes": [ + { + "url": "/worker", + "state": "worker", + "abstract": true, + "component": "vn-worker", + "description": "Workers" + }, { + "url": "/index?q", + "state": "worker.index", + "component": "vn-worker-index", + "description": "Workers" + }, { + "url" : "/summary", + "state": "worker.card.summary", + "component": "vn-worker-summary", + "description": "Summary", + "params": { + "worker": "$ctrl.worker" + } + }, { + "url": "/:id", + "state": "worker.card", + "component": "vn-worker-card", + "abstract": true, + "description": "Detail" + }, { + "url": "/basic-data", + "state": "worker.card.basicData", + "component": "vn-worker-basic-data", + "description": "Basic data", + "params": { + "worker": "$ctrl.worker" + }, + "acl": ["hr"] + }, { + "url" : "/log", + "state": "worker.card.workerLog", + "component": "vn-worker-log", + "description": "Log", + "acl": ["salesAssistant"] + }, { + "url": "/index", + "state": "worker.card.note.index", + "component": "vn-worker-note", + "description": "Notes", + "params": { + "worker": "$ctrl.worker" + }, + "acl": ["hr"] + }, { + "url": "/create", + "state": "worker.card.note.create", + "component": "vn-note-worker-create", + "description": "New note" + }, + { + "url": "/index", + "state": "worker.card.dms.index", + "component": "vn-worker-dms-index", + "description": "My documentation", + "acl": ["employee"] + }, + { + "url": "/create", + "state": "worker.card.dms.create", + "component": "vn-worker-dms-create", + "description": "Upload file", + "params": { + "worker": "$ctrl.worker" + }, + "acl": ["hr"] + }, + { + "url": "/create", + "state": "worker.create", + "component": "vn-worker-create", + "description": "New worker", + "acl": ["hr"] + } + ] +} diff --git a/modules/worker/front/department/summary/index.html b/modules/worker/front/department/summary/index.html new file mode 100644 index 000000000..de8710a6d --- /dev/null +++ b/modules/worker/front/department/summary/index.html @@ -0,0 +1,73 @@ + +
+ + + + {{worker.firstName}} {{worker.lastName}} +
+ + +

+ + Basic data + +

+

+ Basic data +

+ + + + + + + + + {{::worker.boss.nickname}} + + + + + + + + + + +
+ +

User data

+ + + + + + + + +
+
+
+ + diff --git a/modules/worker/front/department/summary/index.js b/modules/worker/front/department/summary/index.js new file mode 100644 index 000000000..c2ad107d5 --- /dev/null +++ b/modules/worker/front/department/summary/index.js @@ -0,0 +1,74 @@ +import ngModule from '../module'; +import Summary from 'salix/components/summary'; + +class Controller extends Summary { + get worker() { + return this._worker; + } + + set worker(value) { + this._worker = value; + this.$.worker = null; + if (!value) return; + + const query = `Workers/${value.id}`; + const filter = { + include: [ + { + relation: 'user', + scope: { + fields: ['name', 'roleFk'], + include: [{ + relation: 'role', + scope: { + fields: ['name'] + } + }, + { + relation: 'emailUser', + scope: { + fields: ['email'] + } + }] + } + }, + { + relation: 'client', + scope: {fields: ['fi', 'phone']} + }, + { + relation: 'boss', + scope: {fields: ['id', 'nickname']} + }, + { + relation: 'sip', + scope: {fields: ['extension']} + }, + { + relation: 'department', + scope: { + include: { + relation: 'department' + } + } + } + ] + }; + + this.$http.get(query, {params: {filter}}).then(res => { + this.$.worker = res.data; + }); + } + + get isHr() { + return this.aclService.hasAny(['hr']); + } +} + +ngModule.vnComponent('vnWorkerSummary', { + template: require('./index.html'), + controller: Controller, + bindings: { + worker: '<' + } +}); diff --git a/modules/worker/front/department/summary/locale/es.yml b/modules/worker/front/department/summary/locale/es.yml new file mode 100644 index 000000000..fb9d2e2ca --- /dev/null +++ b/modules/worker/front/department/summary/locale/es.yml @@ -0,0 +1,4 @@ +Business phone: Teléfono de empresa +Personal phone: Teléfono personal +Mobile extension: Extensión móvil +Locker: Taquilla diff --git a/modules/worker/front/index.js b/modules/worker/front/index.js index 8fad2c0df..605ec9dde 100644 --- a/modules/worker/front/index.js +++ b/modules/worker/front/index.js @@ -11,7 +11,7 @@ import './search-panel'; import './basic-data'; import './pbx'; import './pda'; -import './department'; +import './department/index'; import './calendar'; import './time-control'; import './log'; diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json index 25a0ffbcf..6817d0cef 100644 --- a/modules/worker/front/routes.json +++ b/modules/worker/front/routes.json @@ -118,7 +118,7 @@ "worker": "$ctrl.worker" } }, { - "url" : "/department", + "url" : "/department/department", "state": "worker.department", "component": "vn-worker-department", "description": "Departments",