From 143dbac4e1eacd7478afd5045b87db1621a2aa8d Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 20 Jul 2023 13:28:44 +0700 Subject: [PATCH] Remove report button when done --- edit-mode/function/reportActivity.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/edit-mode/function/reportActivity.js b/edit-mode/function/reportActivity.js index 9d81000..7e2c6e2 100644 --- a/edit-mode/function/reportActivity.js +++ b/edit-mode/function/reportActivity.js @@ -88,7 +88,6 @@ $(document).ready(function () { $('#report-activity-information-status').attr("class", "badge badge-warning"); } else if(statusReport == 'done') { $('#report-activity-information-status').attr("class", "badge badge-success"); - $("#show_form_ra").hide(); } else if(statusReport == 'open') { $('#report-activity-information-status').attr("class", "badge badge-primary"); } @@ -105,7 +104,17 @@ $(document).ready(function () { $("#report-activity-information-start").text(reportStartDate); $("#report-activity-information-end").text(reportFinishDate); } - }).DataTable({ + }).on('draw.dt', function () { + // This event handler will be called after the table is redrawn (after AJAX call) + // Now you can hide the button here based on the statusReport + const statusReport = tableRa.row(0).data()?.status_activity; + + if (statusReport === 'done') { + $('.btn-lihat-actual').hide(); + } else { + $('.btn-lihat-actual').show(); + } + }).DataTable({ "processing": true, "serverSide": true, "ajax": {