Skip to content

Commit

Permalink
Bootstrap + DataTables cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jokob-sk committed Dec 20, 2024
1 parent 40e4502 commit 7913d42
Show file tree
Hide file tree
Showing 35 changed files with 41,755 additions and 16,271 deletions.
6 changes: 1 addition & 5 deletions front/appEventsCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$(document).ready(function() {
// Load JSON data from the provided URL
$.getJSON('api/table_appevents.json', function(data) {
$.getJSON('/php/server/query_json.php?file=table_appevents.json', function(data) {
// Process the JSON data and generate UI dynamically
processData(data)
Expand Down Expand Up @@ -89,7 +89,3 @@ function processData(data) {
</script>

<!-- Datatable -->
<link rel="stylesheet" href="lib/datatables.net-bs/css/dataTables.bootstrap.min.css"/>
<script src="lib/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="lib/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
6 changes: 6 additions & 0 deletions front/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,12 @@ input[readonly] {
text-align: left;
}

#devicePageInfoPlc
{
display: none;
padding-top: 2em;
}

/* ----------------------------------------------------------------- */
/* MODAL popups */
/* ----------------------------------------------------------------- */
Expand Down
17 changes: 8 additions & 9 deletions front/deviceDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
&nbsp<small>Quering device info...</small>
</h1>

<div id="devicePageInfoPlc" class="card-body bg-light">
<div class="small-box panel rounded">
<div class="inner text-center">

</div>
</div>
</div>

<!-- period selector -->
<span class="breadcrumb" style="top: 0px;">
<select class="form-control" id="period" onchange="javascript: periodChanged();">
Expand Down Expand Up @@ -180,15 +188,6 @@
?>


<!-- ----------------------------------------------------------------------- -->
<!-- iCkeck -->
<link rel="stylesheet" href="lib/iCheck/all.css">
<script src="lib/iCheck/icheck.min.js"></script>

<!-- Datatable -->
<link rel="stylesheet" href="lib/datatables.net-bs/css/dataTables.bootstrap.min.css">
<script src="lib/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="lib/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>

<!-- fullCalendar -->
<link rel="stylesheet" href="lib/fullcalendar/fullcalendar.min.css">
Expand Down
4 changes: 4 additions & 0 deletions front/deviceDetailsEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,15 @@ class="fa fa-circle-info pointer helpIconSmallTopRight"
// Page title - Name
if (mac == "new") {
$('#pageTitle').html(`<i title="${getString("Gen_create_new_device")}" class="fa fa-square-plus"></i> ` + getString("Gen_create_new_device"));
$('#devicePageInfoPlc .inner').html(`<i class="fa fa-circle-info"></i> ` + getString("Gen_create_new_device_info"));
$('#devicePageInfoPlc').show();
} else if (deviceData['devOwner'] == null || deviceData['devOwner'] == '' ||
(deviceData['devName'].toString()).indexOf(deviceData['devOwner']) != -1) {
$('#pageTitle').html(deviceData['devName']);
$('#devicePageInfoPlc').hide();
} else {
$('#pageTitle').html(deviceData['devName'] + ' (' + deviceData['devOwner'] + ')');
$('#devicePageInfoPlc').hide();
}
};

Expand Down
61 changes: 20 additions & 41 deletions front/devices.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@
?>


<!-- ----------------------------------------------------------------------- -->
<!-- Datatable -->
<link rel="stylesheet" href="lib/datatables.net-bs/css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="lib/datatables.net/css/select.dataTables.min.css">
<script src="lib/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="lib/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="lib/datatables.net/js/dataTables.select.min.js"></script>

<!-- page script ----------------------------------------------------------- -->
<script>
var deviceStatus = 'all';
Expand Down Expand Up @@ -568,6 +560,12 @@ function initializeDatatable (status) {
'order' : tableOrder,
'select' : true, // Enable selection

'fixedHeader': true,
'fixedHeader': {
'header': true,
'footer': true
},

'columnDefs' : [
{visible: false, targets: tableColumnHide },
{className: 'text-center', targets: [mapIndx(4), mapIndx(9), mapIndx(10), mapIndx(15), mapIndx(18)] },
Expand Down Expand Up @@ -811,41 +809,15 @@ function handleLoadingDialog(needsReload = false)
// the Miantenance section with a 'macs' query string identifying selected devices
function multiEditDevices()
{
rows = $('#tableDevices')[0].rows

// Initialize an empty array to store selected rows
var selectedRows = [];

// console.log($('#tableDevices')[0].rows);

// Loop through each row in the HTML collection
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
// Check if the row has the 'selected' class
if (row.classList.contains('selected')) {
// If selected, push the row's data to the selectedRows array
selectedRows.push(row);
}
}

// Now, selectedRows contains all selected rows
console.log(selectedRows);

var devicesDataTableData = $('#tableDevices').dataTable().fnGetData();

var selectedDevices = [];

for (var i = 0; i < selectedRows.length; i++) {
selectedDevices.push(devicesDataTableData[selectedRows[i]._DT_RowIndex]);
}

// Now, selectedDevices contains all selected devices
// console.log(selectedDevices);
// get selected devices
var selectedDevicesDataTableData = $('#tableDevices').DataTable().rows({ selected: true, page: 'current' }).data().toArray();

console.log(selectedDevicesDataTableData);

macs = ""

for (var i = 0; i < selectedDevices.length; i++) {
macs += selectedDevices[i][mapIndx(11)] + ","; // [11] == MAC
for (var j = 0; j < selectedDevicesDataTableData.length; j++) {
macs += selectedDevicesDataTableData[j][mapIndx(11)] + ","; // [11] == MAC
}

// redirect to the Maintenance section
Expand All @@ -860,12 +832,19 @@ function getMacsOfShownDevices() {
rows = $('#tableDevices')[0].rows
macs = []

var devicesDataTableData = $('#tableDevices').dataTable().fnGetData();
// var devicesDataTableData = $('#tableDevices').dataTable().fnGetData();
var devicesDataTableData = $('#tableDevices').DataTable().rows({ selected: false, page: 'current' }).data().toArray();

console.log(devicesDataTableData);


var selectedDevices = [];

// first row is the heading, skip
for (var i = 1; i < rows.length; i++) {

// console.log(rows[i]._DT_RowIndex);

selectedDevices.push(devicesDataTableData[rows[i]._DT_RowIndex]);
}

Expand Down
8 changes: 0 additions & 8 deletions front/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,6 @@
require 'php/templates/footer.php';
?>


<!-- ----------------------------------------------------------------------- -->
<!-- Datatable -->
<link rel="stylesheet" href="lib/datatables.net-bs/css/dataTables.bootstrap.min.css">
<script src="lib/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="lib/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>


<!-- page script ----------------------------------------------------------- -->
<script>
var parPeriod = 'nax_parPeriod';
Expand Down
3 changes: 1 addition & 2 deletions front/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@

<!-- jQuery 3 -->
<script src="lib/jquery/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="lib/bootstrap/bootstrap.min.js"></script>

<!-- iCheck -->
<script src="lib/iCheck/icheck.min.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion front/js/ui_components.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ window.addEventListener("load", function() {
// try to initialize
setTimeout(() => {
initSelect2()
initializeiCheck();
// initializeiCheck();
}, 1000);
});

Expand Down
48 changes: 0 additions & 48 deletions front/lib/datatables.net-bs/.bower.json

This file was deleted.

20 changes: 0 additions & 20 deletions front/lib/datatables.net-bs/License.txt

This file was deleted.

50 changes: 0 additions & 50 deletions front/lib/datatables.net-bs/Readme.md

This file was deleted.

38 changes: 0 additions & 38 deletions front/lib/datatables.net-bs/bower.json

This file was deleted.

Loading

0 comments on commit 7913d42

Please sign in to comment.