From bade1031fd3fa5838a632b0a4eab059ada13657e Mon Sep 17 00:00:00 2001 From: "valentin.pocotilenco" <valentin.pocotilenco@renam.md> Date: Wed, 24 Jul 2024 22:22:10 +0300 Subject: [PATCH] Move and rename button [Issue #24] --- web/eccs.css | 5 +++++ web/eccs.js | 8 ++++++-- web/index.php | 2 +- web/statistics.js | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/web/eccs.css b/web/eccs.css index 3f30665..a2fbcb5 100644 --- a/web/eccs.css +++ b/web/eccs.css @@ -226,3 +226,8 @@ input[type=checkbox] { display: none; background-size: 100px 100px; } + +.top .inline { + display: flex; + justify-content: space-between; +} diff --git a/web/eccs.js b/web/eccs.js index 9391133..8ac8a80 100644 --- a/web/eccs.js +++ b/web/eccs.js @@ -300,7 +300,7 @@ $(document).ready(function() { }, "lengthMenu": [[10, 30, 50, 100, -1], [10, 30, 50, 100, "All"]], "autoWidth": false, - "dom": '<"top"lip>rt<"bottom"><"clear">', + "dom": '<"top"<"inline"l<"statistics">>ip>rt<"bottom"><"clear">', "columns": [ { "className": 'details-control', @@ -350,7 +350,11 @@ $(document).ready(function() { } }, - "order": [[1, 'asc']] + "order": [[1, 'asc']], + "fnDrawCallback": function() { + let r= $('<input type="button" id="statisticsButton" value="ECCS demand"/>'); + $(".top .statistics").empty().append(r) + } } ); // Add event listener for opening and closing details diff --git a/web/index.php b/web/index.php index acc7474..a20dd7c 100644 --- a/web/index.php +++ b/web/index.php @@ -118,7 +118,7 @@ $data[ 'check_result' ] = htmlspecialchars($_GET[ "check_result" ] ?? null); var check_result = "<?php echo $data[ 'check_result' ] ?>"; </script> <script type="text/javascript" src="eccs.js"></script> - <script type="text/javascript" src="statistics.js" /></script> + <script type="text/javascript" src="statistics.js"></script> </div> <!-- END eccs-central --> <div id="statisticsModal" class="modal"> <div class="modal-content"> diff --git a/web/statistics.js b/web/statistics.js index c4f8841..99fac3c 100644 --- a/web/statistics.js +++ b/web/statistics.js @@ -6,7 +6,7 @@ $(document).ready(function() { $("#statisticsModal").hide() }); - $("#statisticsButton").on("click", function() { + $(document).on("click", "#statisticsButton", function() { $("#statisticsModal").show() getStatistics(); }) -- GitLab