Use bootstrap buttons for ordering

This commit is contained in:
wvengen 2015-10-13 22:06:10 +02:00
parent a03789e048
commit 945a9e4d4a
3 changed files with 27 additions and 16 deletions

View File

@ -5,11 +5,11 @@
//
// Call setDecimalSeparator(char) to overwrite the default character "." with a localized value.
var modified = false // indicates if anything has been clicked on this page
var groupBalance = 0; // available group money
var minimumBalance = 0; // minimum group balance for the order to be succesful
var modified = false; // indicates if anything has been clicked on this page
var groupBalance = 0; // available group money
var minimumBalance = 0; // minimum group balance for the order to be succesful
var toleranceIsCostly = true; // default tolerance behaviour
var isStockit = false; // Wheter the order is from stock oder normal supplier
var isStockit = false; // Whether the order is from stock oder normal supplier
// Article data arrays:
var price = new Array();
@ -139,8 +139,6 @@ function update(item, quantity, tolerance) {
.removeClass('missing-many missing-few missing-none')
.addClass(missing_units_css);
// update balance
updateBalance();
}
@ -185,16 +183,16 @@ function updateBalance() {
}
$(function() {
$('input[data-increase_quantity]').on('touchclick', function() {
$('a[data-increase_quantity]').on('touchclick', function() {
increaseQuantity($(this).data('increase_quantity'));
});
$('input[data-decrease_quantity]').on('touchclick', function() {
$('a[data-decrease_quantity]').on('touchclick', function() {
decreaseQuantity($(this).data('decrease_quantity'));
});
$('input[data-increase_tolerance]').on('touchclick', function() {
$('a[data-increase_tolerance]').on('touchclick', function() {
increaseTolerance($(this).data('increase_tolerance'));
});
$('input[data-decrease_tolerance]').on('touchclick', function() {
$('a[data-decrease_tolerance]').on('touchclick', function() {
decreaseTolerance($(this).data('decrease_tolerance'));
});

View File

@ -48,7 +48,7 @@ body {
// Fix empty dd tags in horizontal dl, see https://github.com/twitter/bootstrap/issues/4062
.dl-horizontal {
.dl-horizontal {
dd { .clearfix(); }
}
@ -129,7 +129,7 @@ table {
th.left, td.left { text-align: left; }
th.right, td.right { text-align: right; }
th.center, td.center { text-align: center; }
td.main_info {
font-weight: bold;
}
@ -194,10 +194,17 @@ table {
}
.unused {
color: @articleUnusedColor;
margin-right: 0.5em;
}
.partused {
color: @articlePartusedColor;
}
.btn-ordering, .btn-group .btn-ordering {
font-size: 10px;
line-height: 14px;
padding: 4px 8px;
margin-top: -2px;
}
#order-footer, .article-info {
text-align: left;

View File

@ -106,8 +106,11 @@
%span.used{id: "q_used_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:used_quantity]
+
%span.unused{id: "q_unused_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] - @ordering_data[:order_articles][order_article.id][:used_quantity]
%input{type: 'button', value: '+', 'data-increase_quantity' => order_article.id}
%input{type: 'button', value: '-', 'data-decrease_quantity' => order_article.id}
.btn-group
%a.btn.btn-ordering{'data-increase_quantity' => order_article.id}
%i.icon-plus
%a.btn.btn-ordering{'data-decrease_quantity' => order_article.id}
%i.icon-minus
%td.tolerance{style: ('display:none' if @order.stockit?)}
%input{id: "t_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][tolerance]", size: "2", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:tolerance]}/
@ -115,8 +118,11 @@
%span.used{id: "t_used_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:used_tolerance]
+
%span.unused{id: "t_unused_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] - @ordering_data[:order_articles][order_article.id][:used_tolerance]
%input{type: 'button', value: '+', 'data-increase_tolerance' => order_article.id}
%input{type: 'button', value: '-', 'data-decrease_tolerance' => order_article.id}
.btn-group
%a.btn.btn-ordering{'data-increase_tolerance' => order_article.id}
%i.icon-plus
%a.btn.btn-ordering{'data-decrease_tolerance' => order_article.id}
%i.icon-minus
%td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"}
%span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price])