forked from TFMM/silent-auction
fix checkout route by aligning view fields with controller expectations
This commit is contained in:
@@ -16,33 +16,67 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@foreach($checkout_info_results as $info)
|
||||
<form method="POST" action="/checkout" class="row g-3">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="bidder_num" value="{{ $bidder->idbidders }}">
|
||||
<input type="hidden" name="checkoutbiddernum" value="{{ $info->idbidders }}">
|
||||
<input type="hidden" name="winnertotal" value="{{ $info->total_cost }}">
|
||||
|
||||
<h3 class="mb-3">Winning Items for {{ $bidder->bidder_fname }} {{ $bidder->bidder_lname }}</h3>
|
||||
<ul class="list-group mb-4">
|
||||
@foreach($winnings as $item)
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
{{ $item->items->item_desc }}
|
||||
<span class="badge bg-primary rounded-pill">${{ number_format($item->winning_cost, 2) }}</span>
|
||||
</li>
|
||||
<h3 class="mb-3">Winning Items for {{ $info->bidder_fname }} {{ $info->bidder_lname }} (Bidder #{{ $info->bidder_assigned_number }})</h3>
|
||||
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-vcenter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Item #</th>
|
||||
<th>Description</th>
|
||||
<th class="text-end">Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($checkout_list_results as $item)
|
||||
<tr>
|
||||
<td>{{ $item->item_assigned_num }}</td>
|
||||
<td>{{ $item->item_desc }}</td>
|
||||
<td class="text-end">${{ number_format($item->winning_cost, 2) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</ul>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="2" class="text-end">Total Due</th>
|
||||
<th class="text-end h3">${{ number_format($info->total_cost, 2) }}</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label for="payment_method" class="form-label">Payment Method</label>
|
||||
<select name="payment_method" id="payment_method" class="form-select" required>
|
||||
@foreach($paymentMethods as $pm)
|
||||
<option value="{{ $pm->pm_id }}">{{ $pm->pm_name }}</option>
|
||||
@endforeach
|
||||
<select name="checkout_payment_method" id="payment_method" class="form-select" required onchange="togglePaymentFields()">
|
||||
{!! \App\Helpers\PaymentMethodSelectList::paymentShowMethods() !!}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-success">Complete Checkout</button>
|
||||
<div id="check_fields" class="col-md-4" style="display:none;">
|
||||
<label for="check_number" class="form-label">Check Number</label>
|
||||
<input type="text" name="check_number" id="check_number" class="form-control">
|
||||
</div>
|
||||
|
||||
<div id="cc_fields" class="col-md-4" style="display:none;">
|
||||
<label for="cc_transaction" class="form-label">Transaction ID / Last 4</label>
|
||||
<input type="text" name="cc_transaction" id="cc_transaction" class="form-control">
|
||||
<input type="hidden" name="cc_amount" value="{{ $info->total_cost }}">
|
||||
</div>
|
||||
|
||||
<div class="col-12 mt-4">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<i class="ti ti-check me-2"></i>Complete Checkout
|
||||
</button>
|
||||
<a href="/checkout" class="btn btn-link">Cancel and Start Over</a>
|
||||
</div>
|
||||
</form>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,6 +84,22 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('components.tomselect')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
function togglePaymentFields() {
|
||||
const method = document.getElementById('payment_method').value;
|
||||
const checkFields = document.getElementById('check_fields');
|
||||
const ccFields = document.getElementById('cc_fields');
|
||||
|
||||
checkFields.style.display = 'none';
|
||||
ccFields.style.display = 'none';
|
||||
|
||||
if (method === '2') { // Check
|
||||
checkFields.style.display = 'block';
|
||||
} else if (method === '3') { // Credit Card
|
||||
ccFields.style.display = 'block';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
{{ csrf_field() }}
|
||||
<div class="col-md-6">
|
||||
<label for="bidder_num" class="form-label">Bidder</label>
|
||||
<select name="bidder_num" id="bidder_num" class="form-select" required>
|
||||
<select name="checkoutbiddernum" id="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
|
||||
|
||||
Reference in New Issue
Block a user