mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Can edit rule group #794
This commit is contained in:
parent
2dbdcf73ed
commit
aae26c5da9
@ -166,10 +166,13 @@ class RuleController extends Controller
|
||||
*/
|
||||
public function edit(Request $request, RuleRepositoryInterface $repository, Rule $rule)
|
||||
{
|
||||
$oldTriggers = $this->getCurrentTriggers($rule);
|
||||
$triggerCount = count($oldTriggers);
|
||||
$oldActions = $this->getCurrentActions($rule);
|
||||
$actionCount = count($oldActions);
|
||||
/** @var RuleGroupRepositoryInterface $ruleGroupRepository */
|
||||
$ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
|
||||
$oldTriggers = $this->getCurrentTriggers($rule);
|
||||
$triggerCount = count($oldTriggers);
|
||||
$oldActions = $this->getCurrentActions($rule);
|
||||
$actionCount = count($oldActions);
|
||||
$ruleGroups = ExpandedForm::makeSelectList($ruleGroupRepository->get());
|
||||
|
||||
// has old input?
|
||||
if ($request->old()) {
|
||||
@ -191,7 +194,8 @@ class RuleController extends Controller
|
||||
Session::flash('gaEventCategory', 'rules');
|
||||
Session::flash('gaEventAction', 'edit-rule');
|
||||
|
||||
return view('rules.rule.edit', compact('rule', 'subTitle', 'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount'));
|
||||
return view('rules.rule.edit', compact('rule', 'subTitle',
|
||||
'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount','ruleGroups'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,7 @@ class RuleFormRequest extends Request
|
||||
{
|
||||
return [
|
||||
'title' => $this->string('title'),
|
||||
'rule_group_id' => $this->integer('rule_group_id'),
|
||||
'active' => $this->boolean('active'),
|
||||
'trigger' => $this->string('trigger'),
|
||||
'description' => $this->string('description'),
|
||||
|
@ -316,6 +316,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
public function update(Rule $rule, array $data): Rule
|
||||
{
|
||||
// update rule:
|
||||
$rule->rule_group_id = $data['rule_group_id'];
|
||||
$rule->active = $data['active'];
|
||||
$rule->stop_processing = $data['stop_processing'];
|
||||
$rule->title = $data['title'];
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
{% block content %}
|
||||
{{ Form.model(rule, {'class' : 'form-horizontal','id' : 'store','url' : route('rules.update', rule.id)}) }}
|
||||
<input type="hidden" name="rule_group_id" value="{{ rule.rule_group_id }}"/>
|
||||
<input type="hidden" name="id" value="{{ rule.id }}"/>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
@ -16,6 +15,7 @@
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.text('title') }}
|
||||
{{ ExpandedForm.select('rule_group_id', ruleGroups) }}
|
||||
{{ ExpandedForm.select('trigger',allJournalTriggers(), primaryTrigger) }}
|
||||
{{ ExpandedForm.checkbox('active',1,rule.active, {helpText: trans('firefly.rule_help_active')}) }}
|
||||
{{ ExpandedForm.checkbox('stop_processing',1,rule.stop_processing, {helpText: trans('firefly.rule_help_stop_processing')}) }}
|
||||
|
Loading…
Reference in New Issue
Block a user