color issues

This commit is contained in:
2020-06-22 20:46:01 -05:00
parent bed71908ae
commit 6cbe808b89

View File

@@ -248,13 +248,24 @@ class MoonsController extends Controller
if($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance') {
$rentalTemp = new Carbon($moon->rental_until);
$rentalEnd = $rentalTemp->format('m-d');
//Setup the correct color for the table
if($rentalTemp->diffInDays($today) < 3 && $today->lessThan($rentalTemp)) {
$color = 'table-warning';
} else if($today->greaterThan($rentalTemp)) {
$color = 'table-primary';
} else if($today->lessThan($rentalTemp)) {
$color = 'table-danger';
}
} else if($moon->rental_type == 'Alliance') {
$rentalTemp = $today->endOfMonth();
$rentalEnd = $rentalTemp->format('m-d');
$color = 'table-info';
} else {
//Set the rental date for if someone is not renting the moon
$rentalTemp = $lastMonth;
$rentalEnd = $rentalTemp->format('m-d');
$color = 'table-primary';
}
//Get the price of the moon from the database based on if the person is in Warped Intentions
@@ -265,21 +276,6 @@ class MoonsController extends Controller
$moonprice = $moon->out_of_alliance_rental_price;
}
//Get the color correct for the table
if($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance') {
if($rentalTemp->diffInDays($today) < 3 && $today->lessThan($rentalTemp) ) {
$color = 'table-danger';
} else if($today->greaterThan($rentalTemp)) {
$color = 'table-primary';
} else if($today->lessThan($rentalTemp)) {
$color = 'table-danger';
}
} else if($moon->rental_type == 'Alliance') {
$color = 'table-info';
} else {
$color = 'table-primary';
}
//Add the data to the html array to be passed to the view
array_push($table, [
'SPM' => $moon->system . " - " . $moon->planet . " - " . $moon->moon,