Skip to content

Firefly III: a personal finances manager

Some new stuff for budget management. [skip ci]

James Colea40b281ea31c
diff --git a/app/config/firefly.php b/app/config/firefly.php
new file mode 100644
index 0000000000..5bf8094e5c
--- /dev/null
+++ b/app/config/firefly.php
@@ -0,0 +1,39 @@
+<?php
+return [
+ 'index_periods' => '1D', '1W', '1M', '3M', '6M', 'custom',
+ 'budget_periods' => 'daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly',
+ 'periods_to_text' => [
+ 'weekly' => 'A week',
+ 'monthly' => 'A month',
+ 'quarterly' => 'A quarter',
+ 'half-year' => 'Six months',
+ 'yearly' => 'A year',
+ ],
+ 'range_to_text' => [
+ '1D' => 'day',
+ '1W' => 'week',
+ '1M' => 'month',
+ '3M' => 'three months',
+ '6M' => 'half year',
+ 'custom' => '(custom)'
+ ],
+ 'range_to_repeat_freq' => [
+ '1D' => 'weekly',
+ '1W' => 'weekly',
+ '1M' => 'monthly',
+ '3M' => 'quarterly',
+ '6M' => 'half-year',
+ 'custom' => 'monthly'
+ ],
+
+ 'date_formats_by_period' => [
+ 'monthly' => [
+ 'group_date' => 'Y-m',
+ 'display_date' => 'F Y'
+ ],
+ 'weekly' => [
+ 'group_date' => 'Y-W',
+ 'display_date' => '\W\e\e\k W, Y'
+ ]
+ ]
+];
\ No newline at end of file
diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.php
index fd246975c5..5dc1159a2e 100644
--- a/app/controllers/BudgetController.php
+++ b/app/controllers/BudgetController.php
@@ -13,67 +13,57 @@ class BudgetController extends BaseController
View::share('menu', 'budgets');
}
- public function index($group = null)
+ public function indexByDate()
{
+ // get a list of dates by getting all repetitions:
+ $budgets = $this->_budgets->get();
+ $reps = [];
+ foreach ($budgets as $budget) {
+ foreach ($budget->limits as $limit) {
+ $dateFormats = \Config::get('firefly.date_formats_by_period.' . $limit->repeat_freq);
+ if(is_null($dateFormats)) {
+ die('No date formats for ' . $limit->repeat_freq);
+ }
- $opts = ['date', 'budget'];
- $group = in_array($group, $opts) ? $group : 'date';
-
- switch ($group) {
- case 'date':
- // get a list of dates by getting all repetitions:
- $budgets = $this->_budgets->get();
- $reps = [];
- foreach ($budgets as $budget) {
- foreach ($budget->limits as $limit) {
- foreach ($limit->limitrepetitions as $rep) {
-
- $monthOrder = $rep->startdate->format('Y-m');
- $month = $rep->startdate->format('F Y');
- $reps[$monthOrder] = isset($reps[$monthOrder]) ? $reps[$monthOrder] : ['date' => $month];
+ foreach ($limit->limitrepetitions as $rep) {
+ $periodOrder = $rep->startdate->format($dateFormats['group_date']);
+ $period = $rep->startdate->format($dateFormats['display_date']);
+ $reps[$periodOrder] = isset($reps[$periodOrder]) ? $reps[$periodOrder] : ['date' => $period];
- }
- }
}
- // put all the budgets under their respective date:
- foreach ($budgets as $budget) {
- foreach ($budget->limits as $limit) {
- foreach ($limit->limitrepetitions as $rep) {
- $month = $rep->startdate->format('Y-m');
- $reps[$month]['limitrepetitions'][] = $rep;
- }
- }
+ }
+ }
+ // put all the budgets under their respective date:
+ foreach ($budgets as $budget) {
+ foreach ($budget->limits as $limit) {
+ $dateFormats = \Config::get('firefly.date_formats_by_period.' . $limit->repeat_freq);
+ if(is_null($dateFormats)) {
+ die('No date formats for ' . $limit->repeat_freq);
}
- krsort($reps);
-
- return View::make('budgets.index')->with('group', $group)->with('reps', $reps);
-
+ foreach ($limit->limitrepetitions as $rep) {
- break;
- case 'budget':
- $budgets = $this->_budgets->get();
- $today = new \Carbon\Carbon;
- return View::make('budgets.index')->with('budgets', $budgets)->with('today', $today)->with(
- 'group', $group
- );
-
- break;
+ $month = $rep->startdate->format($dateFormats['group_date']);
+ $reps[$month]['limitrepetitions'][] = $rep;
+ }
+ }
}
+ krsort($reps);
+ return View::make('budgets.indexByDate')->with('reps', $reps);
}
- public function create()
+ public function indexByBudget()
{
+ $budgets = $this->_budgets->get();
+ $today = new \Carbon\Carbon;
+ return View::make('budgets.indexByBudget')->with('budgets', $budgets)->with('today', $today);
- $periods = [
- 'weekly' => 'A week',
- 'monthly' => 'A month',
- 'quarterly' => 'A quarter',
- 'half-year' => 'Six months',
- 'yearly' => 'A year',
- ];
+ }
+ public function create()
+ {
+ $periods = \Config::get('firefly.periods_to_text');
return View::make('budgets.create')->with('periods', $periods);
}
@@ -92,8 +82,15 @@ class BudgetController extends BaseController
return Redirect::route('budgets.index');
}
+ /**
+ * TODO actual view, actual content.
+ * @param $budgetId
+ *
+ * @return string
+ */
public function show($budgetId)
{
+ /** @var \Budget $budget */
$budget = $this->_budgets->find($budgetId);
$list = $budget->transactionjournals()->get();
@@ -102,7 +99,6 @@ class BudgetController extends BaseController
foreach ($list as $entry) {
$month = $entry->date->format('F Y');
$return[$month] = isset($return[$month]) ? $return[$month] : [];
-
$return[$month][] = $entry;
}
diff --git a/app/controllers/ChartController.php b/app/controllers/ChartController.php
index fcbe9f5f2e..5755f01cb6 100644
--- a/app/controllers/ChartController.php
+++ b/app/controllers/ChartController.php
@@ -36,8 +36,7 @@ class ChartController extends BaseController
*/
public function homeAccount($accountId = null)
{
- list($start, $end) = $this->_tk->getDateRange();
- \Log::debug('Start is (cannot clone?): ' . $start);
+ list($start, $end) = $this->_tk->getDateRangeDates();
$current = clone $start;
$return = [];
$account = null;
@@ -75,10 +74,7 @@ class ChartController extends BaseController
}
} else {
$return[0] = ['name' => $account->name, 'id' => $account->id, 'data' => []];
- \Log::debug('Start is: '.$start);
- \Log::debug('End is: '.$end);
while ($current <= $end) {
- \Log::debug('Current: ' . $current.' is smaller or equal to ' . $end);
if ($current > $today) {
$return[0]['data'][] = [$current->timestamp * 1000, $account->predict(clone $current)];
} else {
@@ -88,21 +84,6 @@ class ChartController extends BaseController
$current->addDay();
}
}
-// // add an error bar as experiment:
-// foreach($return as $index => $serie) {
-// $err = [
-// 'type' => 'errorbar',
-// 'name' => $serie['name'].' pred',
-// 'linkedTo' => $serie['id'],
-// 'data' => []
-// ];
-// foreach($serie['data'] as $entry) {
-// $err['data'][] = [$entry[0],10,300];
-// }
-// $return[] = $err;
-// }
-
-
return Response::json($return);
}
@@ -140,7 +121,7 @@ class ChartController extends BaseController
public function homeCategories()
{
- list($start, $end) =$this->_tk->getDateRange();
+ list($start, $end) =$this->_tk->getDateRangeDates();
$account = null;
$result = [];
// grab all transaction journals in this period:
diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php
index 019a0f3128..74e0c0a1b9 100644
--- a/app/controllers/HomeController.php
+++ b/app/controllers/HomeController.php
@@ -17,8 +17,8 @@ class HomeController extends BaseController
protected $_tk;
/**
- * @param ARI $accounts
- * @param PHI $preferences
+ * @param ARI $accounts
+ * @param PHI $preferences
* @param TJRI $journal
*/
public function __construct(ARI $accounts, PHI $preferences, TJRI $journal, Toolkit $toolkit, BRI $budgets)
@@ -40,7 +40,7 @@ class HomeController extends BaseController
{
// count, maybe we need some introducing text to show:
$count = $this->_accounts->count();
- list($start, $end) = $this->_tk->getDateRange();
+ list($start, $end) = $this->_tk->getDateRangeDates();
// get the preference for the home accounts to show:
@@ -53,12 +53,14 @@ class HomeController extends BaseController
// get the budgets for this period:
- $dates = $this->_tk->getDateRange();
- $budgets = $this->_budgets->getWithRepetitionsInPeriod($dates[0], \Session::get('range'));
+ $budgets = $this->_budgets->getWithRepetitionsInPeriod($start, \Session::get('range'));
$transactions = [];
foreach ($accounts as $account) {
- $transactions[] = [$this->_journal->getByAccountInDateRange($account, 15, $start, $end), $account];
+ $set = $this->_journal->getByAccountInDateRange($account, 15, $start, $end);
+ if (count($set) > 0) {
+ $transactions[] = [$set, $account];
+ }
}
if (count($transactions) % 2 == 0) {
@@ -73,4 +75,10 @@ class HomeController extends BaseController
'budgets', $budgets
);
}
+
+ public function flush()
+ {
+ Cache::flush();
+ return Redirect::route('index');
+ }
}
\ No newline at end of file
diff --git a/app/controllers/LimitController.php b/app/controllers/LimitController.php
index 1476c05b81..02aa07e789 100644
--- a/app/controllers/LimitController.php
+++ b/app/controllers/LimitController.php
@@ -19,20 +19,16 @@ class LimitController extends BaseController
public function create($budgetId = null)
{
- $periods = [
- 'weekly' => 'A week',
- 'monthly' => 'A month',
- 'quarterly' => 'A quarter',
- 'half-year' => 'Six months',
- 'yearly' => 'A year',
+ $periods = \Config::get('firefly.periods_to_text');
+ $prefilled = [
+ 'startdate' => Input::get('startdate') ? : date('Y-m-d'),
+ 'repeat_freq' => Input::get('repeat_freq') ? : 'monthly'
];
- $budget = $this->_budgets->find($budgetId);
- $budget_id = is_null($budget) ? null : $budget->id;
$budgets = $this->_budgets->getAsSelectList();
- return View::make('limits.create')->with('budgets', $budgets)->with('budget_id', $budget_id)->with(
+ return View::make('limits.create')->with('budgets', $budgets)->with('budget_id', $budgetId)->with(
'periods', $periods
- );
+ )->with('prefilled', $prefilled);
}
public function edit($limitId = null)
@@ -50,8 +46,9 @@ class LimitController extends BaseController
if ($limit) {
- return View::make('limits.edit')->with('limit', $limit)->with('budgets', $budgets)->
- with('periods',$periods);
+ return View::make('limits.edit')->with('limit', $limit)->with('budgets', $budgets)->with(
+ 'periods', $periods
+ );
}
}
@@ -60,23 +57,23 @@ class LimitController extends BaseController
{
/** @var \Limit $limit */
$limit = $this->_limits->find($limitId);
- if($limit) {
+ if ($limit) {
$limit->startdate = new \Carbon\Carbon(Input::get('date'));
$limit->repeat_freq = Input::get('period');
$limit->repeats = !is_null(Input::get('repeats')) && Input::get('repeats') == '1' ? 1 : 0;
$limit->amount = floatval(Input::get('amount'));
- if(!$limit->save()) {
- Session::flash('error','Could not save new limit: ' . $limit->errors()->first());
- return Redirect::route('budgets.limits.edit',$limit->id)->withInput();
+ if (!$limit->save()) {
+ Session::flash('error', 'Could not save new limit: ' . $limit->errors()->first());
+ return Redirect::route('budgets.limits.edit', $limit->id)->withInput();
} else {
- Session::flash('success','Limit saved!');
- foreach($limit->limitrepetitions()->get() as $rep) {
+ Session::flash('success', 'Limit saved!');
+ foreach ($limit->limitrepetitions()->get() as $rep) {
$rep->delete();
}
return Redirect::route('budgets.index');
}
}
- return View::make('error')->with('message','No limit!');
+ return View::make('error')->with('message', 'No limit!');
}
diff --git a/app/filters.php b/app/filters.php
index dd76464e1d..87ab7f0a27 100644
--- a/app/filters.php
+++ b/app/filters.php
@@ -4,11 +4,12 @@
App::before(
function ($request) {
+ Event::fire('app.before');
if (Auth::check()) {
$toolkit = App::make('Firefly\Helper\Toolkit\ToolkitInterface');
- $toolkit->getDateRange();
+ return $toolkit->getDateRange();
}
- Event::fire('app.before');
+
}
);
diff --git a/app/lib/Firefly/Helper/Toolkit/Toolkit.php b/app/lib/Firefly/Helper/Toolkit/Toolkit.php
index 58d10ceccc..66a4c29770 100644
--- a/app/lib/Firefly/Helper/Toolkit/Toolkit.php
+++ b/app/lib/Firefly/Helper/Toolkit/Toolkit.php
@@ -37,9 +37,23 @@ class Toolkit implements ToolkitInterface
}
// switch $range, update range or something:
+ $start = \Session::has('start') ? \Session::get('start') : new \Carbon\Carbon();
+ $end = \Session::has('end') ? \Session::get('end') : new \Carbon\Carbon();
$today = new \Carbon\Carbon;
- $start = clone $today;
- $end = clone $today;
+ \Log::debug('Start: ' . $start.' ('.\Session::has('start').')');
+ \Log::debug('End: ' . $end);
+
+ // see if we have to do a prev / next thing:
+ $doPrev = false;
+ $doNext = false;
+ if (\Input::get('action') == 'prev') {
+ $doPrev = true;
+ }
+ if (\Input::get('action') == 'next') {
+ $doNext = true;
+ }
+
+
switch ($range) {
case 'custom':
// when range is custom AND input, we ignore $today
@@ -53,39 +67,94 @@ class Toolkit implements ToolkitInterface
break;
case '1D':
$start->startOfDay();
+ $end = clone $start;
$end->endOfDay();
+ if ($doNext) {
+ $start->addDay();
+ $end->addDay();
+ }
+ if ($doPrev) {
+ $start->subDay();
+ $end->subDay();
+ }
break;
case '1W':
$start->startOfWeek();
+ $end = clone $start;
$end->endOfWeek();
+ if ($doNext) {
+ $start->addWeek();
+ $end->addWeek();
+ }
+ if ($doPrev) {
+ $start->subWeek();
+ $end->subWeek();
+ }
break;
case '1M':
$start->startOfMonth();
+ $end = clone $start;
$end->endOfMonth();
+ if ($doNext) {
+ $start->addMonth();
+ $end->addMonth();
+ }
+ if ($doPrev) {
+ $start->subMonth();
+ \Log::debug('1M prev. Before: ' . $end);
+ $end->startOfMonth()->subMonth()->endOfMonth();
+ \Log::debug('1M prev. After: ' . $end);
+ }
break;
case '3M':
$start->firstOfQuarter();
+ $end = clone $start;
$end->lastOfQuarter();
+ if ($doNext) {
+ $start->addMonths(3)->firstOfQuarter();
+ $end->addMonths(6)->lastOfQuarter();
+ }
+ if ($doPrev) {
+ $start->subMonths(3)->firstOfQuarter();
+ $end->subMonths(3)->lastOfQuarter();
+ }
break;
case '6M':
if (intval($today->format('m')) >= 7) {
$start->startOfYear()->addMonths(6);
+ $end = clone $start;
$end->endOfYear();
} else {
$start->startOfYear();
+ $end = clone $start;
$end->startOfYear()->addMonths(6);
}
+ if ($doNext) {
+ $start->addMonths(6);
+ $end->addMonths(6);
+ }
+ if ($doPrev) {
+ $start->subMonths(6);
+ $end->subMonths(6);
+ }
break;
}
// save in session:
\Session::put('start', $start);
\Session::put('end', $end);
\Session::put('range', $range);
+ if ($doPrev || $doNext) {
+ return \Redirect::route('index');
+
+ }
+ return;
- // and return:
- return [$start, $end];
+ }
+ public function getDateRangeDates()
+ {
+ return [\Session::get('start'), \Session::get('end')];
}
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php b/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php
index edc2a8fef6..a58679d200 100644
--- a/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php
+++ b/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php
@@ -7,4 +7,6 @@ interface ToolkitInterface
{
public function getDateRange();
+ public function getDateRangeDates();
+
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Storage/Budget/EloquentBudgetRepository.php b/app/lib/Firefly/Storage/Budget/EloquentBudgetRepository.php
index f3d157bdfb..944f9e265a 100644
--- a/app/lib/Firefly/Storage/Budget/EloquentBudgetRepository.php
+++ b/app/lib/Firefly/Storage/Budget/EloquentBudgetRepository.php
@@ -23,7 +23,7 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
/** @var \Firefly\Helper\Toolkit\ToolkitInterface $toolkit */
$toolkit = \App::make('Firefly\Helper\Toolkit\ToolkitInterface');
- $dates = $toolkit->getDateRange();
+ $dates = $toolkit->getDateRangeDates();
$start = $dates[0];
$result = [];
diff --git a/app/routes.php b/app/routes.php
index 957c4a2ae0..4c77fdc87b 100644
--- a/app/routes.php
+++ b/app/routes.php
@@ -4,6 +4,7 @@ Route::group(['before' => 'auth'], function () {
// home controller
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
+ Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']);
// chart controller
Route::get('/chart/home/account/{account?}', ['uses' => 'ChartController@homeAccount', 'as' => 'chart.home']);
@@ -28,7 +29,8 @@ Route::group(['before' => 'auth'], function () {
// budget controller:
Route::get('/budget/create',['uses' => 'BudgetController@create', 'as' => 'budgets.create']);
- Route::get('/budgets/{group?}',['uses' => 'BudgetController@index','as' => 'budgets.index']);
+ Route::get('/budgets',['uses' => 'BudgetController@indexByDate','as' => 'budgets.index']);
+ Route::get('/budgets/budget',['uses' => 'BudgetController@indexByBudget','as' => 'budgets.index.budget']);
Route::get('/budget/show/{id}',['uses' => 'BudgetController@show', 'as' => 'budgets.show']);
// limit controller:
diff --git a/app/views/budgets/index-budget.blade.php b/app/views/budgets/indexByBudget.blade.php
similarity index 79%
rename from app/views/budgets/index-budget.blade.php
rename to app/views/budgets/indexByBudget.blade.php
index 7a9116bd68..66a4bfe84a 100644
--- a/app/views/budgets/index-budget.blade.php
+++ b/app/views/budgets/indexByBudget.blade.php
@@ -1,3 +1,23 @@
+@extends('layouts.default')
+@section('content')
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12">
+ <h1>Firefly
+ <small>Budgets and limits</small>
+ </h1>
+ <p class="text-info">
+ These are your budgets and if set, their "limits". Firefly uses an "<a
+ href="http://en.wikipedia.org/wiki/Envelope_System" class="text-success">envelope system</a>" for your
+ budgets,
+ which means that for each period of time (for example a month) a virtual "envelope" can be created
+ containing a certain amount of money. Money spent within a budget is removed from the envelope.
+ </p>
+ <p>
+ <a class="btn btn-default" href ="{{route('budgets.index')}}"><span class="glyphicon glyphicon-th"></span> Group by date</a>
+ <a class="btn btn-default" href ="{{route('budgets.limits.create')}}"><span class="glyphicon glyphicon-plus-sign"></span> Create a limit</a>
+ </p>
+ </div>
+</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<table class="table table-bordered table-striped">
@@ -81,4 +101,5 @@
</table>
</div>
-</div>
\ No newline at end of file
+</div>
+@stop
\ No newline at end of file
diff --git a/app/views/budgets/index-date.blade.php b/app/views/budgets/indexByDate.blade.php
similarity index 68%
rename from app/views/budgets/index-date.blade.php
rename to app/views/budgets/indexByDate.blade.php
index 80e7bcb094..78acda1a48 100644
--- a/app/views/budgets/index-date.blade.php
+++ b/app/views/budgets/indexByDate.blade.php
@@ -1,3 +1,24 @@
+@extends('layouts.default')
+@section('content')
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12">
+ <h1>Firefly
+ <small>Budgets and limits</small>
+ </h1>
+ <p class="text-info">
+ These are your budgets and if set, their "limits". Firefly uses an "<a
+ href="http://en.wikipedia.org/wiki/Envelope_System" class="text-success">envelope system</a>" for your
+ budgets,
+ which means that for each period of time (for example a month) a virtual "envelope" can be created
+ containing a certain amount of money. Money spent within a budget is removed from the envelope.
+ </p>
+ <p>
+ <a class="btn btn-default" href ="{{route('budgets.index.budget')}}"><span class="glyphicon glyphicon-indent-left"></span> Group by budget</a>
+ <a class="btn btn-default" href ="{{route('budgets.limits.create')}}"><span class="glyphicon glyphicon-plus-sign"></span> Create a limit</a>
+ </p>
+ </div>
+</div>
+
@foreach($reps as $date => $data)
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
@@ -46,4 +67,6 @@
</table>
</div>
</div>
-@endforeach
\ No newline at end of file
+@endforeach
+
+@stop
\ No newline at end of file
diff --git a/app/views/index.blade.php b/app/views/index.blade.php
index 36c63f8752..0233d983f8 100644
--- a/app/views/index.blade.php
+++ b/app/views/index.blade.php
@@ -1,47 +1,6 @@
@extends('layouts.default')
@section('content')
-<div class="row">
- <div class="col-lg-12 col-md-12 col-sm-12">
- <h1>Firefly
- @if($count > 0)
- <small>What's playing?</small>
- @endif
- </h1>
- @if($count > 0)
- <form role="form" class="form-horizontal">
- <div class="input-group">
-
- <?php $r = Session::get('range', '1M'); ?>
- <span class="input-group-btn input-group-btn">
- <button name="range" value="1D" class="btn btn-default @if($r=='1D') btn-info @endif btn-sm"
- type="submit">1D
- </button>
- <button name="range" value="1W" class="btn btn-default @if($r=='1W') btn-info @endif btn-sm"
- type="submit">1W
- </button>
- <button name="range" value="1M" class="btn btn-default @if($r=='1M') btn-info @endif btn-sm"
- type="submit">1M
- </button>
- <button name="range" value="3M" class="btn btn-default @if($r=='3M') btn-info @endif btn-sm"
- type="submit">3M
- </button>
- <button name="range" value="6M" class="btn btn-default @if($r=='6M') btn-info @endif btn-sm"
- type="submit">6M
- </button>
- </span>
- <input value="{{Session::get('start')->format('Y-m-d')}}" name="start" type="date"
- style="width:15%;border-right:0;" class="form-control input-sm">
- <input value="{{Session::get('end')->format('Y-m-d')}}" name="end" type="date"
- style="width:15%;border-right:0;" class="form-control input-sm">
- <button class="btn btn-default btn-sm @if($r=='custom') btn-info @endif" type="submit" name="range"
- value="custom">Custom
- </button>
- </div>
- </form>
- @endif
-
- </div>
-</div>
+@include('partials.date_nav')
@if($count == 0)
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
@@ -101,7 +60,8 @@
<h5><a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a></h5>
@if($budget->count == 0)
<p>
- <small><em>No budget set for this period.</em></small>
+ <a href="{{route('budgets.limits.create',[$budget->id])}}?startdate={{\Session::get('start')->format('Y-m-d')}}&amp;repeat_freq={{\Config::get('firefly.range_to_repeat_freq.' . \Session::get('range'))}}" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-envelope"></span> Add a new envelope</a>
+
</p>
@else
@foreach($budget->limits as $limit)
diff --git a/app/views/limits/create.blade.php b/app/views/limits/create.blade.php
index b98e20a15f..26b0221130 100644
--- a/app/views/limits/create.blade.php
+++ b/app/views/limits/create.blade.php
@@ -3,7 +3,7 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h1>Firefly
- <small>Set a limit to a budget</small>
+ <small>Create an envelope for a budget</small>
</h1>
<p class="text-info">
Firefly uses an "<a href="http://en.wikipedia.org/wiki/Envelope_System" class="text-success">envelope
@@ -41,7 +41,7 @@
<div class="form-group">
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-3 control-label'])}}
<div class="col-sm-9">
- <input type="date" name="startdate" value="{{Input::old('startdate') ?: date('Y-m-d')}}"
+ <input type="date" name="startdate" value="{{Input::old('startdate') ?: $prefilled['startdate']}}"
class="form-control"/>
<span class="help-block">This date indicates when the envelope "starts". The date you select
here will correct itself to the nearest [period] you select below.</span>
@@ -52,7 +52,7 @@
<label for="period" class="col-sm-3 control-label">Spending period</label>
<div class="col-sm-9">
- {{Form::select('period',$periods,Input::old('period') ?: 'monthly',['class' => 'form-control'])}}
+ {{Form::select('period',$periods,Input::old('period') ?: $prefilled['repeat_freq'],['class' => 'form-control'])}}
<span class="help-block">How long will the envelope last? A week, a month, or even longer?</span>
</div>
</div>
diff --git a/app/views/partials/date_nav.blade.php b/app/views/partials/date_nav.blade.php
new file mode 100644
index 0000000000..529406368e
--- /dev/null
+++ b/app/views/partials/date_nav.blade.php
@@ -0,0 +1,61 @@
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12">
+ <h1>Firefly
+ @if($count > 0)
+ <small>What's playing?</small>
+ @endif
+ </h1>
+ @if($count > 0)
+ <form role="form" method="GET">
+ <?php $r = Session::get('range', '1M'); ?>
+ <div class="row">
+ <div class="col-lg-2">
+ <button name="action" value="prev" class="btn btn-default @if($r=='1D') btn-info @endif btn-sm"
+ type="submit">&laquo; Previous {{Config::get('firefly.range_to_text.'.$r)}}
+ </button>
+ </div>
+ <div class="col-lg-3">
+ <div class="btn-group btn-group-sm">
+ <button name="range" value="1D" class="btn btn-default @if($r=='1D') btn-info @endif btn-sm"
+ type="submit">1D
+ </button>
+ <button name="range" value="1W" class="btn btn-default @if($r=='1W') btn-info @endif btn-sm"
+ type="submit">1W
+ </button>
+ <button name="range" value="1M" class="btn btn-default @if($r=='1M') btn-info @endif btn-sm"
+ type="submit">1M
+ </button>
+ <button name="range" value="3M" class="btn btn-default @if($r=='3M') btn-info @endif btn-sm"
+ type="submit">3M
+ </button>
+ <button name="range" value="6M" class="btn btn-default @if($r=='6M') btn-info @endif btn-sm"
+ type="submit">6M
+ </button>
+ </div>
+ </div>
+ <div class="col-lg-2">
+ <input value="{{Session::get('start')->format('Y-m-d')}}" name="start" type="date"
+ class="form-control input-sm">
+ </div>
+ <div class="col-lg-2">
+ <input value="{{Session::get('end')->format('Y-m-d')}}" name="end" type="date"
+ class="form-control input-sm">
+ </div>
+ <div class="col-lg-1">
+ <button class="btn btn-default btn-sm @if($r=='custom') btn-info @endif" type="submit" name="range"
+ value="custom">Custom
+ </button>
+ </div>
+ <div class="col-lg-2" style="text-align:right;">
+ <button name="action" value="next" class="btn btn-default @if($r=='1D') btn-info @endif btn-sm"
+ type="submit">&raquo; Next {{Config::get('firefly.range_to_text.'.$r)}}
+ </button>
+ </div>
+ </div>
+ </form>
+
+
+ @endif
+
+ </div>
+</div>
\ No newline at end of file
diff --git a/dev b/dev
new file mode 100644
index 0000000000..d4e6663d05
--- /dev/null
+++ b/dev
@@ -0,0 +1 @@
+<a href="http://localhost/projects/firefly-iii/public">home</a>
\ No newline at end of file
diff --git a/dev.1 b/dev.1
new file mode 100644
index 0000000000..d4e6663d05
--- /dev/null
+++ b/dev.1
@@ -0,0 +1 @@
+<a href="http://localhost/projects/firefly-iii/public">home</a>
\ No newline at end of file
diff --git a/phpunit.xml b/phpunit.xml
index e0b7cc582f..dbd5a7f7bd 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -2,7 +2,7 @@
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
- colors="true"
+ colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
diff --git a/public/assets/javascript/index.js b/public/assets/javascript/index.js
index 686d25e823..e895811d89 100644
--- a/public/assets/javascript/index.js
+++ b/public/assets/javascript/index.js
@@ -1,4 +1,3 @@
-var accountChart;
$(function () {