Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Updated frontend to access the 'test-rules' functionality
Robert Horlings5dc556f0af3c
diff --git a/public/css/firefly.css b/public/css/firefly.cssindex 9843f2f058..4ce8b95c80 100644--- a/public/css/firefly.css+++ b/public/css/firefly.css@@ -37,4 +37,6 @@/* cursors */.rule-triggers {cursor:move;}-.rule-actions {cursor:move;}\ No newline at end of file+.rule-actions {cursor:move;}++#testTriggerModal .modal-body { max-height: 500px; overflow-y: scroll; }diff --git a/public/js/rules/create-edit.js b/public/js/rules/create-edit.jsindex 9310d6d8de..9a4c0c812c 100644--- a/public/js/rules/create-edit.js+++ b/public/js/rules/create-edit.js@@ -82,4 +82,33 @@ function removeAction(e) {if($('.rule-action-tbody tr').length == 0) {addNewAction();}+}++function testRuleTriggers() {+ "use strict";++ // Serialize all trigger data+ var triggerData = $( ".rule-trigger-tbody" ).find( "input[type=text], input[type=checkbox], select" ).serializeArray();++ // Find a list of existing transactions that match these triggers+ $.get('rules/rules/test_triggers', triggerData).done(function (data) {+ var modal = $( "#testTriggerModal" );+ var numTriggers = $( ".rule-trigger-body > tr" ).length;++ // Set title and body+ modal.find( ".transactions-list" ).html(data.html);++ // Show warning if appropriate+ if( data.warning ) {+ modal.find( ".transaction-warning .warning-contents" ).text(data.warning);+ modal.find( ".transaction-warning" ).show();+ } else {+ modal.find( ".transaction-warning" ).hide();+ }++ // Show the modal dialog+ $( "#testTriggerModal" ).modal();+ }).fail(function () {+ alert('Cannot get transactions for given triggers.');+ });}\ No newline at end of filediff --git a/public/js/rules/create.js b/public/js/rules/create.jsindex 617cc284ee..4910378c74 100644--- a/public/js/rules/create.js+++ b/public/js/rules/create.js@@ -31,4 +31,10 @@ $(function () {return false;});++ $('.test_rule_triggers').click(function () {+ testRuleTriggers();++ return false;+ });});diff --git a/public/js/rules/edit.js b/public/js/rules/edit.jsindex dc4ab331a5..39876d8c2c 100644--- a/public/js/rules/edit.js+++ b/public/js/rules/edit.js@@ -24,6 +24,12 @@ $(function () {return false;});+ $('.test_rule_triggers').click(function () {+ testRuleTriggers();++ return false;+ });+$('.add_rule_action').click(function () {addNewAction();diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex 63a8aab69a..ab85aa5a6a 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -126,6 +126,10 @@ return ['delete_rule' => 'Delete rule ":title"','update_rule' => 'Update rule',+ 'test_rule_triggers' => 'See matching transactions',+ 'warning_transaction_subset' => 'For performance reasons this list is limited to :max_num_transactions and may only show a subset of matching transactions',+ 'warning_no_matching_transactions' => 'No matching transactions found. Please note that for performance reasons, only the last :num_transactions transactions have been checked.',+// actions and triggers'rule_trigger_user_action' => 'User action is ":trigger_value"','rule_trigger_from_account_starts' => 'Source account starts with ":trigger_value"',diff --git a/resources/lang/nl_NL/firefly.php b/resources/lang/nl_NL/firefly.phpindex 3fbdfc6d6c..b263512635 100644--- a/resources/lang/nl_NL/firefly.php+++ b/resources/lang/nl_NL/firefly.php@@ -125,6 +125,10 @@ return ['edit_rule' => 'Wijzig regel ":title"','update_rule' => 'Werk regel bij',+ 'test_rule_triggers' => 'Transacties die voldoen aan triggers',+ 'warning_transaction_subset' => 'In verband met de snelheid, worden in deze lijst maximaal :max_num_transactions transacties weergegeven. Het kan daarom zijn dat transacties ontbreken in deze lijst.',+ 'warning_no_matching_transactions' => 'Er zijn geen transacties gevonden die voldoen aan de triggers in de laatste :num_transactions transacties.',+// actions and triggers'rule_trigger_user_action' => 'Gebruikersactie is ":trigger_value"','rule_trigger_from_account_starts' => 'Bronrekeningnaam begint met ":trigger_value"',