@extends('layouts.admin.theme')
@section('title', env('APP_NAME') . ' :: ' . __('Editar Pergunta Frequente - Parque Tecnológico'))

@section('content')

@include('errors.messageFlash')

<div class="card shadow border-0">

    <div class="card-header bg-primary border-bottom">
        <h5 class="mb-0 fw-bold text-dark py-2">
            <i class="fa-solid fa-pen-to-square me-2"></i>
            {{ __('Editar Pergunta Frequente') }}
        </h5>
    </div>

    <div class="card-body p-4">

        <form action="{{ route('admin.parqueTecnologico.faqs.update',$faq->id) }}" method="POST">
            @csrf
            @method('PUT')

            <div class="row">

                <div class="col-md-12 mb-4">
                    <div class="form-floating">

                        <input type="text"
                               name="pergunta"
                               id="pergunta"
                               class="form-control @error('pergunta') is-invalid @enderror"
                               value="{{ old('pergunta',$faq->pergunta) }}"
                               placeholder="Pergunta"
                               required>

                        <label for="pergunta">
                            <i class="fa-solid fa-comment-dots me-1"></i>
                            {{ __('Pergunta') }}
                        </label>

                        @error('pergunta')
                            <div class="invalid-feedback">{{ $message }}</div>
                        @enderror

                    </div>
                </div>


                <div class="col-md-12 mb-4">
                    <label class="form-label fw-semibold">
                        <i class="fa-solid fa-align-left me-1"></i>
                        {{ __('Resposta') }}
                    </label>

                    <textarea name="resposta"
                              id="resposta"
                              rows="5"
                              class="form-control @error('resposta') is-invalid @enderror"
                              required>{{ old('resposta',$faq->resposta) }}</textarea>

                    @error('resposta')
                        <div class="invalid-feedback d-block">{{ $message }}</div>
                    @enderror
                </div>


                <div class="col-md-4 mb-4">
                    <div class="form-floating">

                        <input type="number"
                               name="ordem"
                               id="ordem"
                               min="0"
                               class="form-control @error('ordem') is-invalid @enderror"
                               value="{{ old('ordem',$faq->ordem) }}"
                               placeholder="Ordem">

                        <label for="ordem">
                            <i class="fa-solid fa-sort-numeric-down me-1"></i>
                            {{ __('Ordem de Exibição') }}
                        </label>

                        @error('ordem')
                            <div class="invalid-feedback">{{ $message }}</div>
                        @enderror

                    </div>
                </div>


                <div class="col-md-4 d-flex align-items-center mb-4">

                    <div class="form-check form-switch fs-6 mt-2">
                        <input class="form-check-input"
                               type="checkbox"
                               id="status"
                               name="status"
                               value="1"
                               {{ old('status',$faq->status) ? 'checked' : '' }}>

                        <label class="form-check-label ms-2" for="status">
                            {{ __('Pergunta Ativa') }}
                        </label>
                    </div>

                </div>

            </div>


            <hr class="my-4">

            <div class="d-flex justify-content-between">

                <a href="{{ route('admin.parqueTecnologico.index',['tab'=>'faqs']) }}"
                   class="btn btn-outline-secondary">
                    <i class="fa-solid fa-arrow-left me-1"></i>
                    {{ __('Voltar') }}
                </a>

                <button type="submit" class="btn btn-success px-4">
                    <i class="fa-solid fa-floppy-disk me-1"></i>
                    {{ __('Atualizar') }}
                </button>

            </div>

        </form>

    </div>
</div>

@endsection