removed removal box from update moons
This commit is contained in:
@@ -190,6 +190,7 @@ class MoonsAdminController extends Controller
|
|||||||
array_push($spmnTemp, $temp);
|
array_push($spmnTemp, $temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//From our temporary array with all the values in a numbered key, create the real array with the value being the key
|
||||||
foreach($spmnTemp as $key => $value) {
|
foreach($spmnTemp as $key => $value) {
|
||||||
$spmn[$value] = $value;
|
$spmn[$value] = $value;
|
||||||
}
|
}
|
||||||
@@ -200,6 +201,7 @@ class MoonsAdminController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function storeUpdateMoon(Request $request) {
|
public function storeUpdateMoon(Request $request) {
|
||||||
|
//Declare some static variables as needed
|
||||||
$moonCalc = new MoonCalc;
|
$moonCalc = new MoonCalc;
|
||||||
$lookup = new LookupHelper;
|
$lookup = new LookupHelper;
|
||||||
$paid = false;
|
$paid = false;
|
||||||
@@ -208,13 +210,14 @@ class MoonsAdminController extends Controller
|
|||||||
$moon = null;
|
$moon = null;
|
||||||
$name = null;
|
$name = null;
|
||||||
|
|
||||||
|
//Validate our request from the html form
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'spmn' => 'required',
|
'spmn' => 'required',
|
||||||
'renter' => 'required',
|
'renter' => 'required',
|
||||||
'date' => 'required',
|
'date' => 'required',
|
||||||
'contact' => 'required',
|
'contact' => 'required',
|
||||||
]);
|
]);
|
||||||
dd($request->spmn);
|
|
||||||
//Decode the System, Planet, Moon, Name combinatio sent from the controller
|
//Decode the System, Planet, Moon, Name combinatio sent from the controller
|
||||||
$str_array = explode(" - ", $request->spmn);
|
$str_array = explode(" - ", $request->spmn);
|
||||||
$system = $str_array[0];
|
$system = $str_array[0];
|
||||||
@@ -229,12 +232,14 @@ class MoonsAdminController extends Controller
|
|||||||
$contact = $lookup->CharacterNameToId($request->contact);
|
$contact = $lookup->CharacterNameToId($request->contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Update the paid value for database entry
|
||||||
if($request->paid == 'Yes') {
|
if($request->paid == 'Yes') {
|
||||||
$paid = 'Yes';
|
$paid = 'Yes';
|
||||||
} else {
|
} else {
|
||||||
$paid = 'No';
|
$paid = 'No';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Update the paid unti value for the database entry
|
||||||
if(isset($request->Paid_Until)) {
|
if(isset($request->Paid_Until)) {
|
||||||
$paidUntil = $request->Paid_Until;
|
$paidUntil = $request->Paid_Until;
|
||||||
} else {
|
} else {
|
||||||
@@ -247,6 +252,7 @@ class MoonsAdminController extends Controller
|
|||||||
//Create the date
|
//Create the date
|
||||||
$date = new Carbon($request->date . '00:00:01');
|
$date = new Carbon($request->date . '00:00:01');
|
||||||
|
|
||||||
|
//Count how many rentals we find for later database processing
|
||||||
$count = MoonRental::where([
|
$count = MoonRental::where([
|
||||||
'System' => $system,
|
'System' => $system,
|
||||||
'Planet' => $planet,
|
'Planet' => $planet,
|
||||||
@@ -261,9 +267,12 @@ class MoonsAdminController extends Controller
|
|||||||
'Moon' => $moon,
|
'Moon' => $moon,
|
||||||
])->first();
|
])->first();
|
||||||
|
|
||||||
|
//Calculate the price of the rental and store it in the database
|
||||||
$price = $moonCalc->SpatialMoonsOnlyGoo($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
|
$price = $moonCalc->SpatialMoonsOnlyGoo($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
|
||||||
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
|
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
|
||||||
|
|
||||||
|
//If the database entry isn't found, then insert it into the database,
|
||||||
|
//otherwise, account for it being in the system already.
|
||||||
if($count != 0) {
|
if($count != 0) {
|
||||||
if($allianceId = 99004116) {
|
if($allianceId = 99004116) {
|
||||||
MoonRental::where([
|
MoonRental::where([
|
||||||
|
|||||||
@@ -26,10 +26,6 @@
|
|||||||
{{ Form::label('paid', 'Yes') }}
|
{{ Form::label('paid', 'Yes') }}
|
||||||
{{ Form::radio('paid', 'Yes') }}
|
{{ Form::radio('paid', 'Yes') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('removal', 'Remove Renter') }}
|
|
||||||
{{ Form::checkbox('removal', true, false) }}
|
|
||||||
</div>
|
|
||||||
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user