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. // 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 modified = false; // indicates if anything has been clicked on this page
var groupBalance = 0; // available group money var groupBalance = 0; // available group money
var minimumBalance = 0; // minimum group balance for the order to be succesful var minimumBalance = 0; // minimum group balance for the order to be succesful
var toleranceIsCostly = true; // default tolerance behaviour 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: // Article data arrays:
var price = new Array(); var price = new Array();
@ -139,8 +139,6 @@ function update(item, quantity, tolerance) {
.removeClass('missing-many missing-few missing-none') .removeClass('missing-many missing-few missing-none')
.addClass(missing_units_css); .addClass(missing_units_css);
// update balance
updateBalance(); updateBalance();
} }
@ -185,16 +183,16 @@ function updateBalance() {
} }
$(function() { $(function() {
$('input[data-increase_quantity]').on('touchclick', function() { $('a[data-increase_quantity]').on('touchclick', function() {
increaseQuantity($(this).data('increase_quantity')); increaseQuantity($(this).data('increase_quantity'));
}); });
$('input[data-decrease_quantity]').on('touchclick', function() { $('a[data-decrease_quantity]').on('touchclick', function() {
decreaseQuantity($(this).data('decrease_quantity')); decreaseQuantity($(this).data('decrease_quantity'));
}); });
$('input[data-increase_tolerance]').on('touchclick', function() { $('a[data-increase_tolerance]').on('touchclick', function() {
increaseTolerance($(this).data('increase_tolerance')); increaseTolerance($(this).data('increase_tolerance'));
}); });
$('input[data-decrease_tolerance]').on('touchclick', function() { $('a[data-decrease_tolerance]').on('touchclick', function() {
decreaseTolerance($(this).data('decrease_tolerance')); decreaseTolerance($(this).data('decrease_tolerance'));
}); });

View file

@ -194,10 +194,17 @@ table {
} }
.unused { .unused {
color: @articleUnusedColor; color: @articleUnusedColor;
margin-right: 0.5em;
} }
.partused { .partused {
color: @articlePartusedColor; color: @articlePartusedColor;
} }
.btn-ordering, .btn-group .btn-ordering {
font-size: 10px;
line-height: 14px;
padding: 4px 8px;
margin-top: -2px;
}
#order-footer, .article-info { #order-footer, .article-info {
text-align: left; 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.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] %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} .btn-group
%input{type: 'button', value: '-', 'data-decrease_quantity' => order_article.id} %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?)} %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]}/ %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.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] %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} .btn-group
%input{type: 'button', value: '-', 'data-decrease_tolerance' => order_article.id} %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"} %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]) %span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price])