@extends('layouts.admin.theme')
@section('title', env('APP_NAME').' :: '.__('Fluxo de Ônibus - Editar Agendamento'))
@section('content')
    <div class="card shadow-sm">

        @php $headLine = "<i class='fa-solid fa-bus-simple'></i> " . __('Fluxo de Ônibus - Editar Agendamento'); @endphp

        @include('components.buttons._headLineButtonsBackAdd', [
            'headLine' => $headLine, 
            'routeBack' => 'admin.turisAngra.fluxoDeOnibus.onibusTurismo.index', 
            'nameBack' => __('Lista de agendamentos'), 
            'fontawesomeBack' => '<i class="fa-solid fa-list"></i>', 
            'permission' => 'GERENCIADOR_DE_FLUXO_DE_ONIBUS'])

        <div class="card-body">
            @include('errors.messageFlash')

            <div class="alert alert-warning">

                <strong>ATENÇÃO</strong> <i class="fa-solid fa-triangle-exclamation"></i> : Caso sua empresa já esteja cadastrada na base de dados da Prefeitura de Angra dos Reis, não será possível realizar alterações diretamente por este sistema. Para atualização cadastral, é necessário abrir um chamado junto à Prefeitura.

            </div>

            <form action="{{ route('admin.turisAngra.fluxoDeOnibus.onibusTurismo.enderecoStore', [$empresa?->id, $onibusTurismo?->id]) }}" method="POST">
                @csrf
                @method("POST")

                <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 bg-success disabled', 'hash' => 'primeiraSection', 'label' => 'Dados de Empresa'],
                            ['class' => 'active bg-success disabled', 'hash' => 'segundaSection', 'label' => 'Endereço'],
                            ['class' => 'disabled', 'hash' => 'terceiraSection', 'label' => 'Responsável Legal'],
                            ['class' => 'disabled', 'hash' => 'quartaSection', 'label' => 'Guia Turístico'],
                            ['class' => 'disabled', 'hash' => 'quintaSection', 'label' => 'Arquivos'],
                            ['class' => 'disabled', 'hash' => 'sextaSection', 'label' => 'Reserva'],
                        ]
                    ])

                </ul>
                
                <div class="row">
                    <div class="col-sm-12 col-md-3">
                        <!-- Campo CEP -->
                        <input type="hidden" name="domicilio" value="OUTROS"/>
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "CEP",
                            "name" => "cep",
                            "id" => "zipCode",
                            "required" => true,
                            "type" => null,
                            "old" => old('cep', $empresa?->endereco?->cep),
                            "oninput" => "javascript:aplicarMascaraCEP(this)",
                            "readonly" => false,
                            "small" => null,
                        ])
                    </div>
                    <div class="col-sm-12 col-md-7">
                        <!-- Campo Logradouro -->
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "Logradouro",
                            "name" => "logradouro",
                            "id" => "street",
                            "required" => true,
                            "type" => null,
                            "old" => old('logradouro', $empresa?->endereco?->logradouro),
                            "oninput" => "javascript:this.value = this.value.toUpperCase()",
                            "readonly" => false,
                            "small" => null,
                        ])
                    </div>
                    <div class="col-sm-12 col-md-2">
                        <!-- Campo Número -->
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "Número",
                            "name" => "numero",
                            "id" => "numero",
                            "required" => false,
                            "type" => null,
                            "old" => old('numero', $empresa?->endereco?->numero),
                            "oninput" => "javascript:this.value = this.value.toUpperCase()",
                            "readonly" => false,
                            "small" => null,
                        ])
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12 col-md-6">
                        <!-- Campo Complemento -->
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "Complemento",
                            "name" => "complemento",
                            "id" => "complemento",
                            "required" => false,
                            "type" => null,
                            "old" => old('complemento', $empresa?->endereco?->complemento),
                            "oninput" => "javascript:this.value = this.value.toUpperCase()",
                            "readonly" => false,
                            "small" => null,
                        ])
                    </div>
                    <div class="col-sm-12 col-md-3">
                        <!-- Campo Cidade -->
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "Cidade",
                            "name" => "cidade",
                            "id" => "city",
                            "required" => true,
                            "type" => null,
                            "old" => old('cidade', $empresa?->endereco?->cidade),
                            "oninput" => "javascript:this.value = this.value.toUpperCase()",
                            "readonly" => false,
                            "small" => null,
                        ])
                    </div>
                    <div class="col-sm-12 col-md-3">
                        <!-- Campo Bairro -->
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "Bairro",
                            "name" => "bairro",
                            "id" => "neighborhood",
                            "required" => true,
                            "type" => null,
                            "old" => old('bairro', $empresa?->endereco?->bairro),
                            "oninput" => "javascript:this.value = this.value.toUpperCase()",
                            "readonly" => false,
                            "small" => null,
                        ])
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12 col-md-3">
                        <!-- Campo UF -->
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "UF",
                            "name" => "uf",
                            "id" => "state",
                            "required" => true,
                            "type" => null,
                            "old" => old('uf', $empresa?->endereco?->uf),
                            "oninput" => "javascript:this.value = this.value.toUpperCase()",
                            "readonly" => false,
                            "small" => null,
                            "listName" => "estadosBrasileiros",
                            "arrayList" => [
                                'AC', 'AL', 'AM', 'AP', 'BA', 'CE', 'DF', 'ES', 'GO',
                                'MA', 'MG', 'MS', 'MT', 'PA', 'PB', 'PE', 'PI', 'PR',
                                'RJ', 'RN', 'RO', 'RR', 'RS', 'SC', 'SE', 'SP', 'TO'
                            ],
                        ])
                    </div>
                    <div class="col-sm-12 col-md-7">
                        <!-- Campo Comprovante -->
                        @include('components.inputs._inputType',[
                            "for" => null,
                            "label" => "Comprovante",
                            "name" => "comprovante",
                            "id" => null,
                            "required" => false,
                            "type" => 'file',
                            "old" => null,
                            "oninput" => null,
                            "readonly" => true,
                            "small" => null,
                            "accept" => 'image/jpeg,image/jpg,image/png,image/gif,.pdf',
                        ])
                    </div>
                    <div class="col-sm-12 col-md-2">
                        <!-- Campo Status -->
                        @include('components.inputs._selectType', [
                            "for" => "status",
                            "label" => "Status",
                            "name" => "status",
                            "required" => true,
                            "readonly" => false,
                            "options" => collect(App\Enums\StatusEnum::cases())
                                ->mapWithKeys(fn($status) => [$status->name => $status->value])
                                ->toArray(),
                            "selected" => old('status', $empresa?->endereco?->status ?? ''),
                            "placeholder" => "Selecione o status...",
                            "small" => "Informe o status atual do usuário.",
                            "onchange" => null
                        ])
                    </div>
                </div>
                <hr/>
                <div class="mb-3">
                    <div class="col-sm-12 col-md-3 d-flex justify-content-start align-self-center">
                    <!-- Map Modal -->
                        @include('components.modal._mapModal',[
                            "label" => "Clique no mapa e escolha um determinado ponto",
                        ])
                    </div>

                    <hr/>

                    <div class="row">
                        <div class="col-sm-12 col-md-6">
                            <!-- Campo Latitude -->
                            @include('components.inputs._inputType',[
                                "for" => null,
                                "label" => "Latitude",
                                "name" => "latitude",
                                "id" => null,
                                "required" => false,
                                "type" => null,
                                "old" => old('latitude', $empresa?->endereco?->latitude),
                                "oninput" => "javascript:this.value = this.value.toUpperCase()",
                                "readonly" => false,
                                "small" => null,
                            ])
                        </div>
                        <div class="col-sm-12 col-md-6">
                            <!-- Campo Longitude -->
                            @include('components.inputs._inputType',[
                                "for" => null,
                                "label" => "Longitude",
                                "name" => "longitude",
                                "id" => null,
                                "required" => false,
                                "type" => null,
                                "old" => old('longitude', $empresa?->endereco?->latitude),
                                "oninput" => "javascript:this.value = this.value.toUpperCase()",
                                "readonly" => false,
                                "small" => null,
                            ])
                        </div>
                    </div>
                    <hr>
                </div>
                <div class="row">
                    <div class="col-12">
                        <div class="row">
                            <div class="d-flex justify-content-between mt-4">
                                <a class="btn btn-dark" href="{{ route("admin.turisAngra.fluxoDeOnibus.onibusTurismo.editarAgendamento", [$empresa->id, $onibusTurismo->id]) }}">
                                    <i class="fa-solid fa-arrow-left-long"></i> {{ __("voltar") }}
                                </a>
                                <button class="btn btn-primary d-inline" type="submit">
                                    <i class="fa-solid fa-user-plus"></i> {{ __("Salvar e Prosseguir") }}
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection
