<?php $__env->startSection('content'); ?>

<div class="normalheader transition animated fadeIn">
	
    <div class="hpanel">
		
        <div class="panel-body">
			
            <a class="small-header-action" href="">
                <div class="clip-header">
                    <i class="fa fa-arrow-up"></i>
                </div>
            </a>

            <div id="hbreadcrumb" class="pull-right m-t-lg">
                <ol class="hbreadcrumb breadcrumb">
                    <li>
						<a href="/dealer/dashboard">
							<i class="fa fa-dashboard"></i>
							Dashboard
						</a>
					</li>
					<li>
						<i class="fa fa-cubes"></i>
						Inventario
					</li>
					<li class="active">
						<?php echo e($referencia); ?>

					</li>
                </ol>
            </div>
			
            <h2 class="font-light m-b-xs">
				<i class="fa fa-cubes"></i>
                Inventario
            </h2>
			
            <small>Maestro de Piezas y Canasta B&aacute;sica</small>
			
        </div>
		
    </div>
	
</div>

<div class="content">
	
	<div class="row">
		
		<div class="col-md-12 animated-panel">
			
	        <div class="hpanel">
				
	            <div class="panel-body">
					
					<div class="row">
						
						<div class="col-sm-12">
							
							<h2>Disponibilidad de Producto</h2>
							
							<?php if( !$found ): ?>
							
							<div class="alert alert-danger">No se encontraron referencias del producto <b><?php echo e($referencia); ?></b>.</div>
							
							<?php else: ?>
							
							<h3><?php echo e($referencia); ?></h3>

							<table width="100%" cellspacing="0" cellpadding="4" border="0" class="table table-striped table-bordered">
								
								<tr>
									<th>C&oacute;digo</th>
									<th>Descripci&oacute;n</th>
									<th>Concesionario</th>
									<th>Bodega</th>
									<th>Inventario</th>
									<th>Cantidad</th>
								</tr>
								
								<?php if( !$reemplazosEnInventario->antiguos->isEmpty() ): ?>
								<?php foreach($reemplazosEnInventario->antiguos as $producto): ?>
								<tr>
									<td><?php echo e($producto->codigo); ?></td>
									<td><?php echo e($producto->descripcion); ?></td>
									<td><?php echo e($producto->concesionario->nombre); ?></td>
									<td><?php echo e($producto->bodega->nombre); ?></td>
									<td><?php echo e($producto->inventario->nombre); ?></td>
									<td class="text-right"><?php echo e($producto->cantidad); ?></td>
								</tr>
								<?php endforeach; ?>
								<?php endif; ?>
								
								<?php foreach($productos as $producto): ?>
								<tr class="warning">
									<td><strong><?php echo e($producto->codigo); ?></strong></td>
									<td><?php echo e($producto->descripcion); ?></td>
									<td><?php echo e($producto->concesionario->nombre); ?></td>
									<td><?php echo e($producto->bodega->nombre); ?></td>
									<td><?php echo e($producto->inventario->nombre); ?></td>
									<td class="text-right"><?php echo e($producto->cantidad); ?></td>
								</tr>
								<?php endforeach; ?>
								
								<?php if( !$reemplazosEnInventario->nuevos->isEmpty() ): ?>
								<?php foreach($reemplazosEnInventario->nuevos as $producto): ?>
								<tr>
									<td><?php echo e($producto->codigo); ?></td>
									<td><?php echo e($producto->descripcion); ?></td>
									<td><?php echo e($producto->concesionario->nombre); ?></td>
									<td><?php echo e($producto->bodega->nombre); ?></td>
									<td><?php echo e($producto->inventario->nombre); ?></td>
									<td class="text-right"><?php echo e($producto->cantidad); ?></td>
								</tr>
								<?php endforeach; ?>
								<?php endif; ?>
							</table>
							
							<?php endif; ?>
							
						</div>
						
					</div>
					
					<?php if( !$concesionarios->isEmpty() ): ?>
					<div class="row">
						
						<div class="col-md-12">
							
							<h2>Otros concesionarios con inventario</h2>
							
							<table class="table table-striped">
								<tr>
									<th>Concesionario</th>
									<th>Ciudad</th>
									<th>Bodega</th>
									<th>Fecha actualización</th>
								</tr>
								<?php foreach($concesionarios as $concesionario): ?>
								<tr>
									<td>
										<a href="/dealer/concesionarios/ver/<?php echo e($concesionario->id); ?>">
											<?php echo e($concesionario->nombre); ?>

										</a>
									</td>
									<td>
										<?php echo e($concesionario->ciudad->nombre); ?>

									</td>
									<td>
										<?php echo e($concesionario->upload ? $concesionario->upload->bodega->nombre : ''); ?>

									</td>
									<td>
										<?php echo e($concesionario->upload ? $concesionario->upload->fechaActualizacion : ''); ?><br>
									</td>
								</tr>
								<?php endforeach; ?>
							</table>
							
						</div>
						
					</div>
					<?php endif; ?>
					
				</div>

	        </div>
			
	    </div>
		
	</div>
	
</div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.dealer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>