diff --git a/app/Http/Controllers/Moons/MoonsAdminController.php b/app/Http/Controllers/Moons/MoonsAdminController.php index 5c8550952..02799df89 100644 --- a/app/Http/Controllers/Moons/MoonsAdminController.php +++ b/app/Http/Controllers/Moons/MoonsAdminController.php @@ -89,6 +89,8 @@ class MoonsAdminController extends Controller //If we find a rental record, mark the moon as whether it's paid or not $paid = $rental->Paid; + $paidUntil = new Carbon($rental->Paid_Until); + $paidUntil = $paidUntil->format('m-d'); //Set the rental date up $rentalTemp = new Carbon($rental->RentalEnd); @@ -123,6 +125,7 @@ class MoonsAdminController extends Controller 'RentalEnd' => $rentalEnd, 'RowColor' => $color, 'Paid' => $paid, + 'PaidUntil' => $paidUntil, 'Contact' => $contact, 'Type' => $type, 'Renter' => $ticker, @@ -223,9 +226,9 @@ class MoonsAdminController extends Controller //Validate our request from the html form $this->validate($request, [ 'spmn' => 'required', - 'date' => 'required', 'contact' => 'required', 'paid_until' => 'required', + 'rental_end' => 'required', ]); //Decode the System, Planet, Moon, Name combinatio sent from the controller @@ -264,13 +267,20 @@ class MoonsAdminController extends Controller $renter = $alliance->ticker; } - //Create the date + //Create the paid until date if(isset($request->paid_until)) { $paidUntil = new Carbon($request->paid_until . '00:00:01'); } else { $paidUntil = Carbon::now(); } + //Create the rental end date + if(isset($request->rental_end)) { + $rentalEnd = new Carbon($request->date . '00:00:01'); + } else { + $rentalEnd = Carbon::now(); + } + //Calculate the price of the moon for when it's updated $moon = Moon::where([ 'System' => $system, diff --git a/resources/views/moons/admin/adminmoon.blade.php b/resources/views/moons/admin/adminmoon.blade.php index 763dfcc03..ca7dc1c29 100644 --- a/resources/views/moons/admin/adminmoon.blade.php +++ b/resources/views/moons/admin/adminmoon.blade.php @@ -13,6 +13,7 @@ Contact Rental End Paid? + Paid Until Remove Renter @@ -25,11 +26,12 @@ {{ $row['Renter'] }} {{ $row['Contact'] }} {{ $row['RentalEnd'] }} - @if($row['Paid'] == 'Yes') - Yes - @else - No - @endif + @if($row['Paid'] == 'Yes') + Yes + @else + No + @endif + {{ $row['PaidUntil'] }} {{ Form::radio('remove', $row['SPM'], false, ['class' => 'form-control']) }} @endforeach diff --git a/resources/views/moons/admin/updatemoon.blade.php b/resources/views/moons/admin/updatemoon.blade.php index 66ee57994..d1fd201ec 100644 --- a/resources/views/moons/admin/updatemoon.blade.php +++ b/resources/views/moons/admin/updatemoon.blade.php @@ -12,7 +12,11 @@ {{ Form::text('contact', '', ['class' => 'form-control', 'placeholder' => 'Character']) }}
- {{ Form::label('paid_until', 'Rental End Date') }} + {{ Form::label('rental_end', 'Rental End Date') }} + {{ Form::date('rental_end', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }} +
+
+ {{ Form::label('paid_until', 'Paid Until') }} {{ Form::date('paid_until', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }}