diff --git a/src/lang/es.js b/src/lang/es.js index 564e75b..2452096 100644 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -460,6 +460,7 @@ export default { sales: 'Ventas', returns: 'Devoluciones', clients: 'Clientes', + suppliers: 'Proveedores', clientTiers: 'Niveles de Clientes', billingRequests: 'Solicitudes de Facturación', warehouses: 'Almacenes', @@ -581,5 +582,9 @@ export default { movements: { title: 'Movimientos de Inventario', description: 'Historial de entradas, salidas y traspasos de productos', - } + }, + suppliers: { + title: 'Proveedores', + description: 'Gestión de proveedores', + }, } \ No newline at end of file diff --git a/src/layouts/AppLayout.vue b/src/layouts/AppLayout.vue index 7cd412d..c616458 100644 --- a/src/layouts/AppLayout.vue +++ b/src/layouts/AppLayout.vue @@ -58,6 +58,11 @@ onMounted(() => { name="pos.clients" to="pos.clients.index" /> + form.track_serials, () => {
props.show, (isShown) => { Fecha:

{{ formatDate(movement.created_at) }}

-
- Referencia factura: -

{{ movement.invoice_reference }}

-
Notas:

{{ movement.notes }}

+ + +
+
+ +

Referencia de Factura

+
+

{{ movement.invoice_reference }}

+
+ + +
+
+ +

Proveedor

+
+

{{ movement.supplier.business_name }}

+

RFC: {{ movement.supplier.rfc }}

+
+ + +
+ +
+
+ +

Origen

+
+

{{ movement.warehouse_from.name }}

+

{{ movement.warehouse_from.code }}

+
+ + +
+
+ +

Destino

+
+

{{ movement.warehouse_to.name }}

+

{{ movement.warehouse_to.code }}

+
+
diff --git a/src/pages/POS/Movements/Edit.vue b/src/pages/POS/Movements/Edit.vue index 9930ff8..27069d2 100644 --- a/src/pages/POS/Movements/Edit.vue +++ b/src/pages/POS/Movements/Edit.vue @@ -19,6 +19,7 @@ const props = defineProps({ /** Estado */ const warehouses = ref([]); +const suppliers = ref([]); const loading = ref(false); const api = useApi(); @@ -27,6 +28,7 @@ const form = useForm({ quantity: 0, unit_cost: 0, warehouse_id: '', + supplier_id: null, origin_warehouse_id: '', destination_warehouse_id: '', invoice_reference: '', @@ -72,13 +74,19 @@ const allowsDecimals = computed(() => { /** Métodos */ const loadWarehouses = () => { loading.value = true; - api.get(apiURL('almacenes'), { - onSuccess: (data) => { - warehouses.value = data.warehouses?.data || data.data || []; - }, - onFinish: () => { - loading.value = false; - } + Promise.all([ + api.get(apiURL('almacenes'), { + onSuccess: (data) => { + warehouses.value = data.warehouses?.data || data.data || []; + } + }), + api.get(apiURL('proveedores'), { + onSuccess: (data) => { + suppliers.value = data.suppliers?.data || data.suppliers || []; + } + }) + ]).finally(() => { + loading.value = false; }); }; @@ -93,6 +101,7 @@ const updateMovement = () => { if (props.movement.movement_type === 'entry') { data.unit_cost = Number(form.unit_cost); data.warehouse_to_id = form.destination_warehouse_id; + data.supplier_id = form.supplier_id || null; data.invoice_reference = form.invoice_reference || null; } else if (props.movement.movement_type === 'exit') { data.warehouse_from_id = form.origin_warehouse_id; @@ -122,11 +131,6 @@ const closeModal = () => { emit('close'); }; -const getWarehouseName = (warehouseId) => { - const warehouse = warehouses.value.find(w => w.id === warehouseId); - return warehouse ? `${warehouse.name} (${warehouse.code})` : 'N/A'; -}; - /** Observadores */ watch(() => props.show, (isShown) => { if (isShown) { @@ -136,6 +140,7 @@ watch(() => props.show, (isShown) => { // Cargar datos del movimiento form.quantity = props.movement.quantity || 0; form.unit_cost = props.movement.unit_cost || 0; + form.supplier_id = props.movement.supplier_id || null; form.invoice_reference = props.movement.invoice_reference || ''; form.notes = props.movement.notes || ''; @@ -323,17 +328,37 @@ watch(() => props.show, (isShown) => { - -
- - - + +
+ +
+ + + +
+ + +
+ + + +
diff --git a/src/pages/POS/Movements/EntryModal.vue b/src/pages/POS/Movements/EntryModal.vue index aec1833..0c2a260 100644 --- a/src/pages/POS/Movements/EntryModal.vue +++ b/src/pages/POS/Movements/EntryModal.vue @@ -19,6 +19,7 @@ const props = defineProps({ /** Estado */ const products = ref([]); const warehouses = ref([]); +const suppliers = ref([]); const loading = ref(false); const selectedProducts = ref([]); @@ -36,6 +37,7 @@ const api = useApi(); /** Formulario */ const form = useForm({ warehouse_id: '', + supplier_id: null, invoice_reference: '', notes: '', products: [] @@ -74,6 +76,11 @@ const loadData = () => { } } }), + api.get(apiURL('proveedores'), { + onSuccess: (data) => { + suppliers.value = data.suppliers?.data || data.data || []; + } + }), api.get(apiURL('inventario'), { onSuccess: (data) => { products.value = data.products?.data || data.data || []; @@ -331,6 +338,22 @@ watch(() => form.warehouse_id, (newWarehouseId, oldWarehouseId) => {
+
+ + + +
+
diff --git a/src/pages/POS/Movements/Index.vue b/src/pages/POS/Movements/Index.vue index ec4f58e..edaf6d9 100644 --- a/src/pages/POS/Movements/Index.vue +++ b/src/pages/POS/Movements/Index.vue @@ -100,13 +100,11 @@ const movementTypes = [ const getTypeBadge = (type) => { const badges = { - entry: { label: 'Entrada', class: 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300' }, - exit: { label: 'Salida', class: 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300' }, - transfer: { label: 'Traspaso', class: 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300' }, -/* sale: { label: 'Venta', class: 'bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300' }, - return: { label: 'Devolución', class: 'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300' }, */ + entry: { label: 'Entrada', icon: 'add_circle', class: 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300' }, + exit: { label: 'Salida', icon: 'remove_circle', class: 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300' }, + transfer: { label: 'Traspaso', icon: 'swap_horiz', class: 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300' }, }; - return badges[type] || { label: type, class: 'bg-gray-100 text-gray-800' }; + return badges[type] || { label: type, icon: 'help_outline', class: 'bg-gray-100 text-gray-800' }; }; /** Searcher */ @@ -295,6 +293,7 @@ onMounted(() => {