@extends('tablar::page')

@section('content')
<div class="page-header d-print-none">
    <div class="container-xl">
        <div class="row g-2 align-items-center">
            <div class="col">
                <h2 class="page-title">Manage Winners</h2>
            </div>
        </div>
    </div>
</div>

<div class="page-body">
    <div class="container-xl">
        <div class="row row-cards">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <form method="POST" action="/winners" class="row g-3">
                            {{ csrf_field() }}
                            
                            <div class="col-md-6">
                                <label for="winning_bidder_num" class="form-label">Bidder Number</label>
                                <select name="winning_bidder_num" id="winning_bidder_num" class="form-select" required>
                                    @foreach($bidders as $bidder)
                                        <option value="{{ $bidder->idbidders }}">{{ $bidder->bidder_assigned_number }} - {{ $bidder->bidder_fname }} {{ $bidder->bidder_lname }}</option>
                                    @endforeach
                                </select>
                            </div>
                            
                            <div class="col-md-6">
                                <label for="winning_item_num" class="form-label">Item Number</label>
                                <select name="winning_item_num" id="winning_item_num" class="form-select" required>
                                    @foreach($items as $item)
                                        <option value="{{ $item->iditems }}">{{ $item->item_assigned_num }} - {{ $item->item_desc }}</option>
                                    @endforeach
                                </select>
                            </div>

                            <div class="col-md-4">
                                <label for="winning_cost" class="form-label">Winning Amount</label>
                                <input type="text" name="winning_cost" id="winning_cost" class="form-control" required>
                            </div>

                            <div class="col-12">
                                <button type="submit" class="btn btn-primary">Save Winner</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
@include('components.tomselect')
@push('js')
@endpush
