Expand views and JS.

This commit is contained in:
James Cole
2014-12-05 21:39:48 +01:00
parent 6ff618e388
commit 919a0c01e4
5 changed files with 21 additions and 17 deletions

View File

@@ -28,6 +28,7 @@
@if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account') @if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account')
{{Form::ffBalance('openingbalance')}} {{Form::ffBalance('openingbalance')}}
{{Form::ffDate('openingbalancedate')}} {{Form::ffDate('openingbalancedate')}}
{{Form::ffSelect('account_role',$roles)}}
@endif @endif
</div> </div>
</div> </div>

View File

@@ -2,6 +2,7 @@
<tr> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>Name</th> <th>Name</th>
<th>Role</th>
<th>Current balance</th> <th>Current balance</th>
<th>Active</th> <th>Active</th>
<th>Last activity</th> <th>Last activity</th>
@@ -15,6 +16,7 @@
</div> </div>
</td> </td>
<td><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></td> <td><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></td>
<td>{{{$account->accountRole}}}</td>
<td>{{mf(Steam::balance($account))}}</td> <td>{{mf(Steam::balance($account))}}</td>
<td> <td>
@if($account->active) @if($account->active)

View File

@@ -72,7 +72,7 @@
<table class="table"> <table class="table">
@foreach($members as $jrnl) @foreach($members as $jrnl)
<tr> <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><a href="#">{{{$jrnl->description}}}</a></td>
<td>{{mf($jrnl->getAmount())}}</td> <td>{{mf($jrnl->getAmount())}}</td>
</tr> </tr>
@@ -81,7 +81,7 @@
@endif @endif
<div class="panel-footer"> <div class="panel-footer">
<p> <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> </p>
</div> </div>
</div> </div>
@@ -127,4 +127,5 @@
@stop @stop
@section('scripts') @section('scripts')
{{HTML::script('assets/javascript/firefly/transactions.js')}} {{HTML::script('assets/javascript/firefly/transactions.js')}}
{{HTML::script('assets/javascript/firefly/related-manager.js')}}
@stop @stop

View File

@@ -1,8 +1,22 @@
$(document).ready(function () { $(document).ready(function () {
$('.relateTransaction').click(relateTransaction); $('.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) { function relateTransaction(e) {
var target = $(e.target); var target = $(e.target);
var ID = target.data('id'); var ID = target.data('id');
@@ -12,7 +26,6 @@ function relateTransaction(e) {
$('#relationModal').empty().load('transaction/relate/' + ID, function () { $('#relationModal').empty().load('transaction/relate/' + ID, function () {
$('#relationModal').modal('show'); $('#relationModal').modal('show');
console.log($('#searchRelated').length + '!');
getAlreadyRelatedTransactions(e, ID); getAlreadyRelatedTransactions(e, ID);
$('#searchRelated').submit(function (e) { $('#searchRelated').submit(function (e) {
searchRelatedTransactions(e, ID); searchRelatedTransactions(e, ID);
@@ -20,7 +33,6 @@ function relateTransaction(e) {
return false; return false;
}); });
}); });
console.log($('#searchRelated').length);
return false; return false;

View File

@@ -18,16 +18,4 @@ $(document).ready(function () {
if(typeof googleTablePaged != 'undefined') { if(typeof googleTablePaged != 'undefined') {
googleTablePaged('table/transactions/' + what,'transaction-table'); 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;
}