Skip to content

Firefly III: a personal finances manager

More templates converted to twig.

James Colec98275e73a12
diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php
index 610ad4418f..0574f00b80 100644
--- a/app/Http/breadcrumbs.php
+++ b/app/Http/breadcrumbs.php
@@ -22,6 +22,14 @@ Breadcrumbs::register(
}
);
+Breadcrumbs::register(
+ 'index',
+ function (Generator $breadcrumbs) {
+
+ $breadcrumbs->push('Home', route('index'));
+ }
+);
+
// accounts
Breadcrumbs::register(
'accounts.index', function (Generator $breadcrumbs, $what) {
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index bfff79a9f2..af0a5a5b8e 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -35,6 +35,7 @@ class AppServiceProvider extends ServiceProvider
'Illuminate\Contracts\Auth\Registrar',
'FireflyIII\Services\Registrar'
);
+
}
}
diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php
index 94d9ee03fd..c4deebb1d1 100644
--- a/app/Providers/ConfigServiceProvider.php
+++ b/app/Providers/ConfigServiceProvider.php
@@ -23,7 +23,212 @@ class ConfigServiceProvider extends ServiceProvider
{
config(
[
- //
+ 'twigbridge' => [
+
+ 'twig' => [
+ /*
+ |--------------------------------------------------------------------------
+ | Extension
+ |--------------------------------------------------------------------------
+ |
+ | File extension for Twig view files.
+ |
+ */
+ 'extension' => 'twig',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Accepts all Twig environment configuration options
+ |--------------------------------------------------------------------------
+ |
+ | http://twig.sensiolabs.org/doc/api.html#environment-options
+ |
+ */
+ 'environment' => [
+
+ // When set to true, the generated templates have a __toString() method
+ // that you can use to display the generated nodes.
+ // default: false
+ 'debug' => config('app.debug', false),
+
+ // The charset used by the templates.
+ // default: utf-8
+ 'charset' => 'utf-8',
+
+ // The base template class to use for generated templates.
+ // default: TwigBridge\Twig\Template
+ 'base_template_class' => 'TwigBridge\Twig\Template',
+
+ // An absolute path where to store the compiled templates, or false to disable caching. If null
+ // then the cache file path is used.
+ // default: cache file storage path
+ 'cache' => null,
+
+ // When developing with Twig, it's useful to recompile the template
+ // whenever the source code changes. If you don't provide a value
+ // for the auto_reload option, it will be determined automatically based on the debug value.
+ 'auto_reload' => true,
+
+ // If set to false, Twig will silently ignore invalid variables
+ // (variables and or attributes/methods that do not exist) and
+ // replace them with a null value. When set to true, Twig throws an exception instead.
+ // default: false
+ 'strict_variables' => false,
+
+ // If set to true, auto-escaping will be enabled by default for all templates.
+ // default: true
+ 'autoescape' => true,
+
+ // A flag that indicates which optimizations to apply
+ // (default to -1 -- all optimizations are enabled; set it to 0 to disable)
+ 'optimizations' => -1,
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Global variables
+ |--------------------------------------------------------------------------
+ |
+ | These will always be passed in and can be accessed as Twig variables.
+ | NOTE: these will be overwritten if you pass data into the view with the same key.
+ |
+ */
+ 'globals' => [],
+ ],
+
+ 'extensions' => [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Extensions
+ |--------------------------------------------------------------------------
+ |
+ | Enabled extensions.
+ |
+ | `Twig_Extension_Debug` is enabled automatically if twig.debug is TRUE.
+ |
+ */
+ 'enabled' => [
+ 'TwigBridge\Extension\Loader\Facades',
+ 'TwigBridge\Extension\Loader\Filters',
+ 'TwigBridge\Extension\Loader\Functions',
+
+ 'TwigBridge\Extension\Laravel\Auth',
+ 'TwigBridge\Extension\Laravel\Config',
+ 'TwigBridge\Extension\Laravel\Dump',
+ 'TwigBridge\Extension\Laravel\Input',
+ 'TwigBridge\Extension\Laravel\Session',
+ 'TwigBridge\Extension\Laravel\String',
+ 'TwigBridge\Extension\Laravel\Translator',
+ 'TwigBridge\Extension\Laravel\Url',
+
+ // 'TwigBridge\Extension\Laravel\Form',
+ // 'TwigBridge\Extension\Laravel\Html',
+ // 'TwigBridge\Extension\Laravel\Legacy\Facades',
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Facades
+ |--------------------------------------------------------------------------
+ |
+ | Available facades. Access like `{{ Config.get('foo.bar') }}`.
+ |
+ | Each facade can take an optional array of options. To mark the whole facade
+ | as safe you can set the option `'is_safe' => true`. Setting the facade as
+ | safe means that any HTML returned will not be escaped.
+ |
+ | It is advisable to not set the whole facade as safe and instead mark the
+ | each appropriate method as safe for security reasons. You can do that with
+ | the following syntax:
+ |
+ | <code>
+ | 'Form' => [
+ | 'is_safe' => [
+ | 'open'
+ | ]
+ | ]
+ | </code>
+ |
+ | The values of the `is_safe` array must match the called method on the facade
+ | in order to be marked as safe.
+ |
+ */
+ 'facades' => [
+ 'Breadcrumbs' => [
+ 'is_safe' => [
+ 'renderIfExists'
+ ]
+ ],
+ 'Session',
+ 'Route'
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Functions
+ |--------------------------------------------------------------------------
+ |
+ | Available functions. Access like `{{ secure_url(...) }}`.
+ |
+ | Each function can take an optional array of options. These options are
+ | passed directly to `Twig_SimpleFunction`.
+ |
+ | So for example, to mark a function as safe you can do the following:
+ |
+ | <code>
+ | 'link_to' => [
+ | 'is_safe' => ['html']
+ | ]
+ | </code>
+ |
+ | The options array also takes a `callback` that allows you to name the
+ | function differently in your Twig templates than what it's actually called.
+ |
+ | <code>
+ | 'link' => [
+ | 'callback' => 'link_to'
+ | ]
+ | </code>
+ |
+ */
+ 'functions' => [
+ 'elixir',
+ 'head',
+ 'last',
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Filters
+ |--------------------------------------------------------------------------
+ |
+ | Available filters. Access like `{{ variable|filter }}`.
+ |
+ | Each filter can take an optional array of options. These options are
+ | passed directly to `Twig_SimpleFilter`.
+ |
+ | So for example, to mark a filter as safe you can do the following:
+ |
+ | <code>
+ | 'studly_case' => [
+ | 'is_safe' => ['html']
+ | ]
+ | </code>
+ |
+ | The options array also takes a `callback` that allows you to name the
+ | filter differently in your Twig templates than what is actually called.
+ |
+ | <code>
+ | 'snake' => [
+ | 'callback' => 'snake_case'
+ | ]
+ | </code>
+ |
+ */
+ 'filters' => [],
+ ],
+ ]
]
);
}
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index 1b57c3508e..e047b1dbb9 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -3,6 +3,7 @@
namespace FireflyIII\Providers;
use App;
+use FireflyIII\Models\Account;
use FireflyIII\Support\Amount;
use FireflyIII\Support\ExpandedForm;
use FireflyIII\Support\Navigation;
@@ -10,7 +11,10 @@ use FireflyIII\Support\Preferences;
use FireflyIII\Support\Steam;
use FireflyIII\Validation\FireflyValidator;
use Illuminate\Support\ServiceProvider;
+use Route;
use Twig;
+use Twig_SimpleFilter;
+use Twig_SimpleFunction;
use TwigBridge\Extension\Loader\Functions;
use Validator;
@@ -28,14 +32,89 @@ class FireflyServiceProvider extends ServiceProvider
return new FireflyValidator($translator, $data, $rules, $messages);
}
);
+ /*
+ * Default Twig configuration:
+ */
+ $config = App::make('config');
+ Twig::addExtension(new Functions($config));
+
+ /*
+ * Amount::format
+ */
+ $filter = new Twig_SimpleFilter(
+ 'formatAmount', function ($string) {
+ return App::make('amount')->format($string);
+ }, ['is_safe' => ['html']]
+ );
+ Twig::addFilter($filter);
+
+ /*
+ * Amount::formatJournal
+ */
+ $filter = new Twig_SimpleFilter(
+ 'formatJournal', function ($journal) {
+ return App::make('amount')->formatJournal($journal);
+ }, ['is_safe' => ['html']]
+ );
+ Twig::addFilter($filter);
+
+ /*
+ * Steam::balance()
+ */
+
+ $filter = new Twig_SimpleFilter(
+ 'balance', function (Account $account = null) {
+ if (is_null($account)) {
+ return 'NULL';
+ }
+
+ return App::make('amount')->format(App::make('steam')->balance($account));
+ //return App::make('steam')->balance($account);
+ },['is_safe' => ['html']]
+ );
+ Twig::addFilter($filter);
+
+
+ /*
+ * Current active route.
+ */
+ $filter = new Twig_SimpleFilter(
+ 'activeRoute', function ($string) {
+ if (Route::getCurrentRoute()->getName() == $string) {
+ return 'active';
+ }
+
+ return '';
+ }
+ );
+ Twig::addFilter($filter);
+
+ /*
+ * Amount::getCurrencyCode()
+ */
+ $function = new Twig_SimpleFunction(
+ 'getCurrencyCode', function () {
+ return App::make('amount')->getCurrencyCode();
+ }
+ );
+ Twig::addFunction($function);
+
+
+ /*
+ * env
+ */
+ $function = new Twig_SimpleFunction(
+ 'env', function ($a, $b) {
+ return env($a, $b);
+ }
+ );
+ Twig::addFunction($function);
}
public function register()
{
- $config = App::make('config');
- Twig::addExtension(new Functions($config));
$this->app->bind(
'preferences', function () {
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index b886074aa9..b8cf753024 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -13,6 +13,7 @@ use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Validation\Validator;
use Log;
use Navigation;
+use Symfony\Component\Translation\TranslatorInterface;
/**
* Class FireflyValidator
@@ -22,6 +23,18 @@ use Navigation;
class FireflyValidator extends Validator
{
+ /**
+ * @param TranslatorInterface $translator
+ * @param array $data
+ * @param array $rules
+ * @param array $messages
+ * @param array $customAttributes
+ */
+ public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = [])
+ {
+ parent::__construct($translator, $data, $rules, $messages);
+ }
+
/**
* @param $attribute
* @param $value
diff --git a/resources/twig/index.twig b/resources/twig/index.twig
new file mode 100644
index 0000000000..c767243e4c
--- /dev/null
+++ b/resources/twig/index.twig
@@ -0,0 +1,215 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+{{ Breadcrumbs.renderIfExists }}
+
+{% if count == 0 %}
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12">
+ <p class="lead">Welcome to Firefly III.</p>
+
+ <p>
+ Create a new asset account to get started.
+ </p>
+ </div>
+</div>
+<div class="row">
+ <div class="col-lg-6 col-md-6 col-sm-12">
+ <h2><a href="{{route('accounts.create','asset')}}">Start from scratch</a></h2>
+ </div>
+{% else %}
+
+ <!-- fancy new boxes -->
+ {% include 'partials/boxes.twig' %}
+
+<div class="row">
+ <div class="col-lg-8 col-md-12 col-sm-12">
+ <!-- ACCOUNTS -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-credit-card fa-fw"></i> <a href="#">Your accounts</a>
+ </div>
+ <div class="panel-body">
+ <div id="accounts-chart"></div>
+ </div>
+ </div>
+ <!-- BUDGETS -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-tasks fa-fw"></i> <a href="{{route('budgets.index')}}">Budgets and spending</a>
+ </div>
+ <div class="panel-body">
+ <div id="budgets-chart"></div>
+ </div>
+ </div>
+ <!-- CATEGORIES -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-bar-chart fa-fw"></i> <a href="{{route('categories.index')}}">Categories</a>
+ </div>
+ <div class="panel-body">
+ <div id="categories-chart"></div>
+ </div>
+ </div>
+
+ <!-- SAVINGS -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-line-chart"></i> Savings
+ <span class="pull-right">{{ savingsTotal|formatAmount }}</span>
+ </div>
+ <div class="panel-body">
+ {% if savings|length == 0 %}
+ <p class="small"><em>Mark your asset accounts as "Savings account" to fill this panel.</em></p>
+ {% else %}
+ {% for account in savings %}
+ <div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><h5><a href="{{ route('accounts.show') }}">{{ account.name }}</a></h5></div>
+ </div>
+ <div class="row">
+ <!-- start -->
+ <div class="col-lg-2 col-md-2 col-sm-3 col-xs-4">{{ account.startBalance|formatAmount }}</div>
+ <!-- bar -->
+ <div class="col-lg-8 col-md-8 col-sm-6 col-xs-4">
+ {% if account.difference < 0 %}
+ <!-- green (100-pct), then red (pct) -->
+ <div class="progress">
+ <div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{ 100 - account.percentage }}%">
+ {% if account.percentage <= 50 %}
+ {{account.difference|formatAmount}}
+ {% endif %}
+ </div>
+ <div class="progress-bar progress-bar-danger progress-bar-striped" style="width: {{ account.percentage }}%">
+ {% if account.percentage > 50 %}
+ {{account.difference|formatAmount}}
+ {% endif %}
+ </div>
+ </div>
+ {% else %}
+ <!-- green (pct), then blue (100-pct) -->
+ <div class="progress">
+ <div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{account.percentage}}%">
+ {% if account.percentage <= 50 %}
+ {{account.difference|formatAmount}}
+ {{account.difference|formatAmount}}
+ {% endif %}
+ </div>
+ <div class="progress-bar progress-bar-info progress-bar-striped" style="width: {{100 - account.percentage}}%">
+ {% if account.percentage > 50 %}
+ {{account.difference|formatAmount}}
+ {% endif %}
+ </div>
+ </div>
+ {% endif %}
+
+ </div>
+ <!-- end -->
+ <div class="col-lg-2 col-md-2 col-sm-3 col-xs-4">{{ account.endBalance|formatAmount }}</div>
+ </div>
+ {% endfor %}
+ {% endif %}
+ </div>
+ </div>
+
+ <!-- PIGGY BANKS -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-sort-amount-asc fa-fw"></i> Piggy banks
+ </div>
+ <div class="panel-body">
+ {% if piggyBankAccounts|length == 0%}
+ <p class="small"><em>Create piggy banks to fill this panel.</em></p>
+ {% else %}
+ {% for account in piggyBankAccounts %}
+ <div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><h5><a href="{{route('accounts.show')}}">{{account.name}}</a></h5></div>
+ </div>
+ <div class="row">
+ <!-- start -->
+ <div class="col-lg-2 col-md-2 col-sm-3 col-xs-4">{{ account.startBalance|formatAmount }}</div>
+ <!-- bar -->
+ <div class="col-lg-8 col-md-8 col-sm-6 col-xs-4">
+
+ <div class="progress">
+ <div class="progress-bar progress-bar-info progress-bar-striped" style="width: {{100 - account.percentage}}%">
+ {% if account.percentage <= 50 %}
+ {{account.piggyBalance|formatAmount}} divided
+ {% endif %}
+ </div>
+ <div class="progress-bar progress-bar-success progress-bar-striped" style="width: {{account.percentage}}%">
+ {% if account.percentage > 50 %}
+ {{account.difference|formatAmount}} left to divide
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ <!-- end -->
+ <div class="col-lg-2 col-md-2 col-sm-3 col-xs-4">{{ account.piggyBalance|formatAmount }}</div>
+ </div>
+ {% endfor %}
+ {% endif %}
+ </div>
+ </div>
+
+
+ </div>
+ <div class="col-lg-4 col-md-6 col-sm-12">
+
+ <!-- REMINDERS -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-calendar-o"></i> <a href="{{route('bills.index')}}">Bills</a>
+ </div>
+ <div class="panel-body">
+ <div id="bills-chart"></div>
+ </div>
+ </div>
+
+ <!-- TRANSACTIONS -->
+ {% for data in transactions %}
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-money fa-fw"></i>
+ <a href="{{route('accounts.show',data[1].id)}}">{{data[1].name}}</a> ({{ data[1]|balance }})
+
+
+ <!-- ACTIONS MENU -->
+ <div class="pull-right">
+ <div class="btn-group">
+ <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
+ Actions
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu pull-right" role="menu">
+ <li><a href="{{route('transactions.create','withdrawal')}}?account_id={{data[1].id}}"><i class="fa fa-long-arrow-left fa-fw"></i> New withdrawal</a></li>
+ <li><a href="{{route('transactions.create','deposit')}}?account_id={{data[1].id}}"><i class="fa fa-long-arrow-right fa-fw"></i> New deposit</a></li>
+ <li><a href="{{route('transactions.create','transfer')}}?account_from_id={{data[1].id}}"><i class="fa fa-fw fa-exchange"></i> New transfer</a></li>
+ </ul>
+ </div>
+ </div>
+
+
+
+ </div>
+ <div class="panel-body">
+
+ {% include 'list/journals-tiny.twig' with {'transactions': data[0],'account': data[1]} %}
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+</div>
+
+{% endif %}
+
+
+{% endblock %}
+{% block scripts %}
+ <script type="text/javascript">
+ var currencyCode = '{{getCurrencyCode }}';
+ </script>
+ <!-- load the libraries and scripts necessary for Google Charts: -->
+ <script type="text/javascript" src="https://www.google.com/jsapi"></script>
+ <script type="text/javascript" src="js/gcharts.options.js"></script>
+ <script type="text/javascript" src="js/gcharts.js"></script>
+ <script type="text/javascript" src="js/index.js"></script>
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/layout/default.twig b/resources/twig/layout/default.twig
new file mode 100644
index 0000000000..58d5289c8e
--- /dev/null
+++ b/resources/twig/layout/default.twig
@@ -0,0 +1,157 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <base href="{{ route('index') }}/">
+ <title>Firefly
+ {% if title != "Firefly" %}
+ // {{ title }}
+ {% endif %}
+
+ {% if subTitle %}
+ // {{subTitle}}
+ {% endif %}
+ </title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,700,300italic" type="ext/css" media="all" />
+ <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="css/metisMenu.min.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="css/sb-admin-2.css" type="text/css" media="all" />
+ <!-- date range -->
+ <link rel="stylesheet" href="css/daterangepicker-bs3.css" type="text/css" media="all" />
+
+ <link rel="stylesheet" href="css/firefly.css" type="text/css" media="all" />
+
+
+ {% block styles %}{% endblock %}
+
+ <!-- favicons -->
+ <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png?v=Lb54KlrQnz">
+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png?v=Lb54KlrQnz">
+ <link rel="icon" type="image/png" href="/favicon-32x32.png?v=Lb54KlrQnz" sizes="32x32">
+ <link rel="icon" type="image/png" href="/android-chrome-192x192.png?v=Lb54KlrQnz" sizes="192x192">
+ <link rel="icon" type="image/png" href="/favicon-96x96.png?v=Lb54KlrQnz" sizes="96x96">
+ <link rel="icon" type="image/png" href="/favicon-16x16.png?v=Lb54KlrQnz" sizes="16x16">
+ <link rel="manifest" href="/manifest.json?v=Lb54KlrQnz">
+ <link rel="shortcut icon" href="/favicon.ico?v=Lb54KlrQnz">
+ <meta name="msapplication-TileColor" content="#2d89ef">
+ <meta name="msapplication-TileImage" content="/mstile-144x144.png?v=Lb54KlrQnz">
+ <meta name="theme-color" content="#ffffff">
+
+</head>
+<body>
+<div id="wrapper">
+
+ {% include('partials/menu.twig') %}
+
+ <div id="page-wrapper">
+
+ <div class="row">
+ <div class="col-lg-12">
+ <h1 class="page-header">
+ {% if mainTitleIcon %}
+ <i class="fa {{ mainTitleIcon }}"></i>
+ {% endif %}
+
+ {{ title }}
+
+ {% if subTitle %}
+ <small>
+ {% if subTitleIcon %}
+ <i class="fa {{subTitleIcon}}"></i>
+ {% endif %}
+ {{ subTitle }}
+ </small>
+ {% endif %}
+ <small class="pull-right"><a href="#" id="help" data-route="{{ Route.getCurrentRoute.getName }}"><i data-route="{{Route.getCurrentRoute.getName}}" class="fa fa-question-circle"></i></a></small>
+ </h1>
+
+ </div>
+ <!-- /.col-lg-12 -->
+ </div>
+
+ {% include('partials/flashes.twig') %}
+ {% block content %}{% endblock %}
+
+ <!-- this modal will contain the help-text -->
+ <div class="modal fade" id="helpModal">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="helpTitle">Please hold...</h4>
+ </div>
+ <div class="modal-body" id="helpBody">
+ <i class="fa fa-refresh fa-spin"></i>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+ </div><!-- /.modal -->
+
+ </div>
+</div>
+
+<!-- modal to relate transactions to each other -->
+<div class="modal fade" id="relationModal">
+</div>
+
+<!-- default modal -->
+<div class="modal fade" id="defaultModal">
+</div>
+
+<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
+<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
+<script type="text/javascript" src="js/metisMenu.min.js"></script>
+<script type="text/javascript" src="js/sb-admin-2.js"></script>
+<script type="text/javascript" src="js/help.js"></script>
+
+<!-- date range stuff -->
+<script type="text/javascript" src="js/moment.min.js"></script>
+<script type="text/javascript" src="js/daterangepicker.js"></script>
+
+<script type="text/javascript">
+ var start = "{{Session.get('start').format('d-m-Y')}}";
+ var end = "{{Session.get('end').format('d-m-Y')}}";
+ var titleString = "{{Session.get('start').format('j M Y')}} - {{Session.get('end').format('j M Y')}}";
+ var dateRangeURL = "{{route('daterange')}}";
+ var token = "{{csrf_token()}}";
+ var firstDate = moment("{{Session.get('first').format('Y-m-d')}}");
+ var currentMonthName = "{{ currentMonthName }}";
+ var previousMonthName = "{{ previousMonthName }}";
+ var nextMonthName = "{{ nextMonthName }}";
+ $('#daterange span').text(titleString);
+</script>
+
+<script type="text/javascript" src="js/firefly.js"></script>
+{% block scripts %}{% endblock %}
+
+<script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', 'auto');
+ ga('send', 'pageview');
+
+ // send an event if relevant:
+ {% if Session.has('gaEventCategory') and Session.has('gaEventAction') %}
+ ga('send','event','{{Session.get('gaEventCategory')}}','{{Session.get('gaEventAction')}}');
+ {% endif %}
+
+</script>
+</body>
+</html>
diff --git a/resources/twig/list/journals-tiny.twig b/resources/twig/list/journals-tiny.twig
new file mode 100644
index 0000000000..e4ca10fb72
--- /dev/null
+++ b/resources/twig/list/journals-tiny.twig
@@ -0,0 +1,37 @@
+<div class="list-group">
+ {% for journal in transactions %}
+
+<a class="list-group-item" title="{{journal.date.format('jS M Y')}}" href="{{route('transactions.show',journal.id)}}">
+
+ {% if not journal.type %}
+ {% if journal.transactiontype.type == 'Withdrawal' %}
+ <i class="fa fa-long-arrow-left fa-fw" title="Withdrawal"></i>
+ {% endif %}
+ {% if journal.transactiontype.type == 'Deposit' %}
+ <i class="fa fa-long-arrow-right fa-fw" title="Deposit"></i>
+ {% endif %}
+ {% if journal.transactiontype.type == 'Transfer' %}
+ <i class="fa fa-fw fa-exchange" title="Transfer"></i>
+ {% endif %}
+ {% else %}
+ {% if journal.type == 'Withdrawal' %}
+ <i class="fa fa-long-arrow-left fa-fw" title="Withdrawal"></i>
+ {% endif %}
+ {% if journal.type == 'Deposit' %}
+ <i class="fa fa-long-arrow-right fa-fw" title="Deposit"></i>
+ {% endif %}
+ {% if journal.type == 'Transfer' %}
+ <i class="fa fa-fw fa-exchange" title="Transfer"></i>
+ {% endif %}
+ {% endif %}
+
+ {{ journal.description }}
+
+<span class="pull-right small">
+ {{ journal|formatJournal }}
+
+</span>
+
+</a>
+{% endfor %}
+</div>
diff --git a/resources/twig/partials/boxes.twig b/resources/twig/partials/boxes.twig
new file mode 100644
index 0000000000..748e3cb960
--- /dev/null
+++ b/resources/twig/partials/boxes.twig
@@ -0,0 +1,92 @@
+<!-- /.row -->
+<div class="row">
+ <div class="hidden-xs col-lg-3 col-md-6">
+ <div class="panel panel-red">
+ <div class="panel-heading">
+ <div class="row">
+ <div class="col-xs-3">
+ <i class="fa fa-upload fa-3x"></i>
+ </div>
+ <div class="col-xs-9 text-right">
+ <div id="box-out" class="large"></div>
+ <div>Money out</div>
+ </div>
+ </div>
+ </div>
+ <a href="{{route('transactions.index','withdrawal')}}">
+ <div class="panel-footer">
+ <span class="pull-left">View Details</span>
+ <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
+ <div class="clearfix"></div>
+ </div>
+ </a>
+ </div>
+ </div>
+ <div class="hidden-xs col-lg-3 col-md-6">
+ <div class="panel panel-green">
+ <div class="panel-heading">
+ <div class="row">
+ <div class="col-xs-3">
+ <i class="fa fa-download fa-3x"></i>
+ </div>
+ <div class="col-xs-9 text-right">
+ <div id="box-in" class="large"></div>
+ <div>Money in</div>
+ </div>
+ </div>
+ </div>
+ <a href="{{route('transactions.index','deposit')}}">
+ <div class="panel-footer">
+ <span class="pull-left">View Details</span>
+ <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
+ <div class="clearfix"></div>
+ </div>
+ </a>
+ </div>
+ </div>
+ <div class="hidden-xs col-lg-3 col-md-6">
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <div class="row">
+ <div class="col-xs-3">
+ <i class="fa fa-calendar fa-3x"></i>
+ </div>
+ <div class="col-xs-9 text-right">
+ <div id="box-bills-unpaid" class="large"></div>
+ <div>Bills to pay</div>
+ </div>
+ </div>
+ </div>
+ <a href="{{route('bills.index')}}">
+ <div class="panel-footer">
+ <span class="pull-left">View Details</span>
+ <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
+ <div class="clearfix"></div>
+ </div>
+ </a>
+ </div>
+ </div>
+ <div class="hidden-xs col-lg-3 col-md-6">
+ <div class="panel panel-green">
+ <div class="panel-heading">
+ <div class="row">
+ <div class="col-xs-3">
+ <i class="fa fa-line-chart fa-3x"></i>
+ </div>
+ <div class="col-xs-9 text-right">
+ <div id="box-bills-paid" class="large"></div>
+ <div>Bills paid</div>
+ </div>
+ </div>
+ </div>
+ <a href="{{route('bills.index')}}">
+ <div class="panel-footer">
+ <span class="pull-left">View Details</span>
+ <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
+ <div class="clearfix"></div>
+ </div>
+ </a>
+ </div>
+ </div>
+</div>
+<!-- /.row -->
diff --git a/resources/twig/partials/flashes.twig b/resources/twig/partials/flashes.twig
new file mode 100644
index 0000000000..de601e38c7
--- /dev/null
+++ b/resources/twig/partials/flashes.twig
@@ -0,0 +1,27 @@
+{% if Session.has('success') %}
+<div class="alert alert-success alert-dismissible" role="alert">
+ <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <strong>Success!</strong> {{Session.get('success')}}
+</div>
+{% endif %}
+
+{% if Session.has('info') %}
+<div class="alert alert-info alert-dismissible" role="alert">
+ <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <strong>Info:</strong> {{Session.get('info')}}
+</div>
+{% endif %}
+
+{% if Session.has('warning') %}
+<div class="alert alert-warning alert-dismissible" role="alert">
+ <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <strong>Warning!</strong> {{Session.get('warning')}}
+</div>
+{% endif %}
+
+{% if Session.has('error') %}
+<div class="alert alert-danger alert-dismissible" role="alert">
+ <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <strong>Error!</strong> {{Session.get('error')}}
+</div>
+{% endif %}
diff --git a/resources/twig/partials/menu.twig b/resources/twig/partials/menu.twig
new file mode 100644
index 0000000000..2c6dfe5056
--- /dev/null
+++ b/resources/twig/partials/menu.twig
@@ -0,0 +1,182 @@
+<!-- Navigation -->
+
+<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="{{ route('index') }}">Firefly</a>
+ </div>
+ <!-- /.navbar-header -->
+
+
+ <ul class="nav navbar-top-links navbar-right">
+
+ <!-- reminders -->
+ {% if reminders|length > 0 %}
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
+ <i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i>
+ </a>
+ <ul class="dropdown-menu dropdown-messages">
+ {% for reminder in reminders %}
+ <li>
+ <a href="{{ route('reminders.show',reminder.id) }}">
+ <div>
+ <strong>
+ {{ reminder.remindersable.name }}
+ </strong>
+ <span class="pull-right text-muted">
+ <em>{{ reminder.startdate.diffForHumans }}</em>
+ </span>
+ </div>
+ <div>{{ reminder.description|raw }}</div>
+ </a>
+ </li>
+ <li class="divider"></li>
+ {% endfor %}
+ <li>
+ <a class="text-center" href="{{ route('reminders.index') }}">
+ <strong>See all reminders</strong>
+ <i class="fa fa-angle-right"></i>
+ </a>
+ </li>
+ </ul>
+ <!-- /.dropdown-messages -->
+ </li>
+ {% endif %}
+
+ <!-- menu -->
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
+ </a>
+ <ul class="dropdown-menu dropdown-user">
+ <li><a href="{{ route('profile') }}"><i class="fa fa-user fa-fw"></i> {{ Auth.user.email }}</a></li>
+ <li><a href="{{ route('preferences') }}"><i class="fa fa-gear fa-fw"></i> Preferences</a></li>
+ <li><a href="{{ route('currency.index') }}"><i class="fa fa-usd fa-fw"></i> Currency</a></li>
+ <li><a href="{{ route('reminders.index') }}"><i class="fa fa-clock-o fa-fw"></i> Reminders</a></li>
+ <li class="divider"></li>
+ <li><a href="{{ route('logout') }}"><i class="fa fa-sign-out fa-fw"></i> Logout</a></li>
+ </ul>
+ <!-- /.dropdown-user -->
+ </li>
+
+
+ <!-- /.dropdown -->
+
+
+ </ul>
+ <p class="navbar-text navbar-right" id="daterange"><span>&nbsp;</span> <b class="caret"></b></p>
+
+
+ <!-- /.navbar-top-links -->
+ <div class="navbar-default sidebar" role="navigation">
+ <div class="sidebar-nav navbar-collapse">
+ <ul class="nav" id="side-menu">
+ <li class="sidebar-search">
+ <form action="{{ route('search') }}" method="GET" class="form-inline">
+ <div class="input-group custom-search-form">
+ <input type="text" name="q" class="form-control" value="{% if Input.get('q') %}{{ Input.get('q') }}{% endif %}"
+ placeholder="Search...">
+ <span class="input-group-btn">
+ <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
+ </span>
+ </div>
+ </form>
+ <!-- /input-group -->
+ </li>
+ <li>
+ <a class="{{ 'index'|activeRoute }}" href="{{ route('index') }}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
+ </li>
+ <li class="{{ 'accounts.index'|activeRoute }}">
+ <a href="#"><i class="fa fa-credit-card fa-fw"></i> Accounts <span class="fa arrow"></span></a>
+ <ul class="nav nav-second-level">
+ <li>
+ <a class="{{ 'accounts.index'|activeRoute }}" href="{{ route('accounts.index','asset') }}"><i class="fa fa-money fa-fw"></i> Asset
+ accounts</a>
+ </li>
+ <li>
+ <a class="{{ 'accounts.index'|activeRoute }}" href="{{ route('accounts.index','expense') }}"><i
+ class="fa fa-shopping-cart fa-fw"></i> Expense accounts</a>
+ </li>
+ <li>
+ <a class="{{ 'accounts.index'|activeRoute }}" href="{{ route('accounts.index','revenue') }}"><i class="fa fa-download fa-fw"></i>
+ Revenue accounts</a>
+ </li>
+ </ul>
+ <!-- /.nav-second-level -->
+ </li>
+ <li>
+ <a class="{{ 'budgets'|activeRoute }}" href="{{ route('budgets.index') }}"><i class="fa fa-tasks fa-fw"></i> Budgets</a>
+ </li>
+ <li>
+ <a class="{{ 'categories'|activeRoute }}" href="{{ route('categories.index') }}"><i class="fa fa-bar-chart fa-fw"></i> Categories</a>
+ </li>
+ <li>
+ <a class="{{ 'tags'|activeRoute }}" href="{{ route('tags.index') }}"><i class="fa fa-tags fa-fw"></i> Tags</a>
+ </li>
+ <li>
+ <a class="{{ 'reports'|activeRoute }}" href="{{ route('reports.index') }}"><i class="fa fa-line-chart fa-fw"></i> Reports</a>
+ </li>
+ <li class="{{ 'transactions'|activeRoute }}">
+ <a href="#"><i class="fa fa-repeat fa-fw"></i> Transactions<span class="fa arrow"></span></a>
+ <ul class="nav nav-second-level">
+ <li>
+ <a class="{{ 'transactions'|activeRoute }}" href="{{ route('transactions.index','withdrawal') }}"><i
+ class="fa fa-long-arrow-left fa-fw"></i> Expenses</a>
+ </li>
+ <li>
+ <a class="{{ 'transactions'|activeRoute }}" href="{{ route('transactions.index','deposit') }}"><i
+ class="fa fa-long-arrow-right fa-fw"></i> Revenue / income</a>
+ </li>
+ <li>
+ <a class="{{ 'transactions'|activeRoute }}" href="{{ route('transactions.index','transfers') }}"><i class="fa fa-fw fa-exchange"
+ title="Transfer"></i> Transfers</a>
+ </li>
+ </ul>
+
+ </li>
+ <li class="{{ 'piggy-banks'|activeRoute }}">
+ <a href="#"><i class="fa fa-euro fa-fw"></i> Money management<span class="fa arrow"></span></a>
+ <ul class="nav nav-second-level">
+ <li>
+ <a class="{{ 'piggy-banks'|activeRoute }}" href="{{ route('piggy-banks.index') }}"><i class="fa fa-sort-amount-asc fa-fw"></i> Piggy
+ banks</a>
+ </li>
+ <li>
+ <a class="{{ 'bills'|activeRoute }}" href="{{ route('bills.index') }}"><i class="fa fa-calendar-o fa-fw"></i> Bills</a>
+ </li>
+ </ul>
+ <!-- /.nav-second-level -->
+ </li>
+ <li class="{{ 'transactions.create'|activeRoute }}">
+ <a href="#"><i class="fa fa-plus fa-fw"></i> Create new<span class="fa arrow"></span></a>
+ <ul class="nav nav-second-level">
+ <li>
+ <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('transactions.create','withdrawal') }}"><i
+ class="fa fa-long-arrow-left fa-fw"></i> Withdrawal</a>
+ </li>
+ <li>
+ <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('transactions.create','deposit') }}"><i
+ class="fa fa-long-arrow-right fa-fw"></i> Deposit</a>
+ </li>
+ <li>
+ <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('transactions.create','transfer') }}"><i class="fa fa-fw fa-exchange"
+ title="Transfer"></i> Transfer</a>
+ </li>
+ <li>
+ <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('bills.create') }}"><i class="fa fa-calendar-o fa-fw"></i> Bill</a>
+ </li>
+ </ul>
+ <!-- /.nav-second-level -->
+ </li>
+ </ul>
+ </div>
+ <!-- /.sidebar-collapse -->
+ </div>
+ <!-- /.navbar-static-side -->
+</nav>