diff --git a/src/boot/axios.js b/src/boot/axios.js index 4fd83ddea..fa8a08003 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -55,10 +55,10 @@ const onResponseError = (error) => { } if (session.isLoggedIn() && response?.status === 401) { - session.destroy(); + session.destroy(false); const hash = window.location.hash; const url = hash.slice(1); - Router.push({ path: url }); + Router.push(`/login?redirect=${url}`); } else if (!session.isLoggedIn()) { return Promise.reject(error); } diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index fa7761c5f..a55bde6f2 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -10,7 +10,6 @@ import VnPaginate from 'components/ui/VnPaginate.vue'; import VnConfirm from 'components/ui/VnConfirm.vue'; import SkeletonTable from 'components/ui/SkeletonTable.vue'; import { tMobile } from 'src/composables/tMobile'; -import VnSubToolbar from './ui/VnSubToolbar.vue'; const { push } = useRouter(); const quasar = useQuasar(); diff --git a/src/components/common/TableVisibleColumns.vue b/src/components/common/TableVisibleColumns.vue index 7aa696a07..a4e4afafe 100644 --- a/src/components/common/TableVisibleColumns.vue +++ b/src/components/common/TableVisibleColumns.vue @@ -52,7 +52,7 @@ const toggleMarkAll = (val) => { const getConfig = async (url, filter) => { const response = await axios.get(url, { - params: { filter: filter }, + params: { filter: JSON.stringify(filter) }, }); return response.data && response.data.length > 0 ? response.data[0] : null; }; @@ -60,7 +60,7 @@ const getConfig = async (url, filter) => { const fetchViewConfigData = async () => { try { const userConfigFilter = { - where: { tableCode: $props.tableCode, userFk: user.id }, + where: { tableCode: $props.tableCode, userFk: user.value.id }, }; const userConfig = await getConfig('UserConfigViews', userConfigFilter); @@ -74,8 +74,14 @@ const fetchViewConfigData = async () => { const defaultConfig = await getConfig('DefaultViewConfigs', defaultConfigFilter); if (defaultConfig) { + // Si el backend devuelve una configuración por defecto la usamos setUserConfigViewData(defaultConfig.columns); return; + } else { + // Si no hay configuración por defecto mostramos todas las columnas + const defaultColumns = {}; + $props.allColumns.forEach((col) => (defaultColumns[col] = true)); + setUserConfigViewData(defaultColumns); } } catch (err) { console.err('Error fetching config view data', err); diff --git a/src/pages/Order/Card/OrderCatalogItem.vue b/src/components/ui/CatalogItem.vue similarity index 91% rename from src/pages/Order/Card/OrderCatalogItem.vue rename to src/components/ui/CatalogItem.vue index 8fa0bb5b9..2b4724e35 100644 --- a/src/pages/Order/Card/OrderCatalogItem.vue +++ b/src/components/ui/CatalogItem.vue @@ -7,7 +7,7 @@ import VnImg from 'src/components/ui/VnImg.vue'; import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; -import toCurrency from '../../../filters/toCurrency'; +import { toCurrency } from 'filters/index'; const DEFAULT_PRICE_KG = 0; @@ -18,6 +18,10 @@ defineProps({ type: Object, required: true, }, + isCatalog: { + type: Boolean, + default: false, + }, }); const dialog = ref(null); @@ -28,7 +32,7 @@ const dialog = ref(null);
-
+