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 //If we find a rental record, mark the moon as whether it's paid or not
$paid = $rental->Paid; $paid = $rental->Paid;
$paidUntil = new Carbon($rental->Paid_Until);
$paidUntil = $paidUntil->format('m-d');
//Set the rental date up //Set the rental date up
$rentalTemp = new Carbon($rental->RentalEnd); $rentalTemp = new Carbon($rental->RentalEnd);
@@ -123,6 +125,7 @@ class MoonsAdminController extends Controller
'RentalEnd' => $rentalEnd, 'RentalEnd' => $rentalEnd,
'RowColor' => $color, 'RowColor' => $color,
'Paid' => $paid, 'Paid' => $paid,
'PaidUntil' => $paidUntil,
'Contact' => $contact, 'Contact' => $contact,
'Type' => $type, 'Type' => $type,
'Renter' => $ticker, 'Renter' => $ticker,
@@ -223,9 +226,9 @@ class MoonsAdminController extends Controller
//Validate our request from the html form //Validate our request from the html form
$this->validate($request, [ $this->validate($request, [
'spmn' => 'required', 'spmn' => 'required',
'date' => 'required',
'contact' => 'required', 'contact' => 'required',
'paid_until' => 'required', 'paid_until' => 'required',
'rental_end' => 'required',
]); ]);
//Decode the System, Planet, Moon, Name combinatio sent from the controller //Decode the System, Planet, Moon, Name combinatio sent from the controller
@@ -264,13 +267,20 @@ class MoonsAdminController extends Controller
$renter = $alliance->ticker; $renter = $alliance->ticker;
} }
//Create the date //Create the paid until date
if(isset($request->paid_until)) { if(isset($request->paid_until)) {
$paidUntil = new Carbon($request->paid_until . '00:00:01'); $paidUntil = new Carbon($request->paid_until . '00:00:01');
} else { } else {
$paidUntil = Carbon::now(); $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 //Calculate the price of the moon for when it's updated
$moon = Moon::where([ $moon = Moon::where([
'System' => $system, 'System' => $system,

View File

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

View File

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