Skip to content

Commit

Permalink
Laravel 4 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneGlee committed May 12, 2019
1 parent 6685bdf commit 1d5a687
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Laravel4ReportGeneratorServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace FocalStrategy\ReportGenerator;

use Illuminate\Support\ServiceProvider;
use View;

class Laravel4ReportGeneratorServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
}

/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
$this->package('focalstrategy/report_generator');
View::addNamespace('report_generator', __DIR__.'/resources/views_4');
}
}
67 changes: 67 additions & 0 deletions src/resources/views_4/report.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@if (isset($provider) && Config::get('app.debug'))
<!-- Report Generator: VO = {{ $provider }} -->
@endif

<div class="card">
<h5 class="card-header">
{{ $title ?? 'No Title' }}
</h5>
@if(isset($prefix))
{{ $prefix }}
@endif
<div class="table-responsive">
<table data-pageLength="{{ isset($page_length) ? $page_length : 25 }}" class="table table-bordered table-hover datatable {{ isset($checkbox_select) ? 'checkbox_select' : '' }}">
<thead>
<tr>
@if (isset($checkbox_select))
<th class='checkbox_select'></th>
@endif
@foreach($structure as $col)
@if($col->isVisible())
<th class="{{ $col->isNumber() ? 'numeric_cell' : '' }}">{{ $col->getDisplayName() }}</th>
@endif
@endforeach
</tr>
</thead>
<tbody>
@foreach($data as $row)
<tr class="{{ $row->row_class or '' }}" {{ $row->row_data_attribute}}>
@if (isset($checkbox_select))
<td></td>
@endif
@foreach($structure as $col)
@if($col->isVisible())
@if($row->{$col->getFieldName()} != null)
{{ $row->{$col->getFieldName()} }}
@endif
@endif
@endforeach
</tr>
@endforeach
</tbody>
@if (!empty($aggregate) && count($aggregate) > 0)
<tfoot>
@foreach($aggregate as $ag)
<tr>
@if (isset($checkbox_select))
<th></th>
@endif
<th class="numeric_cell">
<strong>
{{ isset($ag['title']) ? str_replace(' ','&nbsp;', $ag['title']) : '' }}
</strong>
</th>
@foreach($structure as $col)
@if($ag['skip'] != $col->getFieldName())
@if($col->isVisible())
{{ $ag['data'][$col->getFieldName()] ?? '<th />' }}
@endif
@endif
@endforeach
</tr>
@endforeach
</tfoot>
@endif
</table>
</div>
</div>
24 changes: 24 additions & 0 deletions src/resources/views_4/report_async.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="card">
<h5 class="card-header">
{{ $title ?? 'No Title' }}
</h5>
@if(isset($prefix))
{{ $prefix }}
@endif
<div class="table-responsive">
<table class="table async_table" data-route="{{ $async_route }}" width="100%">
<thead>
<tr>
@foreach($structure as $col)
@if($col->isVisible())
<th data-name="{{ $col->getFieldName() }}" class="{{ $col->isNumber() ? 'numeric_cell' : '' }}">{{ $col->getDisplayName() }}</th>
@endif
@endforeach
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
</div>

0 comments on commit 1d5a687

Please sign in to comment.