@extends('layouts.admin.theme')
@section("title", env("APP_NAME") . " :: Editar Paciente com Fibromialgia - Endereço")
@section('content')

    <div class="card shadow">

        @php $headLine = "<i class='fa-solid fa-user-injured'></i> Editar Paciente com Fibromialgia - Endereço"; @endphp

        @include('components.buttons._headLineButtonsBackAdd', [
                        'headLine' => __($headLine),
                        "permission" => "GERENCIADOR_DO_CADASTRO_DE_PACIENTES_COM_FIBROMIALGIA",
                    ])

        <div class="card-body">
            <form action="{{ route("admin.saude.fibromialgia.endereco.update", [$paciente->id, $endereco?->id]) }}" method="post" enctype="multipart/form-data">

                @include("errors.messageFlash")
                @csrf
                @method('post')

                @include('components.modal._modelProfile')

                <hr>

                <ul class="nav nav-pills mb-3 justify-content-center bg-light p-2 rounded shadow-sm" role="tablist">

                    @include('components.lists._liLinkBtnNavFibromialgia', [
                        'items' => [
                            ['class' => '', 'route' => 'admin.saude.fibromialgia.edit', 'routeParams' => [$paciente->id], 'label' => 'Dados de Usuário'],
                            ['class' => '', 'route' => 'admin.saude.fibromialgia.dadosPessoais', 'routeParams' => [$paciente->id], 'label' => 'Dados Pessoais'],
                            ['class' => '', 'route' => 'admin.saude.fibromialgia.documentos', 'routeParams' => [$paciente->id], 'label' => 'Documentos'],
                            ['class' => 'active bg-success', 'route' => 'admin.saude.fibromialgia.endereco', 'routeParams' => [$paciente->id], 'label' => 'Endereço'],
                            ['class' => '', 'route' => 'admin.saude.fibromialgia.arquivos', 'routeParams' => [$paciente->id], 'label' => 'Arquivos'],
                            ['class' => '', 'route' => 'admin.saude.fibromialgia.carteirinha', 'routeParams' => [$paciente->id], 'label' => 'Carteirinha'],
                            ['class' => '', 'route' => 'admin.saude.fibromialgia.anotacoes', 'routeParams' => [$paciente->id], 'label' => 'Anotações'],
                        ]
                    ])

                </ul>

                <div class="tab-content">

                    <div class="mb-3">

                        <div class="row">
                                <div class="col-sm-12 col-md-4">
                                <!-- Campo CEP -->
                                    @include('components.inputs._inputType',[
                                                "for" => null,
                                                "label" => "CEP",
                                                "name" => "cep",
                                                "id" => "zipCode",
                                                "required" => true,
                                                "type" => null,
                                                "old" => old('cep', $endereco?->cep),
                                                "oninput" => "javascript:aplicarMascaraCEP(this)",
                                                "readonly" => false,
                                                "small" => null,
                                            ])
                                </div>
                                <div class="col-sm-12 col-md-6">
                                <!-- Campo Logradouro -->
                                    @include('components.inputs._inputType',[
                                                "for" => null,
                                                "label" => "Logradouro",
                                                "name" => "logradouro",
                                                "id" => "street",
                                                "required" => true,
                                                "type" => null,
                                                "old" => old('logradouro', $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', $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-3">
                                <!-- Campo Complemento -->
                                    @include('components.inputs._inputType',[
                                                "for" => null,
                                                "label" => "Complemento",
                                                "name" => "complemento",
                                                "id" => "complemento",
                                                "required" => false,
                                                "type" => null,
                                                "old" => old('complemento', $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', $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', $endereco?->bairro),
                                                "oninput" => "javascript:this.value = this.value.toUpperCase()",
                                                "readonly" => false,
                                                "small" => null,
                                            ])
                                </div>
                                <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', $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>

                            <div class="row">
                                <div class="col-sm-12 col-md-3 d-flex justify-content-center align-self-center">
                                <!-- Map Modal -->
                                    @include('components.modal._mapModal',[
                                                "label" => "Clique no mapa e escolha um determinado ponto",
                                            ])
                                </div>
                                <div class="col-sm-12 col-md-3">
                                <!-- Campo Latitude -->
                                    @include('components.inputs._inputType',[
                                                "for" => null,
                                                "label" => "Latitude",
                                                "name" => "latitude",
                                                "id" => null,
                                                "required" => true,
                                                "type" => null,
                                                "old" => old('latitude', $endereco?->latitude),
                                                "oninput" => "javascript:this.value = this.value.toUpperCase()",
                                                "readonly" => false,
                                                "small" => null,
                                            ])
                                </div>
                                <div class="col-sm-12 col-md-3">
                                <!-- Campo Longitude -->
                                    @include('components.inputs._inputType',[
                                                "for" => null,
                                                "label" => "Longitude",
                                                "name" => "longitude",
                                                "id" => null,
                                                "required" => true,
                                                "type" => null,
                                                "old" => old('longitude', $endereco?->longitude),
                                                "oninput" => "javascript:this.value = this.value.toUpperCase()",
                                                "readonly" => false,
                                                "small" => null,
                                            ])
                                </div>
                                <div class="col-sm-12 col-md-3">
                                <!-- Campo Comprovante -->
                                    @include('components.inputs._inputType',[
                                                "for" => null,
                                                "label" => "Comprovante de endereço",
                                                "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>
                            <div class="row">
                                <div class="col-12 text-center">
                                    @if($endereco?->comprovante != null && $endereco?->comprovante != "pmar\assets\img\comprovante-residencia-default.jpg")
                                        <hr/>
                                        <a href="{{ asset($endereco?->comprovante) }}" class="text-primary" download>
                                            {{ __("Comprovante de endereço") }} - <small>{{ __("baixar") }}</small> <i class="fa-solid fa-download"></i>
                                        </a>
                                    @endif
                            </div>

                    </div>

                    <div class="row">
                        <div class="d-flex justify-content-between mt-4">
                            <a class="btn btn-outline-secondary" href="{{ route("admin.saude.fibromialgia.documentos", $paciente->id) }}">
                                <i class="fa-solid fa-arrow-left-long"></i> {{ __("Anterior") }}
                            </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>
            </form>

        </div>
    </div>

@endsection
