Allow rule to be applied to transactions (not just group).

This commit is contained in:
James Cole
2017-07-16 13:04:45 +02:00
parent b676b1fef9
commit 09f838089b
13 changed files with 495 additions and 88 deletions

View File

@@ -37,9 +37,40 @@ $(function () {
}
);
// test rule triggers button:
$('.test_rule_triggers').click(testRuleTriggers);
}
);
function testRuleTriggers(e) {
var obj = $(e.target);
var ruleId = parseInt(obj.data('id'));
// Find a list of existing transactions that match these triggers
$.get('rules/test-rule/' + ruleId).done(function (data) {
var modal = $("#testTriggerModal");
// 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
modal.modal();
}).fail(function () {
alert('Cannot get transactions for given triggers.');
});
return false;
}
function sortStop(event, ui) {
"use strict";