@extends('layouts.admin')

@section('content')

<!-- [ breadcrumb ] start -->
<div class="page-header">
    <div class="page-block">
        <div class="row align-items-center">
            <div class="col-md-12">
                <ul class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">হোম</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('admin.page.index') }}">Pages</a></li>
                    <li class="breadcrumb-item" aria-current="page">Edit</li>
                </ul>
            </div>
            <div class="col-md-12">
                <div class="page-header-title">
                    <h2 class="mb-0">{{ __('Edit Page') }} — {{ $data->title }}</h2>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- [ breadcrumb ] end -->

<form action="{{ route('admin.page.update', $data->id) }}" method="POST" enctype="multipart/form-data">
    @csrf

    <div class="card">
        <div class="card-header">
            <h5>{{ __('Page Details') }}</h5>
        </div>
        <div class="card-body">
            @include('includes.admin.form-error')
            @include('includes.admin.form-success')
            @include('includes.admin.flash-message')

            <div class="row">
                <div class="col-md-6 mb-3">
                    <label class="form-label">{{ __('Language') }} <span class="text-danger">*</span></label>
                    <select class="form-select" name="language_id" id="language_id" required>
                        <option value="">{{__('Please Select a Language')}}</option>
                        @foreach ($languages as $language)
                            <option value="{{$language->id}}" {{ $data->language_id == $language->id ? 'selected' : ''}}>{{$language->language}}</option>
                        @endforeach
                    </select>
                </div>

                <div class="col-md-6 mb-3">
                    <label class="form-label">{{ __('Placement') }} <span class="text-danger">*</span></label>
                    <select class="form-select" name="placement" id="placement" required>
                        <option value="">{{__('Please Select a Placement')}}</option>
                        <option value="footer" {{$data->placement == 'footer' ? 'selected' : ''}}>{{__('Footer')}}</option>
                    </select>
                </div>

                <div class="col-md-6 mb-3">
                    <label class="form-label">{{ __('Title') }} <span class="text-danger">*</span></label>
                    <input type="text" name="title" id="title" class="form-control" placeholder="{{ __('Title') }}" value="{{ $data->title }}" required>
                </div>

                <div class="col-md-6 mb-3">
                    <label class="form-label">{{ __('Slug') }} <span class="text-danger">*</span></label>
                    <input type="text" name="slug" id="slug" class="form-control" placeholder="{{ __('Slug') }}" value="{{ $data->slug }}" required>
                </div>

                <div class="col-md-12 mb-3">
                    <label class="form-label">{{ __('Content') }} <span class="text-danger">*</span></label>
                    <textarea name="description" id="description" class="form-control nic-edit" rows="12">{{ $data->description }}</textarea>
                </div>

                <div class="col-md-6 mb-3">
                    <label class="form-label d-block">{{ __('Status') }} <span class="text-danger">*</span></label>
                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="status" id="enable" value="1" {{$data->status == 1 ? 'checked' : ''}}> 
                        <label class="form-check-label" for="enable">{{__('Enable')}}</label>
                    </div>
                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="status" id="disable" value="0" {{$data->status == 0 ? 'checked' : ''}}> 
                        <label class="form-check-label" for="disable">{{__('Disable')}}</label>
                    </div>
                </div>

                <div class="col-md-6 mb-3">
                    <label class="form-label d-block">{{ __('Show Website Right Column') }} <span class="text-danger">*</span></label>
                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="wbsite_right_column" id="yes" value="1" {{$data->wbsite_right_column == 1 ? 'checked' : ''}}> 
                        <label class="form-check-label" for="yes">{{__('Yes')}}</label>
                    </div>
                    <div class="form-check form-check-inline">
                        <input class="form-check-input" type="radio" name="wbsite_right_column" id="no" value="0" {{$data->wbsite_right_column == 0 ? 'checked' : ''}}> 
                        <label class="form-check-label" for="no">{{__('No')}}</label>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <div class="card">
        <div class="card-body d-flex justify-content-between">
            <a href="{{ route('admin.page.index') }}" class="btn btn-outline-secondary">
                <i class="ti ti-arrow-left me-1"></i>{{ __('Back to Pages') }}
            </a>
            <button class="btn btn-primary" type="submit">
                <i class="ti ti-device-floppy me-1"></i>{{ __('Update Page') }}
            </button>
        </div>
    </div>
</form>
@endsection

@section('scripts')
<script src="{{asset('assets/admin/js/page.js')}}"></script>
@endsection
