116 lines
5.4 KiB
Vue
116 lines
5.4 KiB
Vue
<script setup>
|
|
import Modal from '@Holos/Modal.vue';
|
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
|
|
|
/** Props */
|
|
const props = defineProps({
|
|
show: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
product: {
|
|
type: Object,
|
|
default: null
|
|
}
|
|
});
|
|
|
|
/** Emits */
|
|
const emit = defineEmits(['close', 'confirm']);
|
|
|
|
/** Métodos */
|
|
const handleConfirm = () => {
|
|
emit('confirm', props.product.id);
|
|
};
|
|
|
|
const handleClose = () => {
|
|
emit('close');
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<Modal :show="show" max-width="md" @close="handleClose">
|
|
<div class="p-6">
|
|
<!-- Header -->
|
|
<div class="flex items-center justify-between mb-6">
|
|
<div class="flex items-center gap-3">
|
|
<div class="flex items-center justify-center w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30">
|
|
<GoogleIcon name="delete_forever" class="text-2xl text-red-600 dark:text-red-400" />
|
|
</div>
|
|
<h3 class="text-lg font-bold text-gray-900 dark:text-gray-100">
|
|
Eliminar Producto
|
|
</h3>
|
|
</div>
|
|
<button
|
|
@click="handleClose"
|
|
class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"
|
|
>
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Content -->
|
|
<div class="space-y-5">
|
|
<p class="text-gray-700 dark:text-gray-300 text-base">
|
|
¿Estás seguro de que deseas eliminar este producto?
|
|
</p>
|
|
|
|
<div v-if="product" class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 border border-gray-200 dark:border-gray-700 rounded-xl p-5 space-y-3">
|
|
<div class="flex items-start justify-between">
|
|
<div class="flex-1">
|
|
<p class="text-base font-bold text-gray-900 dark:text-gray-100 mb-1">
|
|
{{ product.name }}
|
|
</p>
|
|
<div class="flex items-center gap-3 text-sm text-gray-600 dark:text-gray-400">
|
|
<span class="font-mono font-medium">SKU: {{ product.sku }}</span>
|
|
<span class="text-gray-400">•</span>
|
|
<span>{{ product.category?.name || 'Sin categoría' }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="text-right">
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">Stock</p>
|
|
<p class="text-2xl font-bold" :class="product.stock > 0 ? 'text-orange-600 dark:text-orange-400' : 'text-gray-400'">
|
|
{{ product.stock }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div v-if="product.stock > 0" class="flex items-start gap-2 bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-3">
|
|
<GoogleIcon name="warning" class="text-orange-600 dark:text-orange-400 text-xl flex-shrink-0 mt-0.5" />
|
|
<p class="text-sm text-orange-800 dark:text-orange-300 font-medium">
|
|
Este producto tiene <strong>{{ product.stock }} unidades en stock</strong>. Al eliminarlo, se perderá el inventario registrado.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-start gap-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4">
|
|
<GoogleIcon name="info" class="text-red-600 dark:text-red-400 text-xl flex-shrink-0 mt-0.5" />
|
|
<p class="text-sm text-red-800 dark:text-red-300 font-medium">
|
|
Esta acción es permanente y no se puede deshacer.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Footer -->
|
|
<div class="flex items-center justify-end gap-3 mt-8 pt-6 border-t border-gray-200 dark:border-gray-700">
|
|
<button
|
|
type="button"
|
|
@click="handleClose"
|
|
class="px-5 py-2.5 text-sm font-semibold text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 transition-colors"
|
|
>
|
|
Cancelar
|
|
</button>
|
|
<button
|
|
type="button"
|
|
@click="handleConfirm"
|
|
class="flex items-center gap-2 px-5 py-2.5 bg-red-600 hover:bg-red-700 text-white text-sm font-semibold rounded-lg focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-600 shadow-lg shadow-red-600/30 transition-all"
|
|
>
|
|
<GoogleIcon name="delete" class="text-xl" />
|
|
Eliminar Producto
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
</template>
|