First attempt at interface.

This commit is contained in:
James Cole 2016-01-13 15:59:45 +01:00
parent 668633e764
commit 768508dd4b
3 changed files with 104 additions and 15 deletions

View File

@ -9,6 +9,7 @@
namespace FireflyIII\Http\Controllers;
use Auth;
use FireflyIII\Http\Requests;
use View;
@ -35,6 +36,8 @@ class RuleController extends Controller
*/
public function index()
{
return view('rules.index');
$ruleGroups = Auth::user()->ruleGroups()->with('rules')->get();
return view('rules.index', compact('ruleGroups'));
}
}

View File

@ -1,16 +1,4 @@
<?php
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
// auth routes, i think
Route::group(
@ -247,6 +235,19 @@ Route::group(
*/
Route::get('/rules', ['uses' => 'RuleController@index', 'as' => 'rules.index']);
// rules:
Route::get('/rules/rules/create', ['uses' => 'RuleController@createRule', 'as' => 'rules.rule.create']);
Route::get('/rules/rules/up/{rule}', ['uses' => 'RuleController@upRule', 'as' => 'rules.rule.up']);
Route::get('/rules/rules/down/{rule}', ['uses' => 'RuleController@downRule', 'as' => 'rules.rule.down']);
Route::get('/rules/rules/edit/{rule}', ['uses' => 'RuleController@editRule', 'as' => 'rules.rule.edit']);
Route::get('/rules/rules/delete/{rule}', ['uses' => 'RuleController@deleteRule', 'as' => 'rules.rule.delete']);
// rule groups:
Route::get('/rules/groups/create', ['uses' => 'RuleController@createRuleGroup', 'as' => 'rules.rule-group.create']);
Route::get('/rules/groups/edit/{ruleGroup}', ['uses' => 'RuleController@editRuleGroup', 'as' => 'rules.rule-group.edit']);
Route::get('/rules/groups/delete/{ruleGroup}', ['uses' => 'RuleController@deleteRuleGroup', 'as' => 'rules.rule-group.delete']);
/**
* Search Controller
*/

View File

@ -6,15 +6,100 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">{{ 'rules'|_ }}</h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<div class="box-body">
Bla bla bla
<p>
{{ 'rules_explanation'|_ }}
</p>
</div>
</div>
</div>
</div>
{% for ruleGroup in ruleGroups %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ ruleGroup.title }}</h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<div class="btn-group">
<button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v"></i></button>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ route('rules.rule-group.edit',ruleGroup.id) }}"><i class="fa fa-pencil fa-fw"></i> {{ 'edit'|_ }}</a></li>
<li><a href="{{ route('rules.rule-group.delete',ruleGroup.id) }}"><i class="fa fa-trash fa-fw"></i> {{ 'delete'|_ }}</a>
</li>
</ul>
</div>
</div>
</div>
<div class="box-body">
<p>
<em>{{ ruleGroup.description }}</em>
</p>
{% if ruleGroup.rules.count > 0 %}
<table class="table table- table-striped sortable">
<thead>
<tr>
<th colspan="2">{{ 'rule_name'|_ }}</th>
<th>{{ 'rule_triggers'|_ }}</th>
<th>{{ 'rule_actions'|_ }}</th>
</tr>
</thead>
<tbody>
{% for rule in ruleGroup.rules %}
<tr>
<td>
<div class="btn-group btn-group-xs">
<a title="{{ 'rule_priority_up' }}" href="{{ route('rules.rule.up', rule.id) }}" class="btn btn-default"><span class="fa fa-arrow-up"></span></a>
<a title="{{ 'rule_priority_down' }}" href="{{ route('rules.rule.down', rule.id) }}" class="btn btn-default"><span class="fa fa-arrow-down"></span></a>
<a title="{{ 'edit'|_ }}" href="{{ route('rules.rule.edit', rule.id) }}" class="btn btn-default"><span class="fa fa-pencil"></span></a>
<a title="{{ 'delete'|_ }}" href="{{ route('rules.rule.delete', rule.id) }}" class="btn btn-danger"><span class="fa fa-trash"></span></a>
</div>
</td>
<td>{{ rule.title }}
{% if rule.description != "" %}
<small><br/>{{ rule.description }}</small>
{% endif %}
</td>
<td>X</td>
<td>Y</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>
<em>{{ 'no_rules_in_group'|_ }}</em>
</p>
{% endif %}
<p>
<br />
<a href="{{ route('rules.rule.create') }}" class="btn btn-success">{{ 'new_rule'|_ }}</a>
</p>
</div>
</div>
</div>
</div>
{% endfor %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<a href="{{ route('rules.rule-group.create') }}" class="btn btn-success">{{ 'new_rule_group'|_ }}</a>
</div>
</div>
{% endblock %}