Do full refresh if item update count is > 15 & fix bulk update modal when clicking on glyphicon (#432)

This commit is contained in:
jekkos
2016-05-26 23:17:14 +02:00
parent 1968b598a4
commit fc5aa33d16
13 changed files with 189 additions and 43 deletions

View File

@@ -18,7 +18,7 @@ module.exports = function(grunt) {
all: {
mainFiles: {
'bootswatch-dist': ['bootstrap/dist/js/bootstrap.js'],
'bootstrap-table': [ "src/bootstrap-table.js", "src/bootstrap-table.css", "dist/extensions/export/bootstrap-table-export.js"]
'bootstrap-table': [ "src/bootstrap-table.js", "src/bootstrap-table.css", "dist/extensions/export/bootstrap-table-export.js", "dist/extensions/mobile/bootstrap-table-mobile.js"]
},
dest: {
'js': 'tmp/opensourcepos_bower.js',

View File

@@ -6,7 +6,7 @@
<title>Open Source Point Of Sale <?php echo $this->lang->line('login_login'); ?></title>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<!-- start css template tags -->
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="css/login.css"/>
<!-- end css template tags -->

View File

@@ -43,6 +43,7 @@
<script src="bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
<script src="bower_components/bootstrap-table/src/bootstrap-table.js"></script>
<script src="bower_components/bootstrap-table/dist/extensions/export/bootstrap-table-export.js"></script>
<script src="bower_components/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="bower_components/table-export/tableExport.js"></script>
@@ -64,12 +65,12 @@
<link rel="stylesheet" media="print" href="css/print.css" type="text/css" />
<![endif]-->
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=a9769acab5"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=28f1496971"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=ac10c15522" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=01b7af18a8" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -24,9 +24,11 @@ $(document).ready(function()
pageSize: <?php echo $this->config->item('lines_per_page'); ?>,
uniqueId: 'sale_id',
onLoadSuccess: function(response) {
$("#payment_summary").html(response.payment_summary);
$("#table tbody tr").length > 1 && $("#table tbody tr:last td:first").html("");
if ($("#table tbody tr").length > 1)
{
$("#payment_summary").html(response.payment_summary);
$("#table tbody tr:last td:first").html("");
}
},
queryParams: function() {
return $.extend(arguments[0], {
@@ -72,4 +74,6 @@ $(document).ready(function()
<div id="payment_summary">
</div>
<?php $this->load->view("partial/footer"); ?>

View File

@@ -64,7 +64,8 @@
"main": [
"src/bootstrap-table.js",
"src/bootstrap-table.css",
"dist/extensions/export/bootstrap-table-export.js"
"dist/extensions/export/bootstrap-table-export.js",
"dist/extensions/mobile/bootstrap-table-mobile.js"
]
}
}

View File

@@ -184,3 +184,9 @@ label.required
max-height: calc(100vh - 212px);
overflow-y: auto;
}
#payment_summary
{
position: relative;
top: 100px;
}

View File

File diff suppressed because one or more lines are too long

146
dist/opensourcepos.js vendored
View File

@@ -21270,6 +21270,143 @@ return jQuery;
};
})(jQuery);
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.1.0
*/
!function ($) {
'use strict';
var showHideColumns = function (that, checked) {
if (that.options.columnsHidden.length > 0 ) {
$.each(that.columns, function (i, column) {
if (that.options.columnsHidden.indexOf(column.field) !== -1) {
if (column.visible !== checked) {
that.toggleColumn($.fn.bootstrapTable.utils.getFieldIndex(that.columns, column.field), checked, true);
}
}
});
}
};
var resetView = function (that) {
if (that.options.height || that.options.showFooter) {
setTimeout(function(){
that.resetView.call(that);
}, 1);
}
};
var changeView = function (that, width, height) {
if (that.options.minHeight) {
if ((width <= that.options.minWidth) && (height <= that.options.minHeight)) {
conditionCardView(that);
} else if ((width > that.options.minWidth) && (height > that.options.minHeight)) {
conditionFullView(that);
}
} else {
if (width <= that.options.minWidth) {
conditionCardView(that);
} else if (width > that.options.minWidth) {
conditionFullView(that);
}
}
resetView(that);
};
var conditionCardView = function (that) {
changeTableView(that, false);
showHideColumns(that, false);
};
var conditionFullView = function (that) {
changeTableView(that, true);
showHideColumns(that, true);
};
var changeTableView = function (that, cardViewState) {
that.options.cardView = cardViewState;
that.toggleView();
};
var debounce = function(func,wait) {
var timeout;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
func.apply(context,args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
};
$.extend($.fn.bootstrapTable.defaults, {
mobileResponsive: false,
minWidth: 562,
minHeight: undefined,
heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar
checkOnInit: true,
columnsHidden: []
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init;
BootstrapTable.prototype.init = function () {
_init.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.mobileResponsive) {
return;
}
if (!this.options.minWidth) {
return;
}
if (this.options.minWidth < 100 && this.options.resizable) {
console.log("The minWidth when the resizable extension is active should be greater or equal than 100");
this.options.minWidth = 100;
}
var that = this,
old = {
width: $(window).width(),
height: $(window).height()
};
$(window).on('resize orientationchange',debounce(function (evt) {
// reset view if height has only changed by at least the threshold.
var height = $(this).height(),
width = $(this).width();
if (Math.abs(old.height - height) > that.options.heightThreshold || old.width != width) {
changeView(that, width, height);
old = {
width: width,
height: height
};
}
},200));
if (this.options.checkOnInit) {
var height = $(window).height(),
width = $(window).width();
changeView(this, width, height);
old = {
width: width,
height: height
};
}
};
}(jQuery);
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
@@ -44639,7 +44776,7 @@ THE SOFTWARE.*/
return $(selector).off('click').on('click', function(event) {
var $link = $(event.target);
$link = !$link.is("a, button") ? $link.parents("a") : $link ;
$link = !$link.is("a, button") ? $link.parents("a, button") : $link ;
BootstrapDialog.show($.extend({
title: $link.attr('title'),
message: (function() {
@@ -44758,6 +44895,7 @@ THE SOFTWARE.*/
return function(response) {
typeof options.load_callback == 'function' && options.load_callback();
options.load_callback = undefined;
dialog_support.init("a.modal-dlg, button.modal-dlg");
typeof callback == 'function' && callback.call(this, response);
}
};
@@ -44795,9 +44933,6 @@ THE SOFTWARE.*/
onCheckAll: enable_actions,
onUncheckAll: enable_actions,
onLoadSuccess: load_success(options.onLoadSuccess),
onPostBody: function() {
dialog_support.init("a.modal-dlg, button.modal-dlg");
},
onColumnSwitch : function(field, checked) {
var user_settings = localStorage[options.employee_id];
user_settings = (user_settings && JSON.parse(user_settings)) || {};
@@ -44834,7 +44969,8 @@ THE SOFTWARE.*/
} else {
var message = response.message;
var selector = rows_selector(response.id);
if ($(selector.join(",")).length > 0) {
var rows = $(selector.join(",")).length;
if (rows > 0 && rows < 15) {
var ids = response.id.split(":");
$.get({
url: [url || resource + '/get_row', id].join("/"),

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

@@ -64,7 +64,7 @@
return $(selector).off('click').on('click', function(event) {
var $link = $(event.target);
$link = !$link.is("a, button") ? $link.parents("a") : $link ;
$link = !$link.is("a, button") ? $link.parents("a, button") : $link ;
BootstrapDialog.show($.extend({
title: $link.attr('title'),
message: (function() {
@@ -183,6 +183,7 @@
return function(response) {
typeof options.load_callback == 'function' && options.load_callback();
options.load_callback = undefined;
dialog_support.init("a.modal-dlg, button.modal-dlg");
typeof callback == 'function' && callback.call(this, response);
}
};
@@ -220,9 +221,6 @@
onCheckAll: enable_actions,
onUncheckAll: enable_actions,
onLoadSuccess: load_success(options.onLoadSuccess),
onPostBody: function() {
dialog_support.init("a.modal-dlg, button.modal-dlg");
},
onColumnSwitch : function(field, checked) {
var user_settings = localStorage[options.employee_id];
user_settings = (user_settings && JSON.parse(user_settings)) || {};
@@ -259,7 +257,8 @@
} else {
var message = response.message;
var selector = rows_selector(response.id);
if ($(selector.join(",")).length > 0) {
var rows = $(selector.join(",")).length;
if (rows > 0 && rows < 15) {
var ids = response.id.split(":");
$.get({
url: [url || resource + '/get_row', id].join("/"),

View File

@@ -6,7 +6,7 @@
<title>Open Source Point Of Sale <?php echo $this->lang->line('login_login'); ?></title>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<!-- start css template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="css/login.css"/>
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- end css template tags -->

View File

@@ -57,14 +57,14 @@
<!--[if lte IE 8]>
<link rel="stylesheet" media="print" href="css/print.css" type="text/css" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=9ed20b1ee8"/>
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=a9769acab5"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=28f1496971"/>
<!-- end mincss template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=ac10c15522" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=01b7af18a8" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>