mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Add everything range
This commit is contained in:
@@ -7,6 +7,7 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Session;
|
||||
|
||||
/**
|
||||
* Class ReportHelper
|
||||
@@ -40,12 +41,7 @@ class ReportHelper implements ReportHelperInterface
|
||||
*/
|
||||
public function firstDate()
|
||||
{
|
||||
$journal = Auth::user()->transactionjournals()->orderBy('date', 'ASC')->first();
|
||||
if ($journal) {
|
||||
return $journal->date;
|
||||
}
|
||||
|
||||
return Carbon::now();
|
||||
return Session::get('first');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,12 +3,11 @@
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use Navigation;
|
||||
use Input;
|
||||
use Preferences;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use URL;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* Class HomeController
|
||||
*
|
||||
@@ -24,10 +23,17 @@ class HomeController extends Controller
|
||||
{
|
||||
}
|
||||
|
||||
public function dateRange() {
|
||||
public function dateRange()
|
||||
{
|
||||
$start = new Carbon(Input::get('start'));
|
||||
$end = new Carbon(Input::get('end'));
|
||||
|
||||
$diff = $start->diffInDays($end);
|
||||
|
||||
if ($diff > 50) {
|
||||
Session::flash('warning', $diff . ' days of data may take a while to load.');
|
||||
}
|
||||
|
||||
Session::put('start', $start);
|
||||
Session::put('end', $end);
|
||||
}
|
||||
|
@@ -6,9 +6,9 @@ namespace FireflyIII\Http\Middleware;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Navigation;
|
||||
use Preferences;
|
||||
use Session;
|
||||
use Navigation;
|
||||
|
||||
/**
|
||||
* Class SessionFilter
|
||||
@@ -59,6 +59,14 @@ class Range
|
||||
Session::put('start', $start);
|
||||
Session::put('end', $end);
|
||||
}
|
||||
if (!Session::has('first')) {
|
||||
$journal = $this->auth->user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);
|
||||
if ($journal) {
|
||||
Session::put('first', $journal->date);
|
||||
} else {
|
||||
Session::put('first', Carbon::now());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -7,7 +7,8 @@ $(function () {
|
||||
ranges: {
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')],
|
||||
'Next Month': [moment().add('month', 1).startOf('month'), moment().add('month', 1).endOf('month')]
|
||||
'Next Month': [moment().add('month', 1).startOf('month'), moment().add('month', 1).endOf('month')],
|
||||
'Everything': [firstDate, moment()]
|
||||
},
|
||||
opens: 'left',
|
||||
|
||||
@@ -21,6 +22,7 @@ $(function () {
|
||||
$.post(dateRangeURL, {
|
||||
start: start.format('YYYY-MM-DD'),
|
||||
end: end.format('YYYY-MM-DD'),
|
||||
label: label,
|
||||
_token: token
|
||||
}).success(function() {
|
||||
window.location.reload(true);
|
||||
|
@@ -128,6 +128,7 @@
|
||||
var titleString = "{{Session::get('start')->format('j M Y')}} - {{Session::get('end')->format('j M Y')}}";
|
||||
var dateRangeURL = "{{route('daterange')}}";
|
||||
var token = "{{csrf_token()}}";
|
||||
var firstDate = moment("{{Session::get('first')->format('Y-m-d')}}");
|
||||
$('#daterange span').text(titleString);
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user