add form for system rentals

This commit is contained in:
2020-08-12 02:56:47 -05:00
parent 15ec617fec
commit b916d0364c
2 changed files with 15 additions and 1 deletions

View File

@@ -32,6 +32,20 @@ class RentalAdminController extends Controller
//Get the rental systems from the database //Get the rental systems from the database
$rentals = RentalSystem::all(); $rentals = RentalSystem::all();
foreach($rentals as $rental) {
//Format the rental cost
if($rental->rental_cost > 1000000000.00) {
$rental->rental_cost = $rental->rental_cost / 1000000000.00;
$rental->rental_cost = $rental->rental_cost . "B";
} else if($rental->rental_cost > 1000000.00 && $rental->rental_cost < 999999999.99) {
$rental->rental_cost = $rental->rental_cost / 1000000.00;
$rental->rental_cost = $rental->rental_cost . "M";
}
//Format the date
$rental->paid_until = Carbon::parse($rental->paid_until)->format('Y-m-d');
}
//Return the view with the data //Return the view with the data
return view('rental.list')->with('rentals', $rentals); return view('rental.list')->with('rentals', $rentals);
} }

View File

@@ -25,7 +25,7 @@
<td>{{ $rental->corporation_name }}</td> <td>{{ $rental->corporation_name }}</td>
<td>{{ $rental->system_name }}</td> <td>{{ $rental->system_name }}</td>
<td>{{ number_format($rental->rental_cost, 0, ".", ",") }}</td> <td>{{ number_format($rental->rental_cost, 0, ".", ",") }}</td>
<td>{{ date_format($rental->paid_until, "Y-m-d") }}</td> <td>{{ $rental->paid_until }}</td>
<td> <td>
{!! Form::open(['action' => 'SystemRentals\RentalAdminController@updateRentalSystem', 'method' => 'POST']) !!} {!! Form::open(['action' => 'SystemRentals\RentalAdminController@updateRentalSystem', 'method' => 'POST']) !!}
{{ Form::date('paid_until', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }} {{ Form::date('paid_until', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }}