diff --git a/.env b/.env deleted file mode 100644 index 39faf9b10..000000000 --- a/.env +++ /dev/null @@ -1,87 +0,0 @@ -#-------------------------------------------------------------------- -# ENVIRONMENT -#-------------------------------------------------------------------- - -CI_ENVIRONMENT = production -CI_DEBUG = false - -#-------------------------------------------------------------------- -# APP -#-------------------------------------------------------------------- - -app.appTimezone = 'UTC' - -#-------------------------------------------------------------------- -# DATABASE -#-------------------------------------------------------------------- - -database.default.hostname = 'localhost' -database.default.database = 'ospos' -database.default.username = 'admin' -database.default.password = 'pointofsale' -database.default.DBDriver = 'MySQLi' -database.default.DBPrefix = 'ospos_' -database.default.port = 3306 - -database.development.hostname = 'localhost' -database.development.database = 'ospos' -database.development.username = 'admin' -database.development.password = 'pointofsale' -database.development.DBDriver = 'MySQLi' -database.development.DBPrefix = 'ospos_' -database.development.port = 3306 - -database.tests.hostname = 'localhost' -database.tests.database = 'ospos' -database.tests.username = 'admin' -database.tests.password = 'pointofsale' -database.tests.DBDriver = 'MySQLi' -database.tests.DBPrefix = 'ospos_' -database.tests.charset = utf8mb4 -database.tests.DBCollat = utf8mb4_general_ci -database.tests.port = 3306 - -#-------------------------------------------------------------------- -# EMAIL -#-------------------------------------------------------------------- - -email.SMTPHost = '' -email.SMTPUser = '' -email.SMTPPass = '' -email.SMTPPort = -email.SMTPTimeout = 5 -email.SMTPCrypto = 'tls' - -#-------------------------------------------------------------------- -# ENCRYPTION -#-------------------------------------------------------------------- - -encryption.key = '' - -#-------------------------------------------------------------------- -# HONEYPOT -#-------------------------------------------------------------------- - -honeypot.hidden = true -honeypot.label = 'Fill This Field' -honeypot.name = 'honeypot' -honeypot.template = '' -honeypot.container = '
{template}
' - -#-------------------------------------------------------------------- -# LOGGER -# - 0 = Disables logging, Error logging TURNED OFF -# - 1 = Emergency Messages - System is unusable -# - 2 = Alert Messages - Action Must Be Taken Immediately -# - 3 = Critical Messages - Application component unavailable, unexpected exception. -# - 4 = Runtime Errors - Don't need immediate action, but should be monitored. -# - 5 = Warnings - Exceptional occurrences that are not errors. -# - 6 = Notices - Normal but significant events. -# - 7 = Info - Interesting events, like user logging in, etc. -# - 8 = Debug - Detailed debug information. -# - 9 = All Messages -#-------------------------------------------------------------------- - -logger.threshold = 0 -app.db_log_enabled = false -app.db_log_only_long = false diff --git a/.env-example b/.env.example similarity index 100% rename from .env-example rename to .env.example diff --git a/.gitignore b/.gitignore index a94f727f8..1ef8696fa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ public/license/* !public/license/.gitkeep app/Config/email.php npm-debug.log* +.vscode # Docker !docker/.env diff --git a/INSTALL.md b/INSTALL.md index 9d975c7a8..3aeeca927 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -14,7 +14,7 @@ First of all, if you're seeing the message `system folder missing` after launchi 2. Create/locate a new MySQL database to install Open Source Point of Sale into. 3. Execute the file `app/Database/database.sql` to create the tables needed. 4. Unzip and upload Open Source Point of Sale files to the web-server. -5. Open `.env` file and modify credentials to connect to your database if needed. +5. Open `.env` file and modify credentials to connect to your database if needed. (First copy .env.example to .env and update) 7. Go to your install `public` dir via the browser. 8. Log in using - Username: admin diff --git a/app/Config/Services.php b/app/Config/Services.php index 0c27c353f..942714fab 100644 --- a/app/Config/Services.php +++ b/app/Config/Services.php @@ -2,11 +2,12 @@ namespace Config; -use CodeIgniter\Config\BaseService; -use CodeIgniter\HTTP\IncomingRequest; -use Config\Services as AppServices; +use Locale; use HTMLPurifier; use HTMLPurifier_Config; +use CodeIgniter\Config\BaseService; +use Config\Services as AppServices; +use CodeIgniter\HTTP\IncomingRequest; /** * Services Configuration file. diff --git a/app/Language/en-GB/Reports.php b/app/Language/en-GB/Reports.php index c78a5d28f..8ba531cd0 100644 --- a/app/Language/en-GB/Reports.php +++ b/app/Language/en-GB/Reports.php @@ -146,4 +146,5 @@ return [ "used" => "Points Used", "work_orders" => "Work Orders", "zero_and_less" => "Zero and Less", + "toggle_cost_and_profit" => "Toggle Cost & Profit", ]; diff --git a/app/Language/en/Reports.php b/app/Language/en/Reports.php index 4460a2d32..d8361b7f6 100644 --- a/app/Language/en/Reports.php +++ b/app/Language/en/Reports.php @@ -146,4 +146,5 @@ return [ "used" => "Points Used", "work_orders" => "Work Orders", "zero_and_less" => "Zero and less", + "toggle_cost_and_profit" => "Toggle Cost & Profit", ]; diff --git a/app/Views/partial/visibility_js.php b/app/Views/partial/visibility_js.php new file mode 100644 index 000000000..7fcb3e4d1 --- /dev/null +++ b/app/Views/partial/visibility_js.php @@ -0,0 +1,98 @@ + +// Utility functions for safe localStorage access +function safeSetItem(key, value) { + try { + localStorage.setItem(key, value); + } catch (e) { + console.error(`Failed to set item in localStorage: ${e.message}`); + } +} + +function safeGetItem(key) { + try { + return localStorage.getItem(key); + } catch (e) { + console.error(`Failed to get item from localStorage: ${e.message}`); + return null; // Default fallback + } +} + +function safeRemoveItem(key) { + try { + localStorage.removeItem(key); + } catch (e) { + console.error(`Failed to remove item from localStorage: ${e.message}`); + } +} + +// Load saved column visibility from localStorage +var savedVisibility = JSON.parse(safeGetItem('columnVisibility')) || { cost: false, profit: false }; +var visibleColumns = savedVisibility; + +// Function to save column visibility to localStorage +function saveColumnVisibility(visibility) { + safeSetItem('columnVisibility', JSON.stringify(visibility)); +} + +// Apply column visibility on table initialization +function applyColumnVisibility(columns) { + return columns.map(function (col) { + if (visibleColumns[col.field] !== undefined) { + col.visible = visibleColumns[col.field]; // Apply visibility from localStorage + } + return col; + }); +} + +// Event listener for column visibility toggle +$('#table').on('column-switch.bs.table', function (e, field, checked) { + visibleColumns[field] = checked; // Save the visibility of this column + saveColumnVisibility(visibleColumns); // Store it in localStorage +}); + +// Ensure that saved column visibility is applied immediately after table load +$('#table').bootstrapTable('refreshOptions', { + columns: $('#table').bootstrapTable('getOptions').columns // Force refresh to apply column visibility +}); + +// Initialize visibility settings from localStorage +var summaryVisibility = JSON.parse(safeGetItem('summaryVisibility')) || { cost: false, profit: false }; + +// Function to apply visibility for cost and profit rows +function applySummaryVisibility() { + var rows = $('#report_summary .summary_row'); + var costRow = rows.eq(rows.length - 2); // Second-to-last row + var profitRow = rows.eq(rows.length - 1); // Last row + + if (summaryVisibility.cost === false) { + costRow.hide(); // Hide the cost row + } else { + costRow.show(); // Show the cost row + } + + if (summaryVisibility.profit === false) { + profitRow.hide(); // Hide the profit row + } else { + profitRow.show(); // Show the profit row + } +} + +// Toggle visibility when the button is clicked +$('#toggleCostProfitButton').click(function () { + summaryVisibility.cost = !summaryVisibility.cost; + summaryVisibility.profit = !summaryVisibility.profit; + + safeSetItem('summaryVisibility', JSON.stringify(summaryVisibility)); + applySummaryVisibility(); +}); + +// Apply saved visibility state on page load +applySummaryVisibility(); + +// Initialize dialog (if editable) +var init_dialog = function () { + + table_support.submit_handler(''); + dialog_support.init("a.modal-dlg"); + +}; diff --git a/app/Views/reports/graphical.php b/app/Views/reports/graphical.php index 00d085d0e..1a99371ce 100644 --- a/app/Views/reports/graphical.php +++ b/app/Views/reports/graphical.php @@ -19,6 +19,15 @@
+
+ +
+
@@ -27,4 +36,6 @@
+ + diff --git a/app/Views/reports/tabular.php b/app/Views/reports/tabular.php index 966b9c12b..3bf7b1f89 100644 --- a/app/Views/reports/tabular.php +++ b/app/Views/reports/tabular.php @@ -19,6 +19,14 @@
+
+ +
+
@@ -27,26 +35,29 @@ $value) { if ($name == "total_quantity") { - ?> + ?>
-