@extends('layouts.admin.theme')
@php $tituloHeader = env("APP_NAME") . " :: Atualizar Secretarias, Fundações e Autarquias"; @endphp
@section("title", $tituloHeader)
@section('content')

    <form action="{{ route('admin.secretarias.update', $secretaria->id) }}" method="post" enctype="multipart/form-data">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="card shadow">
                        @php 
                            $headLine = "<i class='fa-solid fa-building-columns'></i> " . __("Atualizar Secretaria, Fundação e Autarquia");
                            $page = request()->input('page', 1);
                        @endphp

                        @include('components.buttons._headLineButtonsBackAdd', [
                            'headLine' => $headLine,
                            'routeBack' => 'admin.secretarias.index',
                            'routeBackParams' => ['page' => $page],
                            'nameBack' => __("Voltar"),
                            'permission' => "GERENCIADOR_DE_SECRETARIAS",
                        ])

                        <div class="card-body">
                            @csrf
                            @method('patch')
                            <input type="hidden" name="page" value="{{ $page }}">
                            @include('errors.messageFlash')

                            <ul class="nav nav-pills mb-3 justify-content-center bg-light p-2 rounded shadow-sm"
                                role="tablist">
                                @include('components.lists._liLinkBtnNavInterna', [
                                    'items' => [
                                        ['class' => 'active', 'hash' => 'primeiraSection', 'label' => __('Cadastro')],
                                        ['class' => '', 'hash' => 'segundaSection', 'label' => __('Endereço')],
                                        ['class' => '', 'hash' => 'terceiraSection', 'label' => __('Email')],
                                        ['class' => '', 'hash' => 'quartaSection', 'label' => __('Sociais')],
                                        ['class' => '', 'hash' => 'quintaSection', 'label' => __('Gestor')],
                                        ...(auth()->user()->getPermissaoDetalhes('SYSADMIN')['visualizar']
                                            ? [['class' => '', 'hash' => 'sextaSection', 'label' => __('Configurações')]]
                                            : []),
                                    ]
                                ])
                            </ul>

                            <div class="tab-content">
                                <div class="tab-pane active" id="primeiraSection">
                                    @include('admin.secretarias.updated.cadastro')
                                    <div class="d-flex justify-content-between align-items-center mt-4">
                                        <button class="btn btn-outline-secondary" disabled>
                                            <i class="fa-solid fa-arrow-left-long"></i> {{ __('Anterior') }}
                                        </button>
                                        <div class="d-flex gap-2">
                                            <button class="btn btn-success" type="submit">
                                                <i class="fa-solid fa-check"></i> {{ __('Atualizar') }}
                                            </button>
                                            <button class="btn btn-primary" onclick="proximaAba('segundaSection')"
                                                type="button">
                                                {{ __('Próximo') }} <i class="fa-solid fa-arrow-right-long"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane" id="segundaSection">
                                    @include('admin.secretarias.updated.endereco')
                                    <div class="d-flex justify-content-between align-items-center mt-4">
                                        <button class="btn btn-outline-secondary" onclick="anteriorAba('primeiraSection')"
                                            type="button">
                                            <i class="fa-solid fa-arrow-left-long"></i> {{ __('Anterior') }}
                                        </button>
                                        <div class="d-flex gap-2">
                                            <button class="btn btn-success" type="submit">
                                                <i class="fa-solid fa-check"></i> {{ __('Atualizar') }}
                                            </button>
                                            <button class="btn btn-primary" onclick="proximaAba('terceiraSection')"
                                                type="button">
                                                {{ __('Próximo') }} <i class="fa-solid fa-arrow-right-long"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane" id="terceiraSection">
                                    @include('admin.secretarias.updated.email')
                                    <div class="d-flex justify-content-between align-items-center mt-4">
                                        <button class="btn btn-outline-secondary" onclick="anteriorAba('segundaSection')"
                                            type="button">
                                            <i class="fa-solid fa-arrow-left-long"></i> {{ __('Anterior') }}
                                        </button>
                                        <div class="d-flex gap-2">
                                            <button class="btn btn-success" type="submit">
                                                <i class="fa-solid fa-check"></i> {{ __('Atualizar') }}
                                            </button>
                                            <button class="btn btn-primary" onclick="proximaAba('quartaSection')" type="button">
                                                {{ __('Próximo') }} <i class="fa-solid fa-arrow-right-long"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane" id="quartaSection">
                                    @include('admin.secretarias.updated.redesSociais')
                                    <div class="d-flex justify-content-between align-items-center mt-4">
                                        <button class="btn btn-outline-secondary" onclick="anteriorAba('terceiraSection')"
                                            type="button">
                                            <i class="fa-solid fa-arrow-left-long"></i> {{ __('Anterior') }}
                                        </button>
                                        <div class="d-flex gap-2">
                                            <button class="btn btn-success" type="submit">
                                                <i class="fa-solid fa-check"></i> {{ __('Atualizar') }}
                                            </button>
                                            <button class="btn btn-primary" onclick="proximaAba('quintaSection')" type="button">
                                                {{ __('Próximo') }} <i class="fa-solid fa-arrow-right-long"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane" id="quintaSection">
                                    @include('admin.secretarias.updated.gestor')
                                    <div class="d-flex justify-content-between align-items-center mt-4">
                                        <button class="btn btn-outline-secondary" onclick="anteriorAba('quartaSection')"
                                            type="button">
                                            <i class="fa-solid fa-arrow-left-long"></i> {{ __('Anterior') }}
                                        </button>
                                        <div class="d-flex gap-2">
                                            <button class="btn btn-success" type="submit">
                                                <i class="fa-solid fa-check"></i> {{ __('Atualizar') }}
                                            </button>
                                            @if(auth()->user()->getPermissaoDetalhes('SYSADMIN')['visualizar'])
                                                <button class="btn btn-primary" onclick="proximaAba('sextaSection')"
                                                    type="button">
                                                    {{ __('Próximo') }} <i class="fa-solid fa-arrow-right-long"></i>
                                                </button>
                                            @else
                                                <button class="btn btn-danger" type="button"
                                                    onclick="window.location.href='{{ route('admin.secretarias.index', ['page' => $page]) }}'">
                                                    <i class="fa-solid fa-xmark"></i> {{ __('Cancelar') }}
                                                </button>
                                            @endif
                                        </div>
                                    </div>
                                </div>
                                @if(auth()->user()->getPermissaoDetalhes('SYSADMIN')['visualizar'])
                                <div class="tab-pane" id="sextaSection">
                                    @include('admin.secretarias.updated.configuracoes')
                                    <div class="d-flex justify-content-between align-items-center mt-4">
                                        <button class="btn btn-outline-secondary" onclick="anteriorAba('quintaSection')"
                                            type="button">
                                            <i class="fa-solid fa-arrow-left-long"></i> {{ __('Anterior') }}
                                        </button>
                                        <div class="d-flex gap-2">
                                            <button class="btn btn-success" type="submit">
                                                <i class="fa-solid fa-check"></i> {{ __('Atualizar') }}
                                            </button>
                                            <button class="btn btn-danger" type="button"
                                                onclick="window.location.href='{{ route('admin.secretarias.index', ['page' => $page]) }}'">
                                                <i class="fa-solid fa-xmark"></i> {{ __('Cancelar') }}
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                @endif
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>

@endsection