Skip to content

Commit

Permalink
Show corporation assets contents
Browse files Browse the repository at this point in the history
  • Loading branch information
leonjza committed Dec 28, 2016
1 parent 6929851 commit 507caf2
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/Http/Controllers/Corporation/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public function getAssets(int $corporation_id)
{

$assets = $this->getCorporationAssets($corporation_id);
$asset_contents = $this->getCorporationAssetContents($corporation_id);

return view('web::corporation.assets', compact('assets'));
return view('web::corporation.assets', compact('assets', 'asset_contents'));
}

}
5 changes: 3 additions & 2 deletions src/resources/views/character/assets.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@
</tr>

</tbody>
@if($asset_contents->where('itemID',$asset->itemID)->count() > 0)

@if($asset_contents->where('itemID', $asset->itemID)->count() > 0)

<tbody style="display: none;" class="tbodycontent">

@foreach( $asset_contents->where('itemID',$asset->itemID) as $asset_content)
@foreach( $asset_contents->where('itemID', $asset->itemID) as $asset_content)

<tr class="hidding">
<td>{{ $asset_content->quantity }}</td>
Expand Down
100 changes: 81 additions & 19 deletions src/resources/views/corporation/assets.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,44 @@
<th>{{ trans('web::seat.group') }}</th>
</tr>
</thead>
<tbody>

@foreach($assets->unique('location')->groupBy('location') as $location => $data)

<tbody style="border-top: 0px;">

<tr class="active">
<td colspan="4">
<b>
@if($location)
{{ $location }}
@else
{{ trans('web::seat.unknown') }}
@endif
</b>
<b>{{ $location }}</b>
<span class="pull-right">
<i>
{{ count($assets->where('locationID', $data[0]->locationID)) }}
{{ trans('web::seat.items_taking') }}
{{ number_metric($assets
->where('locationID', $data[0]->locationID)->map(function($item) {
return $item->quantity * $item->volume;
})->sum()) }} m&sup3;
</i>
</span>
<i>
{{ count($assets->where('locationID', $data[0]->locationID)) }}
{{ trans('web::seat.items_taking') }}
{{ number_metric($assets
->where('locationID', $data[0]->locationID)->map(function($item) {
return $item->quantity * $item->volume;
})->sum()) }} m&sup3;
</i>
</span>
</td>
</tr>

</tbody>

@foreach($assets->where('locationID', $data[0]->locationID) as $asset)

<tbody style="border-top: 0px;">

<tr>
<td>{{ $asset->quantity }}</td>
@if($asset_contents->where('parentAssetItemID', $asset->itemID)->count() > 0)

<td><i class="fa fa-plus viewcontent" style="cursor: pointer;"></i></td>

@else

<td>{{ $asset->quantity }}</td>

@endif

<td>
{!! img('type', $asset->typeID, 32, ['class' => 'img-circle eve-icon small-icon']) !!}
{{ $asset->typeName }}
Expand All @@ -58,14 +66,68 @@
<td>{{ $asset->groupName }}</td>
</tr>

</tbody>

@if($asset_contents->where('parentAssetItemID', $asset->itemID)->count() > 0)

<tbody style="display: none;" class="tbodycontent">

@foreach( $asset_contents->where('parentAssetItemID', $asset->itemID) as $asset_content)

<tr class="hidding">
<td>{{ $asset_content->quantity }}</td>
<td>
{!! img('type', $asset_content->typeID, 32, ['class' => 'img-circle eve-icon small-icon']) !!}
{{ $asset_content->typeName }}
</td>
<td>{{ number_metric($asset_content->quantity * $asset_content->volume) }} m&sup3;</td>
<td>{{ $asset_content->groupName }}</td>
</tr>

@endforeach

</tbody>

@endif

@endforeach

@endforeach

</tbody>
</table>

</div><!-- /.box-body -->
</div>

@stop

@push('javascript')

<script type="text/javascript">
$(".viewcontent").on("click", function (event) {
// get the tbody tag direct after the button
var contents = $(this).closest("tbody").next("tbody");
// Show or hide
contents.toggle();
// Sstyling
if (contents.is(":visible")) {
$(this).removeClass("fa-plus").addClass("fa-minus");
$(this).closest("tr").css("background-color", "#D4D4D4"); // Heading Color
contents.css("background-color", "#E5E5E5"); // Table Contents Colot
} else {
$(this).removeClass("fa-minus").addClass("fa-plus");
$(this).closest("tr").css("background-color", "");
}
});
</script>

@endpush

0 comments on commit 507caf2

Please sign in to comment.