mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -06:00
Fix order.
This commit is contained in:
parent
6dddd6629d
commit
30c5376217
@ -15,7 +15,7 @@ use Input;
|
|||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
use Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionController
|
* Class TransactionController
|
||||||
@ -199,7 +199,14 @@ class TransactionController extends Controller
|
|||||||
$page = intval(\Input::get('page'));
|
$page = intval(\Input::get('page'));
|
||||||
$offset = $page > 0 ? ($page - 1) * 50 : 0;
|
$offset = $page > 0 ? ($page - 1) * 50 : 0;
|
||||||
|
|
||||||
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)->orderBy('date', 'DESC')->get(
|
$set = Auth::user()->
|
||||||
|
transactionJournals()->
|
||||||
|
transactionTypes($types)->
|
||||||
|
withRelevantData()->take(50)->offset($offset)
|
||||||
|
->orderBy('date', 'DESC')
|
||||||
|
->orderBy('order','ASC')
|
||||||
|
->orderBy('id','DESC')
|
||||||
|
->get(
|
||||||
['transaction_journals.*']
|
['transaction_journals.*']
|
||||||
);
|
);
|
||||||
$count = Auth::user()->transactionJournals()->transactionTypes($types)->count();
|
$count = Auth::user()->transactionJournals()->transactionTypes($types)->count();
|
||||||
@ -216,6 +223,18 @@ class TransactionController extends Controller
|
|||||||
public function reorder()
|
public function reorder()
|
||||||
{
|
{
|
||||||
$ids = Input::get('items');
|
$ids = Input::get('items');
|
||||||
|
if (count($ids) > 0) {
|
||||||
|
$order = 0;
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$journal = Auth::user()->transactionjournals()->where('id', $id)->where('date', Input::get('date'))->first();
|
||||||
|
if($journal) {
|
||||||
|
$journal->order = $order;
|
||||||
|
$order++;
|
||||||
|
$journal->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Response::json(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,7 @@ $(document).ready(function () {
|
|||||||
helper: fixHelper,
|
helper: fixHelper,
|
||||||
items: 'tr:not(.ignore)',
|
items: 'tr:not(.ignore)',
|
||||||
stop: sortStop,
|
stop: sortStop,
|
||||||
handle: '.handle',
|
handle: '.handle'
|
||||||
revert: 'invalid'
|
|
||||||
}
|
}
|
||||||
).disableSelection();
|
).disableSelection();
|
||||||
});
|
});
|
||||||
@ -69,7 +68,8 @@ function sortStop(event, ui) {
|
|||||||
submit.push(id);
|
submit.push(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.post('/transaction/reorder',{items: submit,_token:token});
|
// do extra animation when done?
|
||||||
|
$.post('/transaction/reorder',{items: submit,date: thisDate,_token:token});
|
||||||
console.log(submit);
|
console.log(submit);
|
||||||
|
|
||||||
//console.log('TRUE!');
|
//console.log('TRUE!');
|
||||||
|
Loading…
Reference in New Issue
Block a user