From 168201c755f50cefb633598e5488a88bf48068d9 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 15 Jul 2024 12:25:54 +0200 Subject: [PATCH 001/273] 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 002/273] 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 004/273] 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 005/273] 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 009/273] 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(() => { - + es: New item: Nuevo artículo diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index ed6f623aa..0389ba864 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -13,7 +13,6 @@ import VnTable from 'components/VnTable/VnTable.vue'; const { t } = useI18n(); const { notify } = useNotify(); const stateStore = useStateStore(); -const workersOptions = ref([]); let filterParams = ref({}); const denyFormRef = ref(null); const denyRequestId = ref(null); @@ -91,6 +90,7 @@ const columns = computed(() => [ name: 'item', align: 'left', component: 'input', + visible: false, }, { label: t('item.buyRequest.achieved'), @@ -98,6 +98,7 @@ const columns = computed(() => [ name: 'achieved', align: 'left', component: 'input', + visible: false, }, { label: t('item.buyRequest.concept'), @@ -106,6 +107,7 @@ const columns = computed(() => [ align: 'left', sortable: true, component: 'input', + visible: false, }, { label: t('item.buyRequest.state'), @@ -114,10 +116,17 @@ const columns = computed(() => [ align: 'left', }, { + align: 'right', label: '', - name: 'action', - align: 'left', - columnFilter: null, + name: 'tableActions', + actions: [ + { + title: t('Client ticket list'), + icon: 'thumb_down', + action: onDenyAccept, + isPrimary: true, + }, + ], }, ]); From fe78de0c4761772593a3e714c69894f36651e696 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 5 Aug 2024 11:49:06 +0200 Subject: [PATCH 014/273] refs #7283 fixedPrices --- src/pages/Item/ItemFixedPrice.vue | 325 +++++++----------------------- 1 file changed, 70 insertions(+), 255 deletions(-) diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index 2ecd1f21b..41f2bac2f 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -1,7 +1,7 @@ + From e4aec1773b74c002913bf60f807c07ca39a873f5 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 29 Aug 2024 12:38:57 +0200 Subject: [PATCH 023/273] refs #7283 itemRequest fix deny --- src/pages/Item/ItemRequest.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index 41248afbb..0e59a16c4 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -7,6 +7,7 @@ import { useArrayData } from 'composables/useArrayData'; import { toCurrency } from 'filters/index'; import useNotify from 'src/composables/useNotify.js'; import axios from 'axios'; +import ItemRequestDenyForm from './ItemRequestDenyForm.vue'; import { toDate } from 'src/filters'; import VnTable from 'components/VnTable/VnTable.vue'; import VnInput from 'src/components/common/VnInput.vue'; @@ -26,6 +27,10 @@ const arrayData = useArrayData('ItemRequests', { }); const store = arrayData.store; +const userParams = { + state: 'pending', +}; + watch( () => store.data, (value) => (itemRequestsOptions.value = value) @@ -174,7 +179,9 @@ const onDenyAccept = (_, responseData) => { itemRequestsOptions.value[denyRequestIndex.value].isOk = responseData.isOk; itemRequestsOptions.value[denyRequestIndex.value].attenderFk = responseData.attenderFk; + console.log('itemRequestsOptions: ', itemRequestsOptions.value); itemRequestsOptions.value[denyRequestIndex.value].response = responseData.response; + console.log('itemRequestsOptions.value', itemRequestsOptions.value); denyRequestId.value = null; denyRequestIndex.value = null; }; @@ -341,8 +348,10 @@ onBeforeMount(() => { url="ticketRequests/filter" order="shippedDate ASC, isOk ASC" :columns="columns" + :user-params="userParams" :is-editable="true" auto-load + :disable-option="{ card: true }" > - From 388036a2eb589b6475132e630ee555147938b4a6 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 2 Sep 2024 09:19:49 +0200 Subject: [PATCH 024/273] refs #7283 itemRequest fix --- src/pages/Item/ItemRequest.vue | 146 ++------------------------------- 1 file changed, 7 insertions(+), 139 deletions(-) diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index 0e59a16c4..10ed237b4 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -208,140 +208,6 @@ onBeforeMount(() => { From 3bf3e8eeaa4c93dd2c8a737d5a95fb0528abbe50 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 2 Sep 2024 11:08:50 +0200 Subject: [PATCH 025/273] refs #7283 itemRequest fix deny --- src/pages/Item/ItemRequest.vue | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index 10ed237b4..8273c5c91 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -112,16 +112,7 @@ const columns = computed(() => [ { align: 'right', label: '', - name: 'tableActions', - actions: [ - { - title: t('Deny Request'), - icon: 'thumb_down', - class: 'fill-icon', - action: showDenyRequestForm, - isPrimary: true, - }, - ], + name: 'denyOptions', }, ]); @@ -171,7 +162,9 @@ const getState = (isOk) => { const showDenyRequestForm = (requestId, rowIndex) => { denyRequestId.value = requestId; + console.log('denyRequestId.value: ', denyRequestId.value); denyRequestIndex.value = rowIndex; + console.log('denyRequestIndex.value: ', denyRequestIndex.value); denyFormRef.value.show(); }; @@ -255,8 +248,8 @@ onBeforeMount(() => { {{ row.itemDescription }} -