diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 3c9cff3bc..15cf39bd6 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -37,6 +37,10 @@ const $props = defineProps({ type: [Function, Boolean], default: null, }, + rowCtrlClick: { + type: [Function, Boolean], + default: null, + }, redirect: { type: String, default: null, @@ -174,13 +178,17 @@ function splitColumns(columns) { }; for (const col of columns) { - if (col.name == 'tableActions') splittedColumns.value.actions = col; + if (col.name == 'tableActions') { + col.orderBy = false; + splittedColumns.value.actions = col; + } if (col.chip) splittedColumns.value.chips.push(col); if (col.isTitle) splittedColumns.value.title = col; if (col.create) splittedColumns.value.create.push(col); if (col.cardVisible) splittedColumns.value.cardVisible.push(col); if ($props.isEditable && col.disable == null) col.disable = false; - if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true }; + if ($props.useModel && col.columnFilter != false) + col.columnFilter = { ...col.columnFilter, inWhere: true }; splittedColumns.value.columns.push(col); } // Status column @@ -205,6 +213,16 @@ const rowClickFunction = computed(() => { return () => {}; }); +const rowCtrlClickFunction = computed(() => { + if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick; + if ($props.redirect) + return (evt, { id }) => { + stopEventPropagation(evt); + window.open(`/#/${$props.redirect}/${id}`, '_blank'); + }; + return () => {}; +}); + function redirectFn(id) { router.push({ path: `/${$props.redirect}/${id}` }); } @@ -277,6 +295,10 @@ defineExpose({ :search-url="searchUrl" /> -import { onMounted, onUnmounted } from 'vue'; +import { onMounted, onUnmounted, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import RightMenu from 'src/components/common/RightMenu.vue'; import VnTable from 'components/VnTable/VnTable.vue'; @@ -15,12 +15,13 @@ const columns = [ { align: 'center', label: t('entry.latestBuys.tableVisibleColumns.image'), - name: 'image', + name: 'itemFk', columnField: { component: VnImg, attrs: (id) => { return { id, + size: '50x50', width: '50px', }; }, @@ -169,6 +170,7 @@ const columns = [ format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)), }, ]; +const tableRef = ref(); onMounted(async () => { stateStore.rightDrawer = true; @@ -191,6 +193,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); order="id DESC" :columns="columns" redirect="entry" + :row-click="({ entryFk }) => tableRef.redirect(entryFk)" auto-load :right-search="false" /> diff --git a/src/pages/Route/Cmr/CmrList.vue b/src/pages/Route/Cmr/CmrList.vue index 0cc0adcf3..42d0b1c20 100644 --- a/src/pages/Route/Cmr/CmrList.vue +++ b/src/pages/Route/Cmr/CmrList.vue @@ -3,7 +3,7 @@ import { onBeforeMount, onMounted, computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { Notify } from 'quasar'; import { useSession } from 'src/composables/useSession'; -import { toDate } from 'filters/index'; +import { toDate, toDateHourMin } from 'filters/index'; import { useStateStore } from 'src/stores/useStateStore'; import axios from 'axios'; @@ -30,53 +30,69 @@ const columns = computed(() => [ isId: true, }, { - align: 'left', + align: 'center', name: 'hasCmrDms', label: t('route.cmr.list.hasCmrDms'), component: 'checkbox', cardVisible: true, }, { + align: 'left', label: t('route.cmr.list.ticketFk'), name: 'ticketFk', }, { + align: 'left', label: t('route.cmr.list.routeFk'), name: 'routeFk', }, { + align: 'left', label: t('route.cmr.list.clientFk'), name: 'clientFk', }, { - align: 'left', + align: 'right', label: t('route.cmr.list.country'), - name: 'country', + name: 'countryFk', cardVisible: true, - }, - { - align: 'center', - label: t('route.cmr.list.shipped'), - name: 'shipped', - cardVisible: true, - component: 'date', - columnFilter: { - alias: 'c', - inWhere: true, - }, - format: ({ date }) => toDate(date), - }, - { - align: 'center', - name: 'warehouseFk', - label: t('globals.warehouse'), - component: 'select', attrs: { - options: warehouses.value, + url: 'countries', + fields: ['id', 'name'], + optionLabel: 'name', + optionValue: 'id', }, + columnFilter: { + inWhere: true, + component: 'select', + }, + format: ({ countryName }) => countryName, }, { align: 'right', + label: t('route.cmr.list.shipped'), + name: 'shipped', + cardVisible: true, + columnFilter: { + component: 'date', + inWhere: true, + }, + format: ({ shipped }) => toDateHourMin(shipped), + }, + { + align: 'right', + name: 'warehouseFk', + label: t('globals.warehouse'), + columnFilter: { + component: 'select', + }, + attrs: { + options: warehouses.value, + }, + format: ({ warehouseName }) => warehouseName, + }, + { + align: 'center', name: 'tableActions', actions: [ { @@ -153,7 +169,7 @@ function downloadPdfs() { diff --git a/src/pages/Route/RouteAutonomous.vue b/src/pages/Route/RouteAutonomous.vue index 83bc3b7c5..8e7900652 100644 --- a/src/pages/Route/RouteAutonomous.vue +++ b/src/pages/Route/RouteAutonomous.vue @@ -36,23 +36,20 @@ const tableRef = ref(); const columns = computed(() => [ { align: 'left', - name: 'id', + name: 'routeFk', label: 'Id', chip: { condition: () => true, }, isId: true, + columnFilter: false, }, { align: 'left', name: 'created', label: t('Date'), - component: 'date', - columnFilter: { - alias: 'c', - inWhere: true, - }, - format: ({ date }) => toDate(date), + columnFilter: false, + format: ({ created }) => toDate(created), }, { align: 'left', @@ -66,40 +63,63 @@ const columns = computed(() => [ label: t('Agency agreement'), cardVisible: true, }, + { + align: 'left', + name: 'to', + label: t('To'), + visible: false, + cardVisible: true, + create: true, + component: 'date', + format: ({ date }) => toDate(date), + }, + { + align: 'left', + name: 'from', + label: t('From'), + visible: false, + cardVisible: true, + create: true, + component: 'date', + format: ({ date }) => toDate(date), + }, { align: 'left', name: 'packages', label: t('Packages'), + columnFilter: false, }, { align: 'left', name: 'm3', label: 'm³', cardVisible: true, - columnFilter: { - inWhere: true, - }, + columnFilter: false, }, { align: 'left', name: 'kmTotal', label: t('Km'), cardVisible: true, + columnFilter: false, }, { align: 'left', name: 'price', label: t('Price'), + columnFilter: false, }, { align: 'left', name: 'invoiceInFk', label: t('Received'), + columnFilter: false, }, { align: 'left', name: 'supplierName', label: t('Autonomous'), + columnFilter: false, }, { align: 'right', diff --git a/src/pages/Route/RouteList.vue b/src/pages/Route/RouteList.vue index 0f7c06de9..b13e8cacd 100644 --- a/src/pages/Route/RouteList.vue +++ b/src/pages/Route/RouteList.vue @@ -24,7 +24,6 @@ const selectedRows = ref([]); const tableRef = ref([]); const confirmationDialog = ref(false); const startingDate = ref(null); -const refreshKey = ref(0); const router = useRouter(); const routeFilter = { include: [ @@ -45,9 +44,7 @@ const columns = computed(() => [ condition: () => true, }, isId: true, - columnFilter: { - name: 'search', - }, + columnFilter: false, }, { align: 'left', @@ -65,6 +62,9 @@ const columns = computed(() => [ label: 'workerUserName', }, }, + columnFilter: { + inWhere: true, + }, useLike: false, cardVisible: true, format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef), @@ -102,18 +102,38 @@ const columns = computed(() => [ label: 'vehiclePlateNumber', }, }, + columnFilter: { + inWhere: true, + }, }, { align: 'left', name: 'created', label: t('Date'), + columnFilter: false, + cardVisible: true, + create: true, + component: 'date', + format: ({ date }) => toDate(date), + }, + { + align: 'left', + name: 'to', + label: t('To'), + visible: false, + cardVisible: true, + create: true, + component: 'date', + format: ({ date }) => toDate(date), + }, + { + align: 'left', + name: 'from', + label: t('From'), + visible: false, cardVisible: true, create: true, component: 'date', - columnFilter: { - alias: 'c', - inWhere: true, - }, format: ({ date }) => toDate(date), }, { @@ -136,18 +156,21 @@ const columns = computed(() => [ name: 'started', label: t('hourStarted'), component: 'time', + columnFilter: false, }, { align: 'left', name: 'finished', label: t('hourFinished'), component: 'time', + columnFilter: false, }, { align: 'left', name: 'isOk', label: t('Served'), component: 'checkbox', + columnFilter: false, }, { align: 'right', @@ -183,8 +206,8 @@ const cloneRoutes = () => { created: startingDate.value, ids: selectedRows.value.map((row) => row?.id), }); - tableRef.value.reload(); startingDate.value = null; + tableRef.value.reload(); }; const showRouteReport = () => { @@ -220,7 +243,7 @@ const openTicketsDialog = (id) => { id, }, }) - .onOk(() => refreshKey.value++); + .onOk(() => tableRef.value.reload()); }; @@ -249,6 +272,7 @@ const openTicketsDialog = (id) => { { }" save-url="Routes/crud" :disable-option="{ card: true }" - :use-model="true" table-height="85vh" v-model:selected="selectedRows" :table="{ @@ -332,6 +355,8 @@ en: hourStarted: Started hour hourFinished: Finished hour es: + From: Desde + To: Hasta Worker: Trabajador Agency: Agencia Vehicle: Vehículo diff --git a/src/pages/Route/RouteRoadmap.vue b/src/pages/Route/RouteRoadmap.vue index 050691af4..306387cbe 100644 --- a/src/pages/Route/RouteRoadmap.vue +++ b/src/pages/Route/RouteRoadmap.vue @@ -2,7 +2,7 @@ import { useI18n } from 'vue-i18n'; import { computed, ref } from 'vue'; import { dashIfEmpty } from 'src/filters'; -import { toDate } from 'filters/index'; +import { toDate, toDateHourMin } from 'filters/index'; import { useQuasar } from 'quasar'; import { useSummaryDialog } from 'composables/useSummaryDialog'; import toCurrency from 'filters/toCurrency'; @@ -43,10 +43,9 @@ const columns = computed(() => [ label: t('ETD'), component: 'date', columnFilter: { - alias: 'c', inWhere: true, }, - format: ({ date }) => toDate(date), + format: ({ created }) => toDate(created), cardVisible: true, }, { @@ -200,6 +199,12 @@ function confirmRemove() { }" :disable-option="{ card: true }" > + +