diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index b40699bbb..db59b7d78 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -19,7 +19,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { onMounted(() => { setOptions(); store.skip = 0; - const query = route.query; const searchUrl = store.searchUrl; if (query[searchUrl]) { diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index bb7b07478..590967c4d 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -1142,6 +1142,16 @@ supplier: date: Date reference: Reference travel: + travelList: + tableVisibleColumns: + id: Id + ref: Reference + agency: Agency + shipped: Shipped + landed: Landed + warehouseIn: Warehouse in + warehouseOut: Warehouse out + totalEntries: Total entries summary: confirmed: Confirmed entryId: Entry Id diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 3435396aa..c353b4676 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -1115,6 +1115,16 @@ supplier: date: Fecha reference: Referencia travel: + travelList: + tableVisibleColumns: + id: Id + ref: Referencia + agency: Agencia + shipped: Enviado + landed: Llegada + warehouseIn: Almacén de salida + warehouseOut: Almacén de entrada + totalEntries: Total de entradas summary: confirmed: Confirmado entryId: Id entrada diff --git a/src/pages/Travel/Card/TravelCard.vue b/src/pages/Travel/Card/TravelCard.vue index bf7e6d57a..a3c1430e9 100644 --- a/src/pages/Travel/Card/TravelCard.vue +++ b/src/pages/Travel/Card/TravelCard.vue @@ -33,8 +33,12 @@ const filter = { diff --git a/src/pages/Travel/Card/TravelSummary.vue b/src/pages/Travel/Card/TravelSummary.vue index de539e949..af9aa5f7f 100644 --- a/src/pages/Travel/Card/TravelSummary.vue +++ b/src/pages/Travel/Card/TravelSummary.vue @@ -12,8 +12,6 @@ import FetchData from 'src/components/FetchData.vue'; import { toDate, toCurrency } from 'src/filters'; import axios from 'axios'; -onUpdated(() => summaryRef.value.fetch()); - const $props = defineProps({ id: { type: Number, diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index e6696b26f..78844d4b6 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -2,31 +2,27 @@ import { onMounted, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; -import VnPaginate from 'src/components/ui/VnPaginate.vue'; -import CardList from 'src/components/ui/CardList.vue'; -import VnLv from 'src/components/ui/VnLv.vue'; -import TravelSummary from './Card/TravelSummary.vue'; -import TravelFilter from './TravelFilter.vue'; -import FetchData from 'components/FetchData.vue'; -import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; - +import { useRoute } from 'vue-router'; import { useStateStore } from 'stores/useStateStore'; -import { toDate } from 'src/filters/index'; +import VnTable from 'components/VnTable/VnTable.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; -import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js'; -import RightMenu from 'src/components/common/RightMenu.vue'; - +import { computed } from 'vue'; +import TravelSummary from './Card/TravelSummary.vue'; +import VnSearchbar from 'components/ui/VnSearchbar.vue'; +import { dashIfEmpty, toDate } from 'src/filters'; +const { viewSummary } = useSummaryDialog(); const router = useRouter(); const { t } = useI18n(); const stateStore = useStateStore(); -const { viewSummary } = useSummaryDialog(); - -const warehouses = ref([]); - -const navigateToTravelId = (id) => { - router.push({ path: `/travel/${id}` }); -}; - +const route = useRoute(); +const tableRef = ref(); +const $props = defineProps({ + id: { + type: Number, + default: 0, + }, +}); +const entityId = computed(() => $props.id || route.params.id); const cloneTravel = (travelData) => { const stringifiedTravelData = JSON.stringify(travelData); redirectToCreateView(stringifiedTravelData); @@ -40,125 +36,170 @@ const redirectCreateEntryView = (travelData) => { router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } }); }; -const getWarehouseName = (id) => { - return warehouses.value.find((warehouse) => warehouse.id === id).name; -}; - onMounted(async () => { stateStore.rightDrawer = true; }); + +const columns = computed(() => [ + { + align: 'left', + name: 'id', + label: t('travel.travelList.tableVisibleColumns.id'), + isId: true, + field: 'id', + cardVisible: true, + }, + { + align: 'left', + name: 'ref', + label: t('travel.travelList.tableVisibleColumns.ref'), + field: 'ref', + component: 'input', + columnField: { + component: null, + }, + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'agencyModeFk', + label: t('travel.travelList.tableVisibleColumns.agency'), + field: 'agencyModeFk', + component: 'select', + attrs: { + url: 'agencyModes', + fields: ['id', 'name'], + }, + columnField: { + component: null, + }, + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'shipped', + label: t('travel.travelList.tableVisibleColumns.shipped'), + field: 'shipped', + component: 'date', + columnField: { + component: null, + }, + cardVisible: true, + create: true, + format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.shipped)), + }, + { + align: 'left', + name: 'landed', + label: t('travel.travelList.tableVisibleColumns.landed'), + field: 'landed', + component: 'date', + columnField: { + component: null, + }, + cardVisible: true, + create: true, + format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)), + }, + { + align: 'left', + name: 'warehouseInFk', + label: t('travel.travelList.tableVisibleColumns.warehouseIn'), + field: 'warehouseInFk', + component: 'select', + attrs: { + url: 'warehouses', + fields: ['id', 'name'], + }, + columnField: { + component: null, + }, + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'warehouseOutFk', + label: t('travel.travelList.tableVisibleColumns.warehouseOut'), + field: 'warehouseOutFk', + component: 'select', + attrs: { + url: 'warehouses', + fields: ['id', 'name'], + }, + columnField: { + component: null, + }, + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'totalEntries', + label: t('travel.travelList.tableVisibleColumns.totalEntries'), + field: 'totalEntries', + component: 'input', + columnField: { + component: null, + }, + cardVisible: true, + create: true, + }, + { + align: 'right', + label: '', + name: 'tableActions', + actions: [ + { + title: t('Clone'), + icon: 'vn:clone', + action: cloneTravel, + isPrimary: true, + }, + { + title: t('Add entry'), + icon: 'contact_support', + action: redirectCreateEntryView, + }, + { + title: t('View Summary'), + icon: 'preview', + action: (row) => viewSummary(row.id, TravelSummary), + }, + ], + }, +]); @@ -169,4 +210,6 @@ en: es: addEntry: Añadir entrada searchByIdOrReference: Buscar por ID o por referencia + You can search by travel id or name: Buscar por envio por id o nombre + Search travel: Buscar envio