From 3f1c0b95faf7d8ff00b10fa93acdbed4047d6b9a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 10 Jul 2024 15:03:25 +0200 Subject: [PATCH 001/395] fix: proposal to avoid notify error --- src/pages/Customer/Card/CustomerUnpaid.vue | 2 +- src/pages/Customer/Card/CustomerWebAccess.vue | 2 +- src/pages/Customer/components/CustomerChangePassword.vue | 2 +- src/pages/Customer/components/CustomerSamplesCreate.vue | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/Customer/Card/CustomerUnpaid.vue b/src/pages/Customer/Card/CustomerUnpaid.vue index a9d4a3d66..6c61b92a1 100644 --- a/src/pages/Customer/Card/CustomerUnpaid.vue +++ b/src/pages/Customer/Card/CustomerUnpaid.vue @@ -92,7 +92,7 @@ const onSubmit = async () => { notify('globals.dataSaved', 'positive'); unpaidClient.value = true; } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; } diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue index 33659dd77..4468c52f0 100644 --- a/src/pages/Customer/Card/CustomerWebAccess.vue +++ b/src/pages/Customer/Card/CustomerWebAccess.vue @@ -70,7 +70,7 @@ const onSubmit = async () => { notify('globals.dataSaved', 'positive'); if (usersPreviewRef.value) usersPreviewRef.value.fetch(); } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; } diff --git a/src/pages/Customer/components/CustomerChangePassword.vue b/src/pages/Customer/components/CustomerChangePassword.vue index 1bfc5e103..632b11dc9 100644 --- a/src/pages/Customer/components/CustomerChangePassword.vue +++ b/src/pages/Customer/components/CustomerChangePassword.vue @@ -48,7 +48,7 @@ const onSubmit = async () => { await axios.patch(`Clients/${$props.id}/setPassword`, payload); await $props.promise(); } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; if (closeButton.value) closeButton.value.click(); diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue index be614aa0b..283b8fa97 100644 --- a/src/pages/Customer/components/CustomerSamplesCreate.vue +++ b/src/pages/Customer/components/CustomerSamplesCreate.vue @@ -150,7 +150,7 @@ const onSubmit = async () => { notify('globals.dataSaved', 'positive'); onDataSaved(data); } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; } From 168201c755f50cefb633598e5488a88bf48068d9 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 15 Jul 2024 12:25:54 +0200 Subject: [PATCH 002/395] refs #7283 itemList table --- src/pages/Item/ItemList.vue | 477 +++++------------------------------- 1 file changed, 68 insertions(+), 409 deletions(-) diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue index f1e3629cd..334ef2604 100644 --- a/src/pages/Item/ItemList.vue +++ b/src/pages/Item/ItemList.vue @@ -3,114 +3,48 @@ import { onMounted, ref, computed, reactive, onUnmounted } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; -import FetchData from 'components/FetchData.vue'; -import FetchedTags from 'components/ui/FetchedTags.vue'; -import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue'; -import VnInput from 'src/components/common/VnInput.vue'; -import VnSelect from 'src/components/common/VnSelect.vue'; -import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue'; -import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; -import ItemSummary from '../Item/Card/ItemSummary.vue'; -import VnPaginate from 'components/ui/VnPaginate.vue'; -import ItemListFilter from './ItemListFilter.vue'; - +import VnTable from 'components/VnTable/VnTable.vue'; import { useStateStore } from 'stores/useStateStore'; import { toDateFormat } from 'src/filters/date.js'; import { dashIfEmpty } from 'src/filters'; -import { useSummaryDialog } from 'src/composables/useSummaryDialog'; -import { useVnConfirm } from 'composables/useVnConfirm'; import axios from 'axios'; -import RightMenu from 'src/components/common/RightMenu.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; -import VnImg from 'src/components/ui/VnImg.vue'; const router = useRouter(); const stateStore = useStateStore(); const { t } = useI18n(); -const { viewSummary } = useSummaryDialog(); -const { openConfirmationModal } = useVnConfirm(); +const tableRef = ref(); -const paginateRef = ref(null); -const itemTypesOptions = ref([]); -const originsOptions = ref([]); -const buyersOptions = ref([]); -const intrastatOptions = ref([]); -const itemCategoriesOptions = ref([]); -const visibleColumns = ref([]); -const allColumnNames = ref([]); - -const exprBuilder = (param, value) => { - switch (param) { - case 'category': - return { 'ic.name': value }; - case 'buyerFk': - return { 'it.workerFk': value }; - case 'grouping': - return { 'b.grouping': value }; - case 'packing': - return { 'b.packing': value }; - case 'origin': - return { 'ori.code': value }; - case 'typeFk': - return { 'i.typeFk': value }; - case 'intrastat': - return { 'intr.description': value }; - case 'name': - return { 'i.name': { like: `%${value}%` } }; - case 'producer': - return { 'pr.name': { like: `%${value}%` } }; - case 'id': - case 'size': - case 'subname': - case 'isActive': - case 'weightByPiece': - case 'stemMultiplier': - case 'stems': - return { [`i.${param}`]: value }; - } +const itemFilter = { + include: [ + { + relation: 'trainingCourseType', + scope: { + fields: ['id', 'name'], + }, + }, + { + relation: 'trainingCenter', + scope: { + fields: ['id', 'name'], + }, + }, + ], }; - -const params = reactive({ isFloramondo: false, isActive: true }); - -const applyColumnFilter = async (col) => { - try { - const paramKey = col.columnFilter?.filterParamKey || col.field; - params[paramKey] = col.columnFilter.filterValue; - await paginateRef.value.addFilter(null, params); - } catch (err) { - console.error('Error applying column filter', err); - } -}; - -const getInputEvents = (col) => { - return col.columnFilter.type === 'select' - ? { 'update:modelValue': () => applyColumnFilter(col) } - : { - 'keyup.enter': () => applyColumnFilter(col), - }; -}; - const columns = computed(() => [ { label: '', name: 'picture', align: 'left', - columnFilter: null, }, { label: t('item.list.id'), name: 'id', field: 'id', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, + isId: true, + chip: { + condition: () => true, }, }, { @@ -118,101 +52,41 @@ const columns = computed(() => [ field: 'grouping', name: 'grouping', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => dashIfEmpty(val), }, { label: t('item.list.packing'), field: 'packing', name: 'packing', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => dashIfEmpty(val), }, { label: t('globals.description'), field: 'name', name: 'description', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, + create: true, }, { label: t('item.list.stems'), field: 'stems', name: 'stems', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, }, { label: t('item.list.size'), field: 'size', name: 'size', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, }, { label: t('item.list.typeName'), field: 'typeName', name: 'typeName', align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - filterParamKey: 'typeFk', - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: itemTypesOptions.value, - 'option-value': 'id', - 'option-label': 'name', - dense: true, - }, + component: 'select', + attrs: { + url: 'ItemType', + fields: ['id', 'name'], }, }, @@ -221,18 +95,10 @@ const columns = computed(() => [ field: 'category', name: 'category', align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: itemCategoriesOptions.value, - 'option-value': 'name', - 'option-label': 'name', - dense: true, - }, + component: 'select', + attrs: { + url: 'ItemCategory', + fields: ['id', 'name'], }, }, @@ -241,18 +107,10 @@ const columns = computed(() => [ field: 'intrastat', name: 'intrastat', align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: intrastatOptions.value, - 'option-value': 'description', - 'option-label': 'description', - dense: true, - }, + component: 'select', + attrs: { + url: 'Intrastat', + fields: ['id', 'description'], }, }, { @@ -260,18 +118,10 @@ const columns = computed(() => [ field: 'origin', name: 'origin', align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: originsOptions.value, - 'option-value': 'code', - 'option-label': 'code', - dense: true, - }, + component: 'select', + attrs: { + url: 'Origin', + fields: ['id', 'name'], }, }, { @@ -279,36 +129,13 @@ const columns = computed(() => [ field: 'userName', name: 'userName', align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - filterParamKey: 'buyerFk', - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: buyersOptions.value, - 'option-value': 'id', - 'option-label': 'nickname', - dense: true, - }, - }, }, { label: t('item.list.weightByPiece'), field: 'weightByPiece', name: 'weightByPiece', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, + component: 'input', format: (val) => dashIfEmpty(val), }, { @@ -316,16 +143,7 @@ const columns = computed(() => [ field: 'stemMultiplier', name: 'stemMultiplier', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, + component: 'input', format: (val) => dashIfEmpty(val), }, { @@ -333,40 +151,26 @@ const columns = computed(() => [ field: 'isActive', name: 'isActive', align: 'left', - sortable: true, - columnFilter: null, + component: 'checkbox', }, { label: t('item.list.producer'), field: 'producer', name: 'producer', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, + component: 'select', + attrs: { + url: 'Producer', + fields: ['id', 'name'], }, - format: (val) => dashIfEmpty(val), }, { label: t('item.list.landed'), field: 'landed', name: 'landed', align: 'left', - sortable: true, + component: 'date', format: (val) => dashIfEmpty(toDateFormat(val)), - columnFilter: null, - }, - { - label: '', - name: 'actions', - align: 'left', - columnFilter: null, }, ]); @@ -388,49 +192,11 @@ const cloneItem = async (itemFk) => { } }; -onMounted(async () => { - stateStore.rightDrawer = true; - const filteredColumns = columns.value.filter( - (col) => col.name !== 'picture' && col.name !== 'actions' - ); - allColumnNames.value = filteredColumns.map((col) => col.name); -}); - onUnmounted(() => (stateStore.rightDrawer = false)); From 16b5b5d9a1111f31a8c07f53272a8f6f77ae71ba Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 15 Jul 2024 13:48:59 +0200 Subject: [PATCH 003/395] refs #7283 filter --- src/pages/Item/ItemList.vue | 64 +++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue index 334ef2604..4c49f068f 100644 --- a/src/pages/Item/ItemList.vue +++ b/src/pages/Item/ItemList.vue @@ -1,30 +1,39 @@ From daf99f47306f2ae346e9fd023bce9e8b8c222c7b Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 15 Jul 2024 15:00:43 +0200 Subject: [PATCH 005/395] refs #7283 itemRequestList --- src/pages/Item/ItemRequest.vue | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index ae6638953..10cb6c2a6 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -18,6 +18,7 @@ import useNotify from 'src/composables/useNotify.js'; import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js'; import axios from 'axios'; import RightMenu from 'src/components/common/RightMenu.vue'; +import { toDate } from 'src/filters'; const { t } = useI18n(); const { notify } = useNotify(); @@ -46,21 +47,28 @@ const columns = computed(() => [ name: 'id', field: 'id', align: 'left', - sortable: true, + isId: true, + chip: { + condition: () => true, + }, + cardVisible: true, }, { label: t('item.buyRequest.shipped'), field: 'shipped', name: 'shipped', align: 'left', - sortable: true, + component: 'date', + columnField: { + component: null, + }, + format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.shipped)), }, { label: t('globals.description'), field: 'description', name: 'description', align: 'left', - sortable: true, }, { label: t('item.buyRequest.requester'), @@ -80,29 +88,31 @@ const columns = computed(() => [ field: 'price', name: 'price', align: 'left', - sortable: true, - format: (val) => toCurrency(val), + format: (row) => toCurrency(row.price), }, { label: t('item.buyRequest.attender'), field: 'attender', name: 'attender', align: 'left', - sortable: true, + attrs: { + url: 'Workers', + fields: ['id', 'firstName'], + }, }, { label: t('item.buyRequest.item'), field: 'item', name: 'item', align: 'left', - sortable: true, + component: 'input', }, { label: t('item.buyRequest.achieved'), field: 'achieved', name: 'achieved', align: 'left', - sortable: true, + component: 'input', }, { label: t('item.buyRequest.concept'), From b7ba8eec3da2524c3fc2834dc2e4ffb64dbfc20d Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 16 Jul 2024 08:24:57 +0200 Subject: [PATCH 006/395] refs #7283 fix searchbar --- src/pages/Item/ItemList.vue | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue index e2c5f4bb3..17a62c5b9 100644 --- a/src/pages/Item/ItemList.vue +++ b/src/pages/Item/ItemList.vue @@ -3,11 +3,12 @@ import { onMounted, ref, computed, reactive, onUnmounted } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter, useRoute } from 'vue-router'; import VnImg from 'src/components/ui/VnImg.vue'; - +import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnTable from 'components/VnTable/VnTable.vue'; import { useStateStore } from 'stores/useStateStore'; import { toDate } from 'src/filters'; import axios from 'axios'; +import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; const entityId = computed(() => route.params.id); const router = useRouter(); @@ -212,16 +213,21 @@ const columns = computed(() => [ }, format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)), }, + { + align: 'right', + label: '', + name: 'tableActions', + actions: [ + { + title: t('Clone item'), + icon: 'vn:clone', + action: cloneItem, + isPrimary: true, + }, + ], + }, ]); -const redirectToItemCreate = () => { - router.push({ name: 'ItemCreate' }); -}; - -const redirectToItemSummary = (id) => { - router.push({ name: 'ItemSummary', params: { id } }); -}; - const cloneItem = async (itemFk) => { try { const { data } = await axios.post(`Items/${itemFk}/clone`); @@ -236,16 +242,11 @@ onUnmounted(() => (stateStore.rightDrawer = false)); From f29d873ed42abad1c45d641a51aa02bc2ab02db1 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 16 Jul 2024 12:15:39 +0200 Subject: [PATCH 010/395] refs #7283 fix request --- src/pages/Item/ItemRequest.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index 10cb6c2a6..e5faff6b2 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -120,13 +120,13 @@ const columns = computed(() => [ name: 'concept', align: 'left', sortable: true, + component: 'input', }, { label: t('item.buyRequest.state'), field: 'state', name: 'state', align: 'left', - sortable: true, }, { label: '', @@ -252,7 +252,6 @@ onBeforeMount(() => { -