0
0
Fork 0

refs #7283 fix ItemDescriptor warehouse

This commit is contained in:
Carlos Satorres 2024-09-09 12:05:08 +02:00
parent 27f25f611f
commit 3004d77d34
1 changed files with 15 additions and 7 deletions

View File

@ -65,15 +65,23 @@ onMounted(async () => {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = async (entity) => { const setData = async (entity) => {
if (!entity) return; try {
data.value = useCardDescription(entity.name, entity.id); if (!entity) return;
await updateStock(); data.value = useCardDescription(entity.name, entity.id);
await updateStock();
} catch (err) {
console.error('Error item');
}
}; };
const getItemConfigs = async () => { const getItemConfigs = async () => {
const { data } = await axios.get('ItemConfigs/findOne'); try {
if (!data) return; const { data } = await axios.get('ItemConfigs/findOne');
return (warehouseConfig.value = data.warehouseFk); if (!data) return;
return (warehouseConfig.value = data.warehouseFk);
} catch (err) {
console.error('Error item');
}
}; };
const updateStock = async () => { const updateStock = async () => {
try { try {
@ -85,13 +93,13 @@ const updateStock = async () => {
dated: $props.dated, dated: $props.dated,
}; };
await getItemConfigs();
if (!params.warehouseFk) { if (!params.warehouseFk) {
params.warehouseFk = warehouseConfig.value; params.warehouseFk = warehouseConfig.value;
} }
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, { const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
params, params,
}); });
available.value = data.available; available.value = data.available;
visible.value = data.visible; visible.value = data.visible;
} catch (err) { } catch (err) {