#8050: Created WorkerManagement section #1681
|
@ -347,6 +347,7 @@ globals:
|
||||||
vehicleList: Vehicles
|
vehicleList: Vehicles
|
||||||
vehicle: Vehicle
|
vehicle: Vehicle
|
||||||
entryPreAccount: Pre-account
|
entryPreAccount: Pre-account
|
||||||
|
management: Worker management
|
||||||
unsavedPopup:
|
unsavedPopup:
|
||||||
title: Unsaved changes will be lost
|
title: Unsaved changes will be lost
|
||||||
subtitle: Are you sure exit without saving?
|
subtitle: Are you sure exit without saving?
|
||||||
|
|
|
@ -350,6 +350,7 @@ globals:
|
||||||
vehicleList: Vehículos
|
vehicleList: Vehículos
|
||||||
vehicle: Vehículo
|
vehicle: Vehículo
|
||||||
entryPreAccount: Precontabilizar
|
entryPreAccount: Precontabilizar
|
||||||
|
management: Gestión de trabajadores
|
||||||
unsavedPopup:
|
unsavedPopup:
|
||||||
title: Los cambios que no haya guardado se perderán
|
title: Los cambios que no haya guardado se perderán
|
||||||
subtitle: ¿Seguro que quiere salir sin guardar?
|
subtitle: ¿Seguro que quiere salir sin guardar?
|
||||||
|
|
|
@ -33,14 +33,6 @@ const getLocale = (label) => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params }">
|
<template #body="{ params }">
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnInput :label="t('FI')" v-model="params.fi" filled
|
|
||||||
><template #prepend>
|
|
||||||
<QIcon name="badge" size="xs"></QIcon> </template
|
|
||||||
></VnInput>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('First Name')" v-model="params.firstName" filled />
|
<VnInput :label="t('First Name')" v-model="params.firstName" filled />
|
||||||
|
@ -112,7 +104,6 @@ es:
|
||||||
lastName: Apellidos
|
lastName: Apellidos
|
||||||
userName: Usuario
|
userName: Usuario
|
||||||
extension: Extensión
|
extension: Extensión
|
||||||
FI: NIF
|
|
||||||
First Name: Nombre
|
First Name: Nombre
|
||||||
Last Name: Apellidos
|
Last Name: Apellidos
|
||||||
User Name: Usuario
|
User Name: Usuario
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed, onMounted } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
|
|
||||||
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
|
import WorkerSummary from './Card/WorkerSummary.vue';
|
||||||
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import WorkerManagementFilter from './WorkerManagementFilter.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const dataKey = 'ManagementList';
|
||||||
|
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('tableColumns.firstName'),
|
||||||
|
name: 'firstName',
|
||||||
|
isTitle: true,
|
||||||
|
columnFilter: {
|
||||||
|
name: 'firstName',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('tableColumns.lastName'),
|
||||||
|
name: 'lastName',
|
||||||
|
columnFilter: {
|
||||||
|
name: 'lastName',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('management.NIF'),
|
||||||
|
name: 'fi',
|
||||||
|
columnFilter: {
|
||||||
|
name: 'fi',
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('tableColumns.email'),
|
||||||
|
name: 'email',
|
||||||
|
columnFilter: {
|
||||||
|
name: 'email',
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('management.ssn'),
|
||||||
|
labelAbbreviation: t('management.ssn'),
|
||||||
|
toolTip: t('management.completeSsn'),
|
||||||
|
name: 'SSN',
|
||||||
|
columnFilter: {
|
||||||
|
name: 'SSN',
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'departmentFk',
|
||||||
|
label: t('tableColumns.department'),
|
||||||
|
columnFilter: {
|
||||||
|
component: 'select',
|
||||||
|
name: 'departmentFk',
|
||||||
|
attrs: {
|
||||||
|
url: 'Departments',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.department),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
label: '',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('globals.pageTitles.summary'),
|
||||||
|
icon: 'preview',
|
||||||
|
action: (row) => viewSummary(row?.id, WorkerSummary),
|
||||||
|
isPrimary: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const canAccess = useAcl().hasAcl('Worker', 'management', 'WRITE');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnSearchbar
|
||||||
|
:data-key
|
||||||
|
url="Workers/filter"
|
||||||
|
:label="t('management.search')"
|
||||||
|
:info="t('management.searchInfo')"
|
||||||
|
/>
|
||||||
|
<RightMenu>
|
||||||
|
<template #right-panel>
|
||||||
|
<WorkerManagementFilter :data-key />
|
||||||
|
</template>
|
||||||
|
</RightMenu>
|
||||||
|
<VnTable
|
||||||
|
ref="tableRef"
|
||||||
|
url="Workers/filter"
|
||||||
|
:columns="columns"
|
||||||
|
:data-key
|
||||||
|
:right-search="false"
|
||||||
|
order="id DESC"
|
||||||
|
/>
|
||||||
|
</template>
|
|
@ -0,0 +1,99 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
|
const { t, te } = useI18n();
|
||||||
|
const props = defineProps({
|
||||||
|
dataKey: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const departments = ref();
|
||||||
|
|
||||||
|
const getLocale = (label) => {
|
||||||
|
const globalLocale = `globals.params.${label}`;
|
||||||
|
return te(globalLocale) ? t(globalLocale) : t(`management.${label}`);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData url="Departments" @on-fetch="(data) => (departments = data)" auto-load />
|
||||||
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
|
<template #tags="{ tag, formatFn }">
|
||||||
|
<div class="q-gutter-x-xs">
|
||||||
|
<strong>{{ getLocale(tag.label) }}: </strong>
|
||||||
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #body="{ params }">
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput
|
||||||
|
:label="t('tableColumns.firstName')"
|
||||||
|
v-model="params.firstName"
|
||||||
|
filled
|
||||||
|
|||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput
|
||||||
|
:label="t('tableColumns.lastName')"
|
||||||
|
v-model="params.lastName"
|
||||||
|
filled
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput
|
||||||
|
:label="t('management.NIF')"
|
||||||
|
v-model="params.fi"
|
||||||
|
filled
|
||||||
|
data-cy="worker-filter-fi"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<QIcon name="badge" size="xs" />
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput
|
||||||
|
:label="t('tableColumns.email')"
|
||||||
|
v-model="params.email"
|
||||||
|
filled
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput :label="t('management.ssn')" v-model="params.SSN" filled />
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('tableColumns.department')"
|
||||||
|
v-model="params.departmentFk"
|
||||||
|
:options="departments"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
dense
|
||||||
|
filled
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnFilterPanel>
|
||||||
|
</template>
|
|
@ -13,3 +13,11 @@ tableColumns:
|
||||||
SSN: SSN
|
SSN: SSN
|
||||||
extension: Extension
|
extension: Extension
|
||||||
queue: Queue
|
queue: Queue
|
||||||
|
management:
|
||||||
|
search: Search worker
|
||||||
|
searchInfo: You can search by NIF, NSS or worker name
|
||||||
|
NIF: NIF
|
||||||
|
ssn: SSN
|
||||||
|
completeSsn: National Insurance Number
|
||||||
|
firstName: First Name
|
||||||
|
lastName: Last Name
|
||||||
|
|
|
@ -16,3 +16,11 @@ tableColumns:
|
||||||
SSN: NSS
|
SSN: NSS
|
||||||
extension: Extensión
|
extension: Extensión
|
||||||
queue: Cola
|
queue: Cola
|
||||||
|
management:
|
||||||
|
search: Buscar trabajador
|
||||||
|
searchInfo: Puedes buscar por NIF, NSS o nombre del trabajador
|
||||||
|
NIF: NIF
|
||||||
|
ssn: Núm. SS
|
||||||
|
completeSsn: Número de Seguridad Social
|
||||||
|
firstName: Nombre
|
||||||
|
lastName: Apellidos
|
||||||
|
|
|
@ -239,7 +239,7 @@ export default {
|
||||||
icon: 'vn:worker',
|
icon: 'vn:worker',
|
||||||
moduleName: 'Worker',
|
moduleName: 'Worker',
|
||||||
keyBinding: 'w',
|
keyBinding: 'w',
|
||||||
menu: ['WorkerList', 'WorkerDepartment'],
|
menu: ['WorkerList', 'WorkerDepartment', 'WorkerManagement'],
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'WorkerMain' },
|
redirect: { name: 'WorkerMain' },
|
||||||
|
@ -283,6 +283,22 @@ export default {
|
||||||
departmentCard,
|
departmentCard,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'management',
|
||||||
|
name: 'WorkerManagement',
|
||||||
|
meta: {
|
||||||
|
title: 'management',
|
||||||
|
icon: 'view_list',
|
||||||
|
acls: [
|
||||||
|
{
|
||||||
|
model: 'Worker',
|
||||||
|
props: 'isRoleAdvanced',
|
||||||
|
accessType: 'READ',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Worker/WorkerManagement.vue'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
describe('WorkerManagement', () => {
|
||||||
|
const nif = '12091201A';
|
||||||
|
const searchButton = '.q-scrollarea__content > .q-btn--standard > .q-btn__content';
|
||||||
|
const url = '/#/worker/management';
|
||||||
|
|
||||||
|
it('should not enter the section', () => {
|
||||||
|
cy.login('salesPerson');
|
||||||
|
cy.visit(url);
|
||||||
|
cy.url().should('include', '/dashboard');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should enter the section and filter by NIF, then open the worker summary popup', () => {
|
||||||
|
cy.login('hr');
|
||||||
|
cy.visit(url);
|
||||||
|
cy.dataCy('worker-filter-fi').type(nif);
|
||||||
|
cy.get(searchButton).click();
|
||||||
|
cy.dataCy('tableAction-0').click();
|
||||||
|
cy.get('.summaryHeader').should('exist');
|
||||||
|
cy.get('.summaryHeader').should('be.visible');
|
||||||
|
cy.get('.summaryBody').should('exist');
|
||||||
|
cy.get('.summaryBody').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
esto sigue siendo neceario con el tema que se habló en la reunion?
Sí, este es el estilo que tienen los filtros laterales, hay que ponerlo ya que por defecto los filtros no son "filled"