@extends('layouts.app')

@section('title', 'Edit Harga')

@section('content')

<div class="container">

    <div class="card card-modern p-4">

        <h3 class="mb-4">
            ✏️ Edit Harga Harian
        </h3>

        <form action="/prices/{{ $price->id }}" method="POST">

            @csrf
            @method('PUT')

            <div class="mb-3">

                <label class="form-label">
                    Produk
                </label>

                <select name="product_id" class="form-select">

                    @foreach($products as $product)

                    <option
                        value="{{ $product->id }}"
                        {{ $product->id == $price->product_id ? 'selected' : '' }}>

                        {{ $product->name }}

                    </option>

                    @endforeach

                </select>

            </div>

            <div class="mb-3">

                <label class="form-label">
                    Tanggal
                </label>

                <input
                    type="date"
                    name="date_price"
                    class="form-control"
                    value="{{ $price->date_price }}">

            </div>

            <div class="mb-4">

                <label class="form-label">
                    Harga
                </label>

                <input
                    type="number"
                    name="price"
                    class="form-control"
                    value="{{ $price->price }}">

            </div>

            <div class="d-flex gap-2">

                <a href="/prices" class="btn btn-secondary">
                    Batal
                </a>

                <button class="btn btn-warning">
                    💾 Update Harga
                </button>

            </div>

        </form>

    </div>

</div>

@endsection