Merge branch 'dev' into 7449-claimBeginningQuantity
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
e54dbc3514
|
@ -35,6 +35,7 @@ import { getColAlign } from 'src/composables/getColAlign';
|
|||
import RightMenu from '../common/RightMenu.vue';
|
||||
import VnScroll from '../common/VnScroll.vue';
|
||||
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
|
||||
import VnCheckbox from '../common/VnCheckbox.vue';
|
||||
|
||||
const arrayData = useArrayData(useAttrs()['data-key']);
|
||||
const $props = defineProps({
|
||||
|
@ -332,6 +333,7 @@ function stopEventPropagation(event) {
|
|||
|
||||
function reload(params) {
|
||||
selected.value = [];
|
||||
selectAll.value = false;
|
||||
CrudModelRef.value.reload(params);
|
||||
}
|
||||
|
||||
|
@ -645,7 +647,7 @@ const rowCtrlClickFunction = computed(() => {
|
|||
return () => {};
|
||||
});
|
||||
const handleHeaderSelection = (evt, data) => {
|
||||
if (evt === 'selected' && data) {
|
||||
if (evt === 'updateSelected' && selectAll.value) {
|
||||
selected.value = tableRef.value.rows;
|
||||
} else if (evt === 'selectAll') {
|
||||
selected.value = data;
|
||||
|
@ -680,7 +682,13 @@ const handleHeaderSelection = (evt, data) => {
|
|||
:class="$attrs['class'] ?? 'q-px-md'"
|
||||
:limit="$attrs['limit'] ?? 100"
|
||||
ref="CrudModelRef"
|
||||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||
@on-fetch="
|
||||
(...args) => {
|
||||
selectAll = false;
|
||||
selected = [];
|
||||
emit('onFetch', ...args);
|
||||
}
|
||||
"
|
||||
:search-url="searchUrl"
|
||||
:disable-infinite-scroll="isTableMode"
|
||||
:before-save-fn="removeTextValue"
|
||||
|
@ -718,14 +726,23 @@ const handleHeaderSelection = (evt, data) => {
|
|||
:data-cy
|
||||
>
|
||||
<template #header-selection>
|
||||
<VnCheckboxMenu
|
||||
:searchUrl="searchUrl"
|
||||
:expand="$props.multiCheck.expand"
|
||||
v-model="selectAll"
|
||||
:url="$attrs['url']"
|
||||
@update:selected="handleHeaderSelection('selected', $event)"
|
||||
@select:all="handleHeaderSelection('selectAll', $event)"
|
||||
/>
|
||||
<div class="flex items-center no-wrap" style="display: flex">
|
||||
<VnCheckbox
|
||||
v-model="selectAll"
|
||||
@click="handleHeaderSelection('updateSelected', $event)"
|
||||
/>
|
||||
|
||||
<VnCheckboxMenu
|
||||
v-if="selectAll && $props.multiCheck.expand"
|
||||
:searchUrl="searchUrl"
|
||||
v-model="selectAll"
|
||||
:url="$attrs['url']"
|
||||
@update:selected="
|
||||
handleHeaderSelection('updateSelected', $event)
|
||||
"
|
||||
@select:all="handleHeaderSelection('selectAll', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #top-left v-if="!$props.withoutHeader">
|
||||
|
|
|
@ -9,10 +9,6 @@ const route = useRoute();
|
|||
const { t } = useI18n();
|
||||
const model = defineModel({ type: [Boolean] });
|
||||
const props = defineProps({
|
||||
expand: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
required: true,
|
||||
|
@ -22,29 +18,26 @@ const props = defineProps({
|
|||
default: 'table',
|
||||
},
|
||||
});
|
||||
const value = ref(false);
|
||||
const menuRef = ref(null);
|
||||
const errorMessage = ref(null);
|
||||
const rows = ref(0);
|
||||
const onClick = async () => {
|
||||
errorMessage.value = null;
|
||||
|
||||
if (value.value) {
|
||||
const { filter } = JSON.parse(route.query[props.searchUrl]);
|
||||
filter.limit = 0;
|
||||
const params = {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
};
|
||||
try {
|
||||
const { data } = await axios.get(props.url, params);
|
||||
rows.value = data;
|
||||
} catch (error) {
|
||||
const response = error.response;
|
||||
if (response.data.error.name === 'UserError') {
|
||||
errorMessage.value = t('tooManyResults');
|
||||
} else {
|
||||
errorMessage.value = response.data.error.message;
|
||||
}
|
||||
const { filter } = JSON.parse(route.query[props.searchUrl]);
|
||||
filter.limit = 0;
|
||||
const params = {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
};
|
||||
try {
|
||||
const { data } = axios.get(props.url, params);
|
||||
rows.value = data;
|
||||
} catch (error) {
|
||||
const response = error.response;
|
||||
if (response.data.error.name === 'UserError') {
|
||||
errorMessage.value = t('tooManyResults');
|
||||
} else {
|
||||
errorMessage.value = response.data.error.message;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -52,57 +45,53 @@ defineEmits(['update:selected', 'select:all']);
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center no-wrap" style="display: flex">
|
||||
<VnCheckbox v-model="value" @click="$emit('update:selected', value)" />
|
||||
<QIcon
|
||||
style="margin-left: -10px"
|
||||
data-cy="btnMultiCheck"
|
||||
v-if="value && $props.expand"
|
||||
name="expand_more"
|
||||
@click="onClick"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
size="xs"
|
||||
<QIcon
|
||||
style="margin-left: -10px"
|
||||
data-cy="btnMultiCheck"
|
||||
name="expand_more"
|
||||
@click="onClick"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QMenu
|
||||
fit
|
||||
anchor="bottom start"
|
||||
self="top left"
|
||||
ref="menuRef"
|
||||
data-cy="menuMultiCheck"
|
||||
>
|
||||
<QMenu
|
||||
fit
|
||||
anchor="bottom start"
|
||||
self="top left"
|
||||
ref="menuRef"
|
||||
data-cy="menuMultiCheck"
|
||||
>
|
||||
<QList separator>
|
||||
<QItem
|
||||
data-cy="selectAll"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
$refs.menuRef.hide();
|
||||
$emit('select:all', toRaw(rows));
|
||||
"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
<span v-text="t('Select all')" />
|
||||
</QItemLabel>
|
||||
<QItemLabel overline caption>
|
||||
<span
|
||||
v-if="errorMessage"
|
||||
class="text-negative"
|
||||
v-text="errorMessage"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
v-text="t('records', { rows: rows.length })"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<slot name="more-options"></slot>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QIcon>
|
||||
</div>
|
||||
<QList separator>
|
||||
<QItem
|
||||
data-cy="selectAll"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
$refs.menuRef.hide();
|
||||
$emit('select:all', toRaw(rows));
|
||||
"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
<span v-text="t('Select all')" />
|
||||
</QItemLabel>
|
||||
<QItemLabel overline caption>
|
||||
<span
|
||||
v-if="errorMessage"
|
||||
class="text-negative"
|
||||
v-text="errorMessage"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
v-text="t('records', { rows: rows.length ?? 0 })"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<slot name="more-options"></slot>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QIcon>
|
||||
</template>
|
||||
<i18n lang="yml">
|
||||
en:
|
||||
|
|
|
@ -351,6 +351,7 @@ globals:
|
|||
vehicleList: Vehicles
|
||||
vehicle: Vehicle
|
||||
entryPreAccount: Pre-account
|
||||
management: Worker management
|
||||
unsavedPopup:
|
||||
title: Unsaved changes will be lost
|
||||
subtitle: Are you sure exit without saving?
|
||||
|
|
|
@ -354,6 +354,7 @@ globals:
|
|||
vehicleList: Vehículos
|
||||
vehicle: Vehículo
|
||||
entryPreAccount: Precontabilizar
|
||||
management: Gestión de trabajadores
|
||||
unsavedPopup:
|
||||
title: Los cambios que no haya guardado se perderán
|
||||
subtitle: ¿Seguro que quiere salir sin guardar?
|
||||
|
|
|
@ -33,14 +33,6 @@ const getLocale = (label) => {
|
|||
</div>
|
||||
</template>
|
||||
<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>
|
||||
<QItemSection>
|
||||
<VnInput :label="t('First Name')" v-model="params.firstName" filled />
|
||||
|
@ -112,7 +104,6 @@ es:
|
|||
lastName: Apellidos
|
||||
userName: Usuario
|
||||
extension: Extensión
|
||||
FI: NIF
|
||||
First Name: Nombre
|
||||
Last Name: Apellidos
|
||||
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
|
||||
extension: Extension
|
||||
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
|
||||
extension: Extensión
|
||||
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',
|
||||
moduleName: 'Worker',
|
||||
keyBinding: 'w',
|
||||
menu: ['WorkerList', 'WorkerDepartment'],
|
||||
menu: ['WorkerList', 'WorkerDepartment', 'WorkerManagement'],
|
||||
},
|
||||
component: RouterView,
|
||||
redirect: { name: 'WorkerMain' },
|
||||
|
@ -283,6 +283,22 @@ export default {
|
|||
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'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('OrderCatalog', () => {
|
||||
describe.skip('OrderCatalog', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.viewport(1920, 1080);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
describe('TicketList', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.viewport(1920, 1080);
|
||||
cy.visit('/#/ticket/list', false);
|
||||
});
|
||||
|
||||
|
@ -76,7 +77,7 @@ describe('TicketList', () => {
|
|||
});
|
||||
}).as('ticket');
|
||||
|
||||
cy.selectOption('[data-cy="Warehouse_select"]', 'Warehouse Five');
|
||||
cy.selectOption('[data-cy="Warehouse_select"]', 'Warehouse One');
|
||||
cy.searchBtnFilterPanel();
|
||||
cy.wait('@ticket').then((interception) => {
|
||||
const data = interception.response.body[0];
|
||||
|
|
|
@ -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