Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Commit

Permalink
Browser
Browse files Browse the repository at this point in the history
Closes #46
  • Loading branch information
Dreller committed Jul 8, 2021
1 parent 851b6d3 commit ceecc8e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DataTables/lang/FR.json
Original file line number Diff line number Diff line change
@@ -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...",
Expand All @@ -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",
Expand Down
20 changes: 15 additions & 5 deletions js/glutax.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ $(document).ready(function(){
loadPage();
});


// Click on the Website title in the Top NavBar
$("#glutaxTitle").on("click", function(){
loadPage();
Expand Down Expand Up @@ -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 );
});

});
}
2 changes: 1 addition & 1 deletion page.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
<div class="modal-content p-3" id="purchaseReceiptBody">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" onclick="loadPage('purch', 'p=' + myPurchaseID);"><?= _BUTTON_UPDATE ?></button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" onclick="loadPage('purch', 'p=' + myPurchaseID);"><?= _BUTTON_EXPAND ?></button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal"><?= _BUTTON_CLOSE ?></button>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions php/lang/EN.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions php/lang/FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -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&eacute;");
define("_TOAST_TABLE_ADDED", "Nouvel item ajout&eacute;");
Expand Down
6 changes: 6 additions & 0 deletions php/rpt-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
);
# Define sets of columns
$cols_summary = Array(
_SQL_PUR_ID,
_SQL_PUR_DATE,
_SQL_STO_NAME,
_SQL_PER_NAME,
Expand All @@ -26,6 +27,7 @@
);

$cols_details = Array(
_SQL_PUR_ID,
_SQL_PUR_DATE,
_SQL_STO_NAME,
_SQL_PRO_SKU,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion php/rpt-frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# Define sets of columns
$cols_summary = Array(
"iID",
_LABEL_PURCH_DATE,
_LABEL_STORE,
_LABEL_PERSON,
Expand All @@ -19,6 +20,7 @@
);

$cols_details = Array(
"iID",
_LABEL_PURCH_DATE,
_LABEL_STORE,
_LABEL_SKU,
Expand All @@ -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;
Expand Down

0 comments on commit ceecc8e

Please sign in to comment.