@extends('layouts.app') @section('title', 'Productos | Veltrix v2') @section('page_title', 'Productos') @section('page_subtitle', 'Gestion operativa en tiempo real') @section('page_icon', 'bx bxs-box') @section('content') @php $variantCounts = is_array($productVariantCounts ?? null) ? $productVariantCounts : []; $suppliers = $proveedores instanceof \Illuminate\Support\Collection ? $proveedores : collect($proveedores ?? []); $units = $unidades instanceof \Illuminate\Support\Collection ? $unidades : collect($unidades ?? []); $taxes = $impuestos instanceof \Illuminate\Support\Collection ? $impuestos : collect($impuestos ?? []); $taxesById = $taxes->keyBy('id'); $defaultProductImageUrl = product_image_url(''); $defaultCreateTaxId = (int) ($taxes->first()->id ?? 0); $createTaxId = (int) old('impuesto_id', (string) $defaultCreateTaxId); $createTaxRate = (float) old('impuesto_porcentaje', (string) ((float) ($taxesById->get($createTaxId)?->porcentaje ?? 0))); $createHasCustomTax = $createTaxId <= 0 && $createTaxRate > 0; $createCustomTaxLabel = 'Manual ('.number_format($createTaxRate, 2).'%)'; $createVariantsEnabled = (string) old('variantes_habilitadas', '0') === '1'; $createVariantsMode = strtolower((string) old('variantes_modo', 'same')); if (! in_array($createVariantsMode, ['same', 'individual'], true)) { $createVariantsMode = 'same'; } $createVariantNames = (array) old('variante_nombre', []); $createVariantPrices = (array) old('variante_precio', []); $createVariantQuantities = (array) old('variante_cantidad', []); $createVariantMinStocks = (array) old('variante_stock_minimo', []); $createAttributeNames = (array) old('atributo_nombre', ['Talla', 'Color']); $createAttributeValues = (array) old('atributo_valores', ['', '']); $selectedSucursalId = (int) old('sucursal_id', (int) ($tenantSucursalId ?? 0)); $shouldOpenCreateModal = has_permission('productos.crear') && $errors->any() && ( old('_product_form') === 'create' || old('nombre') !== null || old('sku') !== null || old('precio_venta') !== null ); $shouldOpenImportModal = (bool) session('open_import_modal') || ($errors->any() && old('_product_form') === 'import'); @endphp
@if ($errors->any())
{{ $errors->first() }}
@endif

Productos

@if (has_permission('productos.crear')) @endif
@forelse ($productos as $producto) @php $variantCount = (int) ($variantCounts[$producto->id] ?? 0); $isVariable = $variantCount > 0; $supplierName = trim((string) ($producto->proveedor?->nombre ?? '')); if ($supplierName === '') { $supplierName = 'Sin proveedor'; } $unitLabel = trim((string) ($producto->unidadMedida?->abreviatura ?? '')); if ($unitLabel === '') { $unitLabel = trim((string) ($producto->unidadMedida?->nombre ?? '')); } if ($unitLabel === '') { $unitLabel = '-'; } $skuValue = trim((string) ($producto->sku ?? '')); if ($skuValue === '') { $skuValue = '-'; } @endphp @empty @endforelse
ID Foto Nombre Proveedor SKU Unidad Precio Stock Minimo Acciones
{{ $producto->id }} {{ (string) ($producto->nombre ?? 'Producto') }}
{{ $producto->nombre }} {{ $isVariable ? 'Variable' : 'Simple' }} @if ($isVariable) {{ $variantCount }} vars @endif
{{ $supplierName }} {{ $skuValue }} {{ $unitLabel }} {{ money((float) ($producto->precio_venta ?? 0)) }} {{ number_format((float) ($producto->stock_actual ?? 0), 2) }} {{ number_format((float) ($producto->stock_minimo ?? 0), 2) }} Editar
No hay productos registrados.
@if ($productos->hasPages())
{{ $productos->links() }}
@endif
@if (has_permission('productos.crear')) @endif @endsection @push('scripts') @endpush