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')
{{Form::ffBalance('openingbalance')}}
{{Form::ffDate('openingbalancedate')}}
{{Form::ffSelect('account_role',$roles)}}
@endif
</div>
</div>

View File

@@ -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)

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}