@extends('layouts.dashboard')
@section('content')
<div class="container mt-4">
    <a href="{{ route('products.index') }}" class="btn btn-primary">Back</a>
    <div class="row">
        <form action="{{ route('products.store') }}" method="post" 
        enctype="multipart/form-data">
            @csrf

            <div class="mt-3">
                <label for="name">Product Name:</label>
                <input type="text" placeholder="Enter Product Name" 
                name="name" id="name" class="form-control" required>
            </div>
            <div class="mt-3">
                <label for="image">Categories:</label>

                <select name="category_id" class="form-control" required>
                    <option value="">--Select Category--</option>
                    @foreach ($categories as $category )
                    <option value="{{ $category->id }}">{{ $category->name }}</option>
                    @endforeach

                </select>
            </div>
            <div class="mt-3">
                <label for="image">Brands:</label>
                <select name="brand_id" class="form-control" required>
                    <option value="">--Select Brand--</option>
                    @foreach ($brands as $brand )
                    <option value="{{ $brand->id }}">{{ $brand->name }}</option>

                    @endforeach
                </select>
            </div>
            <div class="mt-3">
                <label for="price">Product Price:</label>
                <input type="number" name="price" id="price" class="form-control" required>
            </div>
            <div class="mt-3">
                <label for="Stock">Stock:</label>
                <input type="number" name="stock" id="stock" class="form-control" required>
            </div>
            <div class="mt-3">
                <label for="image">Image:</label>
                <input type="file" name="image" id="image" class="form-control" required>
            </div>
            <div class="mt-3">
                <label for="description">Description:</label>
                <textarea name="description" id="description" class="form-control" rows="5"></textarea>
            </div>
            <br>
            <button type="submit" class="btn btn-dark">Add Product</button>
     </form>
    </div>
</div>

@endsection