<?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>
						<a href="/dealer/concesionarios">
							<i class="fa fa-wrench"></i>
							Concesionarios
						</a>
					</li>
					<li>
						<a href="/dealer/concesionarios/view/<?php echo e($concesionario->id); ?>">
							<i class="fa fa-wrench"></i>
							<?php echo e($concesionario->nombre); ?>

						</a>
					</li>
					<li class="active">
						BODEGAS
					</li>
                </ol>
            </div>
			
            <h2 class="font-light m-b-xs">
				<i class="fa fa-cubes"></i>
                Inventario
            </h2>
			
            <small>Administraci&oacute;n de sedes, bodegas e inventario</small>
			
        </div>
		
    </div>
	
</div>


<div class="content">
	
	<form method="post">
	
	<div class="row">
		<div class="col-md-12 animated-panel">
	        <div class="hpanel">
	            <div class="panel-body">
	                
					<h2><?php echo e($concesionario->nombre); ?></h2>
					
					<h3>Crear nueva Bodega</h3>
					
						<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
						
						<div class="form-group">
							<label for="nombre">Nombre</label>
							<div class="form-control-static"><?php echo e($bodega->nombre); ?></div>
						</div>
						
						<div class="form-group">
							<label for="ubicacion">Ubicaci&oacute;n</label>
							<textarea id="ubicacion" name="ubicacion" class="form-control"><?php echo e($bodega->ubicacion); ?></textarea>
						</div>
						
						<div class="form-group">
							<input type="submit" class="btn btn-primary" value="Guardar" />
							<a href="/dealer/concesionarios/bodegas/<?php echo e($concesionario->id); ?>" class="btn btn-default">Cancelar</a>
						</div>
	            </div>
	        </div>
	    </div>
	</div>
		
	<div class="row">
		
		<div class="col-md-12 animated-panel">
			
	        <div class="hpanel">
				
	            <div class="panel-body">
	                
					<h3>Inventarios</h3>
					
					<table id="table-inventarios" class="table">
						<?php foreach($bodega->inventarios as $inventario): ?>
						<tr>
							<td>
								<input type="hidden" name="inventariosids[]" value="<?php echo e($inventario->id); ?>" />
								<input type="hidden" name="inventarios[]" value="<?php echo e($inventario->nombre); ?>" />
								<b><?php echo e($inventario->nombre); ?></b>
							</td>
							<td class="text-right">
								<a href="#" class="closebox">
									<i class="fa fa-times"></i>
								</a>
							</td>
						</tr>
						<?php endforeach; ?>
					</table>
					
					<div>
						<div class="col-md-6">
							<input type="text" id="textInventario" class="form-control" placeholder="Agregar inventario..." />
						</div>
						<div class="col-md-6">
							<button id="btn-add-inventario" class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i></button>
						</div>
					</div>
					
	            </div>
				
	        </div>
			
	    </div>
		
	</div>
		
	</form>
	
</div>

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


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

<script>
	
	$( document ).ready(function() {
		
		if( $('#table-inventarios tbody').length === 0 ) {
			$('#table-inventarios').append('<tbody></tbody>');
		}
		
		$('#btn-add-inventario').click(function(e) {
			e.preventDefault();
			var text = $('#textInventario').val();
			var template = _.template( $('#tpl-row-inventario').html() );
			var row = template({ text: text });
			$('#table-inventarios tbody').append(row);
			$('#textInventario').val('');
		});
		
	});
	
</script>

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

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

<script type="text/template" id="tpl-row-inventario">
	<tr>
		<td>
			<input type="hidden" name="inventarios[]" value="<%= text %>" />
			<b><%= text %></b>
		</td>
		<td class="text-right">
			<a href="#" class="closebox">
				<i class="fa fa-times"></i>
			</a>
		</td>
	</tr>
</script>

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