@extends('layouts.app')

@section('content')
<div class="container">
    <h2>Edit Commission</h2>

    <form action="{{ route('commissions.update', $commission->id) }}" method="POST">
        @csrf
        @method('PUT')

        <div class="form-group mb-3">
            <label>Date</label>
            <input type="date" name="date" class="form-control" value="{{ $commission->date }}" required>
        </div>

        <div class="form-group mb-3">
            <label>Buyer Commission</label>
            <input type="number" step="0.01" name="buyer_commission" class="form-control" value="{{ $commission->buyer_commission }}" required>
        </div>

        <div class="form-group mb-3">
            <label>Seller Commission</label>
            <input type="number" step="0.01" name="seller_commission" class="form-control" value="{{ $commission->seller_commission }}" required>
        </div>

        <div class="form-group mb-3">
            <label>Receiver Name</label>
            <input type="text" name="receiver_name" class="form-control" value="{{ $commission->receiver_name }}" required>
        </div>

        <div class="form-group mb-3">
            <label>Registration No</label>
            <input type="text" name="registration_no" class="form-control" value="{{ $commission->carSale->registration_no }}" readonly>
        </div>

        <div class="form-group mb-3">
            <label>Buyer Name</label>
            <input type="text" name="buyer_name" class="form-control" value="{{ $commission->carSale->buyer_name }}" readonly>
        </div>

        <div class="form-group mb-3">
            <label>Seller Name</label>
            <input type="text" name="seller_name" class="form-control" value="{{ $commission->carSale->seller_name }}" readonly>
        </div>
        <div class="form-group mb-3">
            <label>Owner Name</label>
            <input type="text" name="owner_name" class="form-control" value="{{ $commission->owner_name }}" >
        </div>
        <button type="submit" class="btn btn-success">Update</button>
        <a href="{{ route('commissions.index') }}" class="btn btn-secondary">Cancel</a>
    </form>
</div>
@endsection
