@extends('layouts.admin.theme')
@section("title", env("APP_NAME") . " :: Integrantes")
@section('content')
<div class="card shadow">
    @php $headLine = "<i class='fa-solid fa-guitar'></i> Integrantes"; @endphp
    @include('components.buttons._headLineButtonsBackAdd', [
        'headLine' => __($headLine),
        "permission" => "GERENCIADOR_CREDENCIAMENTO_DE_MUSICOS",
    ])
    <div class="card-body">
        @include("errors.messageFlash")
        @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._liLinkBtnNavInterna', [
                'items' => [
                    ['class' => 'active bg-success disabled', 'hash' => 'primeiraSection', 'label' => 'Dados de Usuário'],
                    ['class' => 'active bg-success disabled', 'hash' => 'segundaSection', 'label' => 'Dados Pessoais'],
                    ['class' => 'active bg-success disabled', 'hash' => 'terceiraSection', 'label' => 'Documentos'],
                    ['class' => 'active bg-success disabled', 'hash' => 'quartaSection', 'label' => 'Endereço'],
                    ['class' => 'active bg-success disabled', 'hash' => 'quintaSection', 'label' => 'Credenciamento'],
                    ['class' => 'active bg-success disabled', 'hash' => 'sextaSection', 'label' => 'Integrantes'],
                    ['class' => 'disabled', 'hash' => 'setimaSection', 'label' => 'Arquivos'],
                ]
            ])
        </ul>

        <div class="mb-3">
            <form action="{{ route('admin.cultura.credenciamentoMusicos.integrantes.update', $musico->id) }}" method="POST" enctype="multipart/form-data">
                @csrf
                @method('POST')
                <div class="row">
                    <div class="col-md-4">
                        @include('components.inputs._inputType',["label"=>"Nome completo","name"=>"nome","required"=>true,"old"=>old('nome')])
                    </div>
                    <div class="col-md-4">
                        @include('components.inputs._inputType',["label"=>"Função","name"=>"funcao","required"=>true,"old"=>old('funcao')])
                    </div>
                    <div class="col-md-2">
                        @include('components.inputs._inputType',["label"=>"CPF","name"=>"cpf","required"=>true,"old"=>old('cpf')])
                    </div>
                    <div class="col-md-2">
                        @include('components.inputs._inputType',["label"=>"Upload CPF (opcional)","name"=>"arquivoCPF","type"=>'file','accept'=>'application/pdf,image/*','small'=>'(.pdf, .jpg, .jpeg, .png)'])
                    </div>
                </div>
                <div class="d-flex justify-content-end mt-3">
                    <button class="btn btn-primary" type="submit"><i class="fa-solid fa-plus"></i> {{ __("Adicionar integrante") }}</button>
                </div>
            </form>
        </div>

        <hr>

        <h6 class="text-white mb-3">{{ __('Integrantes adicionados') }}</h6>
        <table class="table table-dark table-striped">
            <thead>
                <tr>
                    <th>Nome</th>
                    <th>Função</th>
                    <th>CPF</th>
                    <th>Arquivo CPF</th>
                </tr>
            </thead>
            <tbody>
                @foreach($integrantes as $int)
                    <tr>
                        <td>{{ $int->nome }}</td>
                        <td>{{ $int->funcao }}</td>
                        <td>{{ $int->cpf }}</td>
                        <td>
                            @if($int->arquivo_cpf_arquivo_id)
                                <a href="{{ url(optional(\App\Models\Arquivo::find($int->arquivo_cpf_arquivo_id))->link) }}" class="text-primary" download>
                                    {{ __('baixar arquivo') }} <i class="fa-solid fa-download"></i>
                                </a>
                            @else
                                <span class="text-muted">{{ __('não enviado') }}</span>
                            @endif
                        </td>
                    </tr>
                @endforeach
            </tbody>
        </table>

        <div class="d-flex justify-content-between mt-4">
            <a class="btn btn-outline-secondary" href="{{ route('admin.cultura.credenciamentoMusicos.credenciamento', $musico->id) }}">
                <i class="fa-solid fa-arrow-left-long"></i> {{ __("Anterior") }}
            </a>
            <a class="btn btn-primary" href="{{ route('admin.cultura.credenciamentoMusicos.arquivos', $musico->id) }}">
                {{ __("Prosseguir para Arquivos") }}
            </a>
        </div>
    </div>
</div>
@endsection
