update to moon blade

This commit is contained in:
2019-02-23 21:50:58 -06:00
parent c3c24c580f
commit 9b0eb015f6
2 changed files with 41 additions and 23 deletions

View File

@@ -37,42 +37,44 @@ class MoonsController extends Controller
$moons = DB::table('Moons')->orderBy('System', 'asc')->get(); $moons = DB::table('Moons')->orderBy('System', 'asc')->get();
//declare the html variable and set it to null //declare the html variable and set it to null
$html = ''; $html = '';
$table = array();
$moonprice = null;
foreach($moons as $moon) { foreach($moons as $moon) {
//Setup formats as needed //Setup formats as needed
$spm = $moon->System . ' - ' . $moon->Planet . ' - ' . $moon->Moon; $spm = $moon->System . ' - ' . $moon->Planet . ' - ' . $moon->Moon;
$rentalEnd = new Carbon($moon->RentalEnd); $rentalEnd = new Carbon($moon->RentalEnd);
$rentalEnd = $rentalEnd->format('m-d'); $rentalEnd = $rentalEnd->format('m-d');
$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);
$worth = $moonCalc->SpatialMoonsTotalWorth($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity, $worth = $moonCalc->SpatialMoonsTotalWorth($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity); $moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
//Add the data to the html string to be passed to the view
$html .= '<tr>';
$html .= '<td>' . $spm . '</td>';
$html .= '<td>' . $moon->StructureName . '</td>';
$html .= '<td>' . $moon->FirstOre . '</td>';
$html .= '<td>' . $moon->FirstQuantity . '</td>';
$html .= '<td>' . $moon->SecondOre . '</td>';
$html .= '<td>' . $moon->SecondQuantity . '</td>';
$html .= '<td>' . $moon->ThirdOre . '</td>';
$html .= '<td>' . $moon->ThirdQuantity . '</td>';
$html .= '<td>' . $moon->FourthOre . '</td>';
$html .= '<td>' . $moon->FourthQuantity . '</td>';
if($type == 'W4RP') { if($type == 'W4RP') {
$html .= '<td>' . $price['alliance'] . '</td>'; $moonprice = $price['alliance'];
} else if ($type == 'Legacy') {
$html .= '<td>' . $price['outofalliance'] . '</td>';
} else { } else {
$html .= '<td>N/A</td>'; $moonprice = $price['outofalliance'];
}
$html .= '<td>' . number_format($worth, "2", ".", ",") . '</td>';
$html .= '<td>' . $rentalEnd . '</td>';
$html .= '</tr>';
} }
return view('moons/user/moon')->with('html', $html); //Add the data to the html string to be passed to the view
array_push($table, [
'SPM' => $spm,
'StructureName' => $moon->StrucutreName,
'FirstOre' => $moon->FirstOre,
'FirstQuantity' => $moon->FirstQuantity,
'SecondOre' => $moon->SecondOre,
'SecondQuantity' => $moon->SecondQuantity,
'ThirdOre' => $moon->ThirdOre,
'ThirdQuantity' => $moon->ThirdQuantity,
'FourthQuantity' => $moon->FourthQuantity,
'Price' => $moonprice,
'Worth' => number_format($worth, "2", ".", ","),
'RentalEnd' => $rentalEnd,
]);
}
return view('moons/user/moon')->with('table', $table);
} }
public function displayTotalWorthForm() { public function displayTotalWorthForm() {

View File

@@ -18,7 +18,23 @@
<th>Rental End</th> <th>Rental End</th>
</thead> </thead>
<tbody> <tbody>
{!! $html !!} @foreach($tables as $row)
<tr>
<td>{{ $row['SPM'] }}</td>
<td>{{ $row['StructureName'] }}</td>
<td>{{ $row['FirstOre'] }}</td>
<td>{{ $row['FirstQuantity'] }}</td>
<td>{{ $row['SecondOre'] }}</td>
<td>{{ $row['SecondQuantity'] }}</td>
<td>{{ $row['ThirdOre'] }}</td>
<td>{{ $row['ThirdQuantity'] }}</td>
<td>{{ $row['FourthOre'] }}</td>
<td>{{ $row['FourthQuantity'] }}</td>
<td>{{ $row['Price'] }}</td>
<td>{{ $row['Worth'] }}</td>
<td>{{ $row['RentalEnd'] }}</td>
</tr>
@endforeach
</tbody> </tbody>
</table> </table>
</div> </div>