Merge branch 'dev' into fix_vnLinkPhone
gitea/salix-front/pipeline/pr-dev Build queued... Details
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2025-04-01 14:52:22 +02:00
commit 8849b9ed97
40 changed files with 144 additions and 193 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "25.14.0", "version": "25.16.0",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",
@ -76,4 +76,4 @@
"vite": "^6.0.11", "vite": "^6.0.11",
"vitest": "^0.31.1" "vitest": "^0.31.1"
} }
} }

View File

@ -17,17 +17,6 @@ defineProps({ row: { type: Object, required: true } });
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</router-link> </router-link>
<QIcon
v-if="row?.reserved"
color="primary"
name="vn:reserva"
size="xs"
data-cy="ticketSaleReservedIcon"
>
<QTooltip>
{{ t('ticketSale.reserved') }}
</QTooltip>
</QIcon>
<QIcon <QIcon
v-if="row?.isDeleted" v-if="row?.isDeleted"
color="primary" color="primary"

View File

@ -55,6 +55,8 @@ const $props = defineProps({
}, },
}); });
const label = $props.showLabel && $props.column.label ? $props.column.label : '';
const defaultSelect = { const defaultSelect = {
attrs: { attrs: {
row: $props.row, row: $props.row,
@ -62,7 +64,7 @@ const defaultSelect = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}; };
@ -74,7 +76,7 @@ const defaultComponents = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
number: { number: {
@ -84,7 +86,7 @@ const defaultComponents = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
date: { date: {
@ -96,7 +98,7 @@ const defaultComponents = {
class: 'fit', class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
time: { time: {
@ -105,7 +107,7 @@ const defaultComponents = {
disable: !$props.isEditable, disable: !$props.isEditable,
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
}, },
}, },
checkbox: { checkbox: {
@ -125,7 +127,7 @@ const defaultComponents = {
return defaultAttrs; return defaultAttrs;
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label,
autofocus: true, autofocus: true,
}, },
events: { events: {

View File

@ -70,7 +70,7 @@ function textAlignToFlex(textAlign) {
:style="textAlignToFlex(align)" :style="textAlignToFlex(align)"
> >
<span :title="label">{{ label }}</span> <span :title="label">{{ label }}</span>
<div v-if="name"> <div v-if="name && (model?.index || vertical)">
<QChip <QChip
:label="!vertical ? model?.index : ''" :label="!vertical ? model?.index : ''"
:icon=" :icon="

View File

@ -1,35 +1,14 @@
<script setup> <script setup>
import { nextTick, ref } from 'vue';
import VnInput from './VnInput.vue'; import VnInput from './VnInput.vue';
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard'; import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
const $props = defineProps({
insertable: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
const model = defineModel({ prop: 'modelValue' }); const model = defineModel({ prop: 'modelValue' });
const inputRef = ref(false);
function setCursorPosition(pos) {
const input = inputRef.value.vnInputRef.$el.querySelector('input');
input.focus();
input.setSelectionRange(pos, pos);
}
async function handleUpdateModel(val) {
model.value = val?.at(-1) === '.' ? useAccountShortToStandard(val) : val;
await nextTick(() => setCursorPosition(0));
}
</script> </script>
<template> <template>
<VnInput <VnInput
v-model="model" v-model="model"
ref="inputRef" ref="inputRef"
:insertable @keydown.tab="model = useAccountShortToStandard($event.target.value) ?? model"
@update:model-value="handleUpdateModel" @input="model = $event.target.value.replace(/[^\d.]/g, '')"
/> />
</template> </template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onBeforeMount, computed } from 'vue'; import { onBeforeMount, computed, markRaw } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router'; import { useRoute, useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
@ -37,7 +37,7 @@ onBeforeRouteLeave(() => {
}); });
onBeforeMount(async () => { onBeforeMount(async () => {
stateStore.cardDescriptorChangeValue(props.descriptor); stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
const route = router.currentRoute.value; const route = router.currentRoute.value;
try { try {

View File

@ -30,7 +30,7 @@ const $props = defineProps({
default: null, default: null,
}, },
toModule: { toModule: {
type: String, type: Object,
default: null, default: null,
}, },
}); });

View File

@ -23,18 +23,19 @@ describe('useRole', () => {
name: `T'Challa`, name: `T'Challa`,
nickname: 'Black Panther', nickname: 'Black Panther',
lang: 'en', lang: 'en',
worker: { department: { departmentFk: 155 } },
}; };
const expectedUser = { const expectedUser = {
id: 999, id: 999,
name: `T'Challa`, name: `T'Challa`,
nickname: 'Black Panther', nickname: 'Black Panther',
lang: 'en', lang: 'en',
departmentFk: 155,
}; };
const expectedRoles = ['salesPerson', 'admin']; const expectedRoles = ['salesPerson', 'admin'];
vi.spyOn(axios, 'get') vi.spyOn(axios, 'get').mockResolvedValueOnce({
.mockResolvedValueOnce({
data: { roles: rolesData, user: fetchedUser }, data: { roles: rolesData, user: fetchedUser },
}) });
vi.spyOn(role.state, 'setUser'); vi.spyOn(role.state, 'setUser');
vi.spyOn(role.state, 'setRoles'); vi.spyOn(role.state, 'setRoles');

View File

@ -75,6 +75,7 @@ describe('session', () => {
userConfig: { userConfig: {
darkMode: false, darkMode: false,
}, },
worker: { department: { departmentFk: 155 } },
}; };
const rolesData = [ const rolesData = [
{ {
@ -143,7 +144,7 @@ describe('session', () => {
await session.destroy(); // this clears token and user for any other test await session.destroy(); // this clears token and user for any other test
}); });
}, },
{} {},
); );
describe('RenewToken', () => { describe('RenewToken', () => {
@ -175,7 +176,7 @@ describe('session', () => {
await session.checkValidity(); await session.checkValidity();
expect(sessionStorage.getItem('token')).toEqual(expectedToken); expect(sessionStorage.getItem('token')).toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).toEqual( expect(sessionStorage.getItem('tokenMultimedia')).toEqual(
expectedTokenMultimedia expectedTokenMultimedia,
); );
}); });
it('Should renewToken', async () => { it('Should renewToken', async () => {
@ -204,7 +205,7 @@ describe('session', () => {
await session.checkValidity(); await session.checkValidity();
expect(sessionStorage.getItem('token')).not.toEqual(expectedToken); expect(sessionStorage.getItem('token')).not.toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).not.toEqual( expect(sessionStorage.getItem('tokenMultimedia')).not.toEqual(
expectedTokenMultimedia expectedTokenMultimedia,
); );
}); });
}); });

View File

@ -30,9 +30,16 @@ export function useAcl() {
return false; return false;
} }
function hasAcl(model, prop, accessType) {
const modelAcl = state.getAcls().value[model];
const propAcl = modelAcl?.[prop] || modelAcl?.['*'];
return !!(propAcl?.[accessType] || propAcl?.['*']);
}
return { return {
fetch, fetch,
hasAny, hasAny,
state, state,
hasAcl,
}; };
} }

View File

@ -13,6 +13,7 @@ export function useRole() {
name: data.user.name, name: data.user.name,
nickname: data.user.nickname, nickname: data.user.nickname,
lang: data.user.lang || 'es', lang: data.user.lang || 'es',
departmentFk: data.user.worker.department.departmentFk,
}; };
state.setUser(userData); state.setUser(userData);
state.setRoles(roles); state.setRoles(roles);

View File

@ -100,12 +100,8 @@ const onChangePass = (oldPass) => {
}; };
onMounted(() => { onMounted(() => {
hasitManagementAccess.value = useAcl().hasAny([ hasitManagementAccess.value = useAcl().hasAcl('VnUser', 'higherPrivileges', 'WRITE');
{ model: 'VnUser', props: 'higherPrivileges', accessType: 'WRITE' }, hasSysadminAccess.value = useAcl().hasAcl('VnUser', 'adminUser', 'WRITE');
]);
hasSysadminAccess.value = useAcl().hasAny([
{ model: 'VnUser', props: 'adminUser', accessType: 'WRITE' },
]);
}); });
</script> </script>
<template> <template>
@ -227,7 +223,7 @@ onMounted(() => {
<QItemSection>{{ t('account.card.actions.deactivateUser.name') }}</QItemSection> <QItemSection>{{ t('account.card.actions.deactivateUser.name') }}</QItemSection>
</QItem> </QItem>
<QItem <QItem
v-if="useAcl().hasAny([{ model: 'VnRole', props: '*', accessType: 'WRITE' }])" v-if="useAcl().hasAcl('VnRole', '*', 'WRITE')"
v-ripple v-ripple
clickable clickable
@click="showSyncDialog = true" @click="showSyncDialog = true"

View File

@ -115,6 +115,7 @@ const props = defineProps({
<i18n> <i18n>
en: en:
params: params:
departmentFk: Department
search: Contains search: Contains
clientFk: Customer clientFk: Customer
clientName: Customer clientName: Customer
@ -127,6 +128,7 @@ en:
zoneFk: Zone zoneFk: Zone
es: es:
params: params:
departmentFk: Departamento
search: Contiene search: Contiene
clientFk: Cliente clientFk: Cliente
clientName: Cliente clientName: Cliente

View File

@ -25,7 +25,7 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const { sendEmail, openReport } = usePrintService(); const { sendEmail, openReport } = usePrintService();
const { t } = useI18n(); const { t } = useI18n();
const { hasAny } = useAcl(); const { hasAcl } = useAcl();
const quasar = useQuasar(); const quasar = useQuasar();
const route = useRoute(); const route = useRoute();
@ -276,9 +276,7 @@ const showBalancePdf = ({ id }) => {
> >
<VnInput <VnInput
v-model="scope.value" v-model="scope.value"
:disable=" :disable="!hasAcl('Receipt', '*', 'WRITE')"
!hasAny([{ model: 'Receipt', props: '*', accessType: 'WRITE' }])
"
@keypress.enter="scope.set" @keypress.enter="scope.set"
autofocus autofocus
/> />

View File

@ -156,6 +156,7 @@ en:
email: Email email: Email
isToBeMailed: Mailed isToBeMailed: Mailed
isEqualizated: Equailized isEqualizated: Equailized
departmentFk: Department
businessTypeFk: Business type businessTypeFk: Business type
sageTaxTypeFk: Sage Tax Type sageTaxTypeFk: Sage Tax Type
sageTransactionTypeFk: Sage Tax Type sageTransactionTypeFk: Sage Tax Type
@ -166,6 +167,7 @@ en:
postcode: Postcode postcode: Postcode
es: es:
params: params:
departmentFk: Departamento
search: Contiene search: Contiene
fi: NIF fi: NIF
isActive: Activo isActive: Activo

View File

@ -192,8 +192,10 @@ en:
date: L. O. Date date: L. O. Date
credit: Credit I. credit: Credit I.
defaulterSinced: From defaulterSinced: From
departmentFk: Department
es: es:
params: params:
departmentFk: Departamento
clientFk: Cliente clientFk: Cliente
countryFk: País countryFk: País
paymentMethod: F. Pago paymentMethod: F. Pago

View File

@ -9,12 +9,14 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnRow from 'src/components/ui/VnRow.vue'; import VnRow from 'src/components/ui/VnRow.vue';
import { dateRange } from 'src/filters'; import { dateRange } from 'src/filters';
import useOpenURL from 'src/composables/useOpenURL'; import useOpenURL from 'src/composables/useOpenURL';
import { useState } from 'src/composables/useState';
const { t } = useI18n(); const { t } = useI18n();
const dates = dateRange(Date.vnNew()); const dates = dateRange(Date.vnNew());
const from = ref(dates[0]); const from = ref(dates[0]);
const to = ref(dates[1]); const to = ref(dates[1]);
const state = useState();
const filter = computed(() => { const filter = computed(() => {
const obj = {}; const obj = {};
const formatFrom = setHours(from.value, 'from'); const formatFrom = setHours(from.value, 'from');
@ -24,16 +26,18 @@ const filter = computed(() => {
if (!formatFrom && formatTo) stamp = { lte: formatTo }; if (!formatFrom && formatTo) stamp = { lte: formatTo };
else if (formatFrom && !formatTo) stamp = { gte: formatFrom }; else if (formatFrom && !formatTo) stamp = { gte: formatFrom };
else if (formatFrom && formatTo) stamp = { between: [formatFrom, formatTo] }; else if (formatFrom && formatTo) stamp = { between: [formatFrom, formatTo] };
return Object.assign(obj, {
return Object.assign(obj, { where: { 'v.stamp': stamp } }); where: {
'v.stamp': stamp,
'c.departmentFk': state.getUser().value.departmentFk,
},
});
}); });
function exprBuilder(param, value) { function exprBuilder(param, value) {
switch (param) { switch (param) {
case 'clientFk': case 'clientFk':
return { [`c.id`]: value }; return { [`c.id`]: value };
case 'departmentFk':
return { [`c.${param}`]: value };
} }
} }
@ -66,9 +70,13 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'departmentFk', name: 'departmentFk',
label: t('customer.summary.team'), label: t('customer.summary.team'),
component: 'select', columnFilter: {
attrs: { component: 'select',
url: 'Departments', attrs: {
url: 'Departments',
},
alias: 'c',
inWhere: true,
}, },
columnField: { columnField: {
component: null, component: null,

View File

@ -130,8 +130,10 @@ en:
myTeam: My Team myTeam: My Team
isConfirmed: Order Confirmed isConfirmed: Order Confirmed
showEmpty: Show Empty showEmpty: Show Empty
departmentFk: Department
es: es:
params: params:
departmentFk: Departamento
search: Búsqueda search: Búsqueda
clientFk: Cliente clientFk: Cliente
agencyModeFk: Agencia agencyModeFk: Agencia

View File

@ -3,5 +3,5 @@ import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue';
import VnCard from 'src/components/common/VnCard.vue'; import VnCard from 'src/components/common/VnCard.vue';
</script> </script>
<template> <template>
<VnCard data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" /> <VnCard data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" :filter="{ where: { id: $route.params.id } }" />
</template> </template>

View File

@ -50,7 +50,7 @@ route:
agencyAgreement: Agency agreement agencyAgreement: Agency agreement
agencyModeName: Agency route agencyModeName: Agency route
isOwn: Own isOwn: Own
isAnyVolumeallowed: Any volume allowed isAnyVolumeAllowed: Any volume allowed
Worker: Worker Worker: Worker
Agency: Agency Agency: Agency
Vehicle: Vehicle Vehicle: Vehicle

View File

@ -25,9 +25,7 @@ const { validate } = useValidator();
const { notify } = useNotify(); const { notify } = useNotify();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const canEditZone = useAcl().hasAny([ const canEditZone = useAcl().hasAcl('Ticket', 'editZone', 'WRITE');
{ model: 'Ticket', props: 'editZone', accessType: 'WRITE' },
]);
const agencyFetchRef = ref(); const agencyFetchRef = ref();
const warehousesOptions = ref([]); const warehousesOptions = ref([]);

View File

@ -187,7 +187,9 @@ const getRowUpdateInputEvents = (sale) => {
const resetChanges = async () => { const resetChanges = async () => {
arrayData.fetch({ append: false }); arrayData.fetch({ append: false });
tableRef.value.reload(); tableRef.value.CrudModelRef.hasChanges = false;
await tableRef.value.reload();
selectedRows.value = []; selectedRows.value = [];
}; };
const changeQuantity = async (sale) => { const changeQuantity = async (sale) => {
@ -392,7 +394,7 @@ const changeTicketState = async (val) => {
const params = { ticketFk: route.params.id, code: val }; const params = { ticketFk: route.params.id, code: val };
await axios.post('Tickets/state', params); await axios.post('Tickets/state', params);
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
await resetChanges(); resetChanges();
}; };
const removeSelectedSales = () => { const removeSelectedSales = () => {

View File

@ -55,13 +55,12 @@ const isClaimable = computed(() => {
if (ticket.value) { if (ticket.value) {
const landedPlusWeek = new Date(ticket.value.landed); const landedPlusWeek = new Date(ticket.value.landed);
landedPlusWeek.setDate(landedPlusWeek.getDate() + 7); landedPlusWeek.setDate(landedPlusWeek.getDate() + 7);
const createAfterDeadline = acl.hasAny([ const createAfterDeadline = acl.hasAcl('Claim', 'createAfterDeadline', 'WRITE');
{ model: 'Claim', props: 'createAfterDeadline', accessType: 'WRITE' },
]);
return landedPlusWeek >= Date.vnNew() || createAfterDeadline; return landedPlusWeek >= Date.vnNew() || createAfterDeadline;
} }
return false; return false;
}); });
const sendSms = async (params) => { const sendSms = async (params) => {
await axios.post(`Tickets/${ticket.value.id}/sendSms`, params); await axios.post(`Tickets/${ticket.value.id}/sendSms`, params);
notify(t('SMS sent'), 'positive'); notify(t('SMS sent'), 'positive');
@ -230,18 +229,6 @@ const createRefund = async (withWarehouse) => {
<QItemLabel>{{ t('Add claim') }}</QItemLabel> <QItemLabel>{{ t('Add claim') }}</QItemLabel>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem
v-if="isTicketEditable"
clickable
v-close-popup
v-ripple
@click="setReserved(true)"
data-cy="markAsReservedItem"
>
<QItemSection>
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
</QItemSection>
</QItem>
<QItem clickable v-ripple data-cy="ticketSaleRefundItem"> <QItem clickable v-ripple data-cy="ticketSaleRefundItem">
<QItemSection> <QItemSection>
<QItemLabel>{{ t('Refund') }}</QItemLabel> <QItemLabel>{{ t('Refund') }}</QItemLabel>
@ -287,8 +274,6 @@ es:
Recalculate price: Recalcular precio Recalculate price: Recalcular precio
Update discount: Actualizar descuento Update discount: Actualizar descuento
Add claim: Crear reclamación Add claim: Crear reclamación
Mark as reserved: Marcar como reservado
Unmark as reserved: Desmarcar como reservado
Refund: Abono Refund: Abono
with warehouse: con almacén with warehouse: con almacén
without warehouse: sin almacén without warehouse: sin almacén

View File

@ -22,16 +22,6 @@ const states = ref([]);
const agencies = ref([]); const agencies = ref([]);
const warehouses = ref([]); const warehouses = ref([]);
const groupedStates = ref([]); const groupedStates = ref([]);
const getGroupedStates = (data) => {
for (const state of data) {
groupedStates.value.push({
id: state.id,
name: t(`${state.code}`),
code: state.code,
});
}
};
</script> </script>
<template> <template>
@ -39,12 +29,11 @@ const getGroupedStates = (data) => {
<FetchData url="States" @on-fetch="(data) => (states = data)" auto-load /> <FetchData url="States" @on-fetch="(data) => (states = data)" auto-load />
<FetchData <FetchData
url="AlertLevels" url="AlertLevels"
@on-fetch="
(data) => {
getGroupedStates(data);
}
"
auto-load auto-load
@on-fetch="
(data) =>
(groupedStates = data.map((x) => Object.assign(x, { code: t(x.code) })))
"
/> />
<FetchData <FetchData
url="AgencyModes" url="AgencyModes"
@ -126,12 +115,11 @@ const getGroupedStates = (data) => {
</QItemSection> </QItemSection>
<QItemSection v-if="groupedStates"> <QItemSection v-if="groupedStates">
<VnSelect <VnSelect
:label="t('Grouped state')" :label="t('params.groupedStates')"
v-model="params.groupedStates" v-model="params.groupedStates"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="groupedStates" :options="groupedStates"
option-value="id" option-label="code"
option-label="name"
emit-value emit-value
map-options map-options
use-input use-input
@ -304,7 +292,7 @@ en:
ON_PREPARATION: On preparation ON_PREPARATION: On preparation
PACKED: Packed PACKED: Packed
DELIVERED: Delivered DELIVERED: Delivered
ON_PREVIOUS: ON_PREVIOUS ON_PREVIOUS: On previous
es: es:
params: params:
search: Contiene search: Contiene
@ -349,7 +337,7 @@ es:
ON_PREPARATION: En preparación ON_PREPARATION: En preparación
PACKED: Encajado PACKED: Encajado
DELIVERED: Servido DELIVERED: Servido
ON_PREVIOUS: ON_PREVIOUS ON_PREVIOUS: En previa
Collection: Colección Collection: Colección
Nickname: Nombre mostrado Nickname: Nombre mostrado
</i18n> </i18n>

View File

@ -8,6 +8,6 @@ import filter from './TravelFilter.js';
data-key="Travel" data-key="Travel"
url="Travels" url="Travels"
:descriptor="TravelDescriptor" :descriptor="TravelDescriptor"
:filter="filter" :filter="{ ...filter, where: { id: $route.params.id } }"
/> />
</template> </template>

View File

@ -37,7 +37,7 @@ const cloneTravelWithEntries = async () => {
router.push({ name: 'TravelBasicData', params: { id: data.id } }); router.push({ name: 'TravelBasicData', params: { id: data.id } });
}; };
const canDelete = computed(() => useAcl().hasAny('Travel', '*', 'WRITE')); const canDelete = computed(() => useAcl().hasAcl('Travel', '*', 'WRITE'));
const openDeleteEntryDialog = (id) => { const openDeleteEntryDialog = (id) => {
quasar quasar

View File

@ -410,18 +410,18 @@ onMounted(async () => {
</template> </template>
</QTable> </QTable>
</QCard> </QCard>
<QCard class="full-width" v-if="thermographs.length > 0"> <QCard class="full-width" v-if="thermographs.length > 0">
<RouterLink <FetchData
class="header header-link" url="Warehouses"
:to="{ :filter="{ fields: ['id', 'name'] }"
name: 'TravelThermographsIndex', order="name"
params: { id: travel.id }, @on-fetch="(data) => (warehouses = data)"
}" auto-load
> />
{{ t('travel.summary.thermographs') }} <VnTitle
<QIcon name="open_in_new" /> :url="getLink('thermographs')"
</RouterLink> :text="t('travel.summary.thermographs')"
/>
<QTable <QTable
:rows="thermographs" :rows="thermographs"
:columns="thermographsTableColumns" :columns="thermographsTableColumns"

View File

@ -18,9 +18,7 @@ const router = useRouter();
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const acl = useAcl(); const acl = useAcl();
const canSeeNotes = computed(() => const canSeeNotes = computed(() => acl.hasAcl('Worker', '__get__business', 'READ'));
acl.hasAny([{ model: 'Worker', props: '__get__business', accessType: 'READ' }]),
);
const workerIsFreelance = ref(); const workerIsFreelance = ref();
const WorkerFreelanceRef = ref(); const WorkerFreelanceRef = ref();
const workerCalendarFilterRef = ref(null); const workerCalendarFilterRef = ref(null);

View File

@ -9,7 +9,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
const { hasAny } = useAcl(); const { hasAcl } = useAcl();
const { t } = useI18n(); const { t } = useI18n();
const fetchData = ref(); const fetchData = ref();
const originaLockerId = ref(); const originaLockerId = ref();
@ -58,11 +58,7 @@ const init = async (data) => {
option-label="code" option-label="code"
option-value="id" option-value="id"
hide-selected hide-selected
:readonly=" :readonly="!hasAcl('Worker', '__get__locker', 'READ')"
!hasAny([
{ model: 'Worker', props: '__get__locker', accessType: 'READ' },
])
"
/> />
</template> </template>
</FormModel> </FormModel>

View File

@ -68,13 +68,9 @@ const arrayData = useArrayData('Worker');
const acl = useAcl(); const acl = useAcl();
const selectedDateYear = computed(() => moment(selectedDate.value).isoWeekYear()); const selectedDateYear = computed(() => moment(selectedDate.value).isoWeekYear());
const worker = computed(() => arrayData.store?.data); const worker = computed(() => arrayData.store?.data);
const canSend = computed(() => const canSend = computed(() => acl.hasAcl('WorkerTimeControl', 'sendMail', 'WRITE'));
acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }]),
);
const canUpdate = computed(() => const canUpdate = computed(() =>
acl.hasAny([ acl.hasAcl('WorkerTimeControl', 'updateMailState', 'WRITE'),
{ model: 'WorkerTimeControl', props: 'updateMailState', accessType: 'WRITE' },
]),
); );
const isHimself = computed(() => user.value.id === Number(route.params.id)); const isHimself = computed(() => user.value.id === Number(route.params.id));

View File

@ -102,8 +102,11 @@ en:
lastName: Last name lastName: Last name
userName: User userName: User
extension: Extension extension: Extension
departmentFk: Department
es: es:
params: params:
departmentFk: Departamento
search: Contiene search: Contiene
firstName: Nombre firstName: Nombre
lastName: Apellidos lastName: Apellidos

View File

@ -238,6 +238,7 @@ export default {
title: 'list', title: 'list',
icon: 'view_list', icon: 'view_list',
}, },
component: () => import('src/pages/Route/RouteList.vue'),
}, },
routeCard, routeCard,
], ],
@ -286,6 +287,7 @@ export default {
title: 'list', title: 'list',
icon: 'view_list', icon: 'view_list',
}, },
component: () => import('src/pages/Route/RouteRoadmap.vue'),
}, },
roadmapCard, roadmapCard,
], ],
@ -316,6 +318,8 @@ export default {
title: 'list', title: 'list',
icon: 'view_list', icon: 'view_list',
}, },
component: () =>
import('src/pages/Route/Agency/AgencyList.vue'),
}, },
agencyCard, agencyCard,
], ],
@ -337,6 +341,8 @@ export default {
title: 'vehicleList', title: 'vehicleList',
icon: 'directions_car', icon: 'directions_car',
}, },
component: () =>
import('src/pages/Route/Vehicle/VehicleList.vue'),
}, },
vehicleCard, vehicleCard,
], ],

View File

@ -1,4 +1,4 @@
describe('ClaimNotes', () => { describe('Account descriptor', () => {
const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list'; const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list';
const url = '/#/account/1/summary'; const url = '/#/account/1/summary';
@ -7,6 +7,9 @@ describe('ClaimNotes', () => {
cy.visit(url); cy.visit(url);
cy.dataCy('descriptor-more-opts').click(); cy.dataCy('descriptor-more-opts').click();
cy.get(descriptorOptions) cy.get(descriptorOptions)
.should('exist')
.should('be.visible')
.find('.q-item') .find('.q-item')
.its('length') .its('length')
.then((count) => { .then((count) => {

View File

@ -13,7 +13,7 @@ describe('InvoiceInDescriptor', () => {
cy.validateCheckbox(checkbox, false); cy.validateCheckbox(checkbox, false);
}); });
it('should delete the invoice properly', () => { it.skip('should delete the invoice properly', () => {
cy.visit('/#/invoice-in/2/summary'); cy.visit('/#/invoice-in/2/summary');
cy.selectDescriptorOption(2); cy.selectDescriptorOption(2);
cy.clickConfirm(); cy.clickConfirm();

View File

@ -30,9 +30,11 @@ describe('OrderList', () => {
cy.url().should('include', `/order`); cy.url().should('include', `/order`);
}); });
it.skip('filter list and create order', () => { it('filter list and create order', () => {
cy.dataCy('Customer ID_input').type('1101{enter}'); cy.dataCy('Customer ID_input').type('1101{enter}');
cy.intercept('GET', /\/api\/Clients/).as('clientFilter');
cy.dataCy('vnTableCreateBtn').click(); cy.dataCy('vnTableCreateBtn').click();
cy.wait('@clientFilter');
cy.dataCy('landedDate').find('input').type('06/01/2001'); cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.selectOption(agencyCreateSelect, 1); cy.selectOption(agencyCreateSelect, 1);

View File

@ -0,0 +1,15 @@
describe('Agency modes', () => {
const name = 'inhouse pickup';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/1/modes`);
});
it('should display the agency modes page', () => {
cy.get('.flex > .title').should('have.text', name);
cy.get('.flex > .q-chip > .q-chip__content').should('have.text', 'ID: 1');
cy.get('.list-items > :nth-child(1) > .value').should('have.text', name);
});
});

View File

@ -49,12 +49,12 @@ describe.skip('RouteAutonomous', () => {
cy.get(selectors.firstRowCheckbox).click(); cy.get(selectors.firstRowCheckbox).click();
cy.get(selectors.createInvoiceBtn).click(); cy.get(selectors.createInvoiceBtn).click();
cy.dataCy(selectors.reference).type(data.reference); cy.dataCy(selectors.reference).type(data.reference);
cy.dataCy('attachFile').click();
cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', { cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', {
force: true, force: true,
}); });
cy.dataCy(selectors.saveFormBtn).click(); cy.dataCy(selectors.saveFormBtn).should('be.visible').click();
cy.checkNotification(dataSaved); cy.checkNotification(dataSaved);
cy.typeSearchbar('{enter}');
}); });
it('Should display the total price of the selected rows', () => { it('Should display the total price of the selected rows', () => {

View File

@ -53,17 +53,20 @@ describe('Route extended list', () => {
function fillField(selector, type, value) { function fillField(selector, type, value) {
switch (type) { switch (type) {
case 'select': case 'select':
cy.get(selector).should('be.visible').click(); cy.get(selector).should('be.visible').click().clear().type(value);
cy.dataCy('null_select').clear().type(value);
cy.get('.q-item').contains(value).click(); cy.get('.q-item').contains(value).click();
break; break;
case 'input': case 'input':
cy.get(selector).should('be.visible').click(); cy.get(selector)
cy.dataCy('null_input').clear().type(`${value}`); .should('be.visible')
.click()
.type(`{selectall}{backspace}${value}`);
break; break;
case 'date': case 'date':
cy.get(selector).should('be.visible').click(); cy.get(selector)
cy.dataCy('null_inputDate').clear().type(`${value}`); .should('be.visible')
.click()
.type(`{selectall}{backspace}${value}`);
break; break;
case 'checkbox': case 'checkbox':
cy.get(selector).should('be.visible').click().click(); cy.get(selector).should('be.visible').click().click();
@ -103,8 +106,8 @@ describe('Route extended list', () => {
cy.fillInForm(data); cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click(); cy.dataCy(selectors.saveFormBtn).click();
cy.checkNotification(dataCreated);
cy.url().should('include', '/summary'); cy.url().should('include', '/summary');
cy.checkNotification(dataCreated);
}); });
it('Should reset changed values when click reset button', () => { it('Should reset changed values when click reset button', () => {
@ -140,7 +143,7 @@ describe('Route extended list', () => {
const downloadsFolder = Cypress.config('downloadsFolder'); const downloadsFolder = Cypress.config('downloadsFolder');
cy.get(selectors.lastRowSelectCheckBox).click(); cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.downloadBtn).click(); cy.get(selectors.downloadBtn).click();
cy.wait(5000); cy.wait(3000);
const fileName = 'download.zip'; const fileName = 'download.zip';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist'); cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
@ -177,7 +180,7 @@ describe('Route extended list', () => {
const [month, day, year] = value.split('/'); const [month, day, year] = value.split('/');
value = `${day}/${month}/${year}`; value = `${day}/${month}/${year}`;
} }
cy.validateContent(selector, value); cy.get(selector).should('contain', value);
}); });
}); });

View File

@ -1,37 +0,0 @@
describe('VnAccountNumber', () => {
const accountInput = 'input[data-cy="supplierFiscalDataAccount_input"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/supplier/1/fiscal-data');
});
describe('VnInput handleInsertMode()', () => {
it('should replace character at cursor position in insert mode', () => {
cy.get(accountInput).type('{selectall}4100000001');
cy.get(accountInput).type('{movetostart}');
cy.get(accountInput).type('999');
cy.get(accountInput).should('have.value', '9990000001');
});
it('should replace character at cursor position in insert mode', () => {
cy.get(accountInput).clear();
cy.get(accountInput).type('4100000001');
cy.get(accountInput).type('{movetostart}');
cy.get(accountInput).type('999');
cy.get(accountInput).should('have.value', '9990000001');
});
it('should respect maxlength prop', () => {
cy.get(accountInput).clear();
cy.get(accountInput).type('123456789012345');
cy.get(accountInput).should('have.value', '1234567890');
});
});
it('should convert short account number to standard format', () => {
cy.get(accountInput).clear();
cy.get(accountInput).type('123.');
cy.get(accountInput).should('have.value', '1230000000');
});
});

View File

@ -27,12 +27,15 @@ describe('VnShortcuts', () => {
code: `Key${shortcut.toUpperCase()}`, code: `Key${shortcut.toUpperCase()}`,
}); });
cy.waitSpinner();
cy.url().should('include', module); cy.url().should('include', module);
if (['monitor', 'claim'].includes(module)) { if (['monitor', 'claim'].includes(module)) {
return; return;
} }
cy.waitForElement('.q-page').should('exist'); cy.waitForElement('.q-page').should('exist');
cy.dataCy('vnTableCreateBtn').should('exist'); cy.dataCy('vnTableCreateBtn').should('exist');
cy.waitSpinner();
cy.get('.q-page').trigger('keydown', { cy.get('.q-page').trigger('keydown', {
ctrlKey: true, ctrlKey: true,
altKey: true, altKey: true,