@extends('backend.admin.layouts.app')
@section('content')
    <div class="pagetitle">
        <h1>Dashboard</h1>
        <nav>
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                <li class="breadcrumb-item">Dashboard</li>
                <li class="breadcrumb-item active">{{ $PageTitle }}</li>

            </ol>
        </nav>
    </div><!-- End Page Title -->

    <section class="section dashboard">
        <div class="row">
            <div class="col-lg-8">
                <div class="card">
                    <div class="card-body mt-3">
                        <form action="{{ route('admin.menu-item.store') }}" method="POST" enctype="multipart/form-data">
                            @csrf

                            <div class="row mb-3">
                                <label for="menu_name" class="col-sm-3 col-form-label">Name</label>
                                <div class="col-sm-9">
                                    <input type="text"
                                           class="form-control @error('menu_name') is-invalid @enderror"
                                           value="{{ old('menu_name') }}"
                                           name="menu_name"
                                           id="menu_name">
                                </div>
                            </div>

                            <div class="row mb-3">
                                <label for="parent_id" class="col-sm-3 col-form-label">Select Main Category</label>
                                <div class="col-sm-9">
                                    <select name="parent_id" id="parent_id" class="form-control">
                                        <option value="">None</option>
                                        @foreach($menus as $menu)
                                            <option value="{{ $menu->id }}">{{ $menu->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>

                            <div class="row mb-3">
                                <label for="order" class="col-sm-3 col-form-label">Order</label>
                                <div class="col-sm-9">
                                    <input type="text"
                                           class="form-control @error('order') is-invalid @enderror"
                                           value="{{ old('order') }}"
                                           name="order"
                                           id="order">
                                </div>
                            </div>

                            <div class="row mt-5 mb-4">
                                <label for="image" class="col-sm-3 col-form-label">Image</label>
                                <div class="col-sm-8 mb-25">
                                    <div class="upload-img-box">
                                        <img src="">
                                        <input type="file" name="image" id="image"
                                               accept="image/*" onchange="previewFile(this)" required>
                                        <div class="upload-img-box-icon">
                                            <i class="fa-solid fa-camera"></i>
                                        </div>
                                    </div>
                                    <p class="col-sm-10 mt-2">Size: 950 x 400 (100kb)</p>
                                </div>
                            </div>

                            <div class="row mb-3">
                                <div class="col-sm-9">
                                    <button type="submit" class="btn btn-primary">Save</button>
                                </div>
                            </div>

                        </form><!-- End General Form Elements -->

                    </div>
                </div>

            </div>
        </div>
    </section>
@endsection
@push('style')
    <style>
        .upload-img-box {
            width: 200px;
            height: 200px;
        }
    </style>
@endpush
