Skip to content

Firefly III: a personal finances manager

Expand views and JS.

James Cole919a0c01e4f7
diff --git a/app/views/accounts/edit.blade.php b/app/views/accounts/edit.blade.php
index c978deeb62..0eb2afc949 100644
--- a/app/views/accounts/edit.blade.php
+++ b/app/views/accounts/edit.blade.php
@@ -28,6 +28,7 @@
@if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account')
{{Form::ffBalance('openingbalance')}}
{{Form::ffDate('openingbalancedate')}}
+ {{Form::ffSelect('account_role',$roles)}}
@endif
</div>
</div>
diff --git a/app/views/list/accounts.blade.php b/app/views/list/accounts.blade.php
index 3b86218129..0bbf841fc6 100644
--- a/app/views/list/accounts.blade.php
+++ b/app/views/list/accounts.blade.php
@@ -2,6 +2,7 @@
<tr>
<th>&nbsp;</th>
<th>Name</th>
+ <th>Role</th>
<th>Current balance</th>
<th>Active</th>
<th>Last activity</th>
@@ -15,6 +16,7 @@
</div>
</td>
<td><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></td>
+ <td>{{{$account->accountRole}}}</td>
<td>{{mf(Steam::balance($account))}}</td>
<td>
@if($account->active)
diff --git a/app/views/transactions/show.blade.php b/app/views/transactions/show.blade.php
index d1395b124f..474ce848fa 100644
--- a/app/views/transactions/show.blade.php
+++ b/app/views/transactions/show.blade.php
@@ -72,7 +72,7 @@
<table class="table">
@foreach($members as $jrnl)
<tr>
- <td><input type="checkbox" checked="checked" data-id="{{$jrnl->id}}" class="relate-checkbox" /></td>
+ <td><input type="checkbox" checked="checked" data-relatedto="{{$journal->id}}" data-id="{{$jrnl->id}}" class="unrelate-checkbox" /></td>
<td><a href="#">{{{$jrnl->description}}}</a></td>
<td>{{mf($jrnl->getAmount())}}</td>
</tr>
@@ -81,7 +81,7 @@
@endif
<div class="panel-footer">
<p>
- <a href="#" id="relateTransaction" data-id="{{$journal->id}}" class="btn btn-default"><i data-id="{{$journal->id}}" class="fa fa-compress"></i> Relate to another transaction</a>
+ <a href="#" data-id="{{$journal->id}}" class="relateTransaction btn btn-default"><i data-id="{{$journal->id}}" class="fa fa-compress"></i> Relate to another transaction</a>
</p>
</div>
</div>
@@ -127,4 +127,5 @@
@stop
@section('scripts')
{{HTML::script('assets/javascript/firefly/transactions.js')}}
+{{HTML::script('assets/javascript/firefly/related-manager.js')}}
@stop
\ No newline at end of file
diff --git a/public/assets/javascript/firefly/related-manager.js b/public/assets/javascript/firefly/related-manager.js
index 0e70a7708e..dc4171512a 100644
--- a/public/assets/javascript/firefly/related-manager.js
+++ b/public/assets/javascript/firefly/related-manager.js
@@ -1,8 +1,22 @@
$(document).ready(function () {
$('.relateTransaction').click(relateTransaction);
+ $('.unrelate-checkbox').click(unrelateTransaction);
});
+function unrelateTransaction(e) {
+ var target = $(e.target);
+ var id = target.data('id');
+ var relatedTo = target.data('relatedto');
+
+ $.post('transactions/unrelate/' + relatedTo, {relation: id}).success(function (data) {
+ target.parent().parent().remove();
+ }).fail(function () {
+ alert('Could not!');
+ });
+
+}
+
function relateTransaction(e) {
var target = $(e.target);
var ID = target.data('id');
@@ -12,7 +26,6 @@ function relateTransaction(e) {
$('#relationModal').empty().load('transaction/relate/' + ID, function () {
$('#relationModal').modal('show');
- console.log($('#searchRelated').length + '!');
getAlreadyRelatedTransactions(e, ID);
$('#searchRelated').submit(function (e) {
searchRelatedTransactions(e, ID);
@@ -20,7 +33,6 @@ function relateTransaction(e) {
return false;
});
});
- console.log($('#searchRelated').length);
return false;
diff --git a/public/assets/javascript/firefly/transactions.js b/public/assets/javascript/firefly/transactions.js
index f51d91fac2..5719db469c 100644
--- a/public/assets/javascript/firefly/transactions.js
+++ b/public/assets/javascript/firefly/transactions.js
@@ -18,16 +18,4 @@ $(document).ready(function () {
if(typeof googleTablePaged != 'undefined') {
googleTablePaged('table/transactions/' + what,'transaction-table');
}
- if($('#relateTransaction').length == 1) {
- $('#relateTransaction').click(relateTransaction);
- }
-});
-
-
-function relateTransaction(e) {
- var target = $(e.target);
- var ID = target.data('id');
- alert("TODO remove me");
- $('#relationModal').empty().load('transaction/relate/' + ID).modal('show');
- return false;
-}
\ No newline at end of file
+});
\ No newline at end of file