diff --git a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html index 0bf5a3112df9af761af95150338bfbb6e76b93ea..390d8dc099d723687cdd4be531d2a77c91a9b9ac 100644 --- a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html +++ b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html @@ -3,11 +3,11 @@ {# Left #} <div class="actions-bar__inner actions-bar__inner--left"> <p class="actions-bar__total"><span class="js-total-actions">0</span> Selected</p> - <form> + <form action="" class="js-batch-update-status"> <button class="button button--action button--change-status" type="submit">Change status</button> </form> - <form> + <form action="" class="js-batch-update-reviewers"> <button class="button button--action button--reviewers" type="submit">Reviewers</button> </form> </div> diff --git a/opentech/static_src/src/javascript/apply/batch-actions.js b/opentech/static_src/src/javascript/apply/batch-actions.js index fe77d1f46c2d977cbb75160968a2c650a39262fa..ffba48313baa0a69173c0b75019760c1875350b5 100644 --- a/opentech/static_src/src/javascript/apply/batch-actions.js +++ b/opentech/static_src/src/javascript/apply/batch-actions.js @@ -5,6 +5,8 @@ const $body = $('body'); const $checkbox = $('.js-batch-select'); const $allCheckboxInput = $('.js-batch-select-all'); + const $changeStatusForm = $('.js-batch-update-status'); + const $changeReviewersForm = $('.js-batch-update-reviewers'); const activeClass = 'batch-actions-enabled'; $allCheckboxInput.change(function () { @@ -53,6 +55,24 @@ $allCheckboxInput.prop('checked', false); } + // change status form handler + $changeStatusForm.submit(function (e) { + e.preventDefault(); + + $checkbox.each(function () { + if ($(this).is(':checked')) { + console.log($(this).parents('tr').data('record-id')); // tr data-record-id + console.log($(this).parents('tr').find('.js-title').data('tooltip')); // project title + } + }); + }); + + // reviewers form handler + $changeReviewersForm.submit(function (e) { + e.preventDefault(); + console.log('reviewers form submitted'); + }); + })(jQuery);