Compare commits

..

23 Commits

Author SHA1 Message Date
Pau Rovira f6759da796 Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-04-17 10:52:34 +00:00
Pau Rovira 58057a8ac2 fix: refs #8443 fixed broken route
gitea/salix-front/pipeline/pr-dev Build queued... Details
2025-04-17 12:50:37 +02:00
Pau Rovira 297ef023e4 Merge branch 'dev' of https: refs #8443//gitea.verdnatura.es/verdnatura/salix-front into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-04-17 10:20:36 +02:00
Pau Rovira d8ba342d7c Merge branch 'dev' of https: refs #8443//gitea.verdnatura.es/verdnatura/salix-front into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-04-15 14:36:42 +02:00
Pau Rovira 0a299b0fe5 feat: refs #8443 used data-cy for select in test
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-04-04 15:04:57 +02:00
Javier Segarra f80a14370e Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev Build queued... Details
2025-04-01 13:12:40 +00:00
Pau Rovira 49391140d8 Merge branch 'dev' of https: refs #8443//gitea.verdnatura.es/verdnatura/salix-front into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-04-01 11:01:24 +02:00
Pau Rovira 7d6b3e27b4 refactor: refs #8443 improved code
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-03-31 13:03:27 +02:00
Pau Rovira 70c8780782 fix: refs #8443 code and form view fixes
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-03-31 09:25:25 +02:00
Pau Rovira 4e0922e989 Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-03-26 08:34:32 +00:00
Pau Rovira d12cd08e08 Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-03-26 07:34:07 +00:00
Pau Rovira 47779437d3 feat: refs #8443 added EntityCalendar and EntityCalendarGrid
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-03-26 08:32:29 +01:00
Pau Rovira 018084c7c4 Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-03-21 11:33:05 +00:00
Pau Rovira 75a99caf51 feat: refs #8443 changed VehicleEvents to use native loopback for events fetch 2025-03-21 12:32:01 +01:00
Pau Rovira 8ffc3e8f2d feat: refs #8443 added notifications and translations
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-03-03 13:08:19 +01:00
Pau Rovira ecdd1a95df Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-03-03 09:45:54 +00:00
Pau Rovira 33c268ddb9 Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-02-24 12:03:23 +00:00
Pau Rovira ff24971df9 Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-21 06:49:50 +00:00
Pau Rovira 398f76c6e7 feat: refs #8443 added select in form for vehicle state
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-13 07:49:12 +01:00
Pau Rovira 30f42cbde7 Merge branch '8443-vehicleEvent' of https://gitea.verdnatura.es/verdnatura/salix-front into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-12 12:32:32 +01:00
Pau Rovira bb70969d60 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8443-vehicleEvent 2025-02-12 12:29:52 +01:00
Pau Rovira 80b0efac5a Merge branch 'dev' into 8443-vehicleEvent
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-12 11:29:34 +00:00
Pau Rovira a261de39b4 feat: refs #8443 created vehicle events
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-12 12:26:43 +01:00
29 changed files with 956 additions and 704 deletions

View File

@ -0,0 +1,152 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { date } from 'quasar';
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import useWeekdaysOrder from 'src/composables/getWeekdays';
const formatDate = (dateToFormat, format = 'YYYY-MM-DD') => (
date.formatDate(dateToFormat, format)
);
const props = defineProps({
year: {
type: Number,
required: true,
},
month: {
type: Number,
required: true,
},
monthDate: {
type: Object,
default: null,
},
daysMap: {
type: Object,
default: null,
},
});
const emit = defineEmits(['onDateSelected']);
const { locale } = useI18n();
const weekdayStore = useWeekdayStore();
const weekDays = useWeekdaysOrder();
const calendarRef = ref(null);
const today = ref(formatDate(Date.vnNew()));
const todayTimestamp = computed(() => {
const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
return date.getTime();
});
const _monthDate = computed(() => formatDate(props.monthDate));
const calendarHeaderTitle = computed(() => {
return `${weekdayStore.getLocaleMonths[props.month - 1].locale} ${props.year}`;
});
const isToday = (timestamp) => {
const { year, month, day } = timestamp;
return todayTimestamp.value === new Date(year, month - 1, day).getTime();
};
const getEventByTimestamp = ({ year, month, day }) => {
const stamp = new Date(year, month - 1, day).getTime();
return props.daysMap?.[stamp] || null;
};
const handleDateClick = (timestamp) => {
const event = getEventByTimestamp(timestamp);
const { year, month, day } = timestamp;
const date = new Date(year, month - 1, day);
emit('onDateSelected', {
date,
isNewMode: !event,
event: event?.[0] || null
});
};
const getEventAttrs = (timestamp) => {
return {
class: '--event',
label: timestamp.day,
};
};
defineExpose({ getEventByTimestamp, handleDateClick });
</script>
<template>
<QCalendarMonthWrapper
style="height: 290px; width: 290px"
transparent-background
view-customization="workerCalendar"
>
<template #header>
<span class="full-width text-center text-body1 q-py-sm">{{
calendarHeaderTitle
}}</span>
</template>
<template #calendar>
<QCalendarMonth
ref="calendarRef"
:model-value="_monthDate"
show-work-weeks
no-outside-days
no-active-date
:weekdays="weekDays"
short-weekday-label
:locale="locale"
:now="today"
@click-date="handleDateClick($event.scope.timestamp)"
mini-mode
>
<template #day="{ scope: { timestamp } }">
<slot name="day" :timestamp="timestamp" :getEventAttrs="getEventAttrs">
<QBtn
v-if="getEventByTimestamp(timestamp)"
v-bind="{ ...getEventAttrs(timestamp) }"
@click="handleDateClick(timestamp)"
rounded
dense
flat
class="calendar-event"
:class="{ '--today': isToday(timestamp) }"
/>
</slot>
</template>
</QCalendarMonth>
</template>
</QCalendarMonthWrapper>
</template>
<style lang="scss">
.calendar-event {
display: flex;
justify-content: center;
width: 32px;
height: 32px;
font-size: 13px;
line-height: 1.715em;
cursor: pointer;
color: white;
&.--today {
border: 2px solid $info;
}
&.--event {
background-color: $positive;
color: black;
}
&:hover {
opacity: 0.8;
}
}
</style>

View File

@ -0,0 +1,126 @@
<script setup>
import { computed, onMounted, ref, onUnmounted, nextTick } from 'vue';
import { useStateStore } from 'stores/useStateStore';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import { useArrayData } from 'src/composables/useArrayData';
const props = defineProps({
dataKey: {
type: String,
required: true,
},
calendarComponent: {
type: Object,
required: true,
},
additionalProps: {
type: Object,
default: () => ({}),
}
});
const stateStore = useStateStore();
const weekdayStore = useWeekdayStore();
const nMonths = ref(4);
const _date = ref(Date.vnNew());
const firstDay = ref(Date.vnNew());
const lastDay = ref(Date.vnNew());
const months = ref([]);
const arrayData = useArrayData(props.dataKey);
onMounted(async () => {
const initialDate = Date.vnNew();
initialDate.setDate(1);
initialDate.setHours(0, 0, 0, 0);
date.value = initialDate;
await nextTick();
stateStore.rightDrawer = true;
});
onUnmounted(() => arrayData.destroy());
const emit = defineEmits([
'update:firstDay',
'update:lastDay',
'update:events',
'onDateSelected',
]);
const date = computed({
get: () => _date.value,
set: (value) => {
if (!(value instanceof Date)) return;
_date.value = value;
const stamp = value.getTime();
firstDay.value = new Date(stamp);
firstDay.value.setDate(1);
lastDay.value = new Date(stamp);
lastDay.value.setMonth(lastDay.value.getMonth() + nMonths.value);
lastDay.value.setDate(0);
months.value = [];
for (let i = 0; i < nMonths.value; i++) {
const monthDate = new Date(stamp);
monthDate.setMonth(value.getMonth() + i);
months.value.push(monthDate);
}
emit('update:firstDay', firstDay.value);
emit('update:lastDay', lastDay.value);
emit('refresh-events');
},
});
const headerTitle = computed(() => {
if (!months.value?.length) return '';
const getMonthName = date =>
`${weekdayStore.getLocaleMonths[date.getMonth()].locale} ${date.getFullYear()}`;
return `${getMonthName(months.value[0])} - ${getMonthName(months.value[months.value.length - 1])}`;
});
const step = (direction) => {
const newDate = new Date(date.value);
newDate.setMonth(newDate.getMonth() + nMonths.value * direction);
date.value = newDate;
};
defineExpose({
firstDay,
lastDay
});
</script>
<template>
<QCard style="height: max-content">
<div class="calendars-header">
<QBtn
icon="arrow_left"
size="sm"
flat
class="full-height"
@click="step(-1)"
/>
<span>{{ headerTitle }}</span>
<QBtn
icon="arrow_right"
size="sm"
flat
class="full-height"
@click="step(1)"
/>
</div>
<div class="calendars-container">
<component
:is="calendarComponent"
v-for="(month, index) in months"
:key="index"
:month="month.getMonth() + 1"
:year="month.getFullYear()"
:month-date="month"
v-bind="additionalProps"
@on-date-selected="data => emit('onDateSelected', data)"
/>
</div>
</QCard>
</template>

View File

@ -186,7 +186,7 @@ onMounted(() => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
const someIsLoading = computed(() => isLoading.value || !!arrayData?.isLoading?.value);
const someIsLoading = computed(() => isLoading.value || arrayData?.isLoading?.value);
function findKeyInOptions() {
if (!$props.options) return;
return filter($props.modelValue, $props.options)?.length;
@ -376,7 +376,7 @@ function getCaption(opt) {
>
<template #append>
<QIcon
v-show="isClearable && value != null && value !== ''"
v-show="isClearable && value"
name="close"
@click="
() => {
@ -391,7 +391,7 @@ function getCaption(opt) {
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<div v-if="slotName == 'append'">
<QIcon
v-show="isClearable && value != null && value !== ''"
v-show="isClearable && value"
name="close"
@click.stop="
() => {
@ -416,7 +416,7 @@ function getCaption(opt) {
<QItemLabel>
{{ opt[optionLabel] }}
</QItemLabel>
<QItemLabel caption v-if="getCaption(opt) !== false">
<QItemLabel caption v-if="getCaption(opt)">
{{ `#${getCaption(opt)}` }}
</QItemLabel>
</QItemSection>

View File

@ -89,26 +89,24 @@ function cancel() {
<slot name="customHTML"></slot>
</QCardSection>
<QCardActions align="right">
<slot name="actions" :actions="{ confirm, cancel }">
<QBtn
:label="t('globals.cancel')"
color="primary"
:disable="isLoading"
flat
@click="cancel()"
data-cy="VnConfirm_cancel"
/>
<QBtn
:label="t('globals.confirm')"
:title="t('globals.confirm')"
color="primary"
:loading="isLoading"
@click="confirm()"
unelevated
autofocus
data-cy="VnConfirm_confirm"
/>
</slot>
<QBtn
:label="t('globals.cancel')"
color="primary"
:disable="isLoading"
flat
@click="cancel()"
data-cy="VnConfirm_cancel"
/>
<QBtn
:label="t('globals.confirm')"
:title="t('globals.confirm')"
color="primary"
:loading="isLoading"
@click="confirm()"
unelevated
autofocus
data-cy="VnConfirm_confirm"
/>
</QCardActions>
</QCard>
</QDialog>

View File

@ -0,0 +1,10 @@
import { ref } from 'vue';
import moment from 'moment';
export default function useWeekdaysOrder() {
const firstDay = moment().weekday(1).day();
const weekdays = [...Array(7).keys()].map(i => (i + firstDay) % 7);
return ref(weekdays);
}

View File

@ -1,4 +1,4 @@
import { onMounted, computed, ref } from 'vue';
import { onMounted, computed } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import { useArrayDataStore } from 'stores/useArrayDataStore';
@ -346,7 +346,7 @@ export function useArrayData(key, userOptions) {
}
const totalRows = computed(() => (store.data && store.data.length) || 0);
const isLoading = ref(store.isLoading || false);
const isLoading = computed(() => store.isLoading || false);
return {
fetch,

View File

@ -343,3 +343,20 @@ input::-webkit-inner-spin-button {
.q-item__section--main ~ .q-item__section--side {
padding-inline: 0;
}
.calendars-header {
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
background-color: $primary;
font-weight: bold;
font-size: 16px;
}
.calendars-container {
max-width: 800px;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}

View File

@ -346,7 +346,6 @@ globals:
parking: Parking
vehicleList: Vehicles
vehicle: Vehicle
entryPreAccount: Pre-account
unsavedPopup:
title: Unsaved changes will be lost
subtitle: Are you sure exit without saving?

View File

@ -349,7 +349,6 @@ globals:
parking: Parking
vehicleList: Vehículos
vehicle: Vehículo
entryPreAccount: Precontabilizar
unsavedPopup:
title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar?

View File

@ -1,477 +0,0 @@
<script setup>
import { ref, computed, markRaw, useTemplateRef, onBeforeMount, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters';
import { useArrayData } from 'src/composables/useArrayData';
import VnTable from 'src/components/VnTable/VnTable.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue';
import EntryDescriptorProxy from './Card/EntryDescriptorProxy.vue';
import SupplierDescriptorProxy from '../Supplier/Card/SupplierDescriptorProxy.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnDms from 'src/components/common/VnDms.vue';
import { useState } from 'src/composables/useState';
import { useQuasar } from 'quasar';
import InvoiceInDescriptorProxy from '../InvoiceIn/Card/InvoiceInDescriptorProxy.vue';
import { useStateStore } from 'src/stores/useStateStore';
import { downloadFile } from 'src/composables/downloadFile';
const { t } = useI18n();
const quasar = useQuasar();
const { notify } = useNotify();
const user = useState().getUser();
const stateStore = useStateStore();
const updateDialog = ref();
const uploadDialog = ref();
let maxDays;
let defaultDays;
const dataKey = 'entryPreaccountingFilter';
const url = 'Entries/preAccountingFilter';
const arrayData = useArrayData(dataKey);
const daysAgo = ref();
const isBooked = ref();
const dmsData = ref();
const table = useTemplateRef('table');
const companies = ref([]);
const countries = ref([]);
const entryTypes = ref([]);
const supplierFiscalTypes = ref([]);
const warehouses = ref([]);
const defaultDmsDescription = ref();
const dmsTypeId = ref();
const selectedRows = ref([]);
const totalAmount = ref();
const totalSelectedAmount = computed(() => {
if (!selectedRows.value.length) return 0;
return selectedRows.value.reduce((acc, entry) => acc + entry.amount, 0);
});
let supplierRef;
let dmsFk;
const columns = computed(() => [
{
name: 'id',
label: t('entry.preAccount.id'),
isId: true,
chip: {
condition: () => true,
},
},
{
name: 'invoiceNumber',
label: t('entry.preAccount.invoiceNumber'),
},
{
name: 'company',
label: t('globals.company'),
columnFilter: {
component: 'select',
name: 'companyFk',
optionLabel: 'code',
options: companies.value,
},
},
{
name: 'warehouse',
label: t('globals.warehouse'),
columnFilter: {
component: 'select',
name: 'warehouseInFk',
options: warehouses.value,
},
},
{
name: 'gestDocFk',
label: t('entry.preAccount.gestDocFk'),
},
{
name: 'dmsType',
label: t('entry.preAccount.dmsType'),
columnFilter: {
component: 'select',
label: null,
name: 'dmsTypeFk',
url: 'DmsTypes',
fields: ['id', 'name'],
},
},
{
name: 'reference',
label: t('entry.preAccount.reference'),
},
{
name: 'shipped',
label: t('entry.preAccount.shipped'),
format: ({ shipped }, dashIfEmpty) => dashIfEmpty(toDate(shipped)),
columnFilter: {
component: 'date',
name: 'shipped',
},
},
{
name: 'landed',
label: t('entry.preAccount.landed'),
format: ({ landed }, dashIfEmpty) => dashIfEmpty(toDate(landed)),
columnFilter: {
component: 'date',
name: 'landed',
},
},
{
name: 'invoiceInFk',
label: t('entry.preAccount.invoiceInFk'),
},
{
name: 'supplier',
label: t('globals.supplier'),
format: (row) => row.supplier,
columnFilter: {
component: markRaw(VnSelectSupplier),
label: null,
name: 'supplierFk',
class: 'fit',
},
},
{
name: 'country',
label: t('globals.country'),
columnFilter: {
component: 'select',
name: 'countryFk',
options: countries.value,
},
},
{
name: 'description',
label: t('entry.preAccount.entryType'),
columnFilter: {
component: 'select',
label: null,
name: 'typeFk',
options: entryTypes.value,
optionLabel: 'description',
optionValue: 'code',
},
},
{
name: 'payDem',
label: t('entry.preAccount.payDem'),
columnFilter: {
component: 'number',
name: 'payDem',
},
},
{
name: 'fiscalCode',
label: t('entry.preAccount.fiscalCode'),
format: ({ fiscalCode }) => t(fiscalCode),
columnFilter: {
component: 'select',
name: 'fiscalCode',
options: supplierFiscalTypes.value,
optionLabel: 'locale',
optionValue: 'code',
sortBy: 'code',
},
},
{
name: 'amount',
label: t('globals.amount'),
format: ({ amount }) => toCurrency(amount),
columnFilter: {
component: 'number',
name: 'amount',
},
},
{
name: 'isAgricultural',
label: t('entry.preAccount.isAgricultural'),
component: 'checkbox',
isEditable: false,
},
{
name: 'isBooked',
label: t('entry.preAccount.isBooked'),
component: 'checkbox',
},
{
name: 'isReceived',
label: t('entry.preAccount.isReceived'),
component: 'checkbox',
isEditable: false,
},
]);
onBeforeMount(async () => {
const { data } = await axios.get('EntryConfigs/findOne', {
params: { filter: JSON.stringify({ fields: ['maxDays', 'defaultDays'] }) },
});
maxDays = data.maxDays;
defaultDays = data.defaultDays;
daysAgo.value = arrayData.store.userParams.daysAgo || defaultDays;
isBooked.value = arrayData.store.userParams.isBooked || false;
stateStore.leftDrawer = false;
});
watch(selectedRows, (nVal, oVal) => {
const lastRow = nVal.at(-1);
if (lastRow?.isBooked) selectedRows.value.pop();
if (nVal.length > oVal.length && lastRow.invoiceInFk)
quasar.dialog({
component: VnConfirm,
componentProps: { title: t('entry.preAccount.hasInvoice') },
});
});
function filterByDaysAgo(val) {
if (!val) val = defaultDays;
else if (val > maxDays) val = maxDays;
daysAgo.value = val;
arrayData.store.userParams.daysAgo = daysAgo.value;
table.value.reload();
}
async function preAccount() {
const entries = selectedRows.value;
const { companyFk, isAgricultural, landed } = entries.at(0);
try {
dmsFk = entries.find(({ gestDocFk }) => gestDocFk)?.gestDocFk;
if (isAgricultural) {
const year = new Date(landed).getFullYear();
supplierRef = (
await axios.get('InvoiceIns/getMaxRef', { params: { companyFk, year } })
).data;
return createInvoice();
} else if (dmsFk) {
supplierRef = (
await axios.get(`Dms/${dmsFk}`, {
params: { filter: JSON.stringify({ fields: ['reference'] }) },
})
).data?.reference;
updateDialog.value.show();
} else {
uploadFile();
}
} catch (e) {
throw e;
}
}
async function updateFile() {
await axios.post(`Dms/${dmsFk}/updateFile`, { dmsTypeId: dmsTypeId.value });
await createInvoice();
}
async function uploadFile() {
const firstSelectedEntry = selectedRows.value.at(0);
const { supplier, companyFk, invoiceNumber } = firstSelectedEntry;
dmsData.value = {
dmsTypeFk: dmsTypeId.value,
warehouseFk: user.value.warehouseFk,
companyFk: companyFk,
description: supplier + defaultDmsDescription.value + invoiceNumber,
hasFile: false,
};
uploadDialog.value.show();
}
async function afterUploadFile({ reference }, res) {
supplierRef = reference;
dmsFk = res.data[0].id;
await createInvoice();
}
async function createInvoice() {
try {
await axios.post(`Entries/addInvoiceIn`, {
ids: selectedRows.value.map((entry) => entry.id),
supplierRef,
dmsFk,
});
notify(t('entry.preAccount.success'), 'positive');
} catch (e) {
throw e;
} finally {
supplierRef = null;
dmsFk = undefined;
selectedRows.value.length = 0;
table.value.reload();
}
}
</script>
<template>
<FetchData
url="Countries"
:filter="{ fields: ['id', 'name'] }"
@on-fetch="(data) => (countries = data)"
auto-load
/>
<FetchData
url="Companies"
:filter="{ fields: ['id', 'code'] }"
@on-fetch="(data) => (companies = data)"
auto-load
/>
<FetchData
url="Warehouses"
:filter="{ fields: ['id', 'name'] }"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<FetchData
url="EntryTypes"
:filter="{ fields: ['code', 'description'] }"
@on-fetch="(data) => (entryTypes = data)"
auto-load
/>
<FetchData
url="supplierFiscalTypes"
:filter="{ fields: ['code'] }"
@on-fetch="
(data) =>
(supplierFiscalTypes = data.map((x) => ({ locale: t(x.code), ...x })))
"
auto-load
/>
<FetchData
url="InvoiceInConfigs/findOne"
:filter="{ fields: ['defaultDmsDescription'] }"
@on-fetch="(data) => (defaultDmsDescription = data?.defaultDmsDescription)"
auto-load
/>
<FetchData
url="DmsTypes/findOne"
:filter="{ fields: ['id'] }"
:where="{ code: 'invoiceIn' }"
@on-fetch="(data) => (dmsTypeId = data?.id)"
auto-load
/>
<VnSearchbar
:data-key
:url
:label="t('entry.preAccount.search')"
:info="t('entry.preAccount.searchInfo')"
:search-remove-params="false"
/>
<VnTable
v-model:selected="selectedRows"
:data-key
:columns
:url
:search-url="dataKey"
ref="table"
:disable-option="{ card: true }"
redirect="Entry"
:order="['landed DESC']"
:right-search="false"
:user-params="{ daysAgo, isBooked }"
:row-click="false"
:table="{ selection: 'multiple' }"
:limit="0"
:footer="true"
@on-fetch="
(data) => (totalAmount = data?.reduce((acc, entry) => acc + entry.amount, 0))
"
auto-load
>
<template #top-left>
<QBtn
data-cy="preAccount_btn"
icon="account_balance"
color="primary"
class="q-mr-sm"
:disable="!selectedRows.length"
@click="preAccount"
>
<QTooltip>{{ t('entry.preAccount.btn') }}</QTooltip>
</QBtn>
<VnInputNumber
v-model="daysAgo"
:label="$t('globals.daysAgo')"
dense
:step="1"
:decimal-places="0"
@update:model-value="filterByDaysAgo"
debounce="500"
:title="t('entry.preAccount.daysAgo')"
/>
</template>
<template #column-id="{ row }">
<span class="link" @click.stop>
{{ row.id }}
<EntryDescriptorProxy :id="row.id" />
</span>
</template>
<template #column-company="{ row }">
<QBadge :color="row.color ?? 'transparent'" :label="row.company" />
</template>
<template #column-gestDocFk="{ row }">
<span class="link" @click.stop="downloadFile(row.gestDocFk)">
{{ row.gestDocFk }}
</span>
</template>
<template #column-supplier="{ row }">
<span class="link" @click.stop>
{{ row.supplier }}
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template>
<template #column-invoiceInFk="{ row }">
<span class="link" @click.stop>
{{ row.invoiceInFk }}
<InvoiceInDescriptorProxy :id="row.invoiceInFk" />
</span>
</template>
<template #column-footer-amount>
<div v-text="toCurrency(totalSelectedAmount)" />
<div v-text="toCurrency(totalAmount)" />
</template>
</VnTable>
<VnConfirm
ref="updateDialog"
:title="t('entry.preAccount.dialog.title')"
:message="t('entry.preAccount.dialog.message')"
>
<template #actions>
<QBtn
data-cy="updateFileYes"
:label="t('globals.yes')"
color="primary"
@click="updateFile"
autofocus
v-close-popup
/>
<QBtn
data-cy="updateFileNo"
:label="t('globals.no')"
color="primary"
flat
@click="uploadFile"
v-close-popup
/>
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />
</template>
</VnConfirm>
<QDialog ref="uploadDialog">
<VnDms
model="dms"
:form-initial-data="dmsData"
url="Dms/uploadFile"
@on-data-saved="afterUploadFile"
/>
</QDialog>
</template>
<i18n>
en:
IntraCommunity: Intra-community
NonCommunity: Non-community
CanaryIslands: Canary Islands
es:
IntraCommunity: Intracomunitaria
NonCommunity: Extracomunitaria
CanaryIsland: Islas Canarias
National: Nacional
</i18n>

View File

@ -1,63 +0,0 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper } from 'app/test/vitest/helper';
import EntryPreAccount from '../EntryPreAccount.vue';
import axios from 'axios';
describe('EntryPreAccount', () => {
let wrapper;
let vm;
beforeAll(() => {
vi.spyOn(axios, 'get').mockImplementation((url) => {
if (url == 'EntryConfigs/findOne')
return { data: { maxDays: 90, defaultDays: 30 } };
return { data: [] };
});
wrapper = createWrapper(EntryPreAccount);
vm = wrapper.vm;
});
afterEach(() => {
vi.clearAllMocks();
});
describe('filterByDaysAgo()', () => {
it('should set daysAgo to defaultDays if no value is provided', () => {
vm.filterByDaysAgo();
expect(vm.daysAgo).toBe(vm.defaultDays);
expect(vm.arrayData.store.userParams.daysAgo).toBe(vm.defaultDays);
});
it('should set daysAgo to maxDays if the value exceeds maxDays', () => {
vm.filterByDaysAgo(500);
expect(vm.daysAgo).toBe(vm.maxDays);
expect(vm.arrayData.store.userParams.daysAgo).toBe(vm.maxDays);
});
it('should set daysAgo to the provided value if it is valid', () => {
vm.filterByDaysAgo(30);
expect(vm.daysAgo).toBe(30);
expect(vm.arrayData.store.userParams.daysAgo).toBe(30);
});
});
describe('Dialog behavior when adding a new row', () => {
it('should open the dialog if the new row has invoiceInFk', async () => {
const dialogSpy = vi.spyOn(vm.quasar, 'dialog');
const selectedRows = [{ id: 1, invoiceInFk: 123 }];
vm.selectedRows = selectedRows;
await vm.$nextTick();
expect(dialogSpy).toHaveBeenCalledWith({
component: vm.VnConfirm,
componentProps: { title: vm.t('entry.preAccount.hasInvoice') },
});
});
it('should not open the dialog if the new row does not have invoiceInFk', async () => {
const dialogSpy = vi.spyOn(vm.quasar, 'dialog');
vm.selectedRows = [{ id: 1, invoiceInFk: null }];
await vm.$nextTick();
expect(dialogSpy).not.toHaveBeenCalled();
});
});
});

View File

@ -118,33 +118,6 @@ entry:
searchInfo: You can search by entry reference
descriptorMenu:
showEntryReport: Show entry report
preAccount:
gestDocFk: Gestdoc
dmsType: Gestdoc type
invoiceNumber: Entry ref.
reference: Gestdoc ref.
shipped: Shipped
landed: Landed
id: Entry
invoiceInFk: Invoice in
supplierFk: Supplier
country: Country
description: Entry type
payDem: Payment term
isBooked: B
isReceived: R
entryType: Entry type
isAgricultural: Agricultural
fiscalCode: Account type
daysAgo: Max 365 days
search: Search
searchInfo: You can search by supplier name or nickname
btn: Pre-account
hasInvoice: This entry has already an invoice in
success: It has been successfully pre-accounted
dialog:
title: Pre-account entries
message: Do you want the invoice to inherit the entry document?
entryFilter:
params:
isExcludedFromAvailable: Excluded from available

View File

@ -69,33 +69,6 @@ entry:
observationType: Tipo de observación
search: Buscar entradas
searchInfo: Puedes buscar por referencia de entrada
preAccount:
gestDocFk: Gestdoc
dmsType: Tipo gestdoc
invoiceNumber: Ref. Entrada
reference: Ref. GestDoc
shipped: F. envío
landed: F. llegada
id: Entrada
invoiceInFk: Recibida
supplierFk: Proveedor
country: País
description: Tipo de Entrada
payDem: Plazo de pago
isBooked: C
isReceived: R
entryType: Tipo de entrada
isAgricultural: Agricultural
fiscalCode: Tipo de cuenta
daysAgo: Máximo 365 días
search: Buscar
searchInfo: Puedes buscar por nombre o alias de proveedor
btn: Precontabilizar
hasInvoice: Esta entrada ya tiene una f. recibida
success: Se ha precontabilizado correctamente
dialog:
title: Precontabilizar entradas
message: ¿Desea que la factura herede el documento de la entrada?
params:
entryFk: Entrada
observationTypeFk: Tipo de observación

View File

@ -0,0 +1,183 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue';
import FormPopup from 'components/FormPopup.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { useVnConfirm } from 'composables/useVnConfirm';
import { useState } from 'src/composables/useState';
import axios from 'axios';
import VnSelect from 'src/components/common/VnSelect.vue';
import useNotify from 'src/composables/useNotify.js';
const props = defineProps({
event: {
type: Object,
default: null,
},
isNewMode: {
type: Boolean,
default: true,
},
eventType: {
type: Boolean,
default: true,
},
firstDay: {
type: Date,
default: null,
},
lastDay: {
type: Date,
default: null,
},
});
const emit = defineEmits(['onSubmit', 'closeForm', 'refresh-events']);
const route = useRoute();
const { t } = useI18n();
const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm();
const state = useState();
const user = state.getUser();
const isNew = computed(() => props.isNewMode);
const vehicleFormData = ref({
started: null,
finished: null,
vehicleStateFk: null,
description: '',
vehicleFk: null,
userFk: null,
});
const arrayData = useArrayData('VehicleEvents');
onMounted(() => {
if (props.event) {
vehicleFormData.value = props.event;
}
});
const createVehicleEvent = async () => {
vehicleFormData.value.vehicleFk = route.params.id;
vehicleFormData.value.userFk = user.value.id;
if (isNew.value) {
await axios.post(`VehicleEvents`, vehicleFormData.value);
} else {
await axios.patch(
`VehicleEvents/${props.event?.id}`,
vehicleFormData.value,
);
}
await refetchEvents();
};
const deleteVehicleEvent = async () => {
if (!props.event) return;
await axios.delete(`VehicleEvents/${props.event?.id}`);
await refetchEvents();
};
const refetchEvents = async () => {
await arrayData.refresh({
append: false,
params: {
filter: {
where: {
vehicleFk: route.params.id,
and: [
{
or: [
{ started: { lte: props.lastDay?.toISOString() } },
{ started: null }
]
},
{
or: [
{ finished: { gte: props.firstDay?.toISOString() } },
{ finished: null }
]
}
]
}
}
}
});
emit('refresh-events');
notify(t('globals.dataSaved'), 'positive');
emit('closeForm');
};
</script>
<template>
<FormPopup
:title="isNew ? t('Add vehicle event') : t('Edit vehicle event')"
:default-cancel-button="false"
:default-submit-button="false"
>
<template #form-inputs>
<VnRow class="row q-gutter-md q-mb-md">
<VnInputDate :label="t('Started')" v-model="vehicleFormData.started" />
<VnInputDate :label="t('Finished')" v-model="vehicleFormData.finished" />
<VnSelect
url="VehicleStates"
v-model="vehicleFormData.vehicleStateFk"
:label="t('globals.state')"
option-label="state"
data-cy="State_input"
/>
</VnRow>
<VnInput
v-model="vehicleFormData.description"
:label="t('globals.description')"
/>
</template>
<template #custom-buttons>
<QBtn
:label="t('globals.cancel')"
color="primary"
flat
class="q-mr-sm"
v-close-popup
/>
<QBtn
v-if="!isNew"
:label="t('globals.delete')"
color="primary"
flat
class="q-mr-sm"
@click="
openConfirmationModal(
t('vehicle.deleteTitle'),
t('vehicle.deleteSubtitle'),
() => deleteVehicleEvent(),
)
"
/>
<QBtn
:label="isNew ? t('globals.save') : t('globals.add')"
@click="createVehicleEvent"
color="primary"
/>
</template>
</FormPopup>
</template>
<i18n>
es:
Started: Inicio
Finished: Fin
Add vehicle event: Agregar evento
Edit vehicle event: Editar evento
</i18n>

View File

@ -0,0 +1,86 @@
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import VehicleEventsPanel from './VehicleEventsPanel.vue';
import VehicleCalendarGrid from '../VehicleCalendarGrid.vue';
import VehicleEventInclusionForm from './VehicleEventInclusionForm.vue';
import { useStateStore } from 'stores/useStateStore';
import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n();
const stateStore = useStateStore();
const firstDay = ref();
const lastDay = ref();
const events = ref([]);
const vehicleEventsPanelRef = ref(null);
const showVehicleEventForm = ref(false);
const vehicleEventsFormProps = reactive({
isNewMode: true,
date: null,
event: null,
});
const refreshEvents = async () => {
await vehicleEventsPanelRef.value.fetchData();
};
const openForm = (data) => {
const { date = null, isNewMode, event } = data;
Object.assign(vehicleEventsFormProps, { date, isNewMode, event });
showVehicleEventForm.value = true;
};
const onVehicleEventFormClose = () => {
showVehicleEventForm.value = false;
vehicleEventsFormProps.value = {};
};
</script>
<template>
<RightMenu>
<template #right-panel v-if="stateStore.isHeaderMounted()">
<VehicleEventsPanel
ref="vehicleEventsPanelRef"
:first-day="firstDay"
:last-day="lastDay"
:events="events"
@update:events="events = $event"
/>
</template>
</RightMenu>
<QPage class="q-pa-md flex justify-center">
<VehicleCalendarGrid
v-model:events="events"
v-model:firstDay="firstDay"
v-model:lastDay="lastDay"
data-key="VehicleEvents"
@on-date-selected="openForm"
/>
<QDialog v-model="showVehicleEventForm" @hide="onVehicleEventFormClose()">
<VehicleEventInclusionForm
v-bind="vehicleEventsFormProps"
:first-day="firstDay"
:last-day="lastDay"
@close-form="onVehicleEventFormClose()"
@refresh-events="refreshEvents()"
/>
</QDialog>
<QPageSticky :offset="[20, 20]">
<QBtn
@click="openForm({ isNewMode: true }, true)"
color="primary"
fab
icon="add"
v-shortcut="'+'"
/>
<QTooltip class="text-no-wrap">
{{ t('eventsInclusionForm.addEvent') }}
</QTooltip>
</QPageSticky>
</QPage>
</template>

View File

@ -0,0 +1,196 @@
<script setup>
import { onMounted, watch, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import axios from 'axios';
import { toDateFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import { useVnConfirm } from 'composables/useVnConfirm';
import useNotify from 'src/composables/useNotify.js';
const props = defineProps({
firstDay: {
type: Date,
default: null,
},
lastDay: {
type: Date,
default: null,
},
events: {
type: Array,
default: () => [],
},
});
const emit = defineEmits(['openVehicleForm']);
const { t } = useI18n();
const route = useRoute();
const { notify } = useNotify();
const weekdayStore = useWeekdayStore();
const { openConfirmationModal } = useVnConfirm();
const vehicleStates = ref({});
const fetchVehicleState = async () => {
const vehicles = await axios.get('VehicleStates');
vehicleStates.value = vehicles.data;
};
const getVehicleStateName = (id) => {
return vehicleStates.value[id - 1] ?? dashIfEmpty(id - 1);
};
const params = computed(() => ({
vehicleFk: route.params.id,
started: props.firstDay,
finished: props.lastDay,
}));
const arrayData = useArrayData('VehicleEvents', {
params: params,
url: `VehicleEvents`,
});
const fetchData = async () => {
if (!params.value.vehicleFk || !props.firstDay || !props.lastDay) return;
try {
await arrayData.applyFilter({
params: {
filter: {
where: {
vehicleFk: route.params.id,
and: [
{ or: [
{ started: { lte: props.lastDay } },
{ started: null }
]},
{ or: [
{ finished: { gte: props.firstDay } },
{ finished: null }
]}
]
}
}
}
});
emit('update:events', arrayData.store.data || []);
} catch (error) {
console.error('Error fetching events:', error);
}
};
watch(
params,
async () => {
await fetchData();
},
{ immediate: true, deep: true },
);
watch(
() => props.events,
(newEvents) => {
emit('update:events', newEvents);
},
{ deep: true }
);
const deleteEvent = async (id) => {
if (!id) return;
await axios.delete(`VehicleEvents/${id}`);
notify(t('globals.dataSaved'), 'positive');
await fetchData();
};
const openInclusionForm = (event) => {
emit('openVehicleForm', {
date: event.dated,
event,
isNewMode: false,
});
};
onMounted(async () => {
weekdayStore.initStore();
await fetchVehicleState();
});
defineExpose({
fetchData
});
</script>
<template>
<QForm @submit="onSubmit()">
<div class="column q-pa-md q-gutter-y-sm"></div>
<span class="color-vn-label text-subtitle1 q-px-md">{{
t('eventsPanel.events')
}}</span>
<QList>
<QItem v-for="(event, index) in events" :key="index" class="event-card">
<QItemSection left @click="openInclusionForm(event)">
<div class="q-mb-xs">
<span
>({{ toDateFormat(event.started) }} -
{{ toDateFormat(event.finished) }})</span
>
</div>
<span class="color-vn-label"
>{{ t('globals.description') }}:
<span class="color-vn-text q-ml-xs">{{
dashIfEmpty(event.description)
}}</span>
</span>
<span class="color-vn-label"
>{{ t('globals.state') }}:
<span class="color-vn-text">{{
getVehicleStateName(event.vehicleStateFk).state
}}</span>
</span>
</QItemSection>
<QItemSection side @click="openInclusionForm(event)">
<QBtn
icon="delete"
data-cy="delete_event"
flat
dense
size="md"
color="primary"
@click.stop="
openConfirmationModal(
t('vehicle.deleteTitle'),
t('vehicle.deleteSubtitle'),
() => deleteEvent(event.id),
)
"
>
<QTooltip>{{ t('eventsPanel.delete') }}</QTooltip>
</QBtn>
</QItemSection>
</QItem>
<span
v-if="!events.length"
class="flex justify-center text-h5 color-vn-label"
>
{{ t('globals.noResults') }}
</span>
</QList>
</QForm>
</template>
<style scoped lang="scss">
.event-card {
display: flex;
border-bottom: $border-thin-light;
margin: 0;
&:hover {
background-color: var(--vn-accent-color);
cursor: pointer;
}
}
</style>

View File

@ -0,0 +1,13 @@
<script setup>
import EntityCalendar from 'src/components/EntityCalendar.vue';
const emit = defineEmits(['onDateSelected']);
</script>
<template>
<EntityCalendar
v-bind="$props"
@onDateSelected="(e) => emit('onDateSelected', e)"
/>
</template>

View File

@ -0,0 +1,97 @@
<script setup>
import { ref, watch } from 'vue';
import EntityCalendarGrid from 'src/components/EntityCalendarGrid.vue';
import VehicleCalendar from './VehicleCalendar.vue';
import { useArrayData } from 'src/composables/useArrayData';
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const firstDay = ref(new Date());
const lastDay = ref(new Date());
const entityCalendarRef = ref(null);
const arrayData = useArrayData(props.dataKey);
const { store } = arrayData;
const _data = ref(null);
const days = ref({});
const events = ref([]);
const refreshEvents = () => {
days.value = {};
if (!events.value?.length || !firstDay.value || !lastDay.value) return;
let day = new Date(firstDay.value.getTime());
let endDate = new Date(lastDay.value.getTime());
while (day <= endDate) {
let stamp = day.getTime();
let dayEvents = [];
for (let event of events.value) {
const eventStart = event.started ? new Date(event.started).getTime() : null;
const eventEnd = event.finished ? new Date(event.finished).getTime() : null;
let match = (!eventStart || stamp >= eventStart) &&
(!eventEnd || stamp <= eventEnd);
if (match) {
dayEvents.push(event);
}
}
if (dayEvents.length) {
days.value[stamp] = dayEvents;
}
day.setDate(day.getDate() + 1);
}
};
watch(
() => store.data,
(value) => {
_data.value = value;
events.value = Array.isArray(value) ? value : [];
function toStamp(date) {
return date && new Date(date).setHours(0, 0, 0, 0);
}
if (events.value) {
for (let event of events.value) {
event.dated = toStamp(event.dated);
event.finished = toStamp(event.finished);
event.started = toStamp(event.started);
}
}
refreshEvents();
},
{ immediate: true },
);
watch(() => entityCalendarRef.value?.firstDay, (newVal) => {
if (newVal) firstDay.value = new Date(newVal);
});
watch(() => entityCalendarRef.value?.lastDay, (newVal) => {
if (newVal) lastDay.value = new Date(newVal);
});
</script>
<template>
<EntityCalendarGrid
ref="entityCalendarRef"
:data-key="dataKey"
:calendar-component="VehicleCalendar"
:additional-props="{ daysMap: days }"
@refresh-events="refreshEvents"
v-bind="$attrs"
/>
</template>

View File

@ -15,6 +15,8 @@ vehicle:
remove: Vehicle removed
search: Search Vehicle
searchInfo: Search by id or number plate
deleteTitle: This item will be deleted
deleteSubtitle: Are you sure you want to continue?
params:
vehicleTypeFk: Type
vehicleStateFk: State

View File

@ -15,6 +15,8 @@ vehicle:
remove: Vehículo eliminado
search: Buscar Vehículo
searchInfo: Buscar por id o matrícula
deleteTitle: Este elemento será eliminado
deleteSubtitle: ¿Seguro que quieres continuar?
params:
vehicleTypeFk: Tipo
vehicleStateFk: Estado

View File

@ -11,6 +11,7 @@ import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
import useWeekdaysOrder from 'src/composables/getWeekdays';
const props = defineProps({
year: {
@ -44,6 +45,7 @@ const { locale } = useI18n();
const calendarRef = ref(null);
const weekdayStore = useWeekdayStore();
const weekDays = useWeekdaysOrder();
const selectedDate = ref();
const calendarEventDates = [];
const today = ref(date.formatDate(Date.vnNew(), 'YYYY-MM-DD'));
@ -182,7 +184,7 @@ watch(_year, (newValue) => {
no-outside-days
:selected-dates="calendarEventDates"
no-active-date
:weekdays="[1, 2, 3, 4, 5, 6, 0]"
:weekdays="weekDays"
short-weekday-label
:locale="locale"
:now="today"

View File

@ -4,6 +4,8 @@ import { useI18n } from 'vue-i18n';
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
import useWeekdaysOrder from 'src/composables/getWeekdays';
const $props = defineProps({
modelValue: {
type: String,
@ -32,6 +34,7 @@ const emit = defineEmits(['update:modelValue', 'clickDate', 'onMoved']);
const { locale } = useI18n();
const calendarRef = ref(null);
const weekDays = useWeekdaysOrder();
const stateClasses = {
CONFIRMED: {
@ -135,7 +138,7 @@ const paintWorkWeeks = async () => {
ref="calendarRef"
v-model="value"
show-work-weeks
:weekdays="[1, 2, 3, 4, 5, 6, 0]"
:weekdays="weekDays"
:selected-dates="selectedDates"
:min-weekday-label="1"
:locale="locale"

View File

@ -10,6 +10,7 @@ import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import useWeekdaysOrder from 'src/composables/getWeekdays';
import axios from 'axios';
const props = defineProps({
@ -46,6 +47,7 @@ const route = useRoute();
const calendarRef = ref(null);
const weekdayStore = useWeekdayStore();
const weekDays = useWeekdaysOrder();
const showZoneClosingTable = ref(false);
const zoneClosingData = ref(null);
const today = ref(date.formatDate(Date.vnNew(), 'YYYY-MM-DD'));
@ -161,7 +163,7 @@ const handleDateClick = (timestamp) => {
show-work-weeks
no-outside-days
no-active-date
:weekdays="[1, 2, 3, 4, 5, 6, 0]"
:weekdays="weekDays"
short-weekday-label
:locale="locale"
:now="today"

View File

@ -229,22 +229,3 @@ onUnmounted(() => arrayData.destroy());
</div>
</QCard>
</template>
<style lang="scss" scoped>
.calendars-header {
height: 45px;
display: flex;
justify-content: space-between;
align-items: center;
background-color: $primary;
font-weight: bold;
font-size: 16px;
}
.calendars-container {
max-width: 800px;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
</style>

View File

@ -85,7 +85,6 @@ export default {
'EntryLatestBuys',
'EntryStockBought',
'EntryWasteRecalc',
'EntryPreAccount',
],
},
component: RouterView,
@ -95,7 +94,6 @@ export default {
name: 'EntryMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
props: (route) => ({ leftDrawer: route.name !== 'EntryPreAccount' }),
redirect: { name: 'EntryIndexMain' },
children: [
{
@ -152,15 +150,6 @@ export default {
},
component: () => import('src/pages/Entry/EntryWasteRecalc.vue'),
},
{
path: 'pre-account',
name: 'EntryPreAccount',
meta: {
title: 'entryPreAccount',
icon: 'account_balance',
},
component: () => import('src/pages/Entry/EntryPreAccount.vue'),
},
],
},
],

View File

@ -170,6 +170,7 @@ const vehicleCard = {
'VehicleBasicData',
'VehicleNotes',
'VehicleDms',
'VehicleEvents'
],
},
children: [
@ -209,6 +210,15 @@ const vehicleCard = {
},
component: () => import('src/pages/Route/Vehicle/VehicleDms.vue'),
},
{
name: 'VehicleEvents',
path: 'events',
meta: {
title: 'calendar',
icon: 'vn:calendar',
},
component: () => import('src/pages/Route/Vehicle/Card/VehicleEvents.vue'),
},
],
};

View File

@ -1,48 +0,0 @@
/// <reference types="cypress" />
describe('Entry PreAccount Functionality', () => {
beforeEach(() => {
cy.login('administrative');
cy.visit('/#/entry/pre-account');
});
it("should pre-account without questions if it's agricultural", () => {
selectRowsByCol('id', [2]);
cy.dataCy('preAccount_btn').click();
cy.checkNotification('It has been successfully pre-accounted');
});
it("should ask to upload a doc. if it's not agricultural and doesn't have doc. ", () => {
selectRowsByCol('id', [3]);
cy.dataCy('preAccount_btn').click();
cy.dataCy('Reference_input').type('{selectall}234343fh', { delay: 0 });
cy.dataCy('VnDms_inputFile').selectFile('test/cypress/fixtures/image.jpg', {
force: true,
});
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('It has been successfully pre-accounted');
});
it('should ask to inherit the doc. and open VnDms popup if user choose "no"', () => {
selectRowsByCol('id', [101]);
cy.dataCy('preAccount_btn').click();
cy.dataCy('updateFileNo').click();
cy.get('#formModel').should('be.visible');
});
it('should ask to inherit the doc. and open VnDms popup if user choose "yes" and pre-account', () => {
selectRowsByCol('id', [101]);
cy.dataCy('preAccount_btn').click();
cy.dataCy('updateFileYes').click();
cy.checkNotification('It has been successfully pre-accounted');
});
});
function selectRowsByCol(col = 'id', vals = []) {
for (const val of vals) {
const regex = new RegExp(`^\\s*(${val})\\s*$`);
cy.contains(`[data-col-field="${col}"]`, regex)
.parent()
.find('td > .q-checkbox')
.click();
}
}

View File

@ -6,7 +6,7 @@ describe('Item tax', () => {
});
it('should modify the tax for Spain', () => {
cy.dataCy('Class_select').eq(1).type('IVA General{enter}');
cy.dataCy('Class_select').eq(1).type('General VAT{enter}');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved');
});

View File

@ -0,0 +1,27 @@
describe('Vehicle', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('deliveryAssistant');
cy.visit(`/#/route/vehicle/3/events`);
});
it('should add, edit and delete a vehicle event', () => {
cy.get('.q-page-sticky > div > .q-btn').click();
cy.dataCy('Started_inputDate').type('01/01/2001');
cy.dataCy('Finished_inputDate').type('08/02/2001');
cy.get(':nth-child(5)').find('[data-cy="Description_input"]').clear().type('Test');
cy.selectOption('[data-cy="State_input"]', 3);
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get('.q-current-day > .q-calendar-month__day--content > .q-btn').click();
cy.dataCy('Started_inputDate').clear().type('03/02/2001');
cy.dataCy('Finished_inputDate').clear().type('15/03/2001');
cy.get(':nth-child(5)').find('[data-cy="Description_input"]').clear().type('Test2');
cy.selectOption('[data-cy="State_input"]', 5);
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.dataCy('delete_event').eq(0).click();
cy.dataCy('VnConfirm_confirm').click();
});
});