refs #5334 department seccion
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2023-05-15 10:43:06 +02:00
parent 8a843b37bd
commit 87e1caa4eb
11 changed files with 396 additions and 4 deletions

View File

@ -0,0 +1,101 @@
<mg-ajax path="Workers/{{patch.params.id}}" options="vnPatch"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.worker"
form="form"
save="patch">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-vertical>
<vn-horizontal>
<vn-textfield
vn-one
label="Name"
ng-model="$ctrl.worker.firstName"
rule>
</vn-textfield>
<vn-textfield
vn-one
label="Last name"
ng-model="$ctrl.worker.lastName"
rule>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Business phone"
ng-model="$ctrl.worker.phone"
rule>
</vn-textfield>
<vn-textfield
vn-one
label="Mobile extension"
ng-model="$ctrl.worker.mobileExtension"
rule>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
ng-model="$ctrl.worker.bossFk"
url="Workers/activeWithInheritedRole"
show-field="nickname"
search-function="{firstName: $search}"
where="{role: 'employee'}"
label="Boss">
</vn-autocomplete>
<vn-autocomplete
label="Marital status"
data="$ctrl.maritalStatus"
show-field="name"
value-field="code"
ng-model="$ctrl.worker.maritalStatus">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
ng-model="$ctrl.worker.originCountryFk"
url="Countries"
fields="['id', 'country', 'code']"
show-field="country"
value-field="id"
label="Origin country">
</vn-autocomplete>
<vn-autocomplete
ng-model="$ctrl.worker.educationLevelFk"
url="EducationLevels"
fields="['id', 'name']"
show-field="name"
value-field="id"
label="Education level">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="SSN"
ng-model="$ctrl.worker.SSN"
rule>
</vn-textfield>
<vn-input-number
min="0"
label="Locker"
ng-model="$ctrl.worker.locker">
</vn-input-number>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!watcher.dataChanged()"
label="Save">
</vn-submit>
<vn-button
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()">
</vn-button>
</vn-button-bar>
</form>

View File

@ -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'
}
});

View File

@ -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

View File

@ -12,7 +12,8 @@
sort-func="$ctrl.onSort($a, $b)" sort-func="$ctrl.onSort($a, $b)"
on-drop="$ctrl.onDrop($dropped, $dragged)" on-drop="$ctrl.onDrop($dropped, $dragged)"
on-drag-start="$ctrl.onDragStart(item)" 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}} {{::item.name}}
</vn-treeview> </vn-treeview>
</vn-card> </vn-card>

View File

@ -1,4 +1,4 @@
import ngModule from '../module'; import ngModule from '../../module';
import Section from 'salix/components/section'; import Section from 'salix/components/section';
class Controller extends Section { class Controller extends Section {

View File

@ -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"]
}
]
}

View File

@ -0,0 +1,73 @@
<vn-card class="summary">
<h5>
<a ng-if="::$ctrl.worker.id"
vn-tooltip="Go to the worker"
ui-sref="department.card.summary({id: {{::$ctrl.worker.id}}})"
name="goToSummary">
<vn-icon-button icon="launch"></vn-icon-button>
</a>
<span>{{worker.firstName}} {{worker.lastName}}</span>
</h5>
<vn-horizontal class="vn-pa-md">
<vn-one>
<h4 ng-show="$ctrl.isHr">
<a
ui-sref="worker.card.basicData({id:$ctrl.worker.id})">
<span translate vn-tooltip="Go to">Basic data</span>
</a>
</h4>
<h4
translates
ng-show="!$ctrl.isHr">
Basic data
</h4>
<vn-label-value label="Id"
value="{{worker.id}}">
</vn-label-value>
<vn-label-value label="Email" no-ellipsize
value="{{worker.user.emailUser.email}}">
</vn-label-value>
<vn-label-value label="Department"
value="{{worker.department.department.name}}">
</vn-label-value>
<vn-label-value
label="Boss">
<span
ng-click="workerDescriptor.show($event, worker.boss.id)"
class="link">
{{::worker.boss.nickname}}
</span>
</vn-label-value>
<vn-label-value label="Mobile extension"
value="{{worker.mobileExtension}}">
</vn-label-value>
<vn-label-value label="Business phone"
value="{{worker.phone}}">
</vn-label-value>
<vn-label-value label="Personal phone"
value="{{worker.client.phone}}">
</vn-label-value>
<vn-label-value label="Locker"
value="{{worker.locker}}">
</vn-label-value>
</vn-one>
<vn-one>
<h4 translate>User data</h4>
<vn-label-value label="User id"
value="{{worker.userFk}}">
</vn-label-value>
<vn-label-value label="User"
value="{{worker.user.name}}">
</vn-label-value>
<vn-label-value label="Role"
value="{{worker.user.role.name}}">
</vn-label-value>
<vn-label-value label="Extension"
value="{{worker.sip.extension}}">
</vn-label-value>
</vn-one>
</vn-horizontal>
</vn-card>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -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: '<'
}
});

View File

@ -0,0 +1,4 @@
Business phone: Teléfono de empresa
Personal phone: Teléfono personal
Mobile extension: Extensión móvil
Locker: Taquilla

View File

@ -11,7 +11,7 @@ import './search-panel';
import './basic-data'; import './basic-data';
import './pbx'; import './pbx';
import './pda'; import './pda';
import './department'; import './department/index';
import './calendar'; import './calendar';
import './time-control'; import './time-control';
import './log'; import './log';

View File

@ -118,7 +118,7 @@
"worker": "$ctrl.worker" "worker": "$ctrl.worker"
} }
}, { }, {
"url" : "/department", "url" : "/department/department",
"state": "worker.department", "state": "worker.department",
"component": "vn-worker-department", "component": "vn-worker-department",
"description": "Departments", "description": "Departments",