Desarrollo de los submodulos basic data, notes y pbx #245

Merged
jsegarra merged 16 commits from :features/ms_submodulos_worker into dev 2024-04-08 06:19:29 +00:00
9 changed files with 364 additions and 12 deletions

View File

@ -227,6 +227,7 @@ watch(formUrl, async () => {
defineExpose({
save,
isLoading,
hasChanges,
});
</script>
<template>

View File

@ -82,6 +82,11 @@ select:-webkit-autofill {
color: $white;
}
.card-width {
max-width: 800px;
width: 100%;
}
.vn-card {
background-color: var(--vn-section-color);
color: var(--vn-text-color);

View File

@ -851,12 +851,14 @@ export default {
pageTitles: {
workers: 'Workers',
list: 'List',
basicData: 'Basic data',
summary: 'Summary',
notifications: 'Notifications',
workerCreate: 'New worker',
department: 'Department',
basicData: 'Basic data',
notes: 'Notes',
pda: 'PDA',
notifications: 'Notifications',
pbx: 'Private Branch Exchange',
log: 'Log',
},
list: {

View File

@ -850,12 +850,14 @@ export default {
pageTitles: {
workers: 'Trabajadores',
list: 'Listado',
basicData: 'Datos básicos',
summary: 'Resumen',
notifications: 'Notificaciones',
workerCreate: 'Nuevo trabajador',
department: 'Departamentos',
basicData: 'Datos básicos',
notes: 'Notas',
pda: 'PDA',
notifications: 'Notificaciones',
pbx: 'Centralita',
log: 'Historial',
},
list: {

View File

@ -0,0 +1,168 @@
<script setup>
import { ref } from 'vue';
jsegarra marked this conversation as resolved Outdated

reactive no está en uso

reactive no está en uso

Import de reactive eliminado

Commit: 507c979cc2

Import de `reactive` eliminado Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/507c979cc2d6219a4f2d5e55b21ec6a243b25076
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const route = useRoute();
const { t } = useI18n();
const workersOptions = ref([]);
const countriesOptions = ref([]);
const educationLevelsOptions = ref([]);
const workerFilter = {
include: [
{
relation: 'user',
scope: {
fields: ['name', 'emailVerified'],
include: { relation: 'emailUser', scope: { fields: ['email'] } },
},
},
{ relation: 'sip', scope: { fields: ['extension', 'secret'] } },
{ relation: 'department', scope: { include: { relation: 'department' } } },
],
};
const workersFilter = {
fields: ['id', 'nickname'],
order: 'nickname ASC',
limit: 30,
};
const countriesFilter = {
fields: ['id', 'country', 'code'],
order: 'country ASC',
limit: 30,
};
const educationLevelsFilter = { fields: ['id', 'name'], order: 'name ASC', limit: 30 };
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
</script>
<template>
jsegarra marked this conversation as resolved
Review

FechData

FechData
Review

Nombre actualizado

Commit: 3569afdb85

Nombre actualizado Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/3569afdb85f612696e4c36404402ae92fc460d68
<FetchData
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Usar componente FormModel

Usar componente FormModel

Corregido: 1d37b91e09, se implementa el FormModel en el componente como se solicita, encontré unos puntos de mejora que subiré en el próximo commit.

Corregido: 1d37b91e09, se implementa el FormModel en el componente como se solicita, encontré unos puntos de mejora que subiré en el próximo commit.
:filter="workersFilter"
@on-fetch="(data) => (workersOptions = data)"
auto-load
url="Workers/search"
/>
<FetchData
jsegarra marked this conversation as resolved Outdated
Outdated
Review

FechData

FechData

Nombre actualizado

Commit: 3569afdb85

Nombre actualizado Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/3569afdb85f612696e4c36404402ae92fc460d68
:filter="countriesFilter"
@on-fetch="(data) => (countriesOptions = data)"
auto-load
url="Countries"
/>
<FetchData
jsegarra marked this conversation as resolved Outdated
Outdated
Review

FechData

FechData

Nombre actualizado

Commit: 3569afdb85

Nombre actualizado Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/3569afdb85f612696e4c36404402ae92fc460d68
:filter="educationLevelsFilter"
@on-fetch="(data) => (educationLevelsOptions = data)"
auto-load
url="EducationLevels"
/>
<FormModel
:filter="workerFilter"
:url="`Workers/${route.params.id}`"
auto-load
model="Worker"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput :label="t('Name')" clearable v-model="data.firstName" />
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Quitar <div class="col">

Quitar `<div class="col">`

<div class="col"> removidos

Commit: 71b2f7c8dc

`<div class="col">` removidos Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/71b2f7c8dccccdaa017044f2c9cdcac4b199f656
<VnInput :label="t('Last name')" clearable v-model="data.lastName" />
</VnRow>
jsegarra marked this conversation as resolved
Review

Quitar <div class="col">

Quitar `<div class="col">`
Review

<div class="col"> removidos

Commit: 71b2f7c8dc

`<div class="col">` removidos Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/71b2f7c8dccccdaa017044f2c9cdcac4b199f656
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.phone" :label="t('Business phone')" clearable />
<VnInput
v-model="data.mobileExtension"
:label="t('Mobile extension')"
clearable
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Ya no hace falta usar <div class="col"> en los VnRow (por lo menos si teneis vuesta rama /dev actualizada)

Ya no hace falta usar `<div class="col">` en los `VnRow` (por lo menos si teneis vuesta rama /dev actualizada)

<div class="col"> removidos

Commit: 71b2f7c8dc

`<div class="col">` removidos Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/71b2f7c8dccccdaa017044f2c9cdcac4b199f656
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter
:label="t('Boss')"
:options="workersOptions"
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Quitar <div class="col">

Quitar `<div class="col">`

<div class="col"> removidos

Commit: 71b2f7c8dc

`<div class="col">` removidos Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/71b2f7c8dccccdaa017044f2c9cdcac4b199f656
hide-selected
option-label="nickname"
option-value="id"
v-model="data.bossFk"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Quitar <div class="col">

Quitar `<div class="col">`

<div class="col"> removidos

Commit: 71b2f7c8dc

`<div class="col">` removidos Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/71b2f7c8dccccdaa017044f2c9cdcac4b199f656
{{ scope.opt?.nickname }},
{{ scope.opt?.code }}
</QItemLabel>
</QItemSection>
jsegarra marked this conversation as resolved Outdated

El botón de restarurar no está funcionando o no está habilitado cuando modifico el formulario

El botón de restarurar no está funcionando o no está habilitado cuando modifico el formulario

Corregido: 1d37b91e09

Corregido: 1d37b91e09
</QItem>
</template>
</VnSelectFilter>
<VnSelectFilter
:label="t('Marital status')"
:options="maritalStatus"
hide-selected
option-label="name"
option-value="code"
v-model="data.maritalStatus"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter
:label="t('Origin country')"
:options="countriesOptions"
hide-selected
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Quitar <div class="col">

Quitar `<div class="col">`

<div class="col"> removidos

Commit: 71b2f7c8dc

`<div class="col">` removidos Commit: https://gitea.verdnatura.es/hyervoni/salix-front-mindshore/commit/71b2f7c8dccccdaa017044f2c9cdcac4b199f656
option-label="country"
option-value="id"
v-model="data.originCountryFk"
/>
<VnSelectFilter
:label="t('Education level')"
:options="educationLevelsOptions"
hide-selected
option-label="name"
option-value="id"
v-model="data.educationLevelFk"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.SSN" :label="t('SSN')" clearable />
<VnInput
v-model="data.locker"
type="number"
:label="t('Locker')"
clearable
/>
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Name: Nombre
Last name: Apellidos
Business phone: Teléfono de empresa
Mobile extension: Extensión móvil
Boss: Jefe
Marital status: Estado civil
Married: Casado/a
Single: Soltero/a
Origin country: País origen
Education level: Nivel educación
SSN: NSS
Locker: Taquilla
</i18n>

View File

@ -1,5 +1,5 @@
<script setup>
import { computed, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useSession } from 'src/composables/useSession';
@ -7,6 +7,7 @@ import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import useCardDescription from 'src/composables/useCardDescription';
import { useState } from 'src/composables/useState';
const $props = defineProps({
id: {
@ -23,6 +24,7 @@ const $props = defineProps({
const route = useRoute();
const { t } = useI18n();
const { getTokenMultimedia } = useSession();
const state = useState();
const entityId = computed(() => {
return $props.id || route.params.id;
@ -53,7 +55,18 @@ const filter = {
],
};
const sip = computed(() => worker.value?.sip && worker.value.sip.extension);
const sip = ref(null);
watch(
() => [worker.value?.sip?.extension, state.get('extension')],
([newWorkerSip, newStateExtension], [oldWorkerSip, oldStateExtension]) => {
if (newStateExtension !== oldStateExtension || sip.value === oldStateExtension) {
sip.value = newStateExtension;
} else if (newWorkerSip !== oldWorkerSip && sip.value !== newStateExtension) {
sip.value = newWorkerSip;
}
}
);
function getWorkerAvatar() {
const token = getTokenMultimedia();

View File

@ -0,0 +1,38 @@
<script setup>
import { useRoute } from 'vue-router';
import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const filter = {
order: 'created DESC',
where: { workerFk: route.params.id },
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname'],
},
},
},
},
};
const body = {
workerFk: route.params.id,
};
</script>
<template>
<VnNotes
style="overflow-y: auto"
jsegarra marked this conversation as resolved Outdated
Outdated
Review

Usar componente VnNotes (src/components/ui/VnNotes.vue)

Usar componente VnNotes (src/components/ui/VnNotes.vue)

Corregido: 8cf14929e3

Corregido: 8cf14929e3

Se muestran los segundos pero es tema del composable toDateHour
Por otra parte, si relleno el input pero pulso sobre la X, no muestra el modal de confirmar salida. Esto creo que es punto de mejora en VnNotes. tu que dices @alexm ??

Se muestran los segundos pero es tema del composable toDateHour Por otra parte, si relleno el input pero pulso sobre la X, no muestra el modal de confirmar salida. Esto creo que es punto de mejora en VnNotes. tu que dices @alexm ??
:add-note="{ type: Boolean, default: true }"
url="WorkerObservations"
:filter="filter"
:body="body"
/>
</template>

View File

@ -0,0 +1,70 @@
<script setup>
import { watch, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const state = useState();
const route = useRoute();
const workerPBXForm = ref();
const extension = ref(null);
const filter = {
include: [
{
relation: 'sip',
},
],
};
jsegarra marked this conversation as resolved Outdated

Cuando se modifica no actualiza el valor del Descriptor

Cuando se modifica no actualiza el valor del Descriptor

Corregido: c06d810fe9

Corregido: c06d810fe9
watch(
() => route.params.id,
() => state.set('extension', null)
);
const onFetch = (data) => {
state.set('extension', data?.sip?.extension);
extension.value = state.get('extension');
};
const updateModelValue = (data) => {
jsegarra marked this conversation as resolved Outdated

Los botones no se habilitan cuando se modifica el campo

Los botones no se habilitan cuando se modifica el campo

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
state.set('extension', data);
workerPBXForm.value.hasChanges = true;
};
jsegarra marked this conversation as resolved Outdated

En el caso de que este funcionando bien. Al pulsar guardar, que URL se usaría

En el caso de que este funcionando bien. Al pulsar guardar, que URL se usaría

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
</script>
<template>
<FormModel
ref="workerPBXForm"
:filter="filter"
:url="`Workers/${route.params.id}`"
url-update="Sips"
jsegarra marked this conversation as resolved Outdated

QInput? Usar VnInput

QInput? Usar VnInput

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
auto-load
jsegarra marked this conversation as resolved
Review

Cuando se pierde el foco del campo el valor del input desaparece

Cuando se pierde el foco del campo el valor del input desaparece
Review

Corregido

Commit: 239daceca6

Corregido Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/239daceca60bd3158ea8faa79c851a137a7e3a4a
:mapper="
() => ({
userFk: +route.params.id,
extension,
})
"
model="DeviceProductionUser"
@on-fetch="onFetch"
>
<template #form="{}">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
:label="t('worker.summary.sipExtension')"
v-model="extension"
@update:model-value="updateModelValue"
/>
</div>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -12,7 +12,14 @@ export default {
redirect: { name: 'WorkerMain' },
menus: {
main: ['WorkerList', 'WorkerDepartment'],
card: ['WorkerNotificationsManager', 'WorkerPda', 'WorkerLog'],
card: [
'WorkerBasicData',
'WorkerNotes',
'WorkerPda',
'WorkerNotificationsManager',
'WorkerPBX',
'WorkerLog',
],
departmentCard: ['BasicData'],
},
children: [
@ -66,6 +73,52 @@ export default {
},
component: () => import('src/pages/Worker/Card/WorkerSummary.vue'),
},
{
path: 'basic-data',
name: 'WorkerBasicData',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Worker/Card/WorkerBasicData.vue'),
},
{
path: 'notes',
name: 'NotesCard',
redirect: { name: 'WorkerNotes' },
children: [
{
path: '',
name: 'WorkerNotes',
meta: {
title: 'notes',
icon: 'vn:notes',
},
component: () =>
import('src/pages/Worker/Card/WorkerNotes.vue'),
},
{
path: 'create',
name: 'WorkerNoteCreate',
meta: {
title: 'note-create',
},
component: () =>
import(
'src/pages/Worker/components/WorkerNoteCreate.vue'
),
},
],
},
{
name: 'WorkerPda',
path: 'pda',
meta: {
title: 'pda',
icon: 'phone_android',
},
component: () => import('src/pages/Worker/Card/WorkerPda.vue'),
},
{
name: 'WorkerNotificationsManager',
path: 'notifications',
@ -77,13 +130,13 @@ export default {
import('src/pages/Worker/Card/WorkerNotificationsManager.vue'),
},
{
name: 'WorkerPda',
path: 'pda',
path: 'pbx',
name: 'WorkerPBX',
meta: {
title: 'pda',
icon: 'phone_android',
title: 'pbx',
icon: 'vn:pbx',
},
component: () => import('src/pages/Worker/Card/WorkerPda.vue'),
component: () => import('src/pages/Worker/Card/WorkerPBX.vue'),
},
{
name: 'WorkerLog',