@extends('layouts.admin.theme')
@section("title", env("APP_NAME") . " :: Nova Notícia")
@section('content')

    <div class="container">
        <div class="row">
            <div class="col-12">
                <div class="card shadow"> 
                    <form action="{{ route('admin.noticias.store') }}" method="post" enctype="multipart/form-data">
                        @php $headLine = "<i class='fa-solid fa-bullhorn'></i> Nova Notícia"; @endphp

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

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

                            <input type="hidden" name="slug">
                            <input type="hidden" name="movie">
                            <input type="hidden" name="type" value="DESTAQUE">

                            <div class="mb-3">
                                @include('components.inputs._inputType',[
                                    "for" => null,
                                    "label" => "Título da Notícia",
                                    "name" => "title",
                                    "id" => null,
                                    "required" => false,
                                    "type" => 'text',
                                    "old" => old('title'),
                                    "oninput" => null,
                                    "readonly" => false,
                                    "small" => null,
                                    "placeholder" => null,
                                ])
                                <small id="charCounterTitleNews" class="text-muted">0/85</small>    
                            </div>

                            <div class="mb-3 text-wrap">
                                <!-- Campo Resumo -->
                                @include('components.inputs._textarea', [
                                    'label' => 'Resumo',
                                    'name' => 'summary',
                                    'id' => null,
                                    'rows' => 0,
                                    'required' => false,
                                    'height' => '100px',
                                    'class' => null,
                                    'style' => null,
                                    'value' => old('summary'),
                                ])
                                <small id="charCounterSummaryNews" class="text-muted">0/200</small>
                            </div>

                            <div class="mb-3">
                                
                                <!-- Campo Corpo da Nótícia -->
                                @include('components.inputs._textarea', [
                                    'label' => 'Corpo da Nótícia',
                                    'name' => 'description',
                                    'id' => null,
                                    'rows' => 5,
                                    'required' => false,
                                    'height' => '400px',
                                    'class' => "textarea-body",
                                    'style' => null,
                                    'value' => old('description'),
                                ])
                                
                            </div>
                            <div class="mb-3">
                                <!-- Campo Link Flickr -->
                                @include('components.inputs._inputType',[
                                    "for" => null,
                                    "label" => "Link Flickr",
                                    "name" => "flickr",
                                    "id" => null,
                                    "required" => false,
                                    "type" => 'url',
                                    "old" => old('flickr'),
                                    "oninput" => "javascript:this.value = this.value.toLowerCase()",
                                    "readonly" => false,
                                    "small" => null,
                                    "placeholder" => "https://seulink.com",
                                ]) 
                            </div>
                            <div class="mb-3">
                                <!-- Campo Foto Destaque -->
                                @include('components.inputs._inputType',[
                                    "for" => null,
                                    "label" => "Foto Destaque",
                                    "name" => "featuredPhoto",
                                    "id" => null,
                                    "required" => false,
                                    "type" => 'file',
                                    "old" => null,
                                    "oninput" => null,
                                    "readonly" => true,
                                    "small" => null,
                                    "accept" => 'image/jpeg,image/jpg,image/png,image/gif',
                                ])
                            </div>
                            <div class="mb-3">
                                <!-- Campo Foto Corpo da Notícia -->
                                @include('components.inputs._inputType',[
                                    "for" => null,
                                    "label" => "Foto Corpo da Notícia",
                                    "name" => "internalPhoto",
                                    "id" => null,
                                    "required" => false,
                                    "type" => 'file',
                                    "old" => null,
                                    "oninput" => null,
                                    "readonly" => true,
                                    "small" => null,
                                    "accept" => 'image/jpeg,image/jpg,image/png,image/gif',
                                ])
                            </div>
                            <div class="mb-3">
                                <!-- 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'),
                                        "placeholder" => "Selecione o status...",
                                        "small" => "Informe o status atual do usuário.",
                                        "onchange" => null
                                    ])
                            </div>
                            <div class="mb-3 form-check">
                                <input class="form-check-input" type="checkbox" name="fix" id="fix">
                                <label class="form-check-label" for="fix">
                                    {{ __("Sim, desejo fixar notícia.") }}
                                </label>
                            </div>
                            <hr>
                            
                            <!-- Campo CheckBox Gabinete -->
                            @include('components.inputs.inputCheckBoxListNoticias',[
                                'collection' => $gabinetes,
                                'title' => '* Pertence ao Gabinete',
                                'small' => '* selecionar todos os gabinetes',
                                'id' => 'checkboxGabinetesNoticias',
                                'onclick' => 'javascript:selectAllCheckboxGabinetesNoticias(this)',
                                'belongsTo' => [],
                            ])
                            
                            <!-- Campo CheckBox Secretarias -->
                            @include('components.inputs.inputCheckBoxListNoticias',[
                                'collection' => $secretarias,
                                'title' => '* Pertence as Secretarias',
                                'small' => '* selecionar todas as secretarias',
                                'id' => 'checkboxSecretariasNoticias',
                                'onclick' => 'javascript:selectAllCheckboxSecretariasNoticias(this)',
                                'belongsTo' => [],
                            ])
                            
                            <!-- Campo CheckBox Executivas -->
                            @include('components.inputs.inputCheckBoxListNoticias',[
                                'collection' => $executivas,
                                'title' => '* Pertence as Executivas',
                                'small' => '* selecionar todas as executivas',
                                'id' => 'checkboxExecutivasNoticias',
                                'onclick' => 'javascript:selectAllCheckboxExecutivasNoticias(this)',
                                'belongsTo' => [],
                            ])
                            
                            <!-- Campo CheckBox Autarquias ou Fundações -->
                            @include('components.inputs.inputCheckBoxListNoticias',[
                                'collection' => $autarquias,
                                'title' => '* Pertence as Autarquias ou Fundações',
                                'small' => '* selecionar todos os órgãos',
                                'id' => 'checkboxAutarquiasNoticias',
                                'onclick' => 'javascript:selectAllCheckboxAutarquiasNoticias(this)',
                                'belongsTo' => [],
                            ])
                            
                            <!-- Campo CheckBox Categorias -->
                            @include('components.inputs.inputCheckBoxListCategoriaNoticias',[
                                'collection' => App\Enums\StatusTagCloudNewsEnum::cases(),
                                'title' => '* Categorias',
                                'small' => '* selecionar todas as categorias',
                                'id' => 'checkboxCategoriasNoticias',
                                'onclick' => 'javascript:selectAllCheckboxCategoriasNoticias(this)',
                                'tags' => [],
                            ])

                            <hr>
                            @if (auth()->user()->getPermissaoDetalhes("ADMIN"))
                            
                                <!-- Campo Códigos HTML -->
                                @include('components.inputs._textarea', [
                                    'label' => 'Códigos HTML',
                                    'name' => 'code',
                                    'id' => null,
                                    'rows' => 5,
                                    'required' => false,
                                    'height' => '400px',
                                    'class' => null,
                                    'style' => null,
                                    'value' => old('code'),
                                ])
                                <hr>
                            @endif
                            @include('components.buttons._backAndSend', [
                                    'textBack' => 'Voltar', 
                                    'textSend' => 'Enviar', 
                                    'routeBack' => 'admin.noticias.index'
                                ]
                            )
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


@endsection