From 4276cefd7a77a8204e27a90b34b85dbf6b833eb9 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 4 Dec 2024 09:14:00 +0100 Subject: [PATCH 1/6] feat: requested changes in item module --- src/components/VnTable/VnTable.vue | 1 + src/components/common/VnLog.vue | 6 +- src/components/ui/VnFilterPanel.vue | 1 - src/i18n/locale/en.yml | 4 +- src/i18n/locale/es.yml | 4 +- src/pages/Item/Card/ItemBarcode.vue | 25 ++- src/pages/Item/Card/ItemBasicData.vue | 1 + src/pages/Item/Card/ItemShelving.vue | 185 ++++++------------ src/pages/Item/Card/ItemSummary.vue | 2 +- src/pages/Item/Card/ItemTags.vue | 41 +++- src/pages/Item/Card/ItemTax.vue | 7 +- src/pages/Item/ItemFixedPrice.vue | 1 - src/pages/Item/ItemList.vue | 11 +- src/pages/Item/ItemListFilter.vue | 26 ++- src/pages/Item/ItemRequest.vue | 57 +++--- src/pages/Item/ItemRequestFilter.vue | 22 ++- src/pages/Item/ItemType/ItemTypeSearchbar.vue | 1 - src/pages/Item/ItemTypeList.vue | 41 ++-- src/pages/Item/locale/en.yml | 14 +- src/pages/Item/locale/es.yml | 14 +- 20 files changed, 270 insertions(+), 194 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index ea7cf1dda..41e789343 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -610,6 +610,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) { $props.rowClick && $props.rowClick(row); } " + style="height: 100%" > -import { ref, onUnmounted, watch } from 'vue'; +import { ref, onUnmounted, watch, onMounted } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute, useRouter } from 'vue-router'; import axios from 'axios'; @@ -369,6 +369,10 @@ async function clearFilter() { await applyFilter(); } +onMounted(() => { + stateStore.rightDrawer = true; +}); + onUnmounted(() => { stateStore.rightDrawer = false; }); diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 8c0dbda94..8879b5c53 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -127,7 +127,6 @@ async function search(evt) { userParams.value = newParams; if (!$props.showAll && !Object.values(filter).length) store.data = []; - emit('search'); } finally { isLoading.value = false; } diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index ecfa2c8fe..abf2c0fd9 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -397,8 +397,8 @@ entry: buys: Buys stickers: Stickers package: Package - packing: Packing - grouping: Grouping + packing: Pack. + grouping: Group. buyingValue: Buying value import: Import pvp: PVP diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index def0b0696..9f0f10f19 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -400,8 +400,8 @@ entry: buys: Compras stickers: Etiquetas package: Embalaje - packing: Packing - grouping: Grouping + packing: Pack. + grouping: Group. buyingValue: Coste import: Importe pvp: PVP diff --git a/src/pages/Item/Card/ItemBarcode.vue b/src/pages/Item/Card/ItemBarcode.vue index 197e9142f..6db5943c7 100644 --- a/src/pages/Item/Card/ItemBarcode.vue +++ b/src/pages/Item/Card/ItemBarcode.vue @@ -2,12 +2,15 @@ import { ref, nextTick } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; +import axios from 'axios'; import CrudModel from 'src/components/CrudModel.vue'; import VnInput from 'src/components/common/VnInput.vue'; +import useNotify from 'src/composables/useNotify.js'; const route = useRoute(); const { t } = useI18n(); +const { notify } = useNotify(); const itemBarcodeRef = ref(null); @@ -23,6 +26,24 @@ const focusLastInput = () => { if (lastInput) lastInput.focus(); }); }; + +const removeRow = (row) => { + itemBarcodeRef.value.remove([row]); +}; + +const submit = async (rows) => { + const params = rows[rows.length - 1]; + let { data } = await axios.get('ItemBarcodes'); + const code = params.code; + + if (data.some((codes) => codes.code === code)) { + notify(t('Codes can not be repeated'), 'negative'); + itemBarcodeRef.value.reset(); + return; + } + await axios.patch(`ItemBarcodes`, params); + notify(t('globals.dataSaved'), 'positive'); +};