firefly-iii/resources/views/v1/rules/index.twig
2020-01-04 11:16:14 +01:00

209 lines
13 KiB
Twig

{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p>
<a href="{{ route('rule-groups.create') }}" id="new_rule_group" class="btn btn-success">{{ 'new_rule_group'|_ }}</a>
</p>
</div>
</div>
{% for ruleGroup in ruleGroups %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{% if ruleGroup.active %}
{{ ruleGroup.title }}
{% else %}
<s>{{ ruleGroup.title }}</s> ({{ 'inactive'|_|lower }})
{% endif %}
</h3>
<div class="box-tools pull-right">
<div class="btn-group">
<button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i
class="fa fa-ellipsis-v"></i></button>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ route('rule-groups.edit',ruleGroup.id) }}"><i class="fa fa-fw fa-pencil"></i> {{ 'edit'|_ }}</a></li>
<li><a href="{{ route('rule-groups.delete',ruleGroup.id) }}"><i class="fa fa-fw fa-trash"></i> {{ 'delete'|_ }}</a></li>
<li><a href="{{ route('rule-groups.select-transactions',ruleGroup.id) }}"><i
class="fa fa-fw fa-power-off"></i> {{ trans('firefly.apply_rule_group_selection', {title: ruleGroup.title}) }}
</a></li>
{% if ruleGroup.order > 1 %}
<li><a href="{{ route('rule-groups.up',ruleGroup.id) }}"><i
class="fa fa-fw fa-arrow-up"></i> {{ 'move_rule_group_up'|_ }}</a></li>
{% endif %}
{% if ruleGroup.order < ruleGroups|length %}
<li><a href="{{ route('rule-groups.down',ruleGroup.id) }}"><i
class="fa fa-fw fa-arrow-down"></i> {{ 'move_rule_group_down'|_ }}
</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
<div class="box-body">
<p>
<em>{{ ruleGroup.description }}</em>
</p>
{% if ruleGroup.rules.count > 0 %}
<table class="table table-hover table-striped">
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>{{ 'rule_name'|_ }}</th>
<th class="hidden-xs">{{ 'rule_triggers'|_ }}</th>
<th class="hidden-xs">{{ 'rule_actions'|_ }}</th>
</tr>
</thead>
<tbody>
{% for rule in ruleGroup.rules %}
<tr>
<td>
<div class="btn-group btn-group-xs prio_buttons">
{% if rule.order > 1 %}
<a title="{{ 'rule_priority_up'|_ }}"
href="{{ route('rules.up', rule.id) }}"
class="btn btn-default"><span
class="fa fa-fw fa-arrow-up"></span></a>
{% else %}
<button disabled="disabled" class="btn btn-default"><span
class="fa fa-fw"></span></button>
{% endif %}
{% if rule.order < ruleGroup.rules.count %}
<a title="{{ 'rule_priority_down'|_ }}"
href="{{ route('rules.down', rule.id) }}"
class="btn btn-default"><span
class="fa fa-fw fa-arrow-down"></span>
</a>
{% else %}
<button disabled="disabled" class="btn btn-default"><span
class="fa fa-fw"></span></button>
{% endif %}
</div>
</td>
<td>
<div class="btn-group btn-group-xs edit_buttons">
<a title="{{ 'edit'|_ }}" href="{{ route('rules.edit', rule.id) }}"
class="btn btn-default"><span
class="fa fa-fw fa-pencil"></span></a>
<a title="{{ 'delete'|_ }}"
href="{{ route('rules.delete', rule.id) }}"
class="btn btn-danger"><span
class="fa fa-fw fa-trash"></span></a>
</div>
</td>
<td>
<div class="btn-group btn-group-xs test_buttons">
{# show which transactions would match #}
<a href="#" class="btn btn-default test_rule_triggers" data-id="{{ rule.id }}"
title="{{ 'test_rule_triggers'|_ }}"><i data-id="{{ rule.id }}"
class="test_rule_triggers fa fa-fw fa-flask"></i></a>
{# actually execute rule #}
<a href="{{ route('rules.select-transactions',rule.id) }}" class="btn btn-default"
title=" {{ trans('firefly.apply_rule_selection', {title: rule.title}) }}">
<i class="fa fa-fw fa-power-off "></i></a>
</div>
</td>
<td class="markdown">
{% if rule.active %}
{{ rule.title }}
{% else %}
<s>{{ rule.title }}</s> ({{ 'inactive'|_|lower }})
{% endif %}
{% if rule.stop_processing %}
<i class="fa fa-stop-circle-o"></i>
{% endif %}
{% if rule.description != "" %}
<small class="hidden-xs"
{% if not rule.active %}
class="text-muted"
{% endif %}
><br/>{{ rule.description|markdown }}</small>
{% endif %}
<small><br />{% if rule.strict %}<span class="text-danger">{{ 'rule_is_strict'|_ }}</span>{% else %}<span class="text-success">{{ 'rule_is_not_strict'|_ }}</span>{% endif %}</small>
</td>
<td class="hidden-xs">
{% if rule.ruleTriggers.count > 0 %}
<ul class="small rule-triggers" data-id="{{ rule.id }}">
{% for trigger in rule.ruleTriggers %}
{% if trigger.trigger_type != "user_action" %}
<li
{% if not rule.active %}
class="text-muted"
{% endif %}
data-id="{{ trigger.id }}">{{ trans(('firefly.rule_trigger_' ~ trigger.trigger_type), {trigger_value: trigger.trigger_value}) }}
{% if trigger.stop_processing %}
<i class="fa fa-stop-circle-o"></i>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</td>
<td class="hidden-xs">
{% if rule.ruleActions.count > 0 %}
<ul class="small rule-actions" data-id="{{ rule.id }}">
{% for action in rule.ruleActions %}
<li
{% if not rule.active %}
class="text-muted"
{% endif %}
data-id="{{ action.id }}">{{ trans(('firefly.rule_action_' ~ action.action_type), {action_value: action.action_value}) }}
{% if action.stop_processing %}
<i class="fa fa-stop-circle-o"></i>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>
<em>{{ 'no_rules_in_group'|_ }}</em>
</p>
{% endif %}
<p>
<br/>
<a href="{{ route('rules.create', ruleGroup.id) }}"
class="btn btn-success new_rule">{{ 'new_rule'|_ }}</a>
</p>
</div>
</div>
</div>
</div>
{% endfor %}
{% include '/rules/partials/test-trigger-modal' %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<a href="{{ route('rule-groups.create') }}" class="btn btn-success">{{ 'new_rule_group'|_ }}</a>
</div>
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
<script type="text/javascript" src="v1/js/ff/rules/index.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
{% endblock %}