mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-08 15:05:29 +00:00
- Updated transaction controller to need less code for the same work.
- Small feedback bug in migration controller - Better database create scripts. - Fixed bug in seed scripts. - Cleanup and fixed sorting in various helpers - Extended some tests to catch changed code. - Created show(journal) and edit(journal) (untested) [skip-ci]
This commit is contained in:
@@ -18,10 +18,9 @@
|
||||
<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%;" class="form-control input-sm">
|
||||
<input value="{{Session::get('end')->format('Y-m-d')}}" name="end" type="date" style="width:15%;" class="form-control input-sm">
|
||||
<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>
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Add... <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
|
||||
<li><a href="{{route('transactions.withdrawal')}}" title="For when you spend money"><span class="glyphicon glyphicon-arrow-left"></span> Withdrawal</a></li>
|
||||
<li><a href="{{route('transactions.deposit')}}" title="For when you earn money"><span class="glyphicon glyphicon-arrow-right"></span> Deposit</a></li>
|
||||
<li><a href="{{route('transactions.transfer')}}" title="For when you move money around"><span class="glyphicon glyphicon-resize-full"></span> Transfer</a></li>
|
||||
<li><a href="{{route('transactions.create','withdrawal')}}" title="For when you spend money"><span class="glyphicon glyphicon-arrow-left"></span> Withdrawal</a></li>
|
||||
<li><a href="{{route('transactions.create','deposit')}}" title="For when you earn money"><span class="glyphicon glyphicon-arrow-right"></span> Deposit</a></li>
|
||||
<li><a href="{{route('transactions.create','transfer')}}" title="For when you move money around"><span class="glyphicon glyphicon-resize-full"></span> Transfer</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
164
app/views/transactions/create.blade.php
Normal file
164
app/views/transactions/create.blade.php
Normal file
@@ -0,0 +1,164 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<h1>Firefly
|
||||
<small>Add a new {{$what}}</small>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<p class="text-info">
|
||||
Technically speaking, withdrawals, deposits and transfers are all transactions, moving money from
|
||||
account <em>A</em> to account <em>B</em>.
|
||||
</p>
|
||||
<p class="text-info">
|
||||
@if($what == 'withdrawal')
|
||||
A withdrawal is when you spend money on something, moving an amount to a <em>beneficiary</em>.
|
||||
@endif
|
||||
@if($what == 'deposit')
|
||||
A deposit is when you earn money, moving an amount from a beneficiary into your own account.
|
||||
@endif
|
||||
@if($what == 'transfer')
|
||||
TRANSFER
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{Form::open(['class' => 'form-horizontal','url' => route('transactions.store',$what)])}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<h4>Mandatory fields</h4>
|
||||
|
||||
<!-- ALWAYS AVAILABLE -->
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-sm-4 control-label">Description</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="description" value="{{{Input::old('description')}}}" autocomplete="off" class="form-control" placeholder="Description" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SHOW ACCOUNT (FROM) ONLY FOR WITHDRAWALS AND DEPOSITS -->
|
||||
@if($what == 'deposit' || $what == 'withdrawal')
|
||||
<div class="form-group">
|
||||
<label for="account_id" class="col-sm-4 control-label">
|
||||
@if($what == 'deposit')
|
||||
Receiving account
|
||||
@endif
|
||||
@if($what == 'withdrawal')
|
||||
Paid from account
|
||||
@endif
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
{{Form::select('account_id',$accounts,Input::old('account_id'),['class' => 'form-control'])}}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- SHOW BENEFICIARY (ACCOUNT TO) ONLY FOR WITHDRAWALS AND DEPOSITS -->
|
||||
@if($what == 'deposit' || $what == 'withdrawal')
|
||||
<div class="form-group">
|
||||
<label for="beneficiary" class="col-sm-4 control-label">
|
||||
@if($what == 'deposit')
|
||||
Paying beneficiary
|
||||
@endif
|
||||
@if($what == 'withdrawal')
|
||||
Beneficiary
|
||||
@endif
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="beneficiary" value="{{{Input::old('beneficiary')}}}" autocomplete="off" class="form-control" placeholder="Beneficiary" />
|
||||
<span class="help-block">This field will auto-complete your existing beneficiaries (if any), but you can type freely to create new ones.</span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- ONLY SHOW FROM/TO ACCOUNT WHEN CREATING TRANSFER -->
|
||||
@if($what == 'transfer')
|
||||
<div class="form-group">
|
||||
<label for="account_from_id" class="col-sm-4 control-label">Account from</label>
|
||||
<div class="col-sm-8">
|
||||
{{Form::select('account_to_id',$accounts,Input::old('account_from_id'),['class' => 'form-control'])}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="account_to_id" class="col-sm-4 control-label">Account to</label>
|
||||
<div class="col-sm-8">
|
||||
{{Form::select('account_from_id',$accounts,Input::old('account_to_id'),['class' => 'form-control'])}}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- ALWAYS SHOW AMOUNT -->
|
||||
<div class="form-group">
|
||||
<label for="amount" class="col-sm-4 control-label">
|
||||
@if($what == 'withdrawal')
|
||||
Amount spent
|
||||
@endif
|
||||
@if($what == 'deposit')
|
||||
Amount received
|
||||
@endif
|
||||
@if($what == 'transfer')
|
||||
Amount transferred
|
||||
@endif
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" name="amount" min="0.01" value="{{Input::old('amount') or 0}}" step="any" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ALWAYS SHOW DATE -->
|
||||
<div class="form-group">
|
||||
<label for="date" class="col-sm-4 control-label">Date</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="date" name="date" value="{{Input::old('date') ?: date('Y-m-d')}}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ALWAYS SHOW SUBMit -->
|
||||
<div class="form-group">
|
||||
<label for="submit" class="col-sm-4 control-label"> </label>
|
||||
<div class="col-sm-8">
|
||||
<input type="submit" name="submit" value="Create {{$what}}" class="btn btn-info" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<h4>Optional fields</h4>
|
||||
|
||||
<!-- ONLY WHEN CREATING A WITHDRAWAL -->
|
||||
@if($what == 'withdrawal')
|
||||
<div class="form-group">
|
||||
<label for="budget_id" class="col-sm-4 control-label">Budget</label>
|
||||
<div class="col-sm-8">
|
||||
{{Form::select('budget_id',$budgets,Input::old('budget_id') ?: 0,['class' => 'form-control'])}}
|
||||
<span class="help-block">Select one of your budgets to make this transaction a part of it.</span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category" class="col-sm-4 control-label">Category</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="category" value="" autocomplete="off" class="form-control" placeholder="Category" />
|
||||
<span class="help-block">Add more fine-grained information to this transaction by entering a category.
|
||||
Like the beneficiary-field, this field will auto-complete existing categories but can also be used
|
||||
to create new ones.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
|
||||
<script type="text/javascript" src="assets/javascript/withdrawal.js"></script>
|
||||
@stop
|
||||
98
app/views/transactions/edit.blade.php
Normal file
98
app/views/transactions/edit.blade.php
Normal file
@@ -0,0 +1,98 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<h1>Firefly
|
||||
<small>Edit transaction ""</small>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<p class="text-info">
|
||||
Technically speaking, withdrawals, deposits and transfers are all transactions, moving money from
|
||||
account <em>A</em> to account <em>B</em>.
|
||||
</p>
|
||||
<p class="text-info">
|
||||
A deposit is when you earn money, moving an amount from a beneficiary into your own account.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{Form::open(['class' => 'form-horizontal'])}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<h4>Mandatory fields</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-sm-4 control-label">Description</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="description" value="{{{Input::old('description')}}}" autocomplete="off" class="form-control" placeholder="Description" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="beneficiary" class="col-sm-4 control-label">Beneficiary (payer)</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="beneficiary" value="{{{Input::old('beneficiary')}}}" autocomplete="off" class="form-control" placeholder="Beneficiary" />
|
||||
<span class="help-block">This field will auto-complete your existing beneficiaries (if any), but you can type freely to create new ones.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="account_id" class="col-sm-4 control-label">Account</label>
|
||||
<div class="col-sm-8">
|
||||
{{Form::select('account_id',$accounts,Input::old('account_id'),['class' => 'form-control'])}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amount" class="col-sm-4 control-label">Amount spent</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" name="amount" min="0.01" value="{{Input::old('amount') or 0}}" step="any" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="date" class="col-sm-4 control-label">Date</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="date" name="date" value="{{Input::old('date') ?: date('Y-m-d')}}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="submit" class="col-sm-4 control-label"> </label>
|
||||
<div class="col-sm-8">
|
||||
<input type="submit" name="submit" value="Create deposit" class="btn btn-info" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<h4>Optional fields</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="category" class="col-sm-4 control-label">Category</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="category" value="" autocomplete="off" class="form-control" placeholder="Category" />
|
||||
<span class="help-block">Add more fine-grained information to this transaction by entering a category.
|
||||
Like the beneficiary-field, this field will auto-complete existing categories but can also be used
|
||||
to create new ones.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
|
||||
<script type="text/javascript" src="assets/javascript/withdrawal.js"></script>
|
||||
@stop
|
||||
@@ -20,7 +20,7 @@
|
||||
@endif
|
||||
|
||||
</td>
|
||||
<td><a href="#">{{{$journal->description}}}</a></td>
|
||||
<td><a href="{{route('transactions.show',$journal->id)}}">{{{$journal->description}}}</a></td>
|
||||
<td>{{$journal->date->format('jS M Y')}}</td>
|
||||
<td>
|
||||
@foreach($journal->transactions as $t)
|
||||
|
||||
77
app/views/transactions/show.blade.php
Normal file
77
app/views/transactions/show.blade.php
Normal file
@@ -0,0 +1,77 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<h1>Firefly
|
||||
<small>Transaction "{{{$journal->description}}}"</small>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<h3>Metadata</h3>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>{{{$journal->date->format('jS F Y')}}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Currency</td>
|
||||
<td>{{{$journal->transactioncurrency->code}}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type</td>
|
||||
<td>{{{$journal->transactiontype->type}}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Completed</td>
|
||||
<td>
|
||||
@if($journal->completed == 1)
|
||||
<span class="text-success">Yes</span>
|
||||
@else
|
||||
<span class="text-danger">No</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@foreach($journal->components as $component)
|
||||
<tr>
|
||||
<td>{{$component->class}}</td>
|
||||
<td>{{{$component->name}}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<h3>Transactions</h3>
|
||||
@foreach($journal->transactions as $t)
|
||||
<h4>{{{$t->account->name}}}<br /><small>{{{$t->account->accounttype->description}}}</small></h4>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>Amount</td>
|
||||
<td>{{mf($t->amount)}}</td>
|
||||
</tr>
|
||||
@if(!is_null($t->description))
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>{{{$t->description}}}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" href="{{route('transactions.edit',$journal->id)}}"><span class="glyphicon glyphicon-pencil"></span> Edit</a> <a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
@stop
|
||||
Reference in New Issue
Block a user