feat: mejorar la gestión de errores y optimizar la carga de datos en los componentes de devolución
This commit is contained in:
parent
8210d7dd2f
commit
b895836849
@ -89,7 +89,6 @@ const closeCreateModal = () => {
|
||||
|
||||
const createSerial = () => {
|
||||
const url = apiURL(`inventario/${inventoryId.value}/serials`);
|
||||
console.log('Creating serial at URL:', url, 'inventoryId:', inventoryId.value);
|
||||
|
||||
form.post(url, {
|
||||
onSuccess: (response) => {
|
||||
|
||||
@ -76,9 +76,11 @@ const canSubmit = computed(() => {
|
||||
});
|
||||
|
||||
/** Watchers */
|
||||
watch(() => props.show, (isShown) => {
|
||||
watch(() => props.show, async (isShown) => {
|
||||
if (isShown) {
|
||||
resetForm();
|
||||
// Cargar el estado de la caja registradora
|
||||
await cashRegisterStore.loadCurrentRegister();
|
||||
if (props.sale) {
|
||||
searchSale();
|
||||
}
|
||||
@ -130,7 +132,7 @@ const searchSale = async () => {
|
||||
quantity_sold: item.quantity_sold,
|
||||
quantity_already_returned: item.quantity_already_returned,
|
||||
quantity_returnable: item.quantity_returnable,
|
||||
available_serials: item.serials || [],
|
||||
available_serials: item.available_serials || [],
|
||||
// Estado de selección
|
||||
selected: false,
|
||||
quantity: 0,
|
||||
|
||||
@ -35,7 +35,6 @@ const openDetailModal = async (returnItem) => {
|
||||
selectedReturn.value = response.model || response;
|
||||
showDetailModal.value = true;
|
||||
} catch (error) {
|
||||
console.error('Error al cargar detalles:', error);
|
||||
window.Notify.error('Error al cargar los detalles de la devolución');
|
||||
}
|
||||
};
|
||||
|
||||
@ -22,7 +22,8 @@ const emit = defineEmits(['close', 'cancelled']);
|
||||
|
||||
/** Computados */
|
||||
const returnItems = computed(() => {
|
||||
return props.returnData?.details || [];
|
||||
const items = props.returnData?.details || [];
|
||||
return items;
|
||||
});
|
||||
|
||||
const hasItems = computed(() => {
|
||||
@ -59,8 +60,8 @@ const getRefundMethodBadge = (method) => {
|
||||
const getRefundMethodLabel = (method) => {
|
||||
const labels = {
|
||||
cash: 'Efectivo',
|
||||
card: 'Tarjeta',
|
||||
store_credit: 'Crédito tienda'
|
||||
credit_card: 'Credito',
|
||||
debit_card: 'Debito'
|
||||
};
|
||||
return labels[method] || method || '-';
|
||||
};
|
||||
@ -68,8 +69,8 @@ const getRefundMethodLabel = (method) => {
|
||||
const getRefundMethodIcon = (method) => {
|
||||
const icons = {
|
||||
cash: 'payments',
|
||||
card: 'credit_card',
|
||||
store_credit: 'account_balance_wallet'
|
||||
credit_card: 'credit_card',
|
||||
debit_card: 'credit_card'
|
||||
};
|
||||
return icons[method] || 'payment';
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user