<?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="/delegate/dashboard">
							<i class="fa fa-dashboard"></i>
							Dashboard
						</a>
					</li>
					<li class="active">
						<i class="fa fa-cubes"></i>
						Inventario
					</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 col-lg-10">
							<h3>RESUMEN</h3>
							<table class="table table-striped">
								<tr>
									<th>Proceso</th>
									<th class="text-right">Status</th>
								</tr>
								<tr>
									<td>Lectura del archivo de excel</td>
									<td class="text-right"><i class="fa fa-check text-success"></i></td>
								</tr>
								<tr>
									<td>Formato del archivo</td>
									<td class="text-right"><i class="fa fa-check text-success"></i></td>
								</tr>
								<tr>
									<td>Carga de registros</td>
									<td class="text-right">
										<?php if( $validator->getStatusCarga() ): ?>
										<i class="fa fa-check text-success"></i>
										<?php else: ?>
										<i class="fa fa-times text-danger"></i>
										<?php endif; ?>
									</td>
								</tr>
								<tr>
									<td>Registros exitosos</td>
									<td class="text-right"><span class="text-success"><?php echo e($validator->getCountPiezasValidas()); ?></span></td>
								</tr>
								<tr>
									<td>Registros cargados con errores</td>
									<td class="text-right"><span class="<?php echo e($validator->getCountPiezasInvalidas() ? 'text-danger' : 'text-default'); ?>"><?php echo e($validator->getCountPiezasInvalidas()); ?></span></td>
								</tr>
								<tr>
									<td>Registros duplicados</td>
									<td class="text-right"><span class="<?php echo e($validator->getCountPiezasDuplicadas() ? 'text-danger' : 'text-default'); ?>"><?php echo e($validator->getCountPiezasDuplicadas()); ?></span></td>
								</tr>
							</table>
						</div>
					</div>
	                
					<div class="row">
						
						<div class="col-sm-4 col-lg-3 animated-panel zoomIn" style="animation-delay: 0.4s; -webkit-animation-delay: 0.4s;">
							<div class="hpanel">
								<div class="panel-body">
									<div class="stats-title pull-left">
										<h4>TOTAL PIEZAS EN INVENTARIO</h4>
									</div>
									<div class="m-t-xl">
										<div class="stats-icon pull-right">
											<i class="pe-7s-shuffle fa-4x"></i>
										</div>
										<h1 class="text-success"><?php echo e($validator->getCountPiezas()); ?></h1>
										<small>
											Cantidad de piezas cargadas en este inventario.
										</small>
									</div>
								</div>
							</div>
						</div>
						
						<div class="col-sm-4 col-lg-3 animated-panel zoomIn" style="animation-delay: 0.4s; -webkit-animation-delay: 0.4s;">
							<div class="hpanel">
								<div class="panel-body">
									<div class="stats-title pull-left">
										<h4>CANASTA B&Aacute;SICA</h4>
									</div>
									<div class="m-t-xl">
										<div class="stats-icon pull-right">
											<i class="fa fa-warning fa-2x"></i>
										</div>
										<h1 class="text-danger"><?php echo e(number_format($validator->getPorcentajeProductosCanastaBasica(), 2, '.', '')); ?>%</h1>
										<small>
											&Iacute;ndice (%) de productos en la canasta b&aacute;sica.
										</small>
									</div>
								</div>
							</div>
						</div>
						
						<?php if( !$validator->getStatusCarga() ): ?>
						<div class="col-sm-4 col-lg-3 animated-panel zoomIn" style="animation-delay: 0.4s; -webkit-animation-delay: 0.4s;">
							<div class="hpanel">
								<div class="panel-body">
									<div class="stats-title pull-left">
										<h4>TOTAL PIEZAS CON ERRORES EN LA CARGA</h4>
									</div>
									<div class="stats-icon pull-right">
										<i class="fa fa-warning fa-2x"></i>
									</div>
									<div class="m-t-xl">
										<h1 class="text-danger"><?php echo e($validator->getCountPiezasInvalidas()); ?></h1>
										<small>
											Cantidad de piezas cargadas con errores en el excel.
										</small>
									</div>
								</div>
							</div>
						</div>
						<?php endif; ?>
						
					</div>
					
					<?php if( !$validator->getStatusCarga() ): ?>
					<div class="row">
						<div class="col-sm-12 col-lg-10">
							<h3>PIEZAS INV&Aacute;LIDAS</h3>
							<table class="table table-striped">
								<tr>
									<th>C&Oacute;DIGO</th>
									<th>DESCRIPCI&Oacute;N</th>
									<th>CANTIDAD</th>
									<th>RAZ&Oacute;N</th>
								</tr>
								<?php foreach($validator->getPiezasInvalidas() as $pieza): ?>
								<tr>
									<td><?php echo e($pieza->codigo); ?></td>
									<td><?php echo e($pieza->descripcion); ?></td>
									<td><?php echo e($pieza->cantidad); ?></td>
									<td class="text-danger"><?php echo $validator->getErrorPieza($pieza); ?></td>
								</tr>
								<?php endforeach; ?>
							</table>
						</div>
					</div>
					<?php endif; ?>
					
					<div class="row">
						<div class="col-sm-12 col-lg-10">
							<div class="row">
								<div class="col-md-4">
									<form action="../aceptar/<?php echo e($id_upload); ?>" method="post">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
										<button class="btn btn-success btn-block <?php if ( ! ($validator->getStatusCarga())): ?> disabled <?php endif; ?>">Aceptar Inventario</button>
									</form>
								</div>
								<div class="col-md-4">
									<form action="../rechazar/<?php echo e($id_upload); ?>" method="post">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
										<button class="btn btn-danger btn-block">Rechazar Inventario</button>
									</form>
								</div>
								<div class="col-md-4">
									<a href="/delegate/inventario/carga/<?php echo e($concesionario->id); ?>" class="btn btn-default btn-block">Cargar otro archivo</a>
								</div>
							</div>
						</div>
					</div>
					
	            </div>
				
	        </div>
			
	    </div>
		
	</div>
	
</div>

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

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