@extends('admin.setting.index')

@section('sub_content')
    <div class="setting-layout-body">
        <div class="add-company">
            <div class="add-company-body">
                <form action="{{ route('admin.frontend.seo.save') }}" class="disableSubmission add-company-form" method="POST" enctype="multipart/form-data">
                    @csrf
                    <div class="card style-two w-100">
                        <div class="card-header">
                            <p class="card-title">{{ __($pageTitle) }}</p>
                        </div>
                        <div class="card-body">
                            <div class="row c-gx-4 gy-3 gy-md-4">
                                <div class="col-12">
                                    <div class="image-uploader imageUploader">
                                        <label class="image-uploader-preview">
                                            <img src="{{ getImage(getFilePath('seo') . '/' . ($seo->data_values->image ?? ''), getFileSize('seo')) }}" class="imagePreview" alt="Preview" />
                                            <span class="icon">
                                                <i class="fa-solid fa-plus"></i>
                                            </span>
                                            <input type="file" name="image" class="d-none imageInput" accept=".png, .jpg, .jpeg" />
                                        </label>
                                        <div class="image-uploader-content">
                                            <p class="title">@lang('SEO Image')</p>
                                            <p class="note">
                                                @lang('Supported formats'): @lang('PNG, JPG, JPEG.')
                                            </p>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-12 form-group">
                                    <label class="form--label style-two">@lang('Meta Keywords')</label>
                                    <select name="keywords[]" class="form--control form-control md-style select2-multiple-input" multiple="multiple" required>
                                        @if (isset($seo->data_values->keywords) && $seo->data_values->keywords)
                                            @foreach ($seo->data_values->keywords as $option)
                                                <option value="{{ $option }}" selected>{{ __($option) }}</option>
                                            @endforeach
                                        @endif
                                    </select>
                                </div>
                                <div class="col-md-12">
                                    <label class="form--label style-two">@lang('Meta Description')</label>
                                    <textarea name="description" rows="3" class="form--control md-style" required>{{ isset($seo->data_values->description) ? $seo->data_values->description : '' }}</textarea>

                                </div>
                                <div class="col-md-12">
                                    <label class="form--label style-two">@lang('Social Title')</label>
                                    <input type="text" class="form--control md-style" name="social_title" value="{{ isset($seo->data_values->social_title) ? $seo->data_values->social_title : '' }}" required>

                                </div>

                                <div class="col-12">
                                    <label class="form--label style-two">@lang('Social Description')</label>
                                    <textarea name="social_description" rows="3" class="form--control md-style" required>{{ isset($seo->data_values->social_description) ? $seo->data_values->social_description : '' }}</textarea>
                                </div>
                                <div class="col-12">
                                    <button type="submit" class="btn btn--base w-100 btn--md">@lang('Submit')</button>
                                </div>
                            </div>
                        </div>

                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection


@push('style')
    <style>
        .select2-container--default .select2-selection--multiple .select2-selection__choice {
            margin-top: 9px !important;
        }

        .image-uploader-preview img {
            border: 1px solid hsl(var(--border-color) / .5);
            object-fit: contain;
            border-radius: 8px;
            height: auto;
            width: 240px;
            max-height: 124px;
        }
    </style>
@endpush
