diff --git a/src/pages/POS/Movements/DetailModal.vue b/src/pages/POS/Movements/DetailModal.vue
index f448614..c033ebf 100644
--- a/src/pages/POS/Movements/DetailModal.vue
+++ b/src/pages/POS/Movements/DetailModal.vue
@@ -2,6 +2,7 @@
import { ref, watch, computed } from 'vue';
import { useApi, apiURL } from '@Services/Api';
import { formatDate } from '@/utils/formatters';
+import { hasPermission } from '@Plugins/RolePermission';
import Modal from '@Holos/Modal.vue';
import GoogleIcon from '@Shared/GoogleIcon.vue';
@@ -15,7 +16,7 @@ const props = defineProps({
});
/** Eventos */
-const emit = defineEmits(['close']);
+const emit = defineEmits(['close', 'edit']);
/** Estado */
const movement = ref(null);
@@ -38,6 +39,14 @@ const totalCost = computed(() => {
return movement.value.products.reduce((sum, p) => sum + (Number(p.quantity) * Number(p.unit_cost || 0)), 0);
});
+const canEdit = computed(() => {
+ return hasPermission('movements.edit');
+});
+
+const canEditSingle = computed(() => {
+ return hasPermission('movements.edit') && !isMultiProduct.value;
+});
+
/** Métodos */
const fetchDetail = () => {
if (!props.movementId) return;
@@ -67,6 +76,29 @@ const handleClose = () => {
emit('close');
};
+const handleEdit = () => {
+ emit('edit', movement.value);
+};
+
+const handleEditProduct = (product) => {
+ // Crear un objeto de movimiento individual a partir del producto
+ const individualMovement = {
+ id: product.movement_id,
+ movement_type: movement.value.movement_type,
+ quantity: product.quantity,
+ unit_cost: product.unit_cost,
+ warehouse_id: movement.value.warehouse_to?.id,
+ invoice_reference: movement.value.invoice_reference,
+ notes: movement.value.notes,
+ inventory: product.inventory,
+ warehouse_to: movement.value.warehouse_to,
+ warehouse_from: movement.value.warehouse_from,
+ user: movement.value.user,
+ created_at: movement.value.created_at
+ };
+ emit('edit', individualMovement);
+};
+
const getTypeBadge = (type) => {
const badges = {
entry: { label: 'Entrada', class: 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', icon: 'add_circle' },
@@ -136,31 +168,43 @@ watch(() => props.show, (isShown) => {
:key="index"
class="p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700"
>
-
-
-
- {{ product.inventory?.name || 'N/A' }}
-
-
- {{ product.inventory?.sku || 'N/A' }}
-
-
-
-
Cantidad:
-
{{ product.quantity }}
-
-
-
Costo unit.:
-
- ${{ Number(product.unit_cost || 0).toFixed(2) }}
-
-
-
-
Subtotal:
-
- ${{ (product.quantity * Number(product.unit_cost || 0)).toFixed(2) }}
-
+
+
+
+
+ {{ product.inventory?.name || 'N/A' }}
+
+
+ {{ product.inventory?.sku || 'N/A' }}
+
+
+
+
Cantidad:
+
{{ product.quantity }}
+
+
+
Costo unit.:
+
+ ${{ Number(product.unit_cost || 0).toFixed(2) }}
+
+
+
+
Subtotal:
+
+ ${{ (product.quantity * Number(product.unit_cost || 0)).toFixed(2) }}
+
+
+
+
@@ -252,7 +296,7 @@ watch(() => props.show, (isShown) => {
-
+
+
diff --git a/src/pages/POS/Movements/Edit.vue b/src/pages/POS/Movements/Edit.vue
new file mode 100644
index 0000000..aa7ae0c
--- /dev/null
+++ b/src/pages/POS/Movements/Edit.vue
@@ -0,0 +1,377 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Editar {{ movementTypeInfo.label }}
+
+
+ Movimiento #{{ movement?.id }}
+
+
+
+
+
+
+
+
+
+
+ {{ movement?.inventory?.name || 'N/A' }}
+
+
+ SKU: {{ movement?.inventory?.sku || 'N/A' }}
+
+
+
+
+
+
+
+
diff --git a/src/pages/POS/Movements/ExitModal.vue b/src/pages/POS/Movements/ExitModal.vue
index de7ab24..7557393 100644
--- a/src/pages/POS/Movements/ExitModal.vue
+++ b/src/pages/POS/Movements/ExitModal.vue
@@ -407,21 +407,6 @@ watch(() => form.warehouse_id, (newWarehouseId, oldWarehouseId) => {
/>
-
-
-
-
-
-
@@ -436,50 +421,12 @@ watch(() => form.warehouse_id, (newWarehouseId, oldWarehouseId) => {
-
-
-
-
- Subtotal:
-
- {{ formatCurrency(item.quantity * item.unit_cost) }}
-
-
-
-
-
-
-
-
-
-
- Total de productos: {{ selectedProducts.length }}
-
-
- Cantidad total: {{ totalQuantity }}
-
-
- Costo total: {{ formatCurrency(totalCost) }}
-
-
-
-
-
-
-
-
-
+
-
+
props.show, (val) => {
-
-
-
-
-
-
@@ -481,50 +466,12 @@ watch(() => form.warehouse_to_id, (newWarehouseId, oldWarehouseId) => {
-
-
-
-
- Subtotal:
-
- {{ formatCurrency(item.quantity * item.unit_cost) }}
-
-
-
-
-
-
-
-
-
-
- Total de productos: {{ selectedProducts.length }}
-
-
- Cantidad total: {{ totalQuantity }}
-
-
- Costo total: {{ formatCurrency(totalCost) }}
-
-
-
-
-
-
-
-