Convert checkout view

This commit is contained in:
Russ Long 2018-12-24 12:42:54 -05:00
parent c171fb529a
commit 519ba8452b
2 changed files with 27 additions and 51 deletions

View File

@ -75,28 +75,17 @@ class PagesController extends Controller
return view('checkout_select_form'); return view('checkout_select_form');
} elseif (!$checkout_req->checkout_payment_method) { } elseif (!$checkout_req->checkout_payment_method) {
$checkout_bidder = $checkout_req->checkoutbiddernum; $checkout_bidder = $checkout_req->checkoutbiddernum;
$checkout_list_results = DB::select("SELECT $checkout_list_results = WinningBids::with('items')
*, items.item_assigned_num
FROM winning_bids
INNER JOIN items AS items
ON winning_bids.winning_item_num=items.iditems
WHERE winning_bidder_num = $checkout_bidder
");
WinningBids::with('items')
->where('winning_bidder_num', $checkout_bidder) ->where('winning_bidder_num', $checkout_bidder)
->get(); ->get();
$checkout_info_results = DB::select("SELECT $checkout_info_results = WinningBids::with('bidders')
winning_bids.*, ->where('winning_bidder_num', $checkout_bidder)
bidders.*, ->get();
sum(winning_cost) AS total_cost $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder)
FROM winning_bids ->sum('winning_cost');
INNER JOIN bidders AS bidders
ON winning_bids.winning_bidder_num=bidders.idbidders
WHERE winning_bidder_num = $checkout_bidder
GROUP BY winning_bids.winning_bidder_num
");
return view('checkout', [ return view('checkout', [
'checkout_list_results' => $checkout_list_results, 'checkout_list_results' => $checkout_list_results,
'$checkout_cost_result' => $checkout_cost_result,
'checkout_info_results' => $checkout_info_results 'checkout_info_results' => $checkout_info_results
]); ]);
} else { } else {
@ -106,23 +95,15 @@ class PagesController extends Controller
$check_number = $checkout_req->check_number; $check_number = $checkout_req->check_number;
$cc_transaction = $checkout_req->cc_transaction; $cc_transaction = $checkout_req->cc_transaction;
$cc_amount = $checkout_req->cc_amount; $cc_amount = $checkout_req->cc_amount;
$checkout_list_results = DB::select("SELECT $checkout_list_results = WinningBids::with('items')
*, items.item_assigned_num, items.item_desc ->where('winning_bidder_num', $checkout_bidder)
FROM winning_bids ->get();
INNER JOIN items AS items $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder)
ON winning_bids.winning_item_num=items.iditems ->sum('winning_cost');
WHERE winning_bidder_num = $bidder_num
"); $checkout_info_results = WinningBids::with('bidders')
$checkout_info_results = DB::select("SELECT ->where('winning_bidder_num', $bidder_num)
winning_bids.*, ->get();
bidders.*,
sum(winning_cost) AS total_cost
FROM winning_bids
INNER JOIN bidders AS bidders
ON winning_bids.winning_bidder_num=bidders.idbidders
WHERE winning_bidder_num = $bidder_num
GROUP BY winning_bids.winning_bidder_num
");
$checkout_result = DB::table('checkout')->insertGetID( $checkout_result = DB::table('checkout')->insertGetID(
[ [
'bidder_num' => $bidder_num, 'bidder_num' => $bidder_num,

View File

@ -6,48 +6,43 @@
<div class="col-md-10 col-md-offset-1"> <div class="col-md-10 col-md-offset-1">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Checkout</div> <div class="panel-heading">Checkout</div>
<div class="panel-body"> <div class="panel-body">
<form id="checkout_form" required method="post" action="/checkout" enctype="multipart/form-data" class=form-horizontal> <form id="checkout_form" required method="post" action="/checkout" enctype="multipart/form-data" class=form-horizontal>
{{ csrf_field() }} {{ csrf_field() }}
<table align='center' class='table table-striped table-condensed table-hover table-bordered'> <table align='center' class='table table-striped table-condensed table-hover table-bordered'>
@foreach($checkout_info_results as $checkout_info_result) @foreach($checkout_info_results as $checkout_info_result)
@php
$bidnum = $checkout_info_result->idbidders;
$totaldue = $checkout_info_result->total_cost;
@endphp
<tr> <tr>
<th colspan="2"> <th colspan="2">
<h2> <h2>
Bidder Number: {{ $checkout_info_result->bidder_assigned_number }} Bidder Number: {{ $checkout_info_result->bidders->bidder_assigned_number }}
</h2> </h2>
</th> </th>
<th colspan="2"> <th colspan="2">
<h2> <h2>
Total: ${{ $checkout_info_result->total_cost }} Total: ${{ $checkout_cost_result }}
</h2> </h2>
</th> </th>
</tr> </tr>
<tr> <tr>
<th colspan="2"> <th colspan="2">
Name: {{ $checkout_info_result->bidder_fname }} {{ $checkout_info_result->bidder_lname }} Name: {{ $checkout_info_result->bidders->bidder_fname }} {{ $checkout_info_result->bidders->bidder_lname }}
</th> </th>
<th colspan="2"> <th colspan="2">
Phone Number: {{ $checkout_info_result->bidder_phone }} Phone Number: {{ $checkout_info_result->bidders->bidder_phone }}
</th> </th>
</tr> </tr>
<tr> <tr>
<th> <th>
Address: {{ $checkout_info_result->bidder_addr }} Address: {{ $checkout_info_result->bidders->bidder_addr }}
</th> </th>
<th> <th>
City: {{ $checkout_info_result->bidder_city }} City: {{ $checkout_info_result->bidders->bidder_city }}
</th> </th>
<th> <th>
State: {{ $checkout_info_result->bidder_state }} State: {{ $checkout_info_result->bidders->bidder_state }}
</th> </th>
<th> <th>
Zip: {{ $checkout_info_result->bidder_zip }} Zip: {{ $checkout_info_result->bidders->bidder_zip }}
</th> </th>
</tr> </tr>
@endforeach @endforeach
@ -65,7 +60,7 @@
@foreach($checkout_list_results as $checkout_list_result) @foreach($checkout_list_results as $checkout_list_result)
<tr> <tr>
<td> <td>
{{ $checkout_list_result->item_assigned_num }} {{ $checkout_list_result->items->item_assigned_num }}
</td> </td>
<td> <td>
${{ $checkout_list_result->winning_cost }} ${{ $checkout_list_result->winning_cost }}
@ -109,8 +104,8 @@
<button type="submit" value="Submit" class="btn btn-primary">Checkout</button> <button type="submit" value="Submit" class="btn btn-primary">Checkout</button>
</div> </div>
</div> </div>
<input type="hidden" name="winnertotal" value={{ $totaldue }}> <input type="hidden" name="winnertotal" value={{ $checkout_cost_result }}>
<input type="hidden" name="checkoutbiddernum" value={{ $bidnum }}> <input type="hidden" name="checkoutbiddernum" value={{ $checkout_info_result->bidders->idbidders }}>
</form> </form>
</div> </div>
</div> </div>