@extends('layouts.admin.theme')
@section("title", env("APP_NAME") . " :: " . __('Novo Informe'))
@section('content')

    <form action="{{ route('admin.informativos_recursos_humanos.store') }}" method="post" enctype="multipart/form-data">
        <div class="container py-3">
            <div class="row">
                <div class="col-12">
                    <div class="card shadow">
                        <div class="card-header bg-primary text-white d-flex justify-content-between align-items-center mb-3">
                            <h5 class="mb-0">{{ __('Novo Informe') }}</h5>
                        </div>
                        <div class="card-body">
                            @csrf
                            @include("errors.messageFlash")

                            <div class="mb-3">
                                <label for="type" class="form-label text-bold">{{ __('Categoria') }}: <span class="span-admin-create">*</span></label>
                                <input type="hidden" name="page" value="{{ request()->input('page', 1) }}">
                                <select class="form-control" name="categoria" id="categoria" onchange="javascript:toggleNumero(this)">
                                    @foreach(App\Enums\StatusInformativosRecursosHumanos::cases() as $status)
                                        <option value="{{ $status->name }}" {{ old('categoria') == $status->name ? 'selected' : '' }}>
                                            {{ $status->value }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>

                            <div class="mb-3">
                                <label for="tipo" class="form-label text-bold">{{ __('Tipo') }}: <span class="span-admin-create">*</span></label>
                                <input type="text" class="form-control @error('tipo') is-invalid @enderror" name="tipo" id="tipo" oninput="this.value = this.value.toUpperCase()" autocomplete="off" value="{{ old('tipo') }}">
                                @error('tipo')
                                    <small class="text-danger text-bold">{{ $message }}</small>
                                @enderror
                            </div>
                            
                            <div class="mb-3">
                                <label for="dataPublicacao" class="form-label text-bold">{{ __('Data') }}: <span class="span-admin-create">*</span></label>
                                <input type="date" class="form-control @error('dataPublicacao') is-invalid @enderror" name="dataPublicacao" id="dataPublicacao" autocomplete="off" value="{{ old('dataPublicacao') }}">
                                @error('dataPublicacao')
                                    <small class="text-danger text-bold">{{ $message }}</small>
                                @enderror
                            </div>
                            
                            <div class="mb-3 d-none" id="div-numero">
                                <label for="numero" class="form-label text-bold">{{ __('Número') }}: <span class="span-admin-create">*</span></label>
                                <input type="text" class="form-control @error('numero') is-invalid @enderror" name="numero" id="numero" oninput="this.value = this.value.toUpperCase()" autocomplete="off" value="{{ old('numero') }}">
                                @error('numero')
                                    <small class="text-danger text-bold">{{ $message }}</small>
                                @enderror
                            </div>
                            
                            <div class="mb-3 text-wrap">
                                <label for="descricao" class="form-label text-bold">{{ __('Resumo') }}: <span class="span-admin-create">*</span></label>
                                <textarea class="form-control @error('descricao') is-invalid @enderror textarea-comments" style="height: 100px" name="descricao" id="descricao">{{ old('descricao') }}</textarea>
                                @error('descricao')
                                    <small class="text-danger text-bold">{{ $message }}</small><br>
                                @enderror
                            </div>

                            <hr/>
                            
                            <div class="mb-3">
                                <label for="arquivo" class="form-label text-bold">{{ __('Arquivo') }}: <span class="span-admin-create">*</span></label>
                                <input type="file" class="form-control" name="arquivo" id="arquivo" accept=".pdf" required />
                                @error('arquivo')
                                    <small class="text-danger text-bold">{{ $message }}</small>
                                @enderror
                            </div>

                            <div class="mb-3">
                                <label for="status" class="form-label text-bold">{{ __('Status') }}: <span class="span-admin-create">*</span></label>
                                <select class="form-control @error('status') is-invalid @enderror" name="status" id="status">
                                    @foreach(App\Enums\StatusEnum::cases() as $status)
                                        <option value="{{ $status->name }}">{{ $status->value }}</option>
                                    @endforeach
                                </select>
                                @error('status')
                                    <small class="text-danger text-bold">{{ $message }}</small>
                                @enderror
                            </div>
                            @include('components.buttons._backAndSend', [
                                    'textBack' => __('Voltar'), 
                                    'textSend' => __('Cadastrar'), 
                                    'routeBack' => 'admin.informativos_recursos_humanos.index'
                                ]
                            )
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>

@endsection