mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-17 01:42:19 +00:00
First attempt at form.
This commit is contained in:
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Http\Controllers\Budget;
|
namespace FireflyIII\Http\Controllers\Budget;
|
||||||
|
|
||||||
|
|
||||||
|
use FireflyIII\AutoBudget;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\BudgetFormRequest;
|
use FireflyIII\Http\Requests\BudgetFormRequest;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
@@ -68,6 +69,29 @@ class CreateController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
|
$hasOldInput = null !== $request->old('_token');
|
||||||
|
|
||||||
|
// auto budget options
|
||||||
|
$autoBudgetOptions = [
|
||||||
|
0 => (string)trans('firefly.auto_budget_none'),
|
||||||
|
AutoBudget::AUTO_BUDGET_RESET => (string)trans('firefly.auto_budget_reset'),
|
||||||
|
AutoBudget::AUTO_BUDGET_ROLLOVER => (string)trans('firefly.auto_budget_rollover'),
|
||||||
|
];
|
||||||
|
$autoBudgetPeriods = [
|
||||||
|
'daily' => (string)trans('firefly.auto_budget_period_daily'),
|
||||||
|
'weekly' => (string)trans('firefly.auto_budget_period_weekly'),
|
||||||
|
'monthly' => (string)trans('firefly.auto_budget_period_monthly'),
|
||||||
|
'quarterly' => (string)trans('firefly.auto_budget_period_quarterly'),
|
||||||
|
'half_year' => (string)trans('firefly.auto_budget_period_half_year'),
|
||||||
|
'yearly' => (string)trans('firefly.auto_budget_period_yearly'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$preFilled = [
|
||||||
|
'auto_budget_period' => $hasOldInput ? (bool)$request->old('auto_budget_period') : 'monthly',
|
||||||
|
];
|
||||||
|
|
||||||
|
$request->session()->flash('preFilled', $preFilled);
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "create another").
|
// put previous url in session if not redirect from store (not "create another").
|
||||||
if (true !== session('budgets.create.fromStore')) {
|
if (true !== session('budgets.create.fromStore')) {
|
||||||
$this->rememberPreviousUri('budgets.create.uri');
|
$this->rememberPreviousUri('budgets.create.uri');
|
||||||
@@ -75,7 +99,7 @@ class CreateController extends Controller
|
|||||||
$request->session()->forget('budgets.create.fromStore');
|
$request->session()->forget('budgets.create.fromStore');
|
||||||
$subTitle = (string)trans('firefly.create_new_budget');
|
$subTitle = (string)trans('firefly.create_new_budget');
|
||||||
|
|
||||||
return view('budgets.create', compact('subTitle'));
|
return view('budgets.create', compact('subTitle', 'autoBudgetOptions', 'autoBudgetPeriods'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,7 +23,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||||
{# panel for auto-budget#}
|
{# panel for auto-budget#}
|
||||||
abc
|
<div class="box">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
{{ ExpandedForm.select('auto_budget_option', autoBudgetOptions) }}
|
||||||
|
{{ CurrencyForm.currencyList('transaction_currency_id') }}
|
||||||
|
{{ ExpandedForm.amountNoCurrency('auto_budget_amount') }}
|
||||||
|
{{ ExpandedForm.select('auto_budget_period', autoBudgetPeriods, null) }}
|
||||||
|
</div>
|
||||||
|
<div class="box-footer">
|
||||||
|
<button type="submit" class="btn pull-right btn-success">{{ 'store_new_budget'|_ }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Reference in New Issue
Block a user