Merge branch 'dev' into fix_vnselect_scroll

This commit is contained in:
Alex Moreno 2025-04-25 08:03:05 +00:00
commit eb0b2ea477
31 changed files with 571 additions and 479 deletions

View File

@ -100,7 +100,7 @@ const $props = defineProps({
}, },
preventSubmit: { preventSubmit: {
type: Boolean, type: Boolean,
default: true, default: false,
}, },
}); });
const emit = defineEmits(['onFetch', 'onDataSaved', 'submit']); const emit = defineEmits(['onFetch', 'onDataSaved', 'submit']);
@ -287,7 +287,7 @@ function updateAndEmit(evt, { val, res, old } = { val: null, res: null, old: nul
state.set(modelValue, val); state.set(modelValue, val);
if (!$props.url) arrayData.store.data = val; if (!$props.url) arrayData.store.data = val;
emit(evt, state.get(modelValue), res, old); emit(evt, state.get(modelValue), res, old, formData);
} }
function trimData(data) { function trimData(data) {

View File

@ -33,7 +33,8 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
import VnTableFilter from './VnTableFilter.vue'; import VnTableFilter from './VnTableFilter.vue';
import { getColAlign } from 'src/composables/getColAlign'; import { getColAlign } from 'src/composables/getColAlign';
import RightMenu from '../common/RightMenu.vue'; import RightMenu from '../common/RightMenu.vue';
import VnScroll from '../common/VnScroll.vue' import VnScroll from '../common/VnScroll.vue';
import VnMultiCheck from '../common/VnMultiCheck.vue';
const arrayData = useArrayData(useAttrs()['data-key']); const arrayData = useArrayData(useAttrs()['data-key']);
const $props = defineProps({ const $props = defineProps({
@ -113,6 +114,10 @@ const $props = defineProps({
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
multiCheck: {
type: Object,
default: () => ({}),
},
crudModel: { crudModel: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
@ -157,6 +162,7 @@ const CARD_MODE = 'card';
const TABLE_MODE = 'table'; const TABLE_MODE = 'table';
const mode = ref(CARD_MODE); const mode = ref(CARD_MODE);
const selected = ref([]); const selected = ref([]);
const selectAll = ref(false);
const hasParams = ref(false); const hasParams = ref(false);
const CrudModelRef = ref({}); const CrudModelRef = ref({});
const showForm = ref(false); const showForm = ref(false);
@ -195,10 +201,10 @@ const onVirtualScroll = ({ to }) => {
handleScroll(); handleScroll();
const virtualScrollContainer = tableRef.value?.$el?.querySelector('.q-table__middle'); const virtualScrollContainer = tableRef.value?.$el?.querySelector('.q-table__middle');
if (virtualScrollContainer) { if (virtualScrollContainer) {
virtualScrollContainer.dispatchEvent(new CustomEvent('scroll')); virtualScrollContainer.dispatchEvent(new CustomEvent('scroll'));
if (vnScrollRef.value) { if (vnScrollRef.value) {
vnScrollRef.value.updateScrollContainer(virtualScrollContainer); vnScrollRef.value.updateScrollContainer(virtualScrollContainer);
} }
} }
}; };
@ -638,6 +644,23 @@ const rowCtrlClickFunction = computed(() => {
}; };
return () => {}; return () => {};
}); });
const handleMultiCheck = (value) => {
if (value) {
selected.value = tableRef.value.rows;
} else {
selected.value = [];
}
emit('update:selected', selected.value);
};
const handleSelectedAll = (data) => {
if (data) {
selected.value = data;
} else {
selected.value = [];
}
emit('update:selected', selected.value);
};
</script> </script>
<template> <template>
<RightMenu v-if="$props.rightSearch" :overlay="overlay"> <RightMenu v-if="$props.rightSearch" :overlay="overlay">
@ -679,9 +702,9 @@ const rowCtrlClickFunction = computed(() => {
ref="tableRef" ref="tableRef"
v-bind="table" v-bind="table"
:class="[ :class="[
'vnTable', 'vnTable',
table ? 'selection-cell' : '', table ? 'selection-cell' : '',
$props.footer ? 'last-row-sticky' : '', $props.footer ? 'last-row-sticky' : '',
]" ]"
wrap-cells wrap-cells
:columns="splittedColumns.columns" :columns="splittedColumns.columns"
@ -700,6 +723,17 @@ const rowCtrlClickFunction = computed(() => {
:hide-selected-banner="true" :hide-selected-banner="true"
:data-cy :data-cy
> >
<template #header-selection>
<VnMultiCheck
:searchUrl="searchUrl"
:expand="$props.multiCheck.expand"
v-model="selectAll"
:url="$attrs['url']"
@update:selected="handleMultiCheck"
@select:all="handleSelectedAll"
></VnMultiCheck>
</template>
<template #top-left v-if="!$props.withoutHeader"> <template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"> </slot> <slot name="top-left"> </slot>
</template> </template>
@ -1099,9 +1133,9 @@ const rowCtrlClickFunction = computed(() => {
</FormModelPopup> </FormModelPopup>
</QDialog> </QDialog>
<VnScroll <VnScroll
ref="vnScrollRef" ref="vnScrollRef"
v-if="isTableMode" v-if="isTableMode"
:scroll-target="tableRef?.$el?.querySelector('.q-table__middle')" :scroll-target="tableRef?.$el?.querySelector('.q-table__middle')"
/> />
</template> </template>
<i18n> <i18n>

View File

@ -0,0 +1,93 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'src/components/common/VnInput.vue';
import FetchData from '../FetchData.vue';
import VnSelectDialog from './VnSelectDialog.vue';
import CreateBankEntityForm from '../CreateBankEntityForm.vue';
const $props = defineProps({
iban: {
type: String,
default: null,
},
bankEntityFk: {
type: Number,
default: null,
},
disableElement: {
type: Boolean,
default: false,
},
});
const filter = {
fields: ['id', 'bic', 'name'],
order: 'bic ASC',
};
const { t } = useI18n();
const emit = defineEmits(['updateBic']);
const iban = ref($props.iban);
const bankEntityFk = ref($props.bankEntityFk);
const bankEntities = ref([]);
const autofillBic = async (bic) => {
if (!bic) return;
const bankEntityId = parseInt(bic.substr(4, 4));
const ibanCountry = bic.substr(0, 2);
if (ibanCountry != 'ES') return;
const existBank = bankEntities.value.find((b) => b.id === bankEntityId);
bankEntityFk.value = existBank ? bankEntityId : null;
emit('updateBic', { iban: iban.value, bankEntityFk: bankEntityFk.value });
};
const getBankEntities = (data) => {
bankEntityFk.value = data.id;
};
</script>
<template>
<FetchData
url="BankEntities"
:filter="filter"
auto-load
@on-fetch="(data) => (bankEntities = data)"
/>
<VnInput
:label="t('IBAN')"
clearable
v-model="iban"
@update:model-value="autofillBic($event)"
:disable="disableElement"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
</QIcon>
</template>
</VnInput>
<VnSelectDialog
:label="t('Swift / BIC')"
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:options="bankEntities"
hide-selected
option-label="name"
option-value="id"
v-model="bankEntityFk"
@update:model-value="$emit('updateBic', { iban, bankEntityFk })"
:disable="disableElement"
>
<template #form>
<CreateBankEntityForm @on-data-saved="getBankEntities($event)" />
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel>{{ scope.opt.bic }} </QItemLabel>
<QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
</template>

View File

@ -33,7 +33,7 @@ onBeforeRouteLeave(() => {
}); });
onBeforeMount(async () => { onBeforeMount(async () => {
stateStore.cardDescriptorChangeValue(markRaw(props.descriptor)); if (props.visual) stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
const route = router.currentRoute.value; const route = router.currentRoute.value;
try { try {

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar'; import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import { usePrintService } from 'composables/usePrintService';
import VnUserLink from '../ui/VnUserLink.vue'; import VnUserLink from '../ui/VnUserLink.vue';
import { downloadFile } from 'src/composables/downloadFile'; import { downloadFile } from 'src/composables/downloadFile';
@ -23,6 +24,7 @@ const rows = ref([]);
const dmsRef = ref(); const dmsRef = ref();
const formDialog = ref({}); const formDialog = ref({});
const token = useSession().getTokenMultimedia(); const token = useSession().getTokenMultimedia();
const { openReport } = usePrintService();
const $props = defineProps({ const $props = defineProps({
model: { model: {
@ -199,12 +201,7 @@ const columns = computed(() => [
color: 'primary', color: 'primary',
}), }),
click: (prop) => click: (prop) =>
downloadFile( openReport(`dms/${prop.row.id}/downloadFile`, {}, '_blank'),
prop.row.id,
$props.downloadModel,
undefined,
prop.row.download,
),
}, },
{ {
component: QBtn, component: QBtn,

View File

@ -1,44 +0,0 @@
<script setup>
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const model = defineModel({ type: [Number, String] });
const emit = defineEmits(['updateBic']);
const getIbanCountry = (bank) => {
return bank.substr(0, 2);
};
const autofillBic = async (iban) => {
if (!iban) return;
const bankEntityId = parseInt(iban.substr(4, 4));
const ibanCountry = getIbanCountry(iban);
if (ibanCountry != 'ES') return;
const filter = { where: { id: bankEntityId } };
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`BankEntities`, { params });
emit('updateBic', data[0]?.id);
};
</script>
<template>
<VnInput
:label="t('IBAN')"
clearable
v-model="model"
@update:model-value="autofillBic($event)"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
</QIcon>
</template>
</VnInput>
</template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted, watch, computed } from 'vue'; import { ref, onMounted, onUnmounted, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';

View File

@ -0,0 +1,80 @@
<script setup>
import { ref } from 'vue';
import VnCheckbox from './VnCheckbox.vue';
import axios from 'axios';
import { toRaw } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
const route = useRoute();
const { t } = useI18n();
const model = defineModel({ type: [Boolean] });
const props = defineProps({
expand: {
type: Boolean,
default: false,
},
url: {
type: String,
default: null,
required: true,
},
searchUrl: {
type: [String, Boolean],
default: 'table',
},
});
const value = ref(false);
const rows = ref(0);
const onClick = () => {
if (value.value) {
const { filter } = JSON.parse(route.query[props.searchUrl]);
filter.limit = 0;
const params = {
params: { filter: JSON.stringify(filter) },
};
axios
.get(props.url, params)
.then(({ data }) => {
rows.value = data;
})
.catch(console.error);
}
};
defineEmits(['update:selected', 'select:all']);
</script>
<template>
<div style="display: flex">
<VnCheckbox v-model="value" @click="$emit('update:selected', value)" />
<QBtn
v-if="value && $props.expand"
flat
dense
icon="expand_more"
@click="onClick"
>
<QMenu anchor="bottom right" self="top right">
<QList>
<QItem v-ripple clickable @click="$emit('select:all', toRaw(rows))">
{{ t('Select all', { rows: rows.length }) }}
</QItem>
<slot name="more-options"></slot>
</QList>
</QMenu>
</QBtn>
</div>
</template>
<i18n lang="yml">
en:
Select all: 'Select all ({rows})'
fr:
Select all: 'Sélectionner tout ({rows})'
es:
Select all: 'Seleccionar todo ({rows})'
de:
Select all: 'Alle auswählen ({rows})'
it:
Select all: 'Seleziona tutto ({rows})'
pt:
Select all: 'Selecionar tudo ({rows})'
</i18n>

View File

@ -0,0 +1,43 @@
import { createWrapper } from 'app/test/vitest/helper';
import VnBankDetailsForm from 'components/common/VnBankDetailsForm.vue';
import { vi, afterEach, expect, it, beforeEach, describe } from 'vitest';
describe('VnBankDetail Component', () => {
let vm;
let wrapper;
const bankEntities = [
{ id: 2100, bic: 'CAIXESBBXXX', name: 'CaixaBank' },
{ id: 1234, bic: 'TESTBIC', name: 'Test Bank' },
];
const correctIban = 'ES6621000418401234567891';
beforeAll(() => {
wrapper = createWrapper(VnBankDetailsForm, {
$props: {
iban: null,
bankEntityFk: null,
disableElement: false,
},
});
vm = wrapper.vm;
wrapper = wrapper.wrapper;
});
afterEach(() => {
vi.clearAllMocks();
});
it('should update bankEntityFk when IBAN exists in bankEntities', async () => {
vm.bankEntities = bankEntities;
await vm.autofillBic(correctIban);
expect(vm.bankEntityFk).toBe(2100);
});
it('should set bankEntityFk to null when IBAN bank code is not found', async () => {
vm.bankEntities = bankEntities;
await vm.autofillBic('ES1234567891324567891234');
expect(vm.bankEntityFk).toBe(null);
});
});

View File

@ -1,8 +1,6 @@
<script setup> <script setup>
import { onBeforeMount, watch, computed, ref } from 'vue'; import { watch, ref, onMounted } from 'vue';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { useState } from 'src/composables/useState';
import { useRoute } from 'vue-router';
import VnDescriptor from './VnDescriptor.vue'; import VnDescriptor from './VnDescriptor.vue';
const $props = defineProps({ const $props = defineProps({
@ -20,39 +18,50 @@ const $props = defineProps({
}, },
}); });
const state = useState();
const route = useRoute();
let arrayData; let arrayData;
let store; let store;
let entity; const entity = ref();
const isLoading = ref(false); const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName); const containerRef = ref(null);
defineExpose({ getData });
onBeforeMount(async () => { onMounted(async () => {
arrayData = useArrayData($props.dataKey, { let isPopup;
let el = containerRef.value.$el;
while (el) {
if (el.classList?.contains('q-menu')) {
isPopup = true;
break;
}
el = el.parentElement;
}
arrayData = useArrayData($props.dataKey + (isPopup ? 'Proxy' : ''), {
url: $props.url, url: $props.url,
userFilter: $props.filter, userFilter: $props.filter,
skip: 0, skip: 0,
oneRecord: true, oneRecord: true,
}); });
store = arrayData.store; store = arrayData.store;
entity = computed(() => {
const data = store.data ?? {};
if (data) emit('onFetch', data);
return data;
});
// It enables to load data only once if the module is the same as the dataKey
if (!isSameDataKey.value || !route.params.id) await getData();
watch( watch(
() => [$props.url, $props.filter], () => [$props.url, $props.filter],
async () => { async () => {
if (!isSameDataKey.value) await getData(); await getData();
},
{ immediate: true },
);
watch(
() => arrayData.store.data,
(newValue) => {
entity.value = newValue;
}, },
); );
}); });
defineExpose({ getData });
const emit = defineEmits(['onFetch']);
async function getData() { async function getData() {
store.url = $props.url; store.url = $props.url;
store.filter = $props.filter ?? {}; store.filter = $props.filter ?? {};
@ -60,18 +69,15 @@ async function getData() {
try { try {
await arrayData.fetch({ append: false, updateRouter: false }); await arrayData.fetch({ append: false, updateRouter: false });
const { data } = store; const { data } = store;
state.set($props.dataKey, data);
emit('onFetch', data); emit('onFetch', data);
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
} }
const emit = defineEmits(['onFetch']);
</script> </script>
<template> <template>
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey"> <VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey" ref="containerRef">
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName"> <template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" /> <slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template> </template>

View File

@ -222,7 +222,7 @@ defineExpose({
</script> </script>
<template> <template>
<div class="full-width" v-bind="attrs"> <div class="full-width">
<div <div
v-if="!store.data && !store.data?.length && !isLoading" v-if="!store.data && !store.data?.length && !isLoading"
class="info-row q-pa-md text-center" class="info-row q-pa-md text-center"

View File

@ -4,11 +4,6 @@ import AccountSummary from './AccountSummary.vue';
</script> </script>
<template> <template>
<QPopupProxy style="max-width: 10px"> <QPopupProxy style="max-width: 10px">
<AccountDescriptor <AccountDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="AccountSummary" />
v-if="$attrs.id"
v-bind="$attrs"
:summary="AccountSummary"
:proxy-render="true"
/>
</QPopupProxy> </QPopupProxy>
</template> </template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDateHourMinSec, toPercentage } from 'src/filters'; import { toDateHourMinSec, toPercentage } from 'src/filters';
@ -9,7 +9,6 @@ import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/Departme
import EntityDescriptor from 'components/ui/EntityDescriptor.vue'; import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { getUrl } from 'src/composables/getUrl';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue'; import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import filter from './ClaimFilter.js'; import filter from './ClaimFilter.js';
@ -23,7 +22,6 @@ const $props = defineProps({
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const salixUrl = ref();
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
@ -31,10 +29,6 @@ const entityId = computed(() => {
function stateColor(entity) { function stateColor(entity) {
return entity?.claimState?.classColor; return entity?.claimState?.classColor;
} }
onMounted(async () => {
salixUrl.value = await getUrl('');
});
</script> </script>
<template> <template>
@ -126,7 +120,7 @@ onMounted(async () => {
size="md" size="md"
icon="assignment" icon="assignment"
color="primary" color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/sale-tracking'" :to="{ name: 'TicketSaleTracking', params: { id: entity.ticketFk } }"
> >
<QTooltip>{{ t('claim.saleTracking') }}</QTooltip> <QTooltip>{{ t('claim.saleTracking') }}</QTooltip>
</QBtn> </QBtn>
@ -134,7 +128,7 @@ onMounted(async () => {
size="md" size="md"
icon="visibility" icon="visibility"
color="primary" color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'" :to="{ name: 'TicketTracking', params: { id: entity.ticketFk } }"
> >
<QTooltip>{{ t('claim.ticketTracking') }}</QTooltip> <QTooltip>{{ t('claim.ticketTracking') }}</QTooltip>
</QBtn> </QBtn>

View File

@ -4,11 +4,6 @@ import ClaimSummary from './ClaimSummary.vue';
</script> </script>
<template> <template>
<QPopupProxy style="max-width: 10px"> <QPopupProxy style="max-width: 10px">
<ClaimDescriptor <ClaimDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ClaimSummary" />
v-if="$attrs.id"
v-bind="$attrs.id"
:summary="ClaimSummary"
:proxy-render="true"
/>
</QPopupProxy> </QPopupProxy>
</template> </template>

View File

@ -1,5 +1,4 @@
<script setup> <script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -7,29 +6,15 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import VnInputBic from 'src/components/common/VnInputBic.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const bankEntitiesRef = ref(null);
const filter = {
fields: ['id', 'bic', 'name'],
order: 'bic ASC',
};
const getBankEntities = (data, formData) => {
bankEntitiesRef.value.fetch();
formData.bankEntityFk = Number(data.id);
};
</script> </script>
<template> <template>
<FormModel :url-update="`Clients/${route.params.id}`" auto-load model="Customer"> <FormModel :url-update="`Clients/${route.params.id}`" auto-load model="Customer">
<template #form="{ data, validate }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnSelect <VnSelect
auto-load auto-load
@ -42,42 +27,19 @@ const getBankEntities = (data, formData) => {
/> />
<VnInput :label="t('Due day')" clearable v-model="data.dueDay" /> <VnInput :label="t('Due day')" clearable v-model="data.dueDay" />
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInputBic <VnBankDetailsForm
:label="t('IBAN')" v-model:iban="data.iban"
v-model="data.iban" v-model:bankEntityFk="data.bankEntityFk"
@update-bic="(bankEntityFk) => (data.bankEntityFk = bankEntityFk)" @update-bic="
({ iban, bankEntityFk }) => {
if (!iban || !bankEntityFk) return;
data.iban = iban;
data.bankEntityFk = bankEntityFk;
}
"
/> />
<VnSelectDialog
:label="t('Swift / BIC')"
ref="bankEntitiesRef"
:filter="filter"
auto-load
url="BankEntities"
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:rules="validate('Worker.bankEntity')"
hide-selected
option-label="name"
option-value="id"
v-model="data.bankEntityFk"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="getBankEntities($event, data)"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel>{{ scope.opt.bic }} </QItemLabel>
<QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
</VnRow> </VnRow>
<VnRow> <VnRow>
<QCheckbox :label="t('Received LCR')" v-model="data.hasLcr" /> <QCheckbox :label="t('Received LCR')" v-model="data.hasLcr" />
<QCheckbox :label="t('VNL core received')" v-model="data.hasCoreVnl" /> <QCheckbox :label="t('VNL core received')" v-model="data.hasCoreVnl" />

View File

@ -100,6 +100,9 @@ const columns = computed(() => [
'row-key': 'id', 'row-key': 'id',
selection: 'multiple', selection: 'multiple',
}" }"
:multi-check="{
expand: true,
}"
v-model:selected="selected" v-model:selected="selected"
:right-search="true" :right-search="true"
:columns="columns" :columns="columns"

View File

@ -98,7 +98,9 @@ onMounted(async () => {
<QBtn color="primary" icon="show_chart" :disable="!selectedRows"> <QBtn color="primary" icon="show_chart" :disable="!selectedRows">
<QPopupProxy ref="popupProxyRef"> <QPopupProxy ref="popupProxyRef">
<QCard class="column q-pa-md"> <QCard class="column q-pa-md">
<span class="text-body1 q-mb-sm">{{ t('Campaign consumption') }}</span> <span class="text-body1 q-mb-sm">{{
t('Campaign consumption', { rows: $props.clients.length })
}}</span>
<VnRow> <VnRow>
<VnSelect <VnSelect
:options="moreFields" :options="moreFields"
@ -140,12 +142,13 @@ onMounted(async () => {
valentinesDay: Valentine's Day valentinesDay: Valentine's Day
mothersDay: Mother's Day mothersDay: Mother's Day
allSaints: All Saints' Day allSaints: All Saints' Day
Campaign consumption: Campaign consumption ({rows})
es: es:
params: params:
valentinesDay: Día de San Valentín valentinesDay: Día de San Valentín
mothersDay: Día de la Madre mothersDay: Día de la Madre
allSaints: Día de Todos los Santos allSaints: Día de Todos los Santos
Campaign consumption: Consumo campaña Campaign consumption: Consumo campaña ({rows})
Campaign: Campaña Campaign: Campaña
From: Desde From: Desde
To: Hasta To: Hasta

View File

@ -4,11 +4,6 @@ import ParkingSummary from './ParkingSummary.vue';
</script> </script>
<template> <template>
<QPopupProxy style="max-width: 10px"> <QPopupProxy style="max-width: 10px">
<ParkingDescriptor <ParkingDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ParkingSummary" />
v-if="$attrs.id"
v-bind="$attrs.id"
:summary="ParkingSummary"
:proxy-render="true"
/>
</QPopupProxy> </QPopupProxy>
</template> </template>

View File

@ -7,12 +7,11 @@ import FetchData from 'components/FetchData.vue';
import CrudModel from 'components/CrudModel.vue'; import CrudModel from 'components/CrudModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
@ -26,11 +25,6 @@ const wireTransferFk = ref(null);
const bankEntitiesOptions = ref([]); const bankEntitiesOptions = ref([]);
const filteredBankEntitiesOptions = ref([]); const filteredBankEntitiesOptions = ref([]);
const onBankEntityCreated = async (dataSaved, rowData) => {
await bankEntitiesRef.value.fetch();
rowData.bankEntityFk = dataSaved.id;
};
const onChangesSaved = async () => { const onChangesSaved = async () => {
if (supplier.value.payMethodFk !== wireTransferFk.value) if (supplier.value.payMethodFk !== wireTransferFk.value)
quasar quasar
@ -56,23 +50,6 @@ const setWireTransfer = async () => {
await axios.patch(`Suppliers/${route.params.id}`, params); await axios.patch(`Suppliers/${route.params.id}`, params);
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
}; };
function findBankFk(value, row) {
row.bankEntityFk = null;
if (!value) return;
const bankEntityFk = bankEntitiesOptions.value.find((b) => b.id == value.slice(4, 8));
if (bankEntityFk) row.bankEntityFk = bankEntityFk.id;
}
function bankEntityFilter(val) {
const needle = val.toLowerCase();
filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
(bank) =>
bank.bic.toLowerCase().startsWith(needle) ||
bank.name.toLowerCase().includes(needle),
);
}
</script> </script>
<template> <template>
<FetchData <FetchData
@ -118,47 +95,16 @@ function bankEntityFilter(val) {
:key="index" :key="index"
class="row q-gutter-md q-mb-md" class="row q-gutter-md q-mb-md"
> >
<VnInput <VnBankDetailsForm
:label="t('supplier.accounts.iban')" v-model:iban="row.iban"
v-model="row.iban" v-model:bankEntityFk="row.bankEntityFk"
@update:model-value="(value) => findBankFk(value, row)" @update-bic="
:required="true" ({ iban, bankEntityFk }) => {
> row.iban = iban;
<template #append> row.bankEntityFk = bankEntityFk;
<QIcon name="info" class="cursor-info"> }
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip> "
</QIcon> />
</template>
</VnInput>
<VnSelectDialog
:label="t('worker.create.bankEntity')"
v-model="row.bankEntityFk"
:options="filteredBankEntitiesOptions"
:filter-fn="bankEntityFilter"
option-label="bic"
hide-selected
:required="true"
:roles-allowed-to-create="['financial']"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="
(_, requestResponse) =>
onBankEntityCreated(requestResponse, row)
"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel
>{{ scope.opt.bic }}
{{ scope.opt.name }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
<VnInput <VnInput
:label="t('supplier.accounts.beneficiary')" :label="t('supplier.accounts.beneficiary')"
v-model="row.beneficiary" v-model="row.beneficiary"

View File

@ -25,7 +25,9 @@ const { validate } = useValidator();
const { notify } = useNotify(); const { notify } = useNotify();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const canEditZone = useAcl().hasAcl('Ticket', 'editZone', 'WRITE'); const canEditZone = useAcl().hasAny([
{ model: 'Ticket', props: 'editZone', accessType: 'WRITE' },
]);
const agencyFetchRef = ref(); const agencyFetchRef = ref();
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
@ -68,15 +70,20 @@ async function getDate(query, params) {
for (const param in params) { for (const param in params) {
if (!params[param]) return; if (!params[param]) return;
} }
formData.value.zoneFk = null;
zonesOptions.value = []; zonesOptions.value = [];
const { data } = await axios.get(query, { params }); const { data } = await axios.get(query, { params });
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative'); if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
formData.value.zoneFk = data.zoneFk; formData.value.zoneFk = data.zoneFk;
if (data.landed) formData.value.landed = data.landed; formData.value.landed = data.landed;
if (data.shipped) formData.value.shipped = data.shipped; const shippedDate = new Date(params.shipped);
const landedDate = new Date(data.hour);
shippedDate.setHours(
landedDate.getHours(),
landedDate.getMinutes(),
landedDate.getSeconds(),
);
formData.value.shipped = shippedDate.toISOString();
} }
const onChangeZone = async (zoneId) => { const onChangeZone = async (zoneId) => {
@ -125,6 +132,7 @@ const addressId = computed({
formData.value.addressFk = val; formData.value.addressFk = val;
onChangeAddress(val); onChangeAddress(val);
getShipped({ getShipped({
shipped: formData.value?.shipped,
landed: formData.value?.landed, landed: formData.value?.landed,
addressFk: val, addressFk: val,
agencyModeFk: formData.value?.agencyModeFk, agencyModeFk: formData.value?.agencyModeFk,
@ -417,6 +425,14 @@ async function getZone(options) {
:rules="validate('ticketList.shipped')" :rules="validate('ticketList.shipped')"
@update:model-value="setShipped" @update:model-value="setShipped"
/> />
<VnInputTime
:label="t('basicData.shippedHour')"
v-model="formData.shipped"
:required="true"
:rules="validate('basicData.shippedHour')"
disabled
@update:model-value="setShipped"
/>
<VnInputDate <VnInputDate
:label="t('basicData.landed')" :label="t('basicData.landed')"
v-model="formData.landed" v-model="formData.landed"

View File

@ -1,5 +1,4 @@
<script setup> <script setup>
import { reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -30,31 +29,29 @@ const { t } = useI18n();
const router = useRouter(); const router = useRouter();
const { notify } = useNotify(); const { notify } = useNotify();
const newTicketFormData = reactive({});
const date = new Date(); const date = new Date();
const createTicket = async () => { async function createTicket(formData) {
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id); const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
const params = { const params = {
clientId: $props.ticket.clientFk, clientId: $props.ticket.clientFk,
landed: newTicketFormData.landed, landed: formData.landed,
warehouseId: $props.ticket.warehouseFk, warehouseId: $props.ticket.warehouseFk,
addressId: $props.ticket.addressFk, addressId: $props.ticket.addressFk,
agencyModeId: $props.ticket.agencyModeFk, agencyModeId: $props.ticket.agencyModeFk,
routeId: newTicketFormData.routeFk, routeId: formData.routeFk,
expeditionIds: expeditionIds, expeditionIds: expeditionIds,
}; };
const { data } = await axios.post('Expeditions/moveExpeditions', params); const { data } = await axios.post('Expeditions/moveExpeditions', params);
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');
router.push({ name: 'TicketSummary', params: { id: data.id } }); router.push({ name: 'TicketSummary', params: { id: data.id } });
}; }
</script> </script>
<template> <template>
<FormModelPopup <FormModelPopup
model="expeditionNewTicket" model="expeditionNewTicket"
:form-initial-data="newTicketFormData" :form-initial-data="{}"
:save-fn="createTicket" :save-fn="createTicket"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">

View File

@ -55,73 +55,75 @@ async function handleSave(e) {
auto-load auto-load
url="ObservationTypes" url="ObservationTypes"
/> />
<div class="flex justify-center"> <div class="full-width flex justify-center">
<CrudModel <QPage class="card-width q-pa-lg">
ref="ticketNotesCrudRef" <CrudModel
data-key="TicketNotes" class="fit"
url="TicketObservations" ref="ticketNotesCrudRef"
model="TicketNotes" data-key="TicketNotes"
:filter="crudModelFilter" url="TicketObservations"
:data-required="crudModelRequiredData" model="TicketNotes"
:default-remove="false" :filter="crudModelFilter"
auto-load :data-required="crudModelRequiredData"
style="max-width: 800px" :default-remove="false"
> auto-load
<template #body="{ rows }"> >
<QCard class="q-px-lg q-py-md"> <template #body="{ rows }">
<div <QCard class="q-px-lg q-py-md">
v-for="(row, index) in rows" <div
:key="index" v-for="(row, index) in rows"
class="q-mb-md row q-gutter-x-md" :key="index"
> class="q-mb-md row items-center q-gutter-x-md"
<VnSelect
:label="t('ticketNotes.observationType')"
:options="observationTypes"
hide-selected
option-label="description"
option-value="id"
v-model="row.observationTypeFk"
:disable="!!row.id"
data-cy="ticketNotesObservationType"
/>
<VnInput
:label="t('basicData.description')"
v-model="row.description"
class="col"
@keydown.enter.stop="handleSave"
autogrow
data-cy="ticketNotesDescription"
/>
<QIcon
name="delete"
size="sm"
class="cursor-pointer"
color="primary"
@click="handleDelete(row)"
data-cy="ticketNotesRemoveNoteBtn"
> >
<QTooltip> <VnSelect
{{ t('ticketNotes.removeNote') }} :label="t('ticketNotes.observationType')"
</QTooltip> :options="observationTypes"
</QIcon> hide-selected
</div> option-label="description"
<VnRow v-if="observationTypes.length > rows.length"> option-value="id"
<QBtn v-model="row.observationTypeFk"
icon="add_circle" :disable="!!row.id"
v-shortcut="'+'" data-cy="ticketNotesObservationType"
flat />
class="fill-icon-on-hover q-ml-md" <VnInput
color="primary" :label="t('basicData.description')"
@click="ticketNotesCrudRef.insert()" v-model="row.description"
data-cy="ticketNotesAddNoteBtn" class="col"
> @keydown.enter.stop="handleSave"
<QTooltip> autogrow
{{ t('ticketNotes.addNote') }} data-cy="ticketNotesDescription"
</QTooltip> />
</QBtn> <QIcon
</VnRow> name="delete"
</QCard> size="sm"
</template> class="cursor-pointer"
</CrudModel> color="primary"
@click="handleDelete(row)"
data-cy="ticketNotesRemoveNoteBtn"
>
<QTooltip>
{{ t('ticketNotes.removeNote') }}
</QTooltip>
</QIcon>
</div>
<VnRow v-if="observationTypes.length > rows.length">
<QBtn
icon="add_circle"
v-shortcut="'+'"
flat
class="fill-icon-on-hover q-ml-md"
color="primary"
@click="ticketNotesCrudRef.insert()"
data-cy="ticketNotesAddNoteBtn"
>
<QTooltip>
{{ t('ticketNotes.addNote') }}
</QTooltip>
</QBtn>
</VnRow>
</QCard>
</template>
</CrudModel>
</QPage>
</div> </div>
</template> </template>

View File

@ -49,88 +49,95 @@ watch(
<FetchData <FetchData
@on-fetch="(data) => (listPackagingsOptions = data)" @on-fetch="(data) => (listPackagingsOptions = data)"
auto-load auto-load
:filter="{ fields: ['packagingFk', 'name'], order: 'name ASC' }"
url="Packagings/listPackaging" url="Packagings/listPackaging"
:filter="{
fields: ['packagingFk', 'name'],
order: ['name ASC'],
}"
/> />
<div class="flex justify-center"> <div class="full-width flex justify-center">
<CrudModel <QPage class="card-width q-pa-lg">
ref="ticketPackagingsCrudRef" <CrudModel
data-key="TicketPackagings" ref="ticketPackagingsCrudRef"
url="TicketPackagings" data-key="TicketPackagings"
model="TicketPackagings" url="TicketPackagings"
:filter="crudModelFilter" model="TicketPackagings"
:data-required="crudModelRequiredData" :filter="crudModelFilter"
:default-remove="false" :data-required="crudModelRequiredData"
auto-load :default-remove="false"
style="max-width: 800px" auto-load
> >
<template #body="{ rows, validate }"> <template #body="{ rows, validate }">
<QCard class="q-px-lg q-py-md"> <QCard class="q-px-lg q-py-md">
<div <div
v-for="(row, index) in rows" v-for="(row, index) in rows"
:key="index" :key="index"
class="q-mb-md row items-center q-gutter-x-md" class="q-mb-md row items-center q-gutter-x-md"
>
<VnSelect
:label="t('package.package')"
:options="listPackagingsOptions"
hide-selected
option-label="name"
option-value="packagingFk"
v-model="row.packagingFk"
> >
<template #option="scope"> <VnSelect
<QItem v-bind="scope.itemProps"> :label="t('package.package')"
<QItemSection> :options="listPackagingsOptions"
<QItemLabel> hide-selected
{{ scope.opt?.name }} option-label="name"
</QItemLabel> option-value="packagingFk"
<QItemLabel caption> v-model="row.packagingFk"
#{{ scope.opt?.itemFk }} >
</QItemLabel> <template #option="scope">
</QItemSection> <QItem v-bind="scope.itemProps">
</QItem> <QItemSection>
</template> <QItemLabel>
</VnSelect> {{ scope.opt?.name }}
<VnInput </QItemLabel>
:label="t('basicData.quantity')" <QItemLabel caption>
v-model.number="row.quantity" #{{ scope.opt?.itemFk }}
class="col" </QItemLabel>
type="number" </QItemSection>
min="1" </QItem>
:required="true" </template>
@update:model-value="handleInputQuantityClear(row)" </VnSelect>
:rules="validate('TicketPackaging.quantity')" <VnInput
/> :label="t('basicData.quantity')"
<VnInputDate :label="t('package.added')" v-model="row.created" /> v-model.number="row.quantity"
<QIcon class="col"
name="delete" type="number"
size="sm" min="1"
class="cursor-pointer" :required="true"
color="primary" @update:model-value="handleInputQuantityClear(row)"
@click="ticketPackagingsCrudRef.remove([row])" :rules="validate('TicketPackaging.quantity')"
> />
<QTooltip> <VnInputDate
{{ t('package.removePackage') }} :label="t('package.added')"
</QTooltip> v-model="row.created"
</QIcon> />
</div> <QIcon
<VnRow> name="delete"
<QBtn size="sm"
icon="add_circle" class="cursor-pointer"
v-shortcut="'+'" color="primary"
flat @click="ticketPackagingsCrudRef.remove([row])"
class="fill-icon-on-hover q-ml-md" >
color="primary" <QTooltip>
@click="ticketPackagingsCrudRef.insert()" {{ t('package.removePackage') }}
> </QTooltip>
<QTooltip> </QIcon>
{{ t('package.addPackage') }} </div>
</QTooltip> <VnRow>
</QBtn> <QBtn
</VnRow> icon="add_circle"
</QCard> v-shortcut="'+'"
</template> flat
</CrudModel> class="fill-icon-on-hover q-ml-md"
color="primary"
@click="ticketPackagingsCrudRef.insert()"
>
<QTooltip>
{{ t('package.addPackage') }}
</QTooltip>
</QBtn>
</VnRow>
</QCard>
</template>
</CrudModel>
</QPage>
</div> </div>
</template> </template>

View File

@ -385,7 +385,12 @@ watch(
if (!$el) return; if (!$el) return;
const head = $el.querySelector('thead'); const head = $el.querySelector('thead');
const firstRow = $el.querySelector('thead > tr'); const firstRow = $el.querySelector('thead > tr');
const headSelectionCol = $el.querySelector(
'thead tr.bg-header th.q-table--col-auto-width',
);
if (headSelectionCol) {
headSelectionCol.classList.add('horizontal-separator');
}
const newRow = document.createElement('tr'); const newRow = document.createElement('tr');
destinationElRef.value = document.createElement('th'); destinationElRef.value = document.createElement('th');
originElRef.value = document.createElement('th'); originElRef.value = document.createElement('th');
@ -394,8 +399,8 @@ watch(
destinationElRef.value.classList.add('text-uppercase', 'color-vn-label'); destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
originElRef.value.classList.add('text-uppercase', 'color-vn-label'); originElRef.value.classList.add('text-uppercase', 'color-vn-label');
destinationElRef.value.setAttribute('colspan', '7'); destinationElRef.value.setAttribute('colspan', '10');
originElRef.value.setAttribute('colspan', '9'); originElRef.value.setAttribute('colspan', '10');
destinationElRef.value.textContent = `${t( destinationElRef.value.textContent = `${t(
'advanceTickets.destination', 'advanceTickets.destination',
@ -490,8 +495,6 @@ watch(
selection: 'multiple', selection: 'multiple',
}" }"
v-model:selected="selectedTickets" v-model:selected="selectedTickets"
:pagination="{ rowsPerPage: 0 }"
:no-data-label="$t('globals.noResults')"
:right-search="false" :right-search="false"
:order="['futureTotalWithVat ASC']" :order="['futureTotalWithVat ASC']"
auto-load auto-load

View File

@ -1,6 +1,5 @@
<script setup> <script setup>
import { ref, nextTick, onMounted } from 'vue'; import { ref, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
@ -9,21 +8,23 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary'; import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
import { useRoute } from 'vue-router';
const { t } = useI18n(); const { t } = useI18n();
const form = ref(); const form = ref();
const educationLevels = ref([]); const educationLevels = ref([]);
const countries = ref([]); const countries = ref([]);
const model = 'Worker';
const maritalStatus = [ const maritalStatus = [
{ code: 'M', name: t('Married') }, { code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') }, { code: 'S', name: t('Single') },
]; ];
const route = useRoute();
onMounted(async () => { async function addAdvancedData(data) {
const advanced = await useAdvancedSummary('Workers', useRoute().params.id); const advanced = await useAdvancedSummary('Workers', route.params.id);
Object.assign(form.value.formData, advanced); data.value = { ...data.value, ...advanced };
nextTick(() => (form.value.hasChanges = false)); nextTick(() => (form.value.hasChanges = false));
}); }
</script> </script>
<template> <template>
<FetchData <FetchData
@ -42,7 +43,8 @@ onMounted(async () => {
ref="form" ref="form"
:url-update="`Workers/${$route.params.id}`" :url-update="`Workers/${$route.params.id}`"
auto-load auto-load
model="Worker" :model
@on-fetch="(data, res, old, formData) => addAdvancedData(formData)"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>

View File

@ -4,9 +4,11 @@ import VnCard from 'src/components/common/VnCard.vue';
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Worker" :data-key="$attrs['data-key'] ?? 'Worker'"
url="Workers/summary" url="Workers/summary"
:id-in-where="true" :id-in-where="true"
:descriptor="WorkerDescriptor" :descriptor="WorkerDescriptor"
v-bind="$attrs"
v-on="$attrs"
/> />
</template> </template>

View File

@ -2,7 +2,6 @@
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import EntityDescriptor from 'src/components/ui/EntityDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import VnChangePassword from 'src/components/common/VnChangePassword.vue'; import VnChangePassword from 'src/components/common/VnChangePassword.vue';
@ -11,6 +10,8 @@ import VnImg from 'src/components/ui/VnImg.vue';
import EditPictureForm from 'components/EditPictureForm.vue'; import EditPictureForm from 'components/EditPictureForm.vue';
import WorkerDescriptorMenu from './WorkerDescriptorMenu.vue'; import WorkerDescriptorMenu from './WorkerDescriptorMenu.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue'; import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
import WorkerCard from './WorkerCard.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -52,14 +53,17 @@ const handlePhotoUpdated = (evt = false) => {
}; };
</script> </script>
<template> <template>
<EntityDescriptor <CardDescriptor
v-bind="$attrs"
ref="cardDescriptorRef" ref="cardDescriptorRef"
:data-key="dataKey" :data-key="dataKey"
:summary="$props.summary" :summary="$props.summary"
url="Workers/summary" :card="WorkerCard"
:id="entityId"
:filter="{ where: { id: entityId } }" :filter="{ where: { id: entityId } }"
title="user.nickname" title="user.nickname"
@on-fetch="getIsExcluded" @on-fetch="getIsExcluded"
module="Worker"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<WorkerDescriptorMenu <WorkerDescriptorMenu
@ -165,7 +169,7 @@ const handlePhotoUpdated = (evt = false) => {
</QBtn> </QBtn>
</QCardActions> </QCardActions>
</template> </template>
</EntityDescriptor> </CardDescriptor>
<VnChangePassword <VnChangePassword
ref="changePassRef" ref="changePassRef"
:submit-fn=" :submit-fn="

View File

@ -2,7 +2,6 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue'; import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
import { axiosNoError } from 'src/boot/axios';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue'; import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue';
@ -281,11 +280,11 @@ const fetchWeekData = async () => {
week: selectedWeekNumber.value, week: selectedWeekNumber.value,
}; };
try { try {
const [{ data: mailData }, { data: countData }] = await Promise.all([ const [{ data: mailData }, { data: countData }] = await Promise.allS([
axiosNoError.get(`Workers/${route.params.id}/mail`, { axios.get(`Workers/${route.params.id}/mail`, {
params: { filter: { where } }, params: { filter: { where } },
}), }),
axiosNoError.get('WorkerTimeControlMails/count', { params: { where } }), axios.get('WorkerTimeControlMails/count', { params: { where } }),
]); ]);
const mail = mailData[0]; const mail = mailData[0];

View File

@ -10,15 +10,13 @@ import VnRadio from 'src/components/common/VnRadio.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnLocation from 'src/components/common/VnLocation.vue'; import VnLocation from 'src/components/common/VnLocation.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import WorkerFilter from './WorkerFilter.vue'; import WorkerFilter from './WorkerFilter.vue';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios'; import axios from 'axios';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue'; import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import VnInputBic from 'src/components/common/VnInputBic.vue'; import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
@ -122,12 +120,6 @@ onBeforeMount(async () => {
).data?.payMethodFk; ).data?.payMethodFk;
}); });
async function handleNewBankEntity(data, resp) {
await bankEntitiesRef.value.fetch();
data.bankEntityFk = resp.id;
bankEntitiesOptions.value.push(resp);
}
function handleLocation(data, location) { function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {}; const { town, code, provinceFk, countryFk } = location ?? {};
data.postcode = code; data.postcode = code;
@ -323,51 +315,19 @@ function generateCodeUser(worker) {
(val) => !val && delete data.payMethodFk (val) => !val && delete data.payMethodFk
" "
/> />
<VnInputBic
:label="t('IBAN')"
v-model="data.iban"
:disable="data.isFreelance"
@update-bic="
(bankEntityFk) => (data.bankEntityFk = bankEntityFk)
"
/>
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelectDialog <VnBankDetailsForm
:label="t('worker.create.bankEntity')" v-model:iban="data.iban"
v-model="data.bankEntityFk" v-model:bankEntityFk="data.bankEntityFk"
:options="bankEntitiesOptions" :disable-element="data.isFreelance"
option-label="name" @update-bic="
option-value="id" ({ iban, bankEntityFk }) => {
hide-selected data.iban = iban;
:acls="[ data.bankEntityFk = bankEntityFk;
{ }
model: 'BankEntity', "
props: '*', />
accessType: 'WRITE',
},
]"
:disable="data.isFreelance"
:filter-options="['bic', 'name']"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="
(_, resp) => handleNewBankEntity(data, resp)
"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel
>{{ scope.opt.bic }}
{{ scope.opt.name }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
</VnRow> </VnRow>
</div> </div>
</template> </template>

View File

@ -189,16 +189,14 @@ const exprBuilder = (param, value) => {
return { return {
code: { like: `%${value}%` }, code: { like: `%${value}%` },
}; };
case 'id':
case 'price':
case 'agencyModeFk': case 'agencyModeFk':
return { return {
agencyModeFk: value, [param]: value,
}; };
case 'search': case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } }; return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
case 'price':
return {
price: value,
};
} }
}; };

View File

@ -54,7 +54,7 @@ describe('Handle Items FixedPrice', () => {
}); });
it('should edit all items', () => { it('should edit all items', () => {
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click(); cy.get('.bg-header > :nth-child(1) [data-cy="vnCheckbox"]').click();
cy.dataCy('FixedPriceToolbarEditBtn').should('not.be.disabled'); cy.dataCy('FixedPriceToolbarEditBtn').should('not.be.disabled');
cy.dataCy('FixedPriceToolbarEditBtn').click(); cy.dataCy('FixedPriceToolbarEditBtn').click();
cy.dataCy('EditFixedPriceSelectOption').type(grouping); cy.dataCy('EditFixedPriceSelectOption').type(grouping);
@ -65,7 +65,7 @@ describe('Handle Items FixedPrice', () => {
}); });
it('should remove all items', () => { it('should remove all items', () => {
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click(); cy.get('.bg-header > :nth-child(1) [data-cy="vnCheckbox"]').click();
cy.dataCy('crudModelDefaultRemoveBtn').should('not.be.disabled'); cy.dataCy('crudModelDefaultRemoveBtn').should('not.be.disabled');
cy.dataCy('crudModelDefaultRemoveBtn').click(); cy.dataCy('crudModelDefaultRemoveBtn').click();
cy.dataCy('VnConfirm_confirm').click(); cy.dataCy('VnConfirm_confirm').click();