Skip to content

Commit

Permalink
Add land advisor
Browse files Browse the repository at this point in the history
  • Loading branch information
WaveHack committed Jan 23, 2017
1 parent 2043eff commit e8c08c2
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 4 deletions.
85 changes: 84 additions & 1 deletion app/resources/views/pages/dominion/advisors/land.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,88 @@
@section('content')
@include('partials.dominion.advisor-selector')

todo
<div class="row">

<div class="col-sm-12 col-md-6">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title"><i class="ra ra-honeycomb"></i> Land Advisor</h3>
</div>
<div class="box-body no-padding">
<table class="table">
<colgroup>
<col>
<col width="100">
<col width="100">
<col width="100">
</colgroup>
<thead>
<tr>
<th>Land Type</th>
<th class="text-center">Number</th>
<th class="text-center">% of total</th>
<th class="text-center">Barren</th>
</tr>
</thead>
<tbody>
@foreach ($landHelper->getLandTypes() as $landType)
<tr>
<td>{{ ucfirst($landType) }}</td>
<td class="text-center">{{ number_format($selectedDominion->{'land_' . $landType}) }}</td>
<td class="text-center">{{ number_format((($selectedDominion->{'land_' . $landType} / $landCalculator->getTotalLand()) * 100), 2) }}%</td>
<td class="text-center">{{ number_format($landCalculator->getBarrenLandByLandType()[$landType]) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>

<div class="col-sm-12 col-md-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-clock-o"></i> Incoming land breakdown</h3>
</div>
<div class="box-body no-padding">
<table class="table">
<colgroup>
<col>
@for ($i = 0; $i < 13; $i++)
<col width="20">
@endfor
<col width="100">
</colgroup>
<thead>
<tr>
<th>Land Type</th>
@for ($i = 0; $i < 13; $i++)
<th class="text-center">{{ $i }}</th>
@endfor
<th class="text-center">Total</th>
</tr>
</thead>
<tbody>
@foreach ($landHelper->getLandTypes() as $landType)
<tr>
<td>{{ ucfirst($landType) }}</td>
@for ($i = 0; $i < 13; $i++)
<td class="text-center">
@if ($dominionQueueService->getExplorationQueue()[$landType][$i] === 0)
-
@else
{{ number_format($dominionQueueService->getExplorationQueue()[$landType][$i]) }}
@endif
</td>
@endfor
<td class="text-center">{{ number_format($dominionQueueService->getExplorationQueueTotalByLand($landType)) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>

</div>
@endsection
10 changes: 9 additions & 1 deletion src/Http/Controllers/DominionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ public function getAdvisorsMilitary()

public function getAdvisorsLand()
{
return view('pages.dominion.advisors.land');
$landHelper = app()->make(LandHelper::class);
$landCalculator = app()->make(LandCalculator::class);
$dominionQueueService = app()->make(DominionQueueService::class);

return view('pages.dominion.advisors.land', compact(
'landHelper',
'landCalculator',
'dominionQueueService'
));
}

public function getAdvisorsConstruction()
Expand Down
4 changes: 2 additions & 2 deletions src/Services/DominionQueueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public function getExplorationQueue()
->where('dominion_id', $this->dominion->id)
->get(['land_type', 'amount', 'hours']);

$explorationQueue = array_fill_keys($this->landHelper->getLandTypes(), array_fill(0, 12, 0));
$explorationQueue = array_fill_keys($this->landHelper->getLandTypes(), array_fill(0, 13, 0));

foreach ($rows as $row) {
$explorationQueue[$row->land_type][$row->hours - 1] = (int)$row->amount;
$explorationQueue[$row->land_type][$row->hours] = (int)$row->amount;
}

$this->explorationQueue = $explorationQueue;
Expand Down

0 comments on commit e8c08c2

Please sign in to comment.