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);
-
+