From 2d219803139ea63ca3cf8a81b2ac1ee4986bf8b4 Mon Sep 17 00:00:00 2001 From: jekkos Date: Thu, 22 Oct 2020 17:43:37 +0200 Subject: [PATCH 1/9] Update bower.json --- Gruntfile.js | 3 ++- application/views/partial/header.php | 16 ++++++++-------- bower.json | 20 +++++++++----------- package.json | 2 +- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index de3d09757..aef0f0819 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -11,7 +11,8 @@ module.exports = function(grunt) { bower_concat: { all: { mainFiles: { - 'bootstrap-table': [ "src/bootstrap-table.js", "src/bootstrap-table.css", "dist/extensions/export/bootstrap-table-export.js", "dist/extensions/mobile/bootstrap-table-mobile.js", "dist/extensions/sticky-header/bootstrap-table-sticky-header.js", "dist/extensions/sticky-header/bootstrap-table-sticky-header.css"] + 'bootstrap-table': [ "dist/bootstrap-table.min.js", "dist/bootstrap-table.css", "dist/extensions/export/bootstrap-table-export.min.js", "dist/extensions/mobile/bootstrap-table-mobile.min.js", "dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js", "dist/extensions/sticky-header/bootstrap-table-sticky-header.css"], + 'chartist-plugin-axistitle': [ "./dist/chartist-plugin-axistitle.min.js"] }, dest: { 'js': 'tmp/opensourcepos_bower.js', diff --git a/application/views/partial/header.php b/application/views/partial/header.php index 04d7ba0d0..0598e575f 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -14,7 +14,7 @@ - + @@ -42,19 +42,19 @@ - + - + + - + - + - @@ -75,7 +75,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/bower.json b/bower.json index 0e80da4fe..1f59164e4 100644 --- a/bower.json +++ b/bower.json @@ -33,12 +33,12 @@ "bootswatch": "3.4.1+1", "smalot-bootstrap-datetimepicker": "~2.4.4", "bootstrap-select": "~1.13.18", - "bootstrap-table": "~1.12.2", + "bootstrap-table": "~1.18.0", "bootstrap-daterangepicker": "~2.1.27", - "tableExport.jquery.plugin": "1.5.1", - "jspdf": "~1.0.272", - "chartist": "0.9.8", - "chartist-plugin-axistitle": "0.0.5", + "tableExport.jquery.plugin": "1.10.20", + "jspdf": "~1.3.4", + "chartist": "0.11.4", + "chartist-plugin-axistitle": "0.0.7", "chartist-plugin-pointlabels": "0.0.4", "chartist-plugin-tooltip": "https://github.com/tmmdata/chartist-plugin-tooltip.git#0.0.18", "chartist-plugin-barlabels": "https://github.com/mtgibbs/chartist-plugin-barlabels.git#0.0.5", @@ -48,7 +48,8 @@ "bootstrap-toggle": "^2.2.2" }, "resolutions": { - "jquery": "~1.12.4" + "chartist": "0.9.8", + "jspdf": ">=1.3.4" }, "overrides": { "jquery-ui": { @@ -64,16 +65,13 @@ }, "bootstrap-table": { "main": [ - "src/bootstrap-table.js", - "src/bootstrap-table.css", + "dist/bootstrap-table.js", + "dist/bootstrap-table.css", "dist/extensions/export/bootstrap-table-export.js", "dist/extensions/mobile/bootstrap-table-mobile.js", "dist/extensions/sticky-header/bootstrap-table-sticky-header.js", "dist/extensions/sticky-header/bootstrap-table-sticky-header.css" ] } - }, - "resolutions": { - "chartist": "0.9.8" } } diff --git a/package.json b/package.json index 609094b2a..5ad95e56d 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "grunt-contrib-concat": "~0.5.1", "grunt-contrib-cssmin": "^0.14.0", "grunt-contrib-jshint": "~0.6.3", - "grunt-contrib-uglify": "~0.8.0", + "grunt-contrib-uglify-es": "github:opensourcepos/grunt-contrib-uglify#harmony", "grunt-contrib-watch": "~0.5.3", "grunt-license-bower": "~1.0.1", "grunt-mocha-webdriver": "^1.2.2", From 2e2ef29f7294d662eb3e81cd57a7f5a7cfddd0c4 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Sun, 20 Dec 2020 12:09:50 +0100 Subject: [PATCH 2/9] Add chartist bower main override --- bower.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bower.json b/bower.json index 1f59164e4..e8a77e837 100644 --- a/bower.json +++ b/bower.json @@ -63,6 +63,11 @@ "tableExport.js" ] }, + "chartist-axis-plugin": { + "main": [ + "dist/chartist-plugin-axistitle.js" + ] + }, "bootstrap-table": { "main": [ "dist/bootstrap-table.js", From 9a881c5232b6e1bef01f96ada0897a825530b1d4 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Mon, 21 Dec 2020 15:40:05 +0100 Subject: [PATCH 3/9] Add stripes to table again (#2980) --- application/views/reports/tabular.php | 32 ++++---- application/views/reports/tabular_details.php | 76 ++++++++++--------- public/js/manage_tables.js | 6 +- 3 files changed, 60 insertions(+), 54 deletions(-) diff --git a/application/views/reports/tabular.php b/application/views/reports/tabular.php index 03a6daf1c..a13032e90 100644 --- a/application/views/reports/tabular.php +++ b/application/views/reports/tabular.php @@ -37,21 +37,23 @@ { load->view('partial/bootstrap_tables_locale'); ?> - $('#table').bootstrapTable({ - columns: , - stickyHeader: true, - pageSize: config->item('lines_per_page'); ?>, - striped: true, - sortable: true, - showExport: true, - exportDataType: 'all', - exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'], - pagination: true, - showColumns: true, - data: , - iconSize: 'sm', - paginationVAlign: 'bottom', - escape: false + $('#table') + .addClass("table-striped") + .addClass("table-bordered") + .bootstrapTable({ + columns: , + stickyHeader: true, + pageSize: config->item('lines_per_page'); ?>, + sortable: true, + showExport: true, + exportDataType: 'all', + exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'], + pagination: true, + showColumns: true, + data: , + iconSize: 'sm', + paginationVAlign: 'bottom', + escape: false }); }); diff --git a/application/views/reports/tabular_details.php b/application/views/reports/tabular_details.php index 9b6b23482..e30703937 100644 --- a/application/views/reports/tabular_details.php +++ b/application/views/reports/tabular_details.php @@ -45,45 +45,47 @@ ?> }; - $('#table').bootstrapTable({ - columns: , - stickyHeader: true, - pageSize: config->item('lines_per_page'); ?>, - striped: true, - pagination: true, - sortable: true, - showColumns: true, - uniqueId: 'id', - showExport: true, - exportDataType: 'all', - exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'], - data: , - iconSize: 'sm', - paginationVAlign: 'bottom', - detailView: true, - escape: false, - onPageChange: init_dialog, - onPostBody: function() { - dialog_support.init("a.modal-dlg"); - }, - onExpandRow: function (index, row, $detail) { - $detail.html('
').find("table").bootstrapTable({ - columns: , - data: details_data[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(/(POS|RECV)\s*/g, '')] - }); - - config->item('customer_reward_enable') == TRUE && !empty($details_data_rewards)) - { - ?> - $detail.append('
').find("table").bootstrapTable({ - columns: , - data: details_data_rewards[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(/(POS|RECV)\s*/g, '')] + $('#table') + .addClass("table-striped") + .addClass("table-bordered") + .bootstrapTable({ + columns: , + stickyHeader: true, + pageSize: config->item('lines_per_page'); ?>, + pagination: true, + sortable: true, + showColumns: true, + uniqueId: 'id', + showExport: true, + exportDataType: 'all', + exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'], + data: , + iconSize: 'sm', + paginationVAlign: 'bottom', + detailView: true, + escape: false, + onPageChange: init_dialog, + onPostBody: function() { + dialog_support.init("a.modal-dlg"); + }, + onExpandRow: function (index, row, $detail) { + $detail.html('
').find("table").bootstrapTable({ + columns: , + data: details_data[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(/(POS|RECV)\s*/g, '')] }); - config->item('customer_reward_enable') == TRUE && !empty($details_data_rewards)) + { + ?> + $detail.append('
').find("table").bootstrapTable({ + columns: , + data: details_data_rewards[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(/(POS|RECV)\s*/g, '')] + }); + } - ?> - } }); init_dialog(); diff --git a/public/js/manage_tables.js b/public/js/manage_tables.js index 76f802291..49bbb0266 100644 --- a/public/js/manage_tables.js +++ b/public/js/manage_tables.js @@ -208,13 +208,15 @@ options = _options; enable_actions = enable_actions(options.enableActions); load_success = load_success(options.onLoadSuccess); - $('#table').bootstrapTable($.extend(options, { + $('#table') + .addClass("table-striped") + .addClass("table-bordered") + .bootstrapTable($.extend(options, { columns: options.headers, stickyHeader: true, url: options.resource + '/search', sidePagination: 'server', pageSize: options.pageSize, - striped: true, pagination: true, search: options.resource || false, showColumns: true, From 18d61188ff73a595e09915246a33615630fe99c2 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Tue, 22 Dec 2020 11:41:36 +0100 Subject: [PATCH 4/9] Fix sticky table headers (#2980) --- application/views/reports/tabular.php | 4 ++++ application/views/reports/tabular_details.php | 3 +++ bower.json | 10 +++++----- public/js/manage_tables.js | 13 +++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/application/views/reports/tabular.php b/application/views/reports/tabular.php index a13032e90..b5433aa9f 100644 --- a/application/views/reports/tabular.php +++ b/application/views/reports/tabular.php @@ -43,6 +43,8 @@ .bootstrapTable({ columns: , stickyHeader: true, + stickyHeaderOffsetLeft: $('#table').offset().left + 'px', + stickyHeaderOffsetRight: $('#table').offset().right + 'px', pageSize: config->item('lines_per_page'); ?>, sortable: true, showExport: true, @@ -56,6 +58,8 @@ escape: false }); + table_support.init_resize(); + }); diff --git a/application/views/reports/tabular_details.php b/application/views/reports/tabular_details.php index e30703937..59f3698e5 100644 --- a/application/views/reports/tabular_details.php +++ b/application/views/reports/tabular_details.php @@ -51,6 +51,8 @@ .bootstrapTable({ columns: , stickyHeader: true, + stickyHeaderOffsetLeft: $('#table').offset().left + 'px', + stickyHeaderOffsetRight: $('#table').offset().right + 'px', pageSize: config->item('lines_per_page'); ?>, pagination: true, sortable: true, @@ -89,6 +91,7 @@ }); init_dialog(); + table_support.init_resize(); }); diff --git a/bower.json b/bower.json index e8a77e837..240eca4a3 100644 --- a/bower.json +++ b/bower.json @@ -33,7 +33,7 @@ "bootswatch": "3.4.1+1", "smalot-bootstrap-datetimepicker": "~2.4.4", "bootstrap-select": "~1.13.18", - "bootstrap-table": "~1.18.0", + "bootstrap-table": "~1.18.1", "bootstrap-daterangepicker": "~2.1.27", "tableExport.jquery.plugin": "1.10.20", "jspdf": "~1.3.4", @@ -70,11 +70,11 @@ }, "bootstrap-table": { "main": [ - "dist/bootstrap-table.js", + "dist/bootstrap-table.min.js", "dist/bootstrap-table.css", - "dist/extensions/export/bootstrap-table-export.js", - "dist/extensions/mobile/bootstrap-table-mobile.js", - "dist/extensions/sticky-header/bootstrap-table-sticky-header.js", + "dist/extensions/export/bootstrap-table-export.min.js", + "dist/extensions/mobile/bootstrap-table-mobile.min.js", + "dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js", "dist/extensions/sticky-header/bootstrap-table-sticky-header.css" ] } diff --git a/public/js/manage_tables.js b/public/js/manage_tables.js index 49bbb0266..1aa67280f 100644 --- a/public/js/manage_tables.js +++ b/public/js/manage_tables.js @@ -214,6 +214,8 @@ .bootstrapTable($.extend(options, { columns: options.headers, stickyHeader: true, + stickyHeaderOffsetLeft: $('#table').offset().left + 'px', + stickyHeaderOffsetRight: $('#table').offset().right + 'px', url: options.resource + '/search', sidePagination: 'server', pageSize: options.pageSize, @@ -259,10 +261,20 @@ enable_actions(); init_delete(); init_restore(); + init_resize(); toggle_column_visibility(); dialog_support.init("button.modal-dlg"); }; + var init_resize = function() { + $(window).resize(function () { + $('#table').bootstrapTable('refreshOptions', { + stickyHeaderOffsetLeft: $('#table').offset().left + 'px', + stickyHeaderOffsetRight: $('#table').offset().left + 'px', + }) + }) + } + var init_delete = function (confirmMessage) { $("#delete").click(function(event) { do_action("delete")(); @@ -321,6 +333,7 @@ }, handle_submit: handle_submit, init: init, + init_resize: init_resize, do_delete: do_action("delete"), do_restore: do_action("restore"), refresh : refresh, From f312a45469a6a8ea2704015db85e6feb4f1c82f4 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Tue, 22 Dec 2020 14:16:44 +0100 Subject: [PATCH 5/9] Update header.php (#2980) --- application/views/partial/header.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/views/partial/header.php b/application/views/partial/header.php index 0598e575f..8571952f6 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -42,10 +42,10 @@ - - - - + + + + @@ -84,7 +84,7 @@ - + From 37cacdbc398fa02e6c57d15c3698d70546b864f6 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Tue, 22 Dec 2020 23:36:46 +0100 Subject: [PATCH 6/9] Fix sticky table header alignment (#2980) --- public/js/manage_tables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/manage_tables.js b/public/js/manage_tables.js index 1aa67280f..c85a30d6e 100644 --- a/public/js/manage_tables.js +++ b/public/js/manage_tables.js @@ -215,7 +215,7 @@ columns: options.headers, stickyHeader: true, stickyHeaderOffsetLeft: $('#table').offset().left + 'px', - stickyHeaderOffsetRight: $('#table').offset().right + 'px', + stickyHeaderOffsetRight: $('#table').offset().left + 'px', url: options.resource + '/search', sidePagination: 'server', pageSize: options.pageSize, From 58192f74c0290a289a1c37a827b09713898c8e58 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Fri, 25 Dec 2020 20:25:11 +0100 Subject: [PATCH 7/9] Export only selection if it's present (#2980) --- public/js/manage_tables.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/js/manage_tables.js b/public/js/manage_tables.js index c85a30d6e..0d4778565 100644 --- a/public/js/manage_tables.js +++ b/public/js/manage_tables.js @@ -111,6 +111,7 @@ var enable_actions = function(callback) { return function() { var selection_empty = selected_rows().length == 0; + $("#table").data('bootstrap.table').options.exportDataType = selection_empty ? 'all' : 'selected'; $("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty); typeof callback == 'function' && callback(); } @@ -214,8 +215,8 @@ .bootstrapTable($.extend(options, { columns: options.headers, stickyHeader: true, - stickyHeaderOffsetLeft: $('#table').offset().left + 'px', - stickyHeaderOffsetRight: $('#table').offset().left + 'px', + stickyHeaderOffsetLeft: $('#table').offset().right + 'px', + stickyHeaderOffsetRight: $('#table').offset().right + 'px', url: options.resource + '/search', sidePagination: 'server', pageSize: options.pageSize, @@ -270,7 +271,7 @@ $(window).resize(function () { $('#table').bootstrapTable('refreshOptions', { stickyHeaderOffsetLeft: $('#table').offset().left + 'px', - stickyHeaderOffsetRight: $('#table').offset().left + 'px', + stickyHeaderOffsetRight: $('#table').offset().right + 'px', }) }) } From 23e4deb7c4240acac543e20453bc5362f80f0210 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Sat, 26 Dec 2020 23:39:36 +0100 Subject: [PATCH 8/9] se basic as export mode if nothing is selected (#2980) --- public/js/manage_tables.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/manage_tables.js b/public/js/manage_tables.js index 0d4778565..559715c50 100644 --- a/public/js/manage_tables.js +++ b/public/js/manage_tables.js @@ -111,7 +111,7 @@ var enable_actions = function(callback) { return function() { var selection_empty = selected_rows().length == 0; - $("#table").data('bootstrap.table').options.exportDataType = selection_empty ? 'all' : 'selected'; + $("#table").data('bootstrap.table').options.exportDataType = selection_empty ? 'basic' : 'selected'; $("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty); typeof callback == 'function' && callback(); } @@ -225,7 +225,7 @@ showColumns: true, clickToSelect: true, showExport: true, - exportDataType: 'all', + exportDataType: 'basic', exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'], exportOptions: { fileName: options.resource.replace(/.*\/(.*?)$/g, '$1') From 4e85b8a6774ef3e82df9401e6ca8ab3c76c5d072 Mon Sep 17 00:00:00 2001 From: Jeroen Peelaerts Date: Sun, 27 Dec 2020 22:00:22 +0100 Subject: [PATCH 9/9] Remove basic/selected toggle (#2980) --- public/js/manage_tables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/manage_tables.js b/public/js/manage_tables.js index 559715c50..7d1f0e5a6 100644 --- a/public/js/manage_tables.js +++ b/public/js/manage_tables.js @@ -111,7 +111,6 @@ var enable_actions = function(callback) { return function() { var selection_empty = selected_rows().length == 0; - $("#table").data('bootstrap.table').options.exportDataType = selection_empty ? 'basic' : 'selected'; $("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty); typeof callback == 'function' && callback(); } @@ -219,6 +218,7 @@ stickyHeaderOffsetRight: $('#table').offset().right + 'px', url: options.resource + '/search', sidePagination: 'server', + selectItemName: 'btSelectItem', pageSize: options.pageSize, pagination: true, search: options.resource || false,