diff --git a/src/components/FilterTravelForm.vue b/src/components/FilterTravelForm.vue index 9fc91457a..ab50d0899 100644 --- a/src/components/FilterTravelForm.vue +++ b/src/components/FilterTravelForm.vue @@ -181,6 +181,7 @@ const selectTravel = ({ id }) => { color="primary" :disabled="isLoading" :loading="isLoading" + data-cy="save-filter-travel-form" /> { :no-data-label="t('Enter a new search')" class="q-mt-lg" @row-click="(_, row) => selectTravel(row)" + data-cy="table-filter-travel-form" > diff --git a/src/pages/Entry/Card/EntryDescriptor.vue b/src/pages/Entry/Card/EntryDescriptor.vue index 7ea3bd0d2..8559b104a 100644 --- a/src/pages/Entry/Card/EntryDescriptor.vue +++ b/src/pages/Entry/Card/EntryDescriptor.vue @@ -94,25 +94,53 @@ const getEntryRedirectionFilter = (entry) => { function showEntryReport() { openReport(`Entries/${entityId.value}/entry-order-pdf`); } -async function recalculateRates(entity) { - const entryConfig = await axios.get('EntryConfigs/findOne'); - if (entryConfig.data?.inventorySupplierFk === entity.supplierFk) { - quasar.notify({ - type: 'negative', - message: t('Cannot recalculate prices because this is an inventory entry'), - }); - return; - } - await axios.post(`Entries/${entityId.value}/recalcEntryPrices`); +function showNotification(type, message) { + quasar.notify({ + type: type, + message: t(message), + }); } + +async function recalculateRates(entity) { + try { + const entryConfig = await axios.get('EntryConfigs/findOne'); + if (entryConfig.data?.inventorySupplierFk === entity.supplierFk) { + showNotification( + 'negative', + 'Cannot recalculate prices because this is an inventory entry', + ); + return; + } + + await axios.post(`Entries/${entityId.value}/recalcEntryPrices`); + showNotification('positive', 'Entry prices recalculated'); + } catch (error) { + showNotification('negative', 'Failed to recalculate rates'); + console.error(error); + } +} + async function cloneEntry() { - await axios - .post(`Entries/${entityId.value}/cloneEntry`) - .then((response) => push(`/entry/${response.data[0].vNewEntryFk}`)); + try { + const response = await axios.post(`Entries/${entityId.value}/cloneEntry`); + push({ path: `/entry/${response.data[0].vNewEntryFk}` }); + showNotification('positive', 'Entry cloned'); + } catch (error) { + showNotification('negative', 'Failed to clone entry'); + console.error(error); + } } + async function deleteEntry() { - await axios.post(`Entries/${entityId.value}/deleteEntry`).then(() => push(`/entry/`)); + try { + await axios.post(`Entries/${entityId.value}/deleteEntry`); + push({ path: `/entry/list` }); + showNotification('positive', 'Entry deleted'); + } catch (error) { + showNotification('negative', 'Failed to delete entry'); + console.error(error); + } } @@ -146,7 +174,13 @@ async function deleteEntry() { {{ t('Clone') }} - + {{ t('Delete') }} @@ -253,4 +287,10 @@ es: landed: Recibido This entry is deleted: Esta entrada está eliminada Cannot recalculate prices because this is an inventory entry: No se pueden recalcular los precios porque es una entrada de inventario + Entry deleted: Entrada eliminada + Entry cloned: Entrada clonada + Entry prices recalculated: Precios de la entrada recalculados + Failed to recalculate rates: No se pudieron recalcular las tarifas + Failed to clone entry: No se pudo clonar la entrada + Failed to delete entry: No se pudo eliminar la entrada diff --git a/src/pages/Entry/Card/EntrySummary.vue b/src/pages/Entry/Card/EntrySummary.vue index c25a7c186..6b7477cfc 100644 --- a/src/pages/Entry/Card/EntrySummary.vue +++ b/src/pages/Entry/Card/EntrySummary.vue @@ -176,9 +176,8 @@ onMounted(async () => { /> diff --git a/src/pages/Entry/EntryList.vue b/src/pages/Entry/EntryList.vue index ad66ebb58..a41af5cee 100644 --- a/src/pages/Entry/EntryList.vue +++ b/src/pages/Entry/EntryList.vue @@ -263,12 +263,12 @@ onBeforeMount(async () => {