moons and flex structures

This commit is contained in:
2020-02-03 23:47:48 -06:00
parent 1f2686ed28
commit d76b8c965a
3 changed files with 24 additions and 8 deletions

View File

@@ -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,

View File

@@ -13,6 +13,7 @@
<th>Contact</th>
<th>Rental End</th>
<th>Paid?</th>
<th>Paid Until</th>
<th>Remove Renter</th>
</thead>
<tbody>
@@ -25,11 +26,12 @@
<td>{{ $row['Renter'] }}</td>
<td>{{ $row['Contact'] }}</td>
<td>{{ $row['RentalEnd'] }}</td>
@if($row['Paid'] == 'Yes')
<td>Yes</td>
@else
<td>No</td>
@endif
@if($row['Paid'] == 'Yes')
<td>Yes</td>
@else
<td>No</td>
@endif
<td>{{ $row['PaidUntil'] }}</td>
<td>{{ Form::radio('remove', $row['SPM'], false, ['class' => 'form-control']) }}</td>
</tr>
@endforeach

View File

@@ -12,7 +12,11 @@
{{ Form::text('contact', '', ['class' => 'form-control', 'placeholder' => 'Character']) }}
</div>
<div class="form-group col-md-6">
{{ 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']) }}
</div>
<div class="form-group col-md-6">
{{ Form::label('paid_until', 'Paid Until') }}
{{ Form::date('paid_until', \Carbon\Carbon::now()->endOfMonth(), ['class' => 'form-control']) }}
</div>
<div class="form-group">