diff --git a/src/pages/POS/Inventory/CreateModal.vue b/src/pages/POS/Inventory/CreateModal.vue
index 806b276..fccaf3b 100644
--- a/src/pages/POS/Inventory/CreateModal.vue
+++ b/src/pages/POS/Inventory/CreateModal.vue
@@ -21,6 +21,7 @@ const units = ref([]);
/** Formulario */
const form = useForm({
name: '',
+ key_sat: '',
sku: '',
barcode: '',
category_id: '',
@@ -159,6 +160,21 @@ watch(() => form.track_serials, () => {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
{{ model.category?.name || '-' }}
diff --git a/src/pages/POS/Point.vue b/src/pages/POS/Point.vue
index e6ea2f0..251f122 100644
--- a/src/pages/POS/Point.vue
+++ b/src/pages/POS/Point.vue
@@ -146,10 +146,30 @@ const addToCart = async (product) => {
try {
const response = await serialService.getAvailableSerials(product.id);
- const hasSerials = response.serials?.data?.length > 0;
+ const allSerials = response.serials?.data || [];
- if (hasSerials) {
- // Agregar track_serials al producto para que el store lo reconozca
+ if (allSerials.length > 0) {
+ // Verificar cuántos quedan después de excluir los del carrito
+ const excluded = cart.getSelectedSerials();
+ const available = allSerials.filter(s => !excluded.includes(s.serial_number));
+
+ if (available.length === 0) {
+ // Todos los seriales están bloqueados — buscar si un paquete del carrito los tiene
+ const blockingBundle = cart.items.find(item => {
+ if (!item.is_bundle || !item.serial_numbers) return false;
+ const bundleSerials = item.serial_numbers[product.id] || [];
+ return bundleSerials.length > 0;
+ });
+
+ if (blockingBundle) {
+ window.Notify.warning(`"${product.name}" forma parte del paquete "${blockingBundle.product_name}". No hay suficiente stock para vender`);
+ } else {
+ window.Notify.warning(`No hay seriales disponibles para "${product.name}"`);
+ }
+ return;
+ }
+
+ // Hay seriales disponibles — abrir selector
product.track_serials = true;
serialSelectorProduct.value = product;
showSerialSelector.value = true;
|