diff --git a/src/components/EditTableCellValueForm.vue b/src/components/EditTableCellValueForm.vue index 6d3b7b08b..9e48889a0 100644 --- a/src/components/EditTableCellValueForm.vue +++ b/src/components/EditTableCellValueForm.vue @@ -71,13 +71,9 @@ const closeForm = () => { -

- {{ - t('editBuyTitle', { - buysAmount: rows.length, - }) - }} -

+ {{ t('Edit') }} + {{ ` ${rows.length} ` }} + {{ t('buy(s)') }}
{
- +
@@ -129,13 +125,18 @@ const closeForm = () => { right: 20px; cursor: pointer; } + +.countLines { + font-size: 24px; + color: $primary; + font-weight: bold; +} - en: - editBuyTitle: Edit {buysAmount} buy(s) - es: - editBuyTitle: Editar {buysAmount} compra(s) - Field to edit: Campo a editar - Value: Valor - +es: + Edit: Editar + buy(s): compra(s) + Field to edit: Campo a editar + Value: Valor + diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 8e0ef2890..66da9b7bf 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -1,6 +1,7 @@ - - -es: - This claim is not associated to any RMA: Esta reclamación no está asociada a ninguna ARM - diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index b343d84f5..e14351286 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -226,7 +226,7 @@ function openDialog(dmsId) { /> - + {{ t('claim.summary.notes') }} diff --git a/src/pages/Claim/ClaimRmaList.vue b/src/pages/Claim/ClaimRmaList.vue deleted file mode 100644 index b906e32fa..000000000 --- a/src/pages/Claim/ClaimRmaList.vue +++ /dev/null @@ -1,171 +0,0 @@ - - - - - diff --git a/src/pages/Customer/components/CustomerNewPayment.vue b/src/pages/Customer/components/CustomerNewPayment.vue index fc0c52b0f..a141618d0 100644 --- a/src/pages/Customer/components/CustomerNewPayment.vue +++ b/src/pages/Customer/components/CustomerNewPayment.vue @@ -112,7 +112,7 @@ const onDataSaved = async () => { :filter="filterBanks" @on-fetch="(data) => (bankOptions = data)" auto-load - url="Banks" + url="Accountings" /> -import { onMounted, ref, computed } from 'vue'; +import { onMounted, ref, computed, reactive, onUnmounted } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; @@ -8,11 +8,16 @@ import FetchedTags from 'components/ui/FetchedTags.vue'; import EntryDescriptorProxy from './Card/EntryDescriptorProxy.vue'; import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue'; import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue'; +import VnInput from 'src/components/common/VnInput.vue'; +import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; +import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue'; +import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.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 session = useSession(); @@ -21,11 +26,72 @@ 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 rows = ref([]); + +const exprBuilder = (param, value) => { + switch (param) { + case 'id': + case 'size': + case 'weightByPiece': + case 'isActive': + case 'family': + case 'minPrice': + case 'packingOut': + return { [`i.${param}`]: value }; + case 'name': + case 'description': + return { [`i.${param}`]: { like: `%${value}%` } }; + case 'code': + return { 'it.code': value }; + case 'intrastat': + return { 'intr.description': value }; + case 'origin': + return { 'ori.code': value }; + case 'landing': + return { [`lb.${param}`]: value }; + case 'packing': + case 'grouping': + case 'quantity': + case 'entryFk': + case 'buyingValue': + case 'freightValue': + case 'comissionValue': + case 'packageValue': + case 'isIgnored': + case 'price2': + case 'price3': + case 'ektFk': + case 'weight': + case 'packagingFk': + return { [`b.${param}`]: value }; + } +}; + +const params = reactive({}); +const arrayData = useArrayData('EntryLatestBuys', { + url: 'Buys/latestBuysFilter', + order: ['itemFk DESC'], + exprBuilder: exprBuilder, +}); +const store = arrayData.store; +const rows = computed(() => store.data); const rowsSelected = ref([]); + +const getInputEvents = (col) => { + return col.columnFilter.type === 'select' + ? { 'update:modelValue': () => applyColumnFilter(col) } + : { + 'keyup.enter': () => applyColumnFilter(col), + }; +}; + const columns = computed(() => [ { label: t('entry.latestBuys.picture'), @@ -37,12 +103,32 @@ const columns = computed(() => [ name: 'itemFk', field: 'itemFk', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, }, { label: t('entry.latestBuys.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), }, { @@ -50,6 +136,16 @@ 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), }, { @@ -57,12 +153,32 @@ const columns = computed(() => [ field: 'quantity', name: 'quantity', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, }, { label: t('globals.description'), field: 'description', name: 'description', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => dashIfEmpty(val), }, { @@ -70,35 +186,104 @@ const columns = computed(() => [ field: 'size', name: 'size', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, }, { label: t('entry.latestBuys.tags'), name: 'tags', align: 'left', + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, }, { label: t('entry.latestBuys.type'), field: 'code', name: 'type', align: 'left', + sortable: true, + columnFilter: { + component: VnSelectFilter, + 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', name: 'intrastat', align: 'left', + sortable: true, + columnFilter: { + component: VnSelectFilter, + 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', name: 'origin', align: 'left', + sortable: true, + columnFilter: { + component: VnSelectFilter, + 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', name: 'weightByPiece', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, + format: (val) => dashIfEmpty(val), }, { @@ -106,24 +291,67 @@ const columns = computed(() => [ field: '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: VnSelectFilter, + 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), }, { @@ -131,6 +359,16 @@ const columns = computed(() => [ field: 'freightValue', name: 'freightValue', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => toCurrency(val), }, { @@ -138,6 +376,16 @@ const columns = computed(() => [ field: 'comissionValue', name: 'comissionValue', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => toCurrency(val), }, { @@ -145,6 +393,16 @@ const columns = computed(() => [ field: 'packageValue', name: 'packageValue', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => toCurrency(val), }, { @@ -152,12 +410,33 @@ const columns = computed(() => [ 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), }, { @@ -165,6 +444,16 @@ const columns = computed(() => [ field: 'price3', name: 'price3', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => toCurrency(val), }, { @@ -172,6 +461,16 @@ const columns = computed(() => [ field: 'minPrice', name: 'minPrice', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => toCurrency(val), }, { @@ -179,6 +478,16 @@ const columns = computed(() => [ field: 'ektFk', name: 'ektFk', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => dashIfEmpty(val), }, { @@ -186,18 +495,51 @@ const columns = computed(() => [ field: 'weight', name: 'weight', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, }, { label: t('entry.latestBuys.packagingFk'), field: 'packagingFk', name: 'packagingFk', align: 'left', + sortable: true, + columnFilter: { + component: VnSelectFilter, + type: 'select', + filterValue: null, + event: getInputEvents, + attrs: { + options: packagingsOptions.value, + 'option-value': 'id', + 'option-label': 'id', + dense: true, + }, + }, }, { 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), }, { @@ -205,6 +547,16 @@ const columns = computed(() => [ field: 'landing', name: 'landing', align: 'left', + sortable: true, + columnFilter: { + component: VnInput, + type: 'text', + filterValue: null, + event: getInputEvents, + attrs: { + dense: true, + }, + }, format: (val) => toDate(val), }, ]); @@ -234,20 +586,55 @@ const redirectToEntryBuys = (entryFk) => { router.push({ name: 'EntryBuys', params: { id: entryFk } }); }; +const applyColumnFilter = async (col) => { + try { + params[col.field] = col.columnFilter.filterValue; + await arrayData.addFilter({ params }); + } catch (err) { + console.error('Error applying column filter', err); + } +}; + 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 }); }); + +onUnmounted(() => (stateStore.rightDrawer = false));