@extends('layouts.app')

@section('title',"Agregar usuarios")

@section('content')
@if (session('create'))
    <div class="alert alert-success">
        {{ session('create') }}
    </div>
@endif

<div class="alert alert-secundary p-2 mb-0"><a href="{{ url('user') }}"><i class="icon-arrow-left13"></i> Volver al listado de usuarios</a></div>
<div class="card">
	<div class="card-header header-elements-inline">
		<h5 class="card-title"><i class="icon-clipboard "></i> Usuarios </h5>
		<div class="header-elements">
			<div class="list-icons">
        		<a class="list-icons-item" data-action="collapse"></a>
        		<a class="list-icons-item" data-action="reload"></a>
        		<a class="list-icons-item" data-action="remove"></a>
        	</div>
    	</div>
	</div>	
	<div class="card-body">
		<form action="{{ url('user') }}" method="POST" onsubmit="createform(this); return false">
			<input type="hidden" name="action" value="add">
			<div class="row">
				<div class="col-3">
					<label for=""><b>Nombre:</b></label>
					<input type="text" class="form-control" name="name" required="" placeholder="Ingresa tu nombre">
				</div>
				<div class="col-3">
					<label for=""><b>Ruc:</b></label>
					<input type="text" class="form-control" name="ruc" required="" placeholder="Ingresa tu ruc o dni">
				</div>
				<div class="col-3">
					<label for=""><b>Email:</b></label>
					<input type="email" class="form-control" name="email" required="" placeholder="exampl@gmail.com">
				</div>
				<div class="col-3">
					<label for=""><b>Contraseña:</b></label>
					<input type="password" class="form-control" name="password" required="" placeholder="example:*******">
				</div>
			</div>
			<hr>
			<div class="row">
				<div class="col-4">
					<label for=""><b>Nombre empresa:</b></label>
					<input type="text" class="form-control" name="nempresa" required="" placeholder="Ingresa tu nombre">
				</div>
				<div class="col-4">
					<label for=""><b>Direccion:</b></label>
					<input type="text" class="form-control" name="direccion" required="" placeholder="Ingresa tu ruc o dni">
				</div>
				<div class="col-4">
					<label for=""><b>Rol:</b></label>
					<select id="roles" class="form-control text-uppercase" required="">
						<option value="">Seleccionar</option>
						@foreach ($role as $r)
							<option value="{{$r->name}}" data-id="{{$r->id}}">{{$r->name}}</option>
						@endforeach
					</select>
				</div>
			</div>
			<hr>
			<h3 class="text-center">Roles seleccionados</h3>
			<div class="row justify-content-center">
				<div class="col-6">
					<div class="row resp-roles">
						
					</div>
				</div>
			</div>
			<hr>
			<div class="row">
				<div class="col-12 text-center">
					<button class="btn btn-primary"><i class="icon-floppy-disk "></i> Guardar</button>
				</div>
			</div>
		</form>
	</div>

</div>
<div class="response-ajax"></div>

@endsection
@section('scripts')
	<script src="{!! asset('assets/views_functions/user.js') !!}"></script>
@endsection