|
@ -246,6 +246,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
}
|
||||
|
||||
function updateStateParams() {
|
||||
if (!route) return;
|
||||
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
|
||||
newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import useCardDescription from 'src/composables/useCardDescription';
|
|||
import { getUrl } from 'src/composables/getUrl';
|
||||
import axios from 'axios';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -49,58 +50,49 @@ const entityId = computed(() => {
|
|||
});
|
||||
|
||||
const regularizeStockFormDialog = ref(null);
|
||||
const available = ref(null);
|
||||
const visible = ref(null);
|
||||
const salixUrl = ref();
|
||||
const mounted = ref();
|
||||
|
||||
const arrayDataStock = useArrayData('descriptorStock', {
|
||||
url: `Items/${entityId.value}/getVisibleAvailable`,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
salixUrl.value = await getUrl('');
|
||||
salixUrl.value = await getUrl('getVisibleAvailable');
|
||||
carlossa marked this conversation as resolved
Outdated
|
||||
await getItemConfigs();
|
||||
await updateStock();
|
||||
mounted.value = true;
|
||||
});
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = async (entity) => {
|
||||
try {
|
||||
if (!entity) return;
|
||||
data.value = useCardDescription(entity.name, entity.id);
|
||||
await updateStock();
|
||||
} catch (err) {
|
||||
console.error('Error item');
|
||||
}
|
||||
};
|
||||
|
||||
const getItemConfigs = async () => {
|
||||
try {
|
||||
const { data } = await axios.get('ItemConfigs/findOne');
|
||||
if (!data) return;
|
||||
return (warehouseConfig.value = data.warehouseFk);
|
||||
} catch (err) {
|
||||
console.error('Error item');
|
||||
}
|
||||
};
|
||||
const updateStock = async () => {
|
||||
try {
|
||||
available.value = null;
|
||||
visible.value = null;
|
||||
if (!mounted.value) return;
|
||||
await getItemConfigs();
|
||||
|
||||
const params = {
|
||||
carlossa marked this conversation as resolved
jsegarra
commented
Deberia aparecer el almacen seleccionado al abrir el modal segun el valor del usaurio Deberia aparecer el almacen seleccionado al abrir el modal segun el valor del usaurio
|
||||
warehouseFk: $props.warehouseFk,
|
||||
warehouseFk: $props.warehouseFk ?? warehouseConfig.value,
|
||||
dated: $props.dated,
|
||||
};
|
||||
|
||||
await getItemConfigs();
|
||||
if (!params.warehouseFk) {
|
||||
params.warehouseFk = warehouseConfig.value;
|
||||
}
|
||||
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
|
||||
params,
|
||||
if (!params.warehouseFk) return;
|
||||
|
||||
const stock = useArrayData('descriptorStock', {
|
||||
url: `Items/${entityId.value}/getVisibleAvailable`,
|
||||
userParams: params,
|
||||
});
|
||||
available.value = data.available;
|
||||
visible.value = data.visible;
|
||||
} catch (err) {
|
||||
console.error('Error updating stock');
|
||||
}
|
||||
const storeData = stock.store.data;
|
||||
if (storeData?.itemFk == entityId.value) return;
|
||||
await stock.fetch({});
|
||||
};
|
||||
|
||||
const openRegularizeStockForm = () => {
|
||||
|
@ -163,8 +155,8 @@ const openCloneDialog = async () => {
|
|||
<template #before>
|
||||
<ItemDescriptorImage
|
||||
:entity-id="entityId"
|
||||
:visible="visible"
|
||||
:available="available"
|
||||
:visible="arrayDataStock.store.data?.visible"
|
||||
:available="arrayDataStock.store.data?.available"
|
||||
/>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
jsegarra marked this conversation as resolved
Outdated
jsegarra
commented
Traducir el icono de información Traducir el icono de información
|
||||
|
|
|
@ -32,6 +32,10 @@ const editPhotoFormDialog = ref(null);
|
|||
const showEditPhotoForm = ref(false);
|
||||
const warehouseName = ref(null);
|
||||
|
||||
onMounted(async () => {
|
||||
getItemConfigs();
|
||||
});
|
||||
|
||||
const toggleEditPictureForm = () => {
|
||||
showEditPhotoForm.value = !showEditPhotoForm.value;
|
||||
};
|
||||
|
@ -56,10 +60,6 @@ const getWarehouseName = async (warehouseFk) => {
|
|||
warehouseName.value = data.name;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
getItemConfigs();
|
||||
});
|
||||
|
||||
const handlePhotoUpdated = (evt = false) => {
|
||||
image.value.reload(evt);
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@ import { toDateFormat } from 'src/filters/date.js';
|
|||
import { dashIfEmpty } from 'src/filters';
|
||||
import { date } from 'quasar';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import axios from 'axios';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -37,6 +38,33 @@ const warehouseFk = ref(null);
|
|||
const _showWhatsBeforeInventory = ref(false);
|
||||
const inventoriedDate = ref(null);
|
||||
|
||||
const originTypeMap = {
|
||||
entry: {
|
||||
descriptor: EntryDescriptorProxy,
|
||||
icon: 'vn:entry',
|
||||
color: 'green',
|
||||
},
|
||||
ticket: {
|
||||
descriptor: TicketDescriptorProxy,
|
||||
icon: 'vn:ticket',
|
||||
color: 'red',
|
||||
},
|
||||
order: {
|
||||
descriptor: OrderDescriptorProxy,
|
||||
icon: 'vn:basket',
|
||||
color: 'yellow',
|
||||
},
|
||||
};
|
||||
|
||||
const entityTypeMap = {
|
||||
client: {
|
||||
descriptor: CustomerDescriptorProxy,
|
||||
},
|
||||
supplier: {
|
||||
descriptor: SupplierDescriptorProxy,
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'claim',
|
||||
|
@ -105,6 +133,28 @@ const showWhatsBeforeInventory = computed({
|
|||
},
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
today.value.setHours(0, 0, 0, 0);
|
||||
if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk;
|
||||
else if (user.value) warehouseFk.value = user.value.warehouseFk;
|
||||
itemsBalanceFilter.where.warehouseFk = warehouseFk.value;
|
||||
const { data } = await axios.get('Configs/findOne');
|
||||
inventoriedDate.value = data.inventoried;
|
||||
await fetchItemBalances();
|
||||
await scrollToToday();
|
||||
await updateWarehouse(warehouseFk.value);
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value.params.id,
|
||||
(newId) => {
|
||||
itemsBalanceFilter.where.itemFk = newId;
|
||||
itemBalancesRef.value.fetch();
|
||||
}
|
||||
);
|
||||
|
||||
const fetchItemBalances = async () => await itemBalancesRef.value.fetch();
|
||||
|
||||
const getBadgeAttrs = (_date) => {
|
||||
|
@ -131,53 +181,15 @@ const formatDateForAttribute = (dateValue) => {
|
|||
return dateValue;
|
||||
};
|
||||
|
||||
const originTypeMap = {
|
||||
entry: {
|
||||
descriptor: EntryDescriptorProxy,
|
||||
icon: 'vn:entry',
|
||||
color: 'green',
|
||||
async function updateWarehouse(warehouseFk) {
|
||||
const stock = useArrayData('descriptorStock', {
|
||||
userParams: {
|
||||
warehouseFk,
|
||||
},
|
||||
ticket: {
|
||||
descriptor: TicketDescriptorProxy,
|
||||
icon: 'vn:ticket',
|
||||
color: 'red',
|
||||
},
|
||||
order: {
|
||||
descriptor: OrderDescriptorProxy,
|
||||
icon: 'vn:basket',
|
||||
color: 'yellow',
|
||||
},
|
||||
};
|
||||
|
||||
const entityTypeMap = {
|
||||
client: {
|
||||
descriptor: CustomerDescriptorProxy,
|
||||
},
|
||||
supplier: {
|
||||
descriptor: SupplierDescriptorProxy,
|
||||
},
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
today.value.setHours(0, 0, 0, 0);
|
||||
if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk;
|
||||
else if (user.value) warehouseFk.value = user.value.warehouseFk;
|
||||
itemsBalanceFilter.where.warehouseFk = warehouseFk.value;
|
||||
const { data } = await axios.get('Configs/findOne');
|
||||
inventoriedDate.value = data.inventoried;
|
||||
await fetchItemBalances();
|
||||
await scrollToToday();
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value.params.id,
|
||||
(newId) => {
|
||||
itemsBalanceFilter.where.itemFk = newId;
|
||||
itemBalancesRef.value.fetch();
|
||||
}
|
||||
);
|
||||
});
|
||||
await stock.fetch({});
|
||||
stock.store.data.itemFk = route.params.id
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -203,7 +215,9 @@ watch(
|
|||
option-value="id"
|
||||
dense
|
||||
v-model="itemsBalanceFilter.where.warehouseFk"
|
||||
@update:model-value="fetchItemBalances"
|
||||
@update:model-value="
|
||||
(value) => fetchItemBalances() && updateWarehouse(value)
|
||||
"
|
||||
class="q-mr-lg"
|
||||
/>
|
||||
<QCheckbox
|
||||
|
|
Loading…
Reference in New Issue
?