moons admin controller coloring for moon rentals
This commit is contained in:
@@ -242,7 +242,6 @@ class MoonsAdminController extends Controller
|
|||||||
|
|
||||||
//Check if a current rental for the moon is on going
|
//Check if a current rental for the moon is on going
|
||||||
if(($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance')) {
|
if(($moon->rental_type == 'In Alliance' || $moon->rental_type == 'Out of Alliance')) {
|
||||||
|
|
||||||
$paid = $moon->paid;
|
$paid = $moon->paid;
|
||||||
$paidUntil = new Carbon($moon->paid_until);
|
$paidUntil = new Carbon($moon->paid_until);
|
||||||
$paidUntil = $paidUntil->format('m-d');
|
$paidUntil = $paidUntil->format('m-d');
|
||||||
@@ -251,17 +250,28 @@ class MoonsAdminController extends Controller
|
|||||||
$rentalTemp = new Carbon($moon->rental_until);
|
$rentalTemp = new Carbon($moon->rental_until);
|
||||||
$rentalEnd = $rentalTemp->format('m-d');
|
$rentalEnd = $rentalTemp->format('m-d');
|
||||||
|
|
||||||
|
//Set the correct color for the table
|
||||||
|
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
|
||||||
|
$color = 'table-warning';
|
||||||
|
} else if($today->lessThan($rentalTemp)) {
|
||||||
|
$color = 'table-danger';
|
||||||
|
} else {
|
||||||
|
$color = 'table-primary';
|
||||||
|
}
|
||||||
|
|
||||||
//Set the contact name based on the contact type
|
//Set the contact name based on the contact type
|
||||||
if($moon->rental_contact_type == 'Alliance') {
|
if($moon->rental_contact_type == 'Alliance') {
|
||||||
$allianceInfo = $lookupHelper->GetAllianceInfo($moon->rental_contact_id);
|
$allianceInfo = $lookupHelper->GetAllianceInfo($moon->rental_contact_id);
|
||||||
//Set the contact name and ticker
|
//Set the contact name and ticker
|
||||||
$contact = $allianceInfo->name;
|
$contact = $allianceInfo->name;
|
||||||
$ticker = $allianceInfo->ticker;
|
$ticker = $allianceInfo->ticker;
|
||||||
|
|
||||||
} else if($moon->rental_contact_type == 'Corporation') {
|
} else if($moon->rental_contact_type == 'Corporation') {
|
||||||
$corporationInfo = $lookupHelper->GetCorporationInfo($moon->rental_contact_id);
|
$corporationInfo = $lookupHelper->GetCorporationInfo($moon->rental_contact_id);
|
||||||
//Set the contact name and ticker
|
//Set the contact name and ticker
|
||||||
$contact = $corporationInfo->name;
|
$contact = $corporationInfo->name;
|
||||||
$ticker = $corporationInfo->ticker;
|
$ticker = $corporationInfo->ticker;
|
||||||
|
|
||||||
} else if($moon->rental_contact_type == 'Character') {
|
} else if($moon->rental_contact_type == 'Character') {
|
||||||
$characterInfo = $lookupHelper->GetCharacterInfo($moon->rental_contact_id);
|
$characterInfo = $lookupHelper->GetCharacterInfo($moon->rental_contact_id);
|
||||||
//Set the contact name
|
//Set the contact name
|
||||||
@@ -269,10 +279,12 @@ class MoonsAdminController extends Controller
|
|||||||
//Get the ticker for the character from the corporation he belongs to
|
//Get the ticker for the character from the corporation he belongs to
|
||||||
$corpInfo = $lookupHelper->GetCorporationInfo($characterInfo->corporation_id);
|
$corpInfo = $lookupHelper->GetCorporationInfo($characterInfo->corporation_id);
|
||||||
$ticker = $corpInfo->ticker;
|
$ticker = $corpInfo->ticker;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$contact = 'N/A';
|
$contact = 'N/A';
|
||||||
$ticker = 'N/A';
|
$ticker = 'N/A';
|
||||||
$type = 'N/A';
|
$type = 'N/A';
|
||||||
|
$color = 'table-primary';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if the moon is currently being utilized by the alliance
|
//Check if the moon is currently being utilized by the alliance
|
||||||
@@ -281,8 +293,10 @@ class MoonsAdminController extends Controller
|
|||||||
$paid = 'No';
|
$paid = 'No';
|
||||||
|
|
||||||
//Setup the rental end time as the end of the month
|
//Setup the rental end time as the end of the month
|
||||||
$rentalTemp = $today->endOfMonth();
|
$rentalTemp = Carbon::now()->endOfMonth();
|
||||||
$rentalEnd = $rentalTemp->format('m-d');
|
$rentalEnd = $rentalTemp->format('m-d');
|
||||||
|
//Set the color of the table
|
||||||
|
$color = 'table-info';
|
||||||
|
|
||||||
//Setup the paid time as the same as the rental end
|
//Setup the paid time as the same as the rental end
|
||||||
$paidUntiltemp = $rentalTemp;
|
$paidUntiltemp = $rentalTemp;
|
||||||
@@ -312,21 +326,15 @@ class MoonsAdminController extends Controller
|
|||||||
$renter = 'None';
|
$renter = 'None';
|
||||||
$ticker = 'N/A';
|
$ticker = 'N/A';
|
||||||
$type = 'N/A';
|
$type = 'N/A';
|
||||||
|
|
||||||
|
//Set the color of the table
|
||||||
|
$color = 'table-primary';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set up the moon rental type
|
//Set up the moon rental type
|
||||||
if($moon->rental_type == 'In Alliance') {
|
if($moon->rental_type == 'In Alliance') {
|
||||||
$type = 'IA';
|
$type = 'IA';
|
||||||
} else if($moon->rental_type == 'Out of Alliance') {
|
//Setup the row color
|
||||||
$type = 'OOA';
|
|
||||||
} else if($moon->rental_type == 'Alliance') {
|
|
||||||
$type = 'W4RP';
|
|
||||||
} else {
|
|
||||||
$type = 'N/A';
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set the color for the table
|
|
||||||
if($moon->rental_type != 'Alliance') {
|
|
||||||
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
|
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
|
||||||
$color = 'table-warning';
|
$color = 'table-warning';
|
||||||
} else if($today->lessThan($rentalTemp)) {
|
} else if($today->lessThan($rentalTemp)) {
|
||||||
@@ -334,8 +342,24 @@ class MoonsAdminController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$color = 'table-primary';
|
$color = 'table-primary';
|
||||||
}
|
}
|
||||||
} else {
|
} else if($moon->rental_type == 'Out of Alliance') {
|
||||||
|
$type = 'OOA';
|
||||||
|
//Setup the row color
|
||||||
|
if($rentalTemp->diffInDays(Carbon::now()) < 3 && $today->lessThan($rentalTemp)) {
|
||||||
|
$color = 'table-warning';
|
||||||
|
} else if($today->lessThan($rentalTemp)) {
|
||||||
|
$color = 'table-danger';
|
||||||
|
} else {
|
||||||
|
$color = 'table-primary';
|
||||||
|
}
|
||||||
|
} else if($moon->rental_type == 'Alliance') {
|
||||||
|
$type = 'W4RP';
|
||||||
|
//Set the row color
|
||||||
$color = 'table-info';
|
$color = 'table-info';
|
||||||
|
} else {
|
||||||
|
$type = 'N/A';
|
||||||
|
//Set the row color
|
||||||
|
$color = 'table-primary';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add the data to the html string to be passed to the view
|
//Add the data to the html string to be passed to the view
|
||||||
|
|||||||
Reference in New Issue
Block a user