@extends('admin.layouts.app')
@section('panel')
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                    <form action="{{ route('admin.card.update', $card->id) }}" method="POST" enctype="multipart/form-data">
                        @csrf
                        <div class="row justify-content-center">
                            <div class="col-lg-6 col-md-7">
                                <div class="form-group ">
                                    <label>@lang('Subcategory')</label>
                                    <select class="form-control select2" name="subcategory_id" required>
                                        @foreach ($subcategories as $subcategory)
                                            <option value="{{ $subcategory->id }}"
                                                @if ($subcategory->id == $card->subcategory_id) selected @endif>
                                                {{ __($subcategory->name) }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>@lang('Image')</label>
                                    <x-image-uploader class="w-100" type="card" image="{{ $card->image }}"
                                        :required=false />
                                </div>
                                <div class="form-group">
                                    <label class="form-label">@lang('Details')</label>
                                    <textarea class="form-control" name="details" rows="2" required>{{ old('details', $card->details) }}</textarea>
                                </div>
                            </div>
                        </div>
                        @if (!$card->user_id)
                            <div class="col-md-12">
                                <button class="btn btn--primary w-100 h-45" type="submit">@lang('Submit') </button>
                            </div>
                        @endif

                    </form>
                </div><!-- card end -->
            </div>
        </div>
    @endsection

    @push('breadcrumb-plugins')
        <x-back route="{{ route('admin.card.index') }}" />
    @endpush

    @push('style')
        <style>
            .card-wrapper {
                padding: 30px;
                border: 1px solid #00000012;
                border-radius: 4px;
                margin: 20px 0;
            }

            .add-new-card {
                display: flex;
                align-items: center;
                justify-content: center;
                height: 90%;
                border: 1px solid #cacaca73;
                border-radius: 10px;
                cursor: pointer;
                padding: 30px;
            }

            .add-new-card-box {
                text-align: center;
                color: #b1b1b1;
            }

            .add-new-card-box i {
                font-size: 50px;
                margin-bottom: 10px;
            }

            .add-new-card-box p {
                font-weight: 500;
            }

            .add-new-card:hover {
                background: #f3f3f3;
            }

            .add-new-card:hover .add-new-card-box {
                color: hsl(var(--body-color));
            }
        </style>
    @endpush
