mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Added the ability to manually add or remove money from piggy banks (issue #6) [skip ci]
This commit is contained in:
@@ -66,9 +66,17 @@
|
||||
@endif
|
||||
|
||||
</p>
|
||||
<div class="btn-group-xs btn-group">
|
||||
<div class="btn-group-sm btn-group">
|
||||
<a href="{{route('piggybanks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
@if($piggyBank->leftInAccount > 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
|
||||
<a href="{{route('piggybanks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -114,9 +122,16 @@
|
||||
|
||||
|
||||
</p>
|
||||
<div class="btn-group-xs btn-group">
|
||||
<a href="{{route('piggybanks.edit',$repeated->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
<a href="{{route('piggybanks.delete',$repeated->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="{{route('piggybanks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
@if($piggyBank->leftInAccount > 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
|
||||
<a href="{{route('piggybanks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
|
||||
</div>
|
||||
</td></tr>
|
||||
@endif
|
||||
@@ -125,6 +140,18 @@
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL -->
|
||||
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
<?php echo javascript_include_tag('piggybanks'); ?>
|
||||
|
||||
62
app/views/piggybanks/modifyAmount.blade.php
Normal file
62
app/views/piggybanks/modifyAmount.blade.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">
|
||||
@if($what == 'add')
|
||||
Add money to "{{{$piggybank->name}}}"
|
||||
@else
|
||||
Remove money from "{{{$piggybank->name}}}"
|
||||
@endif
|
||||
</h4>
|
||||
</div>
|
||||
<form style="display: inline;" action="{{route('piggybanks.modMoney',$piggybank->id)}}" method="POST">
|
||||
<input type="hidden" name="what" value="{{$what}}" />
|
||||
{{Form::token()}}
|
||||
<div class="modal-body">
|
||||
<p class="text-info">
|
||||
@if($what == 'add')
|
||||
Usually you would add money to this
|
||||
@if($piggybank->repeated == 1)
|
||||
repeated expense
|
||||
@else
|
||||
piggy bank
|
||||
@endif
|
||||
by transferring it from one of your accounts to "{{{$piggybank->account->name}}}". However,
|
||||
since there is still {{mf($maxAdd)}} on that account not locked in any piggy bank or repeated expense,
|
||||
you can also add it manually.
|
||||
|
||||
@else
|
||||
|
||||
If you need the money in this
|
||||
@if($piggybank->repeated == 1)
|
||||
repeated expense
|
||||
@else
|
||||
piggy bank
|
||||
@endif
|
||||
for something else, you can opt to remove it using this form. Since there is {{mf($maxRemove)}} in this
|
||||
@if($piggybank->repeated == 1)
|
||||
repeated expense
|
||||
@else
|
||||
piggy bank
|
||||
@endif
|
||||
that is the maximum amount of money you can remove using this form.
|
||||
@endif
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label for="amount">Amount to {{$what}}</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">€</div>
|
||||
@if($what == 'add')
|
||||
<input type="number" step="any" max="{{min($maxAdd,$piggybank->targetamount)}}" min="0.01" class="form-control" id="amount" name="amount">
|
||||
@else
|
||||
<input type="number" step="any" max="{{$maxRemove}}" min="0.01" class="form-control" id="amount" name="amount">
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<input type="submit" class="btn btn-primary" value="Submit" name="submit" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
<h1>Firefly
|
||||
<small>Piggy bank "{{{$piggyBank->name}}}"</small>
|
||||
</h1>
|
||||
<p>
|
||||
<a href="{{route('accounts.show',$piggyBank->account_id)}}">{{{$piggyBank->account->name}}}</a> has
|
||||
a balance of {{mf($piggyBank->account->balance())}}.
|
||||
Of that {{mf($piggyBank->account->balance())}}, you have {{mf(0)}} not yet locked up in other piggy banks.
|
||||
You can add {{mf(max(0,1))}} to this piggy bank.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user