Allow report options to be pulled using AJAX. Ajax is cool.

This commit is contained in:
James Cole
2016-11-09 19:25:09 +01:00
parent f0e0cdb49b
commit fe57648349
5 changed files with 47 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Support\Collection;
use Preferences;
use Response;
use Session;
use Steam;
use View;
@@ -85,6 +86,23 @@ class ReportController extends Controller
return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear'));
}
/**
* @param string $reportType
*
* @return mixed
*/
public function options(string $reportType)
{
$result = false;
switch ($reportType) {
default:
$result = $this->noReportOptions();
break;
}
return Response::json($result);
}
/**
* @param string $reportType
* @param Carbon $start
@@ -292,4 +310,12 @@ class ReportController extends Controller
)
);
}
/**
* @return array
*/
private function noReportOptions(): array
{
return ['html' => view('reports.options.no-options')->render()];
}
}