mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Lots of code cleanup.
This commit is contained in:
@@ -93,19 +93,43 @@ class CategoryController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
$category = $this->_repository->store(Input::all());
|
$data = Input::all();
|
||||||
if ($category->validate()) {
|
/** @var \FireflyIII\Database\Category $repos */
|
||||||
Session::flash('success', 'Category "' . $category->name . '" created!');
|
$repos = App::make('FireflyIII\Database\Category');
|
||||||
|
|
||||||
if (Input::get('create') == '1') {
|
switch ($data['post_submit_action']) {
|
||||||
return Redirect::route('categories.create');
|
default:
|
||||||
}
|
throw new FireflyException('Cannot handle post_submit_action "' . e($data['post_submit_action']) . '"');
|
||||||
|
break;
|
||||||
|
case 'create_another':
|
||||||
|
case 'store':
|
||||||
|
$messages = $repos->validate($data);
|
||||||
|
/** @var MessageBag $messages ['errors'] */
|
||||||
|
if ($messages['errors']->count() > 0) {
|
||||||
|
Session::flash('warnings', $messages['warnings']);
|
||||||
|
Session::flash('successes', $messages['successes']);
|
||||||
|
Session::flash('error', 'Could not save category: ' . $messages['errors']->first());
|
||||||
|
|
||||||
return Redirect::route('categories.index');
|
return Redirect::route('categories.create')->withInput()->withErrors($messages['errors']);
|
||||||
} else {
|
}
|
||||||
Session::flash('error', 'Could not save the new category!');
|
// store!
|
||||||
|
$repos->store($data);
|
||||||
|
Session::flash('success', 'New category stored!');
|
||||||
|
|
||||||
return Redirect::route('categories.create')->withInput();
|
if ($data['post_submit_action'] == 'create_another') {
|
||||||
|
return Redirect::route('categories.create')->withInput();
|
||||||
|
} else {
|
||||||
|
return Redirect::route('categories.index');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'validate_only':
|
||||||
|
$messageBags = $repos->validate($data);
|
||||||
|
Session::flash('warnings', $messageBags['warnings']);
|
||||||
|
Session::flash('successes', $messageBags['successes']);
|
||||||
|
Session::flash('errors', $messageBags['errors']);
|
||||||
|
|
||||||
|
return Redirect::route('categories.create')->withInput();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exception\FireflyException;
|
use FireflyIII\Exception\FireflyException;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
@@ -84,7 +85,8 @@ class RecurringController extends BaseController
|
|||||||
$repos = App::make('FireflyIII\Database\Recurring');
|
$repos = App::make('FireflyIII\Database\Recurring');
|
||||||
|
|
||||||
$recurring = $repos->get();
|
$recurring = $repos->get();
|
||||||
return View::make('recurring.index',compact('recurring'));
|
|
||||||
|
return View::make('recurring.index', compact('recurring'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,9 +118,13 @@ class RecurringController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function show(RecurringTransaction $recurringTransaction)
|
public function show(RecurringTransaction $recurringTransaction)
|
||||||
{
|
{
|
||||||
$journals = $recurringTransaction->transactionjournals()->withRelevantData()->orderBy('date','DESC')->get();
|
$journals = $recurringTransaction->transactionjournals()->withRelevantData()->orderBy('date', 'DESC')->get();
|
||||||
$hideRecurring = true;
|
$hideRecurring = true;
|
||||||
return View::make('recurring.show',compact('journals','hideRecurring'))->with('recurring', $recurringTransaction)->with('subTitle', $recurringTransaction->name);
|
|
||||||
|
|
||||||
|
return View::make('recurring.show', compact('journals', 'hideRecurring','finalDate'))->with('recurring', $recurringTransaction)->with(
|
||||||
|
'subTitle', $recurringTransaction->name
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store()
|
public function store()
|
||||||
|
@@ -46,8 +46,16 @@ class Category implements CUD, CommonDatabaseCalls, CategoryInterface
|
|||||||
*/
|
*/
|
||||||
public function store(array $data)
|
public function store(array $data)
|
||||||
{
|
{
|
||||||
// TODO: Implement store() method.
|
$category = new \Category;
|
||||||
throw new NotImplementedException;
|
$category->name = $data['name'];
|
||||||
|
$category->class = 'Category';
|
||||||
|
$category->user()->associate($this->getUser());
|
||||||
|
if(!$category->validate()) {
|
||||||
|
var_dump($category->errors());
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$category->save();
|
||||||
|
return $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -83,6 +83,7 @@ class Date
|
|||||||
$currentEnd->addYear()->subDay();
|
$currentEnd->addYear()->subDay();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return $currentEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,4 +125,43 @@ class Date
|
|||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
* @param $repeatFreq
|
||||||
|
* @param int $substract
|
||||||
|
*
|
||||||
|
* @return Carbon
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function substractPeriod(Carbon $date, $repeatFreq, $substract = 1)
|
||||||
|
{
|
||||||
|
switch ($repeatFreq) {
|
||||||
|
default:
|
||||||
|
throw new FireflyException('Cannot do addPeriod for $repeat_freq ' . $repeatFreq);
|
||||||
|
break;
|
||||||
|
case 'daily':
|
||||||
|
$date->subDays($substract);
|
||||||
|
break;
|
||||||
|
case 'weekly':
|
||||||
|
$date->subWeeks($substract);
|
||||||
|
break;
|
||||||
|
case 'monthly':
|
||||||
|
$date->subMonths($substract);
|
||||||
|
break;
|
||||||
|
case 'quarterly':
|
||||||
|
$months = $substract * 3;
|
||||||
|
$date->subMonths($months);
|
||||||
|
break;
|
||||||
|
case 'half-year':
|
||||||
|
$months = $substract * 6;
|
||||||
|
$date->subMonths($months);
|
||||||
|
break;
|
||||||
|
case 'yearly':
|
||||||
|
$date->subYears($substract);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
}
|
}
|
@@ -90,7 +90,15 @@ class Piggybank extends Ardent
|
|||||||
*/
|
*/
|
||||||
public function currentRelevantRep()
|
public function currentRelevantRep()
|
||||||
{
|
{
|
||||||
$query = $this->piggybankrepetitions()->where(
|
if($this->currentRep) {
|
||||||
|
return $this->currentRep;
|
||||||
|
}
|
||||||
|
if ($this->repeats == 0) {
|
||||||
|
$rep = $this->piggybankrepetitions()->first();
|
||||||
|
$this->currentRep = $rep;
|
||||||
|
return $rep;
|
||||||
|
} else {
|
||||||
|
$query = $this->piggybankrepetitions()->where(
|
||||||
function ($q) {
|
function ($q) {
|
||||||
|
|
||||||
$q->where(
|
$q->where(
|
||||||
@@ -100,12 +108,12 @@ class Piggybank extends Ardent
|
|||||||
$q->orWhere('startdate', '<=', $today->format('Y-m-d'));
|
$q->orWhere('startdate', '<=', $today->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
)->where(
|
)->where(
|
||||||
function ($q) {
|
function ($q) {
|
||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
$q->whereNull('targetdate');
|
$q->whereNull('targetdate');
|
||||||
$q->orWhere('targetdate', '>=', $today->format('Y-m-d'));
|
$q->orWhere('targetdate', '>=', $today->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)->orWhere(
|
)->orWhere(
|
||||||
function ($q) {
|
function ($q) {
|
||||||
@@ -114,9 +122,11 @@ class Piggybank extends Ardent
|
|||||||
$q->where('targetdate', '>=', $today->format('Y-m-d'));
|
$q->where('targetdate', '>=', $today->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
)->orderBy('startdate', 'ASC');
|
)->orderBy('startdate', 'ASC');
|
||||||
$result = $query->first();
|
$result = $query->first();
|
||||||
|
$this->currentRep = $result;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -155,26 +165,26 @@ class Piggybank extends Ardent
|
|||||||
public function repetitionForDate(Carbon $date)
|
public function repetitionForDate(Carbon $date)
|
||||||
{
|
{
|
||||||
$query = $this->piggybankrepetitions()->where(
|
$query = $this->piggybankrepetitions()->where(
|
||||||
function ($q) use ($date) {
|
function ($q) use ($date) {
|
||||||
|
|
||||||
$q->where(
|
$q->where(
|
||||||
function ($q) use ($date) {
|
function ($q) use ($date) {
|
||||||
$q->whereNull('startdate');
|
$q->whereNull('startdate');
|
||||||
$q->orWhere('startdate', '<=', $date->format('Y-m-d'));
|
$q->orWhere('startdate', '<=', $date->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
)->where(
|
)->where(
|
||||||
function ($q) use ($date) {
|
function ($q) use ($date) {
|
||||||
$q->whereNull('targetdate');
|
$q->whereNull('targetdate');
|
||||||
$q->orWhere('targetdate', '>=', $date->format('Y-m-d'));
|
$q->orWhere('targetdate', '>=', $date->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)->orWhere(
|
)->orWhere(
|
||||||
function ($q) use ($date) {
|
function ($q) use ($date) {
|
||||||
$q->where('startdate', '>=', $date->format('Y-m-d'));
|
$q->where('startdate', '>=', $date->format('Y-m-d'));
|
||||||
$q->where('targetdate', '>=', $date->format('Y-m-d'));
|
$q->where('targetdate', '>=', $date->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
)->orderBy('startdate', 'ASC');
|
)->orderBy('startdate', 'ASC');
|
||||||
$result = $query->first();
|
$result = $query->first();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@@ -51,44 +51,66 @@ class RecurringTransaction extends Ardent
|
|||||||
return ['created_at', 'updated_at', 'date'];
|
return ['created_at', 'updated_at', 'date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function lastFoundMatch() {
|
||||||
|
$last = $this->transactionjournals()->orderBy('date','DESC')->first();
|
||||||
|
if($last) {
|
||||||
|
return $last->date;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Carbon
|
* Find the next expected match based on the set journals and the date stuff from the recurring
|
||||||
|
* transaction.
|
||||||
*/
|
*/
|
||||||
public function next()
|
public function nextExpectedMatch()
|
||||||
{
|
{
|
||||||
$today = new Carbon;
|
|
||||||
$start = clone $this->date;
|
|
||||||
$skip = $this->skip == 0 ? 1 : $this->skip;
|
|
||||||
if ($today < $start) {
|
|
||||||
return $start;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ($start <= $this->date) {
|
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||||
switch ($this->repeat_freq) {
|
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
||||||
case 'daily':
|
|
||||||
$start->addDays($skip);
|
|
||||||
break;
|
|
||||||
case 'weekly':
|
|
||||||
$start->addWeeks($skip);
|
|
||||||
break;
|
|
||||||
case 'monthly':
|
|
||||||
$start->addMonths($skip);
|
|
||||||
break;
|
|
||||||
case 'quarterly':
|
|
||||||
$start->addMonths($skip * 3);
|
|
||||||
break;
|
|
||||||
case 'half-year':
|
|
||||||
$start->addMonths($skip * 6);
|
|
||||||
break;
|
|
||||||
case 'yearly':
|
|
||||||
$start->addYears($skip);
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The date Firefly tries to find. If this stays null, it's "unknown".
|
||||||
|
*/
|
||||||
|
$finalDate = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $today is the start of the next period, to make sure FF3 won't miss anything
|
||||||
|
* when the current period has a transaction journal.
|
||||||
|
*/
|
||||||
|
$today = $dateKit->addPeriod(new Carbon, $this->repeat_freq, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FF3 loops from the $start of the recurring transaction, and to make sure
|
||||||
|
* $skip works, it adds one (for modulo).
|
||||||
|
*/
|
||||||
|
$skip = $this->skip + 1;
|
||||||
|
$start = $dateKit->startOfPeriod(new Carbon, $this->repeat_freq);
|
||||||
|
/*
|
||||||
|
* go back exactly one month/week/etc because FF3 does not care about 'next'
|
||||||
|
* recurring transactions if they're too far into the past.
|
||||||
|
*/
|
||||||
|
// echo 'Repeat freq is: ' . $recurringTransaction->repeat_freq . '<br />';
|
||||||
|
|
||||||
|
// echo 'Start: ' . $start . ' <br />';
|
||||||
|
|
||||||
|
$counter = 0;
|
||||||
|
while ($start <= $today) {
|
||||||
|
if (($counter % $skip) == 0) {
|
||||||
|
// do something.
|
||||||
|
$end = $dateKit->endOfPeriod(clone $start, $this->repeat_freq);
|
||||||
|
$journalCount = $this->transactionjournals()->before($end)->after($start)->count();
|
||||||
|
if ($journalCount == 0) {
|
||||||
|
$finalDate = clone $start;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $start;
|
// add period for next round!
|
||||||
|
$start = $dateKit->addPeriod($start, $this->repeat_freq, 0);
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
return $finalDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -78,29 +78,6 @@ class Transaction extends Ardent
|
|||||||
return $this->belongsToMany('Component');
|
return $this->belongsToMany('Component');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Piggybank $piggybank
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function connectPiggybank(\Piggybank $piggybank = null)
|
|
||||||
{
|
|
||||||
// TODO connect a piggy bank to a transaction.
|
|
||||||
throw new NotImplementedException;
|
|
||||||
// if (is_null($piggybank)) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// /** @var \Firefly\Storage\Piggybank\PiggybankRepositoryInterface $piggyRepository */
|
|
||||||
// $piggyRepository = \App::make('Firefly\Storage\Piggybank\PiggybankRepositoryInterface');
|
|
||||||
// if ($this->account_id == $piggybank->account_id) {
|
|
||||||
// $this->piggybank()->associate($piggybank);
|
|
||||||
// $this->save();
|
|
||||||
// \Event::fire('piggybanks.createRelatedTransfer', [$piggybank, $this->transactionJournal, $this]);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
|
@@ -1,57 +1,37 @@
|
|||||||
@extends('layouts.default')
|
@extends('layouts.default')
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
|
||||||
<p class="lead">Use categories to group your expenses</p>
|
|
||||||
<p class="text-info">
|
|
||||||
Use categories to group expenses by hobby, for certain types of groceries or what bills are for.
|
|
||||||
Expenses grouped in categories do not have to reoccur every month or every week, like budgets.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div><!-- TODO cleanup to match new theme & form -->
|
|
||||||
|
|
||||||
{{Form::open(['class' => 'form-horizontal','url' => route('categories.store')])}}
|
{{Form::open(['class' => 'form-horizontal','url' => route('categories.store')])}}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-md-12 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||||
<h4>Mandatory fields</h4>
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">
|
||||||
<div class="form-group">
|
<i class="fa fa-exclamation"></i> Mandatory fields
|
||||||
<label for="name" class="col-sm-4 control-label">Name</label>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="panel-body">
|
||||||
<input type="text" name="name" class="form-control" id="name" value="{{Input::old('name')}}" placeholder="Name">
|
{{Form::ffText('name')}}
|
||||||
@if($errors->has('name'))
|
|
||||||
<p class="text-danger">{{$errors->first('name')}}</p>
|
|
||||||
@else
|
|
||||||
<span class="help-block">For example: bike, utilities, daily groceries</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p>
|
||||||
|
<button type="submit" class="btn btn-lg btn-success">
|
||||||
|
<i class="fa fa-plus-circle"></i> Store new category
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||||
<div class="col-lg-6 col-md-12 col-sm-6">
|
|
||||||
|
|
||||||
<!-- add another after this one? -->
|
<!-- panel for options -->
|
||||||
<div class="form-group">
|
<div class="panel panel-default">
|
||||||
<label for="create" class="col-sm-4 control-label"> </label>
|
<div class="panel-heading">
|
||||||
<div class="col-sm-8">
|
<i class="fa fa-bolt"></i> Options
|
||||||
<div class="checkbox">
|
</div>
|
||||||
<label>
|
<div class="panel-body">
|
||||||
{{Form::checkbox('create',1,Input::old('create') == '1')}}
|
{{Form::ffOptionsList('create','category')}}
|
||||||
Create another (return to this form)
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-offset-4 col-sm-8">
|
|
||||||
<button type="submit" class="btn btn-default btn-success">Create the category</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
<table class="table table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>Total</th>
|
|
||||||
<th>{{mf($sum*-1)}}</th>
|
|
||||||
</tr>
|
|
||||||
@foreach($rows as $name => $entry)
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{route('accounts.show',$entry['id'])}}">{{{$name}}}</a></td>
|
|
||||||
<td>{{mf($entry['amount']*-1)}}</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</table><!-- TODO remove me -->
|
|
@@ -1,15 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en-US">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h2>Password Reset</h2>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
To reset your password, complete this form: {{ URL::to('password/reset', array($token)) }}.<br/>
|
|
||||||
This link will expire in {{ Config::get('auth.reminder.expire', 60) }} minutes.
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<!-- TODO remove me -->
|
|
@@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<base href="{{URL::route('index')}}/">
|
<base href="{{URL::route('index')}}/">
|
||||||
<title>Firefly</title>
|
<title>Firefly III</title>
|
||||||
|
|
||||||
{{HTML::style('assets/stylesheets/bootstrap/bootstrap.min.css')}}
|
{{HTML::style('assets/stylesheets/bootstrap/bootstrap.min.css')}}
|
||||||
{{HTML::style('assets/stylesheets/metisMenu/metisMenu.min.css')}}
|
{{HTML::style('assets/stylesheets/metisMenu/metisMenu.min.css')}}
|
||||||
@@ -25,4 +25,4 @@
|
|||||||
@yield('content')
|
@yield('content')
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html><!-- TODO main update title and title-tag -->
|
</html>
|
@@ -1,98 +0,0 @@
|
|||||||
@extends('layouts.default')
|
|
||||||
@section('content')
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
|
||||||
<p class="text-info">
|
|
||||||
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 class="text-info">
|
|
||||||
Firefly gives you the opportunity to create such an envelope when you create a budget. However, you can
|
|
||||||
always add more of them.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div><!-- TODO cleanup and use new forms -->
|
|
||||||
|
|
||||||
{{Form::open(['class' => 'form-horizontal','url' => route('budgets.limits.store',$prefilled['budget_id'])])}}
|
|
||||||
{{Form::hidden('from',e(Input::get('from')))}}
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6 col-md-12 col-sm-6">
|
|
||||||
<h4>Mandatory fields</h4>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('budget_id', 'Budget', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
{{Form::select('budget_id',$budgets,Input::old('budget_id') ?: $prefilled['budget_id'], ['class' =>
|
|
||||||
'form-control'])}}
|
|
||||||
@if($errors->has('budget_id'))
|
|
||||||
<p class="text-danger">{{$errors->first('name')}}</p>
|
|
||||||
@else
|
|
||||||
<span class="help-block">Select one of your existing budgets.</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="period" class="col-sm-4 control-label">Spending period</label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
{{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>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="period" class="col-sm-4 control-label">Repeat</label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" value="1" name="repeats" @if(intval(Input::old('repeats')) == 1) checked @endif>
|
|
||||||
Repeat
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<span class="help-block">If you want, Firefly can automatically recreate the "envelope" and fill it again
|
|
||||||
when the timespan above has expired. Be careful with this option though. It makes it easier
|
|
||||||
to <a href="http://en.wikipedia.org/wiki/Personal_budget#Concepts">fall back to old habits</a>.
|
|
||||||
Instead, you should recreate the envelope yourself each [period].</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('amount', 'Amount', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="number" value="{{Input::old('amount')}}" name="amount" min="0.01" step="any" class="form-control"/>
|
|
||||||
<span class="help-block">Of course, there needs to be money in the envelope.</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('submit', ' ', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="submit" name="submit" value="Save new envelope" class="btn btn-success"/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{Form::close()}}
|
|
||||||
|
|
||||||
|
|
||||||
@stop
|
|
@@ -1,62 +0,0 @@
|
|||||||
@extends('layouts.default')
|
|
||||||
@section('content')
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
|
||||||
<p class="lead">Remember that deleting something is permanent.</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div><!-- TODO cleanup and use new forms -->
|
|
||||||
|
|
||||||
{{Form::open(['class' => 'form-horizontal','url' => route('budgets.limits.destroy',$limit->id)])}}
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<h4> </h4>
|
|
||||||
<p class="text-info">
|
|
||||||
This form allows you to delete the envelope for budget {{{$limit->budget->name}}}, with a content of
|
|
||||||
{{mf($limit->amount,false)}}
|
|
||||||
@if($limit->repeats == 0)
|
|
||||||
in {{$limit->limitrepetitions[0]->startdate->format('M Y')}} ({{$limit->repeat_freq}}).
|
|
||||||
@endif
|
|
||||||
</p>
|
|
||||||
<p class="text-info">
|
|
||||||
Destroying an envelope does not remove any transactions from the budget.
|
|
||||||
</p>
|
|
||||||
<p class="text-danger">
|
|
||||||
Are you sure?
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="submit" name="submit" value="Remove envelope" class="btn btn-danger" />
|
|
||||||
@if(Input::get('from') == 'date')
|
|
||||||
<a href="{{route('budgets.index')}}" class="btn-default btn">Cancel</a>
|
|
||||||
@else
|
|
||||||
<a href="{{route('budgets.index')}}" class="btn-default btn">Cancel</a>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@if($limit->repeats == 1)
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
|
||||||
<h4>Auto repeating</h4>
|
|
||||||
<p class="text-info">
|
|
||||||
This envelope is set to repeat itself; creating a new period whenever the previous period
|
|
||||||
has passed. If you change this envelope, you'll also change the following (automatically created)
|
|
||||||
envelopes.
|
|
||||||
{{$limit->limitrepetitions()->count() }}
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
@foreach($limit->limitrepetitions()->orderBy('startdate','DESC')->get() as $rep)
|
|
||||||
<li>Evenlope for {{$rep->periodShow()}}, {{mf($rep->amount,false)}}</li>
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{{Form::close()}}
|
|
||||||
|
|
||||||
@stop
|
|
@@ -1,115 +0,0 @@
|
|||||||
@extends('layouts.default')
|
|
||||||
@section('content')
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
|
||||||
<p class="text-info">
|
|
||||||
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 class="text-info">
|
|
||||||
This form allows you to edit the envelope for budget {{{$limit->budget->name}}}, with a content of
|
|
||||||
{{mf($limit->amount,false)}}
|
|
||||||
@if($limit->repeats == 0)
|
|
||||||
in {{$limit->limitrepetitions[0]->startdate->format('M Y')}} ({{$limit->repeat_freq}}).
|
|
||||||
@endif
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div><!-- TODO cleanup and use new forms -->
|
|
||||||
|
|
||||||
{{Form::open(['class' => 'form-horizontal','url' => route('budgets.limits.update',$limit->id)])}}
|
|
||||||
{{Form::hidden('from',e(Input::get('from')))}}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6 col-md-12 col-sm-6">
|
|
||||||
<h4>Mandatory fields</h4>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('budget_id', 'Budget', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
{{Form::select('budget_id',$budgets,Input::old('budget_id') ?: $limit->component_id, ['class' =>
|
|
||||||
'form-control'])}}
|
|
||||||
@if($errors->has('budget_id'))
|
|
||||||
<p class="text-danger">{{$errors->first('name')}}</p>
|
|
||||||
@else
|
|
||||||
<span class="help-block">Select one of your existing budgets.</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('startdate', 'Start date', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="date" name="startdate" value="{{Input::old('startdate') ?: $limit->startdate->format('Y-m-d')}}"
|
|
||||||
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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="period" class="col-sm-4 control-label">Spending period</label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
{{Form::select('period',$periods,Input::old('period') ?: $limit->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>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="period" class="col-sm-4 control-label">Repeat</label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" value="1" name="repeats" @if(intval(Input::old('repeats')) == 1 || intval($limit->repeats) == 1) checked @endif>
|
|
||||||
Repeat
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<span class="help-block">If you want, Firefly can automatically recreate the "envelope" and fill it again
|
|
||||||
when the timespan above has expired. Be careful with this option though. It makes it easier
|
|
||||||
to <a href="http://en.wikipedia.org/wiki/Personal_budget#Concepts">fall back to old habits</a>.
|
|
||||||
Instead, you should recreate the envelope yourself each [period].</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('amount', 'Amount', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="number" value="{{ is_null(Input::old('amount')) || Input::old('amount') == '' ? $limit->amount : Input::old('amount')}}" name="amount" min="0.01" step="any" class="form-control"/>
|
|
||||||
<span class="help-block">Of course, there needs to be money in the envelope.</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{{ Form::label('submit', ' ', ['class' => 'col-sm-4 control-label'])}}
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input type="submit" name="submit" value="Update envelope" class="btn btn-success"/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@if($limit->repeats == 1)
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
|
||||||
<h4>Auto repeating</h4>
|
|
||||||
<p class="text-info">
|
|
||||||
This envelope is set to repeat itself; creating a new period whenever the previous period
|
|
||||||
has passed. If you change this envelope, you'll also change the following (automatically created)
|
|
||||||
envelopes.
|
|
||||||
{{$limit->limitrepetitions()->count() }}
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
@foreach($limit->limitrepetitions()->orderBy('startdate','DESC')->get() as $rep)
|
|
||||||
<li>Evenlope for {{$rep->periodShow()}}, {{mf($rep->amount,false)}}</li>
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{Form::close()}}
|
|
||||||
|
|
||||||
|
|
||||||
@stop
|
|
@@ -32,10 +32,20 @@
|
|||||||
{{mf($entry->amount_max)}}
|
{{mf($entry->amount_max)}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- TODO -->
|
<?php $lastMatch = $entry->lastFoundMatch();?>
|
||||||
|
@if($lastMatch)
|
||||||
|
{{$lastMatch->format('j F Y')}}
|
||||||
|
@else
|
||||||
|
<em>Unknown</em>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- TODO -->
|
<?php $nextExpectedMatch = $entry->nextExpectedMatch();?>
|
||||||
|
@if($nextExpectedMatch)
|
||||||
|
{{$nextExpectedMatch->format('j F Y')}}
|
||||||
|
@else
|
||||||
|
<em>Unknown</em>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if($entry->active)
|
@if($entry->active)
|
||||||
|
@@ -1,63 +0,0 @@
|
|||||||
<table class="table">
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
@foreach($journals as $journal)
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
@if($journal->transactiontype->type == 'Withdrawal')
|
|
||||||
<span class="glyphicon glyphicon-arrow-left" title="Withdrawal"></span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Deposit')
|
|
||||||
<span class="glyphicon glyphicon-arrow-right" title="Deposit"></span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Transfer')
|
|
||||||
<span class="glyphicon glyphicon-resize-full" title="Transfer"></span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Opening balance')
|
|
||||||
<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
bud / cat
|
|
||||||
</td>
|
|
||||||
<td><a href="#" title="{{{$journal->description}}}">{{{$journal->description}}}</a></td>
|
|
||||||
<td>
|
|
||||||
@if($journal->transactiontype->type == 'Withdrawal')
|
|
||||||
<span class="text-danger">{{mf($journal->transactions[1]->amount,false)}}</span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Deposit')
|
|
||||||
<span class="text-success">{{mf($journal->transactions[1]->amount,false)}}</span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Transfer')
|
|
||||||
<span class="text-info">{{mf($journal->transactions[1]->amount,false)}}</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if($journal->transactions[0]->account->accounttype->description == 'Cash account')
|
|
||||||
<span class="text-success">(cash)</span>
|
|
||||||
@else
|
|
||||||
<a href="#">{{{$journal->transactions[0]->account->name}}}</a>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if($journal->transactions[1]->account->accounttype->description == 'Cash account')
|
|
||||||
<span class="text-success">(cash)</span>
|
|
||||||
@else
|
|
||||||
<a href="#">{{{$journal->transactions[1]->account->name}}}</a>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="btn-group btn-group-xs">
|
|
||||||
<a href="{{route('transactions.edit',$journal->id)}}" class="btn btn-default">
|
|
||||||
<span class="glyphicon glyphicon-pencil"></span>
|
|
||||||
<a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-danger">
|
|
||||||
<span class="glyphicon glyphicon-trash"></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{{$journals->links()}}
|
|
@@ -1,27 +0,0 @@
|
|||||||
<div class="list-group">
|
|
||||||
@foreach($transactions as $journal)
|
|
||||||
<a class="list-group-item" title="{{$journal->date->format('jS M Y')}}" href="{{route('transactions.show',$journal->id)}}">
|
|
||||||
|
|
||||||
@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-arrows-h fa-fw" title="Transfer"></i>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
{{{$journal->description}}}
|
|
||||||
|
|
||||||
<span class="pull-right small">
|
|
||||||
@foreach($journal->transactions as $t)
|
|
||||||
@if($t->account_id == $account->id)
|
|
||||||
{{mf($t->amount)}}
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
@@ -1,33 +0,0 @@
|
|||||||
<div class="list-group">
|
|
||||||
@foreach($transactions as $journal)
|
|
||||||
<a class="list-group-item" title="{{$journal->date->format('jS M Y')}}" href="{{route('transactions.show',$journal->id)}}">
|
|
||||||
|
|
||||||
@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-arrows-h fa-fw" title="Transfer"></i>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
{{{$journal->description}}}
|
|
||||||
|
|
||||||
<span class="pull-right small">
|
|
||||||
@foreach($journal->transactions as $t)
|
|
||||||
@if($journal->transactiontype->type == 'Withdrawal' && $t->amount < 0)
|
|
||||||
{{mf($t->amount)}}
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Deposit' && $t->amount > 0)
|
|
||||||
{{mf($t->amount)}}
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Transfer' && $t->amount > 0)
|
|
||||||
{{mf($t->amount)}}
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
@@ -1,120 +0,0 @@
|
|||||||
<table class="table table-striped table-condensed" id="transactionTable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2" id="empty1">A</th>
|
|
||||||
<th>Date</th><!-- TODO remove me-->
|
|
||||||
<th>Description</th>
|
|
||||||
<th>Amount (€)</th>
|
|
||||||
<th>From</th>
|
|
||||||
<th>To</th>
|
|
||||||
<th id="empty2">B</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<?php $expenses = 0;$incomes = 0;$transfers = 0; ?>
|
|
||||||
@foreach($journals as $journal)
|
|
||||||
@if(isset($journal->transactions[0]) && isset($journal->transactions[1]))
|
|
||||||
<tr
|
|
||||||
@if(isset($highlight) && $highlight == $journal->id)
|
|
||||||
class="success"
|
|
||||||
@endif
|
|
||||||
>
|
|
||||||
<td>
|
|
||||||
@if($journal->transactiontype->type == 'Withdrawal')
|
|
||||||
<span class="glyphicon glyphicon-arrow-left" title="Withdrawal"></span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Deposit')
|
|
||||||
<span class="glyphicon glyphicon-arrow-right" title="Deposit"></span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Transfer')
|
|
||||||
<span class="glyphicon glyphicon-resize-full" title="Transfer"></span>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Opening balance')
|
|
||||||
<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@foreach($journal->components as $component)
|
|
||||||
@if($component->class == 'Budget')
|
|
||||||
<a href="{{route('budgets.show',$component->id)}}?highlight={{$journal->id}}"><span class="glyphicon glyphicon-tasks" title="Budget: {{{$component->name}}}"></span></a>
|
|
||||||
@endif
|
|
||||||
@if($component->class == 'Category')
|
|
||||||
<a href="{{route('categories.show',$component->id)}}?highlight={{$journal->id}}"><span class="glyphicon glyphicon-tag" title="Category: {{{$component->name}}}"></span></a>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
<!-- recurring transaction -->
|
|
||||||
@if(!is_null($journal->recurringTransaction))
|
|
||||||
<a href="{{route('recurring.show',$journal->recurring_transaction_id)}}" title="{{{$journal->recurringTransaction->name}}}"><span title="{{{$journal->recurringTransaction->name}}}" class="glyphicon glyphicon-refresh"></span></a>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{$journal->date->format('d F Y')}}
|
|
||||||
</td>
|
|
||||||
<td><a href="{{route('transactions.show',$journal->id)}}" title="{{{$journal->description}}}">{{{$journal->description}}}</a></td>
|
|
||||||
<td>
|
|
||||||
@if($journal->transactiontype->type == 'Withdrawal')
|
|
||||||
<span class="text-danger">{{mf($journal->transactions[1]->amount,false)}}</span>
|
|
||||||
<?php $expenses -= $journal->transactions[1]->amount;?>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Deposit')
|
|
||||||
<span class="text-success">{{mf($journal->transactions[1]->amount,false)}}</span>
|
|
||||||
<?php $incomes += $journal->transactions[1]->amount;?>
|
|
||||||
@endif
|
|
||||||
@if($journal->transactiontype->type == 'Transfer')
|
|
||||||
<span class="text-info">{{mf($journal->transactions[1]->amount,false)}}</span>
|
|
||||||
<?php $transfers += $journal->transactions[1]->amount;?>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{route('accounts.show',$journal->transactions[0]->account_id)}}">{{{$journal->transactions[0]->account->name}}}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if($journal->transactiontype->type != 'Opening balance')
|
|
||||||
<div class="btn-group btn-group-xs">
|
|
||||||
<a href="{{route('transactions.edit',$journal->id)}}" class="btn btn-default">
|
|
||||||
<span class="glyphicon glyphicon-pencil"></span>
|
|
||||||
<a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-danger">
|
|
||||||
<span class="glyphicon glyphicon-trash"></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@else
|
|
||||||
<!--
|
|
||||||
<tr class="danger">
|
|
||||||
<td colspan="7">Invalid data found. Please delete this transaction and recreate it.</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-danger btn-xs">
|
|
||||||
<span class="glyphicon glyphicon-trash"></span>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
-->
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
@if(isset($sum) && $sum == true)
|
|
||||||
@if($expenses != 0)
|
|
||||||
<tr>
|
|
||||||
<td colspan="4">Expenses:</td>
|
|
||||||
<td colspan="4">{{mf($expenses)}}</td>
|
|
||||||
</tr>
|
|
||||||
@endif
|
|
||||||
@if($incomes != 0)
|
|
||||||
<tr>
|
|
||||||
<td colspan="4">Incomes:</td>
|
|
||||||
<td colspan="4">{{mf($incomes)}}</td>
|
|
||||||
</tr>
|
|
||||||
@endif
|
|
||||||
@if($transfers != 0)
|
|
||||||
<tr>
|
|
||||||
<td colspan="4">Transfers:</td>
|
|
||||||
<td colspan="4" class="text-info">{{mf($transfers,false)}}</td>
|
|
||||||
</tr>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
|
@@ -1,3 +0,0 @@
|
|||||||
{{$journals->links()}}
|
|
||||||
@include('lists.transactions')
|
|
||||||
{{$journals->links()}} <!-- TODO is this even used? -->
|
|
@@ -8,7 +8,7 @@
|
|||||||
<i class="fa fa-fw fa-clock-o"></i> Events
|
<i class="fa fa-fw fa-clock-o"></i> Events
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="piggybank-history"></div> <!-- TODO -->
|
<div id="piggybank-history"></div> <!-- TODO piggy bank events -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -30,11 +30,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Saved so far</td>
|
<td>Saved so far</td>
|
||||||
<td>{{mf(0)}}</td> <!-- TODO -->
|
<td>{{mf($piggybank->currentRelevantRep()->currentamount)}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Left to save</td>
|
<td>Left to save</td>
|
||||||
<td>{{mf(0)}}</td> <!-- TODO -->
|
<td>{{mf($piggybank->targetamount-$piggybank->currentRelevantRep()->currentamount)}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Start date</td>
|
<td>Start date</td>
|
||||||
@@ -72,11 +72,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Reminders left</td>
|
<td>Reminders left</td>
|
||||||
<td>12</td> <!-- TODO -->
|
<td>12</td> <!-- TODO piggy bank reminders-->
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Expected amount per reminder</td>
|
<td>Expected amount per reminder</td>
|
||||||
<td>{{mf(0)}}</td> <!-- TODO -->
|
<td>{{mf(0)}}</td> <!-- TODO piggy bank reminder -->
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -84,129 +84,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{--
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
|
||||||
<div class="btn-group">
|
|
||||||
<a href="{{route('piggybanks.edit',$piggybank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
|
|
||||||
<a href="{{route('piggybanks.delete',$piggybank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a>
|
|
||||||
|
|
||||||
@if(min(max($balance,$leftOnAccount),$piggybank->targetamount) > 0)
|
|
||||||
<a data-toggle="modal" href="{{route('piggybanks.amount.add',$piggybank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-plus-sign"></span> Add money</a>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if($piggybank->currentRelevantRep()->currentamount > 0)
|
|
||||||
<a data-toggle="modal" href="{{route('piggybanks.amount.remove',$piggybank->id)}}" data-target="#modal" class="btn btn-default"><span class="glyphicon glyphicon-minus-sign"></span> Remove money</a>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div><!-- TODO cleanup for new forms and layout. -->
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
|
||||||
<h3>General information</h3>
|
|
||||||
<table class="table table-bordered table-striped">
|
|
||||||
<tr>
|
|
||||||
<th>Field</th>
|
|
||||||
<th>Value</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Account</td>
|
|
||||||
<td><a href="{{route('accounts.show',$piggybank->account_id)}}">{{{$piggybank->account->name}}}</a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Target amount</td>
|
|
||||||
<td>{{mf($piggybank->targetamount)}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Start date</td>
|
|
||||||
<td>
|
|
||||||
@if(is_null($piggybank->startdate))
|
|
||||||
<em>No start date</em>
|
|
||||||
@else
|
|
||||||
{{$piggybank->startdate->format('jS F Y')}}
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Target date</td>
|
|
||||||
<td>
|
|
||||||
@if(is_null($piggybank->targetdate))
|
|
||||||
<em>No target date</em>
|
|
||||||
@else
|
|
||||||
{{$piggybank->targetdate->format('jS F Y')}}
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Repeats every</td>
|
|
||||||
<td>
|
|
||||||
@if(!is_null($piggybank->rep_length))
|
|
||||||
Every {{$piggybank->rep_every}} {{$piggybank->rep_length}}(s)
|
|
||||||
@if(!is_null($piggybank->rep_times))
|
|
||||||
({{$piggybank->rep_times}} times)
|
|
||||||
@else
|
|
||||||
(indefinitely)
|
|
||||||
@endif
|
|
||||||
@else
|
|
||||||
<em>Does not repeat</em>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Reminder</td>
|
|
||||||
<td>
|
|
||||||
@if(is_null($piggybank->reminder))
|
|
||||||
<em>(no reminder)</em>
|
|
||||||
@else
|
|
||||||
Every {{$piggybank->reminder_skip}} {{$piggybank->reminder}}(s)
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
|
||||||
<h3>Piggy bank instances info</h3>
|
|
||||||
@foreach($piggybank->piggybankrepetitions()->orderBy('startdate')->get() as $rep)
|
|
||||||
<table class="table table-bordered table-striped">
|
|
||||||
<tr>
|
|
||||||
<th style="width:50%;">Field</th>
|
|
||||||
<th>Value</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>ID</td>
|
|
||||||
<td>#{{$rep->id}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Current amount</td>
|
|
||||||
<td>{{mf($rep->currentamount)}} of {{mf($piggybank->targetamount)}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Start date</td>
|
|
||||||
<td>
|
|
||||||
@if(is_null($rep->startdate))
|
|
||||||
<em>No start date</em>
|
|
||||||
@else
|
|
||||||
{{$rep->startdate->format('jS F Y')}}
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Target date</td>
|
|
||||||
<td>
|
|
||||||
@if(is_null($rep->targetdate))
|
|
||||||
<em>No target date</em>
|
|
||||||
@else
|
|
||||||
{{$rep->targetdate->format('jS F Y')}}
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
--}}
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
|
@@ -46,8 +46,15 @@
|
|||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Next reminder</td>
|
<td>Next expected match</td>
|
||||||
<td>some date <!-- TODO --></td>
|
<td>
|
||||||
|
<?php $nextExpectedMatch = $recurring->nextExpectedMatch();?>
|
||||||
|
@if($nextExpectedMatch)
|
||||||
|
{{$nextExpectedMatch->format('j F Y')}}
|
||||||
|
@else
|
||||||
|
<em>Unknown</em>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,6 +74,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-sm-12 col-md-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Chart
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<!-- TODO chart with hits, grouped by repeat_freq and two lines with max/min amount -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-sm-12 col-md-12">
|
<div class="col-lg-12 col-sm-12 col-md-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
@extends('layouts.default')
|
@extends('layouts.default')
|
||||||
@section('content')
|
@section('content')
|
||||||
@if(!is_null($query))
|
@if(!is_null($query))
|
||||||
<div class="row"><!-- TODO cleanup for new forms and layout and see if it actually still works. -->
|
<div class="row">
|
||||||
@if(isset($result['transactions']) && $result['transactions']->count() > 0)
|
@if(isset($result['transactions']) && $result['transactions']->count() > 0)
|
||||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
Reference in New Issue
Block a user