From ceecc8e961622901778ab37065ae755b3c3834ed Mon Sep 17 00:00:00 2001 From: Dreller <60242965+Dreller@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:04:54 -0400 Subject: [PATCH] Browser Closes #46 --- DataTables/lang/FR.json | 4 ++-- js/glutax.js | 20 +++++++++++++++----- page.php | 2 +- php/lang/EN.php | 1 + php/lang/FR.php | 1 + php/rpt-data.php | 6 ++++++ php/rpt-frame.php | 4 +++- 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/DataTables/lang/FR.json b/DataTables/lang/FR.json index 2630a13..7d196e1 100644 --- a/DataTables/lang/FR.json +++ b/DataTables/lang/FR.json @@ -1,5 +1,5 @@ { - "emptyTable": "Aucune donnée disponible dans le tableau", + "emptyTable": "Aucune donnée disponible pour ce rapport", "lengthMenu": "Afficher _MENU_ éléments", "loadingRecords": "Chargement...", "processing": "Traitement...", @@ -8,7 +8,7 @@ "first": "Premier", "last": "Dernier", "previous": "Précédent", - "next": "Suiv" + "next": "Suivant" }, "aria": { "sortAscending": ": activer pour trier la colonne par ordre croissant", diff --git a/js/glutax.js b/js/glutax.js index 4b11bf4..a422143 100644 --- a/js/glutax.js +++ b/js/glutax.js @@ -8,7 +8,6 @@ $(document).ready(function(){ loadPage(); }); - // Click on the Website title in the Top NavBar $("#glutaxTitle").on("click", function(){ loadPage(); @@ -333,21 +332,32 @@ $("#myBox").load('php/rpt-frame.php?r=' + report + defn, function(){ // Create the column Indices to hide according to the Report Type. var myCols; - if( defn.search("summ=y") > 0 ){ + if( defn.search("summ=y") > 0 || report.search("summary") > 0 ){ // Summary - myCols = ''; + myCols = [ + {"visible": false, "targets": [0], "searchable": false} + ]; }else{ // Details myCols = [ - {"visible": false, "targets": [2,6,7,8]} + {"visible": false, "targets": [2,6,7,8]}, + {"visible": false, "targets": [0], "searchable": false} ]; } + // Inject "columnDefs" option if( myCols !== '' ){ dataOptions.columnDefs = myCols; } + // Send Options - $('#glutaxReport').DataTable(dataOptions); + var myTable = $('#glutaxReport').DataTable(dataOptions); + +// Add On Click + myTable.on('click', 'tr', function(){ + var pID = myTable.row( this ).data()[0]; + purchReceipt( pID ); + }); }); } \ No newline at end of file diff --git a/page.php b/page.php index db55497..ec83005 100644 --- a/page.php +++ b/page.php @@ -181,7 +181,7 @@ diff --git a/php/lang/EN.php b/php/lang/EN.php index bfad425..7dd7aa8 100644 --- a/php/lang/EN.php +++ b/php/lang/EN.php @@ -120,6 +120,7 @@ define("_BUTTON_CONFIRM", "Are you sure ?"); define("_BUTTON_CLOSE", "Close"); define("_BUTTON_NEXT", "Next"); +define("_BUTTON_EXPAND", "Open"); define("_TOAST_PURCH_ADDED", "Purchase saved"); define("_TOAST_TABLE_ADDED", "New item added"); diff --git a/php/lang/FR.php b/php/lang/FR.php index 8dac2ff..2cf881f 100644 --- a/php/lang/FR.php +++ b/php/lang/FR.php @@ -120,6 +120,7 @@ define("_BUTTON_CONFIRM", "Certain ?"); define("_BUTTON_CLOSE", "Fermer"); define("_BUTTON_NEXT", "Suivant"); +define("_BUTTON_EXPAND", "Ouvrir"); define("_TOAST_PURCH_ADDED", "Achat sauvegardé"); define("_TOAST_TABLE_ADDED", "Nouvel item ajouté"); diff --git a/php/rpt-data.php b/php/rpt-data.php index 2bb6054..0909aa5 100644 --- a/php/rpt-data.php +++ b/php/rpt-data.php @@ -18,6 +18,7 @@ ); # Define sets of columns $cols_summary = Array( + _SQL_PUR_ID, _SQL_PUR_DATE, _SQL_STO_NAME, _SQL_PER_NAME, @@ -26,6 +27,7 @@ ); $cols_details = Array( + _SQL_PUR_ID, _SQL_PUR_DATE, _SQL_STO_NAME, _SQL_PRO_SKU, @@ -108,6 +110,10 @@ # Insert in parent-array $data[] = $lowLevel; } +# If $data is not set, set it to empty. +if(!isset($data)){ + $data = ""; +} # Prepare the output $dtable = Array( "draw" => 1, diff --git a/php/rpt-frame.php b/php/rpt-frame.php index 0756eeb..d69f735 100644 --- a/php/rpt-frame.php +++ b/php/rpt-frame.php @@ -11,6 +11,7 @@ # Define sets of columns $cols_summary = Array( + "iID", _LABEL_PURCH_DATE, _LABEL_STORE, _LABEL_PERSON, @@ -19,6 +20,7 @@ ); $cols_details = Array( + "iID", _LABEL_PURCH_DATE, _LABEL_STORE, _LABEL_SKU, @@ -34,7 +36,7 @@ # Set Report parameters switch($reportType){ case "custom": - $reportTitle = "=BROWSE="; + $reportTitle = _REPORT_BROWSER; $summary = $_GET['summ']; $cols = ($summary == "y" ? $cols_summary:$cols_details); break;