From f93929de6a52d243e5d7886c6aa167348f59e19c Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 27 Jun 2024 13:01:00 +0200 Subject: [PATCH 01/13] refs #6897 vnTable, columns --- src/pages/Entry/EntryList.vue | 166 +++++++++++++++++----------------- 1 file changed, 82 insertions(+), 84 deletions(-) diff --git a/src/pages/Entry/EntryList.vue b/src/pages/Entry/EntryList.vue index e5d37900c..715b4dcd2 100644 --- a/src/pages/Entry/EntryList.vue +++ b/src/pages/Entry/EntryList.vue @@ -1,15 +1,12 @@ From 8ec51ff8fdad3d335abb3506ee9881a7544e5a3e Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 28 Jun 2024 09:01:28 +0200 Subject: [PATCH 04/13] refs #6897 fix columns --- src/pages/Entry/EntryLatestBuys.vue | 515 +++++----------------------- 1 file changed, 93 insertions(+), 422 deletions(-) diff --git a/src/pages/Entry/EntryLatestBuys.vue b/src/pages/Entry/EntryLatestBuys.vue index ecb5b7f22..6b4b41dc4 100644 --- a/src/pages/Entry/EntryLatestBuys.vue +++ b/src/pages/Entry/EntryLatestBuys.vue @@ -4,29 +4,16 @@ import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; import VnTable from 'components/VnTable/VnTable.vue'; -import VnInput from 'src/components/common/VnInput.vue'; -import VnSelect from 'src/components/common/VnSelect.vue'; import { useStateStore } from 'stores/useStateStore'; -import { toDate, toCurrency } from 'src/filters'; -// import { useSession } from 'composables/useSession'; -import { dashIfEmpty } from 'src/filters'; import { useArrayData } from 'composables/useArrayData'; const router = useRouter(); -// const { getTokenMultimedia } = useSession(); -// const token = getTokenMultimedia(); const stateStore = useStateStore(); const { t } = useI18n(); const rowsFetchDataRef = ref(null); -const itemTypesOptions = ref([]); -const originsOptions = ref([]); -const itemFamiliesOptions = ref([]); -const intrastatOptions = ref([]); -const packagingsOptions = ref([]); const editTableCellDialogRef = ref(null); -const visibleColumns = ref([]); const allColumnNames = ref([]); const exprBuilder = (param, value) => { @@ -88,470 +75,154 @@ const getInputEvents = (col) => { const columns = computed(() => [ { - label: t('entry.latestBuys.picture'), + label: t('entry.latestBuys.tableVisibleColumns.picture'), name: 'picture', - align: 'left', }, { - label: t('entry.latestBuys.itemFk'), + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.itemFk'), name: 'itemFk', - field: 'itemFk', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, + isTitle: true, }, { - label: t('entry.latestBuys.packing'), - field: 'packing', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.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('entry.latestBuys.grouping'), - field: 'grouping', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.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('entry.latestBuys.quantity'), - field: 'quantity', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.quantity'), name: 'quantity', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, }, { - label: t('entry.latestBuys.description'), - field: 'description', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.description'), name: 'description', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => dashIfEmpty(val), + }, { - label: t('entry.latestBuys.size'), - field: 'size', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.size'), name: 'size', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, + }, { - label: t('entry.latestBuys.tags'), + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.tags'), name: 'tags', - align: 'left', - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, + }, { - label: t('entry.latestBuys.type'), - field: 'code', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.type'), name: 'type', - align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: itemTypesOptions.value, - 'option-value': 'code', - 'option-label': 'code', - dense: true, - }, - }, + }, { - label: t('entry.latestBuys.intrastat'), - field: 'intrastat', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.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, - }, - }, + }, { - label: t('entry.latestBuys.origin'), - field: 'origin', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.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, - }, - }, }, { - label: t('entry.latestBuys.weightByPiece'), - field: 'weightByPiece', + + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.weightByPiece'), name: 'weightByPiece', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - - format: (val) => dashIfEmpty(val), }, { - label: t('entry.latestBuys.isActive'), - field: 'isActive', + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.isActive'), name: 'isActive', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - }, - { - label: t('entry.latestBuys.family'), - field: 'family', - name: 'family', - align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: itemFamiliesOptions.value, - 'option-value': 'code', - 'option-label': 'code', - dense: true, - }, - }, - }, - { - label: t('entry.latestBuys.entryFk'), - field: 'entryFk', - name: 'entryFk', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - }, - { - label: t('entry.latestBuys.buyingValue'), - field: 'buyingValue', - name: 'buyingValue', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toCurrency(val), - }, - { - label: t('entry.latestBuys.freightValue'), - field: 'freightValue', - name: 'freightValue', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toCurrency(val), - }, - { - label: t('entry.latestBuys.comissionValue'), - field: 'comissionValue', - name: 'comissionValue', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toCurrency(val), - }, - { - label: t('entry.latestBuys.packageValue'), - field: 'packageValue', - name: 'packageValue', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toCurrency(val), - }, - { - label: t('entry.latestBuys.isIgnored'), - field: 'isIgnored', - name: 'isIgnored', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - }, - { - label: t('entry.latestBuys.price2'), - field: 'price2', - name: 'price2', - align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toCurrency(val), }, { - label: t('entry.latestBuys.price3'), - field: 'price3', - name: 'price3', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toCurrency(val), + label: t('entry.latestBuys.tableVisibleColumns.family'), + name: 'family' + }, { - label: t('entry.latestBuys.minPrice'), - field: 'minPrice', - name: 'minPrice', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toCurrency(val), + label: t('entry.latestBuys.tableVisibleColumns.entryFk'), + name: 'entryFk' + }, { - label: t('entry.latestBuys.ektFk'), - field: 'ektFk', - name: 'ektFk', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => dashIfEmpty(val), + label: t('entry.latestBuys.tableVisibleColumns.buyingValue'), + name: 'buyingValue' + }, { - label: t('entry.latestBuys.weight'), - field: 'weight', - name: 'weight', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, + label: t('entry.latestBuys.tableVisibleColumns.freightValue'), + name: 'freightValue' }, { - label: t('entry.latestBuys.packagingFk'), - field: 'packagingFk', - name: 'packagingFk', align: 'left', - sortable: true, - columnFilter: { - component: VnSelect, - type: 'select', - filterValue: null, - event: getInputEvents, - attrs: { - options: packagingsOptions.value, - 'option-value': 'id', - 'option-label': 'id', - dense: true, - }, - }, + label: t('entry.latestBuys.tableVisibleColumns.comissionValue'), + name: 'comissionValue' }, { - label: t('entry.latestBuys.packingOut'), - field: 'packingOut', - name: 'packingOut', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => dashIfEmpty(val), + label: t('entry.latestBuys.tableVisibleColumns.packageValue'), + name: 'packageValue' }, { - label: t('entry.latestBuys.landing'), - field: 'landing', - name: 'landing', align: 'left', - sortable: true, - columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, - attrs: { - dense: true, - }, - }, - format: (val) => toDate(val), + label: t('entry.latestBuys.tableVisibleColumns.isIgnored'), + name: 'isIgnored' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.price2'), + name: 'price2' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.price3'), + name: 'price3' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.minPrice'), + name: 'minPrice' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.ektFk'), + name: 'ektFk' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.weight'), + name: 'weight' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.packagingFk'), + name: 'packagingFk' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.packingOut'), + name: 'packingOut' + }, + { + align: 'left', + label: t('entry.latestBuys.tableVisibleColumns.landing'), + name: 'landing' }, ]); @@ -602,10 +273,10 @@ onUnmounted(() => (stateStore.rightDrawer = false)); diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 23ffddead..89e5b24df 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -442,6 +442,8 @@ entry: packagingFk: Package packingOut: Package out landing: Landing + isExcludedFromAvailable: Es inventory + isRaid: Raid ticket: pageTitles: tickets: Tickets diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index c3aca500f..5be1c5773 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -441,6 +441,8 @@ entry: packagingFk: Embalaje packingOut: Embalaje envíos landing: Llegada + isExcludedFromAvailable: Es inventario + isRaid: Redada ticket: pageTitles: tickets: Tickets diff --git a/src/pages/Entry/EntryLatestBuys.vue b/src/pages/Entry/EntryLatestBuys.vue index b591b107a..555155a4e 100644 --- a/src/pages/Entry/EntryLatestBuys.vue +++ b/src/pages/Entry/EntryLatestBuys.vue @@ -12,6 +12,8 @@ const router = useRouter(); const stateStore = useStateStore(); const { t } = useI18n(); import { toDate } from 'src/filters'; +import VnImg from 'src/components/ui/VnImg.vue'; +import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; const rowsFetchDataRef = ref(null); const editTableCellDialogRef = ref(null); const allColumnNames = ref([]); @@ -73,10 +75,20 @@ const getInputEvents = (col) => { }; }; -const columns = computed(() => [ +const columns = [ { - label: t('entry.latestBuys.tableVisibleColumns.picture'), - name: 'picture', + label: t('entry.latestBuys.tableVisibleColumns.image'), + name: 'image', + columnField: { + component: VnImg, + attrs: (id) => { + return { + id, + width: '50px', + } + }, + }, + columnFilter: false }, { align: 'left', @@ -229,7 +241,7 @@ const columns = computed(() => [ }, format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)) }, -]); +]; const editTableCellFormFieldsOptions = [ { field: 'packing', label: t('entry.latestBuys.packing') }, @@ -267,15 +279,16 @@ const applyColumnFilter = async (col) => { onMounted(async () => { stateStore.rightDrawer = true; - const filteredColumns = columns.value.filter((col) => col.name !== 'picture'); - allColumnNames.value = filteredColumns.map((col) => col.name); - await arrayData.fetch({ append: false }); + // const filteredColumns = columns.value.filter((col) => col.name !== 'picture'); + // allColumnNames.value = filteredColumns.map((col) => col.name); + // await arrayData.fetch({ append: false }); }); onUnmounted(() => (stateStore.rightDrawer = false));