@extends('layouts.dashboard')

@section('content')
    <section class="container all-container">
        <div class="card mb-3">
            <div class="card-header titulo-eliminar">
                <div class="title">
                    <i class="fab fa-wpforms"></i> Formulario
                </div>
                <strong>{{$formulario->nombre}}</strong>
                <div class="eliminar-container">
                    <div class="btn-group mr-2">
                        <button class="btn btn-sm btn-outline-secondary" onclick="editar()"><i class="fas fa-edit"></i></button>
                        <button class="btn btn-sm btn-outline-secondary" onclick="eliminarFormulario('{{ route("eliminarFormulario",[$formulario->id]) }}','{{ route('modulo',[$formulario->modulo_id]) }}')"><i class="far fa-trash-alt" ></i></button>
                    </div>
                </div>
            </div>
            <div class="card-body padding-10">
                <form action="{{ route('actualizarFormulario',[$formulario->id]) }}" method="post"  id="form-datos">
                    {{ csrf_field() }}
                    <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label">Nombre</label>
                        <div class="col-sm-10">
                            <input type="text" id="nombre" value="{{$formulario->nombre}}" name="nombre"  class="form-control" placeholder="Nombre del formulario" disabled required>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputPassword3" class="col-sm-2 col-form-label">Modulo</label>
                        <div class="col-sm-10">
                            <span class="form-control col-md-4 span-edit-show">{{ucfirst($formulario->modulo_id)}}</span>
                            <select class="form-control col-md-4 span-edit-hidden" name="modulo" disabled required>
                            @foreach($modulos as $modulos)
                             <option value="{{$modulos->id}}">{{$modulos->nombre}}</option>
                            @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label">Descripcion</label>
                        <div class="col-sm-10">
                            <textarea id="Descripcion" style="resize: none;" rows="5" name="Descripcion"  class="form-control" placeholder="Descripcion" required disabled>{{$formulario->Descripcion}}</textarea>
                        </div>
                    </div><hr>
                    <div class="form-group row buttons-edit-container">
                        <div class="col-sm-10">
                            <button type="button" onclick="editar()" id="button-editar" class="btn btn-dark">Cancelar</button>
                            <button type="submit" class="btn btn-light" id="button-guardar">Guardar</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>
    <style>        
        #mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item>.modulosLink {color:#1cff2f;}
    </style>
	<link  media="all" rel="stylesheet" type="text/css" href="{{ asset('css/general.css') }}">
	<script src="{{ asset('js/sweetalert.min.js') }}"></script>
	<script  src="{{ asset('js/agregar.js') }}"></script>
	<script src="{{ asset('js/aplicacion.js') }}"></script>
	<script src="{{ asset('js/formulario.js') }}"></script>
@endsection