@extends('layouts.dashboard')

@section('content')
    <section class="container all-container">
        <div class="header-titulo">
            Agregar requerimientos
        </div>
        <div class="card mb-3">
            <div class="card-body padding-10">
                <form action="{{ route('AgregarRequerimiento') }}" method="post"  id="form-datos">
                    {{ csrf_field() }}
                    @if ($errors->has('HistorialId'))
                        <div class="alert alert-danger requerido">{{ $errors->first('HistorialId') }}</div>
                    @endif
                    @if ($errors->any())
                        <div class="alert alert-danger">
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif   
                    <div class="form-group row">
                        <div class="col-sm-2">titulo</div>
                        <div class="col-sm-10">
                            <input class="form-control" name="titulo" required>
                        </div>
                    </div>
                    <input type="hidden" name="creador" value="{{Auth::user()->id}}">
                    <div class="form-group row">
                        <div class="col-sm-2">Aplicacion</div>
                        <div class="col-sm-10 col-md-2">
                            <select class="form-control " name="aplicacion" onchange="filtrarModulos(this.value)" required>
                                <option value=''>-Aplicaciones</option>
                                @foreach($aplicaciones as $aplicacion)
                                    <option value="{{$aplicacion->app_id}}">{{$aplicacion->app_name}}</option>
                                @endforeach 
                            </select>
                        </div>
                        <div class="col-sm-10 col-md-4">
                            <select class="form-control " name="modulo" url="{{ route('obtenerModulos')}}" onchange="filtrarFormularios(this.value)" id="modulos"required>
                                <option value=''>-Modulos</option>
                            </select>
                        </div>
                        <div class="col-sm-10 col-md-4">
                            <select class="form-control" url="{{ route('obtenerFormularios')}}" name="formulario" id="formularios">
                                <option value=''>-Formularios</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-sm-2">Prioridad</div>
                        <div class="col-sm-10 col-md-2">
                            <select class="form-control" name="prioridad" required>
                                <option value="Normal">Normal</option>
                                <option value="Importante">Importante</option>
                                <option value="Urgente">Urgente</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-sm-2">Tipo</div>
                        <div class="col-sm-10 col-md-2">
                            <select class="form-control" name="tipo" required>
                                <option value="Mejora">Mejora</option>
                                <option value="Correccion">Correccion</option>
                            </select>
                        </div>
                    </div>
                    <fieldset class="form-group">
                        <div class="row">
                            <legend class="col-form-label col-sm-2 pt-0">Descripcion</legend>
                            <div class="col-sm-10">
                            <textarea  style="resize: none;" rows="5" id="textarea" name="descripcion" class="form-control" required></textarea>
                            </div>
                        </div>
                    </fieldset>
                    <input type="hidden" name="HistorialId" id="HistorialId" value="{{$HistorialId}}">
                    <div class="form-group row">
                        <div class="col-sm-10">
                            <button type="submit" class="btn btn-light light2">Guardar</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="card-footer small text-muted">
            </div>
        </div>
    </section>
    <style>        
        #mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item>.RequerimientosLink {color:#1c8dff;}
    </style>
	<script src="{{ asset('js/sweetalert.min.js') }}"></script>
	<link  media="all" rel="stylesheet" type="text/css" href="{{ asset('css/general.css') }}">
	<script src="{{ asset('js/aplicacion.js') }}"></script>
	<script src="{{ asset('js/requerimientos.js') }}"></script>
@endsection