@extends('layouts.app')

@section('title', 'Add Product')

@section('content')
    <div class="mb-4">
        <h4 class="mb-0">Add New Product</h4>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb mb-0">
                <li class="breadcrumb-item"><a href="{{ url('/') }}">Dashboard</a></li>
                <li class="breadcrumb-item"><a href="{{ route('products.index') }}">Products</a></li>
                <li class="breadcrumb-item active">New Product</li>
            </ol>
        </nav>
    </div>

    <div class="row justify-content-center">
        <div class="col-lg-10">
            <div class="card shadow-sm border-0">
                <div class="card-body p-4">
                    <form action="{{ route('products.store') }}" method="POST">
                        @csrf

                        <div class="row g-4">
                            <div class="col-md-8">
                                <label class="form-label fw-bold small text-muted text-uppercase">Product Name <span
                                        class="text-danger">*</span></label>
                                <input type="text" name="name" class="form-control form-control-lg" required
                                    placeholder="e.g. Solar Panel 400W">
                            </div>
                            <div class="col-md-4">
                                <label class="form-label fw-bold small text-muted text-uppercase">SKU / Item Code <span
                                        class="text-danger">*</span></label>
                                <input type="text" name="sku" class="form-control form-control-lg" required
                                    placeholder="SP-400-X-1">
                            </div>

                            <div class="col-md-4">
                                <label class="form-label fw-bold small text-muted text-uppercase">Category <span
                                        class="text-danger">*</span></label>
                                <select name="category" class="form-select" required>
                                    <option value="raw_material">Raw Material</option>
                                    <option value="semi_finished">Semi-Finished Good</option>
                                    <option value="finished_good">Finished Good</option>
                                </select>
                            </div>

                            <div class="col-md-4">
                                <label class="form-label fw-bold small text-muted text-uppercase">Unit of Measure <span
                                        class="text-danger">*</span></label>
                                <select name="unit_of_measure" class="form-select" required>
                                    <option value="pcs">Pieces (pcs)</option>
                                    <option value="kg">Kilograms (kg)</option>
                                    <option value="m">Meters (m)</option>
                                    <option value="sqm">Square Meters (sqm)</option>
                                    <option value="liter">Liters (L)</option>
                                </select>
                            </div>

                            <div class="col-md-4">
                                <label class="form-label fw-bold small text-muted text-uppercase">Status</label>
                                <select name="status" class="form-select">
                                    <option value="1">Active</option>
                                    <option value="0">Inactive / Discontinued</option>
                                </select>
                            </div>

                            <div class="col-md-12">
                                <label class="form-label fw-bold small text-muted text-uppercase">Description</label>
                                <textarea name="description" class="form-control" rows="3"
                                    placeholder="Technical specifications, notes..."></textarea>
                            </div>

                            <div class="col-md-12 mt-5">
                                <h6 class="fw-bold mb-3 text-primary border-bottom pb-2">Pricing (Optional)</h6>
                            </div>

                            <div class="col-md-6">
                                <label class="form-label fw-bold small text-muted text-uppercase">Standard Cost</label>
                                <div class="input-group">
                                    <span class="input-group-text">$</span>
                                    <input type="number" step="0.01" name="cost_price" class="form-control"
                                        placeholder="0.00">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label fw-bold small text-muted text-uppercase">Standard Sale
                                    Price</label>
                                <div class="input-group">
                                    <span class="input-group-text">$</span>
                                    <input type="number" step="0.01" name="sale_price" class="form-control"
                                        placeholder="0.00">
                                </div>
                            </div>
                        </div>

                        <div class="mt-5 d-flex justify-content-end gap-2">
                            <a href="{{ route('products.index') }}" class="btn btn-light px-4 py-2">Back to Catalog</a>
                            <button type="submit" class="btn btn-primary px-5 py-2">Save Product</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection