Fixed ordering view.
This commit is contained in:
parent
adbe93f39e
commit
f3773314a7
6 changed files with 417 additions and 291 deletions
43
app/views/ordering/_data.html.erb
Normal file
43
app/views/ordering/_data.html.erb
Normal file
|
@ -0,0 +1,43 @@
|
|||
<script>
|
||||
//<![CDATA[
|
||||
$(function() {
|
||||
<% if Foodsoft.config[:tolerance_is_costly]
|
||||
for i in 0...@price.size %>
|
||||
addData(<%= @price[i] %>,
|
||||
<%= @unit[i] %>,
|
||||
<%= @price[i] * (@tolerance[i] + @quantity[i])%>,
|
||||
<%= @others_quantity[i] %>,
|
||||
<%= @others_tolerance[i] %>,
|
||||
<%= @used_quantity[i] %>,
|
||||
0);
|
||||
<% end
|
||||
else
|
||||
for j in 0...@price.size -%>
|
||||
addData(<%= @price[j] %>,
|
||||
<%= @unit[j] %>,
|
||||
<%= @price[j] * @quantity[j]%>,
|
||||
<%= @others_quantity[j] %>,
|
||||
<%= @others_tolerance[j] %>,
|
||||
<%= @used_quantity[j] %>,
|
||||
0);
|
||||
<% end
|
||||
end%>
|
||||
setGroupBalance(<%= @availableFunds %>);
|
||||
|
||||
// localization
|
||||
setDecimalSeparator(",");
|
||||
|
||||
// configuration
|
||||
setToleranceBehaviour(<%= Foodsoft.config[:tolerance_is_costly] %>);
|
||||
|
||||
// initialize javascript
|
||||
updateBalance();
|
||||
|
||||
// show article info on row hover
|
||||
<%#*$$('tbody tr').observer('hover', function() {%>
|
||||
|
||||
<%#*});%>
|
||||
|
||||
});
|
||||
//]]>
|
||||
</script>
|
88
app/views/ordering/order.html.haml
Normal file
88
app/views/ordering/order.html.haml
Normal file
|
@ -0,0 +1,88 @@
|
|||
- content_for :head do
|
||||
= render 'data'
|
||||
|
||||
= render :partial => 'order_head'
|
||||
|
||||
- form_tag(:action => 'saveOrder', :id => @order) do
|
||||
.single_column{:style => "clear:both;margin-bottom:7em;"}
|
||||
.box_title
|
||||
%h2 Artikel
|
||||
.column_content
|
||||
%table#order.list
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th{:style => "width:13px;"}
|
||||
%th{:style => "width:4.5em;"} Preis
|
||||
%th{:style => "width:4.5em;"} Einheit
|
||||
%th{:style => "width:70px;"} Fehlende Einheiten
|
||||
%th#col_required Menge
|
||||
- if not @order.stockit?
|
||||
%th#col_tolerance Toleranz
|
||||
%th{:style => "width:15px;"} Summe
|
||||
%tbody
|
||||
- total = 0
|
||||
- i = 0
|
||||
- @articles_grouped_by_category.each do |category, order_articles|
|
||||
%tr{:style => "background-color:#EFEFEF"}
|
||||
%td{:style => "text-align:left"}
|
||||
%b= h category
|
||||
%td{:colspan => "9"}
|
||||
- order_articles.each do |order_article|
|
||||
- if Foodsoft.config[:tolerance_is_costly]
|
||||
- article_total = @price[i] * (@tolerance[i] + @quantity[i])
|
||||
- else
|
||||
- article_total = @price[i] * @quantity[i]
|
||||
- total += article_total
|
||||
%tr{:class => "#{cycle('even', 'odd', :name => 'articles')} order-article", :valign => "top"}
|
||||
%td.name= order_article.article.name
|
||||
%td= h order_article.article.origin
|
||||
%td= number_to_currency(@price[i])
|
||||
%td= order_article.article.unit
|
||||
%td
|
||||
%span{:id => "missing_units_#{i}"}
|
||||
- if @order.stockit?
|
||||
- order_article.article.quantity_available
|
||||
- else
|
||||
- missing_units = @unit[i] - (((@quantity[i] + @others_quantity[i]) % @unit[i]) + @tolerance[i] + @others_tolerance[i])
|
||||
- missing_units < 0 ? 0 : missing_units
|
||||
%td.quantity
|
||||
%input{:id => "q_#{i}", :name => "ordered[#{order_article.id}][quantity]", :size => "2", :type => "hidden", :value => @quantity[i]}/
|
||||
%span.used{:id => "q_used_#{i}"}= @used_quantity[i]
|
||||
+
|
||||
%span.unused{:id => "q_unused_#{i}"}= @quantity[i] - @used_quantity[i]
|
||||
= button_to_function('+', "increaseQuantity(#{i})")
|
||||
= button_to_function('-', "decreaseQuantity(#{i})")
|
||||
- unless @order.stockit?
|
||||
%td.tolerance
|
||||
%input{:id => "t_#{i}", :name => "ordered[#{order_article.id}][tolerance]", :size => "2", :type => "hidden", :value => @tolerance[i]}/
|
||||
- if (@unit[i] > 1)
|
||||
%span.used{:id => "t_used_#{i}"}= @used_tolerance[i]
|
||||
+
|
||||
%span.unused{:id => "t_unused_#{i}"}= @tolerance[i] - @used_tolerance[i]
|
||||
= button_to_function('+', "increaseTolerance(#{i})")
|
||||
= button_to_function('-', "decreaseTolerance(#{i})")
|
||||
%td{:id => "td_price_#{i}", :style => "text-align:right; padding-right:10px; width:4em"}
|
||||
%span{:id => "price_#{i}_display"}= number_to_currency(article_total, :unit => "")
|
||||
€
|
||||
.article-info
|
||||
%h3= order_article.article.name
|
||||
.right
|
||||
Volle Gebinde:
|
||||
%span{:id => "units_#{i}"}= order_article.units_to_order
|
||||
%br/
|
||||
Gesamt-Einheiten:
|
||||
%span{:id => "q_total_#{i}"}= @quantity[i] + @others_quantity[i]
|
||||
%br/
|
||||
Gesamt-Toleranz:
|
||||
%span{:id => "t_total_#{i}"}= @tolerance[i] + @others_tolerance[i]
|
||||
%br/
|
||||
.left
|
||||
Hersteller: #{order_article.article.manufacturer}
|
||||
%br/
|
||||
Gebinde: #{@order.stockit? ? order_article.article.quantity_available : @unit[i]} * #{h order_article.article.unit}
|
||||
%br/
|
||||
Notiz: #{order_article.article.note}
|
||||
%br/
|
||||
- i = i + 1
|
||||
= render "order_footer", :total => total
|
|
@ -1,131 +0,0 @@
|
|||
<%= render :partial => 'order_head' %>
|
||||
|
||||
<% form_tag(:action => 'saveOrder', :id => @order) do %>
|
||||
<div class="single_column" style="clear:both;margin-bottom:7em;">
|
||||
<div class="box_title">
|
||||
<h2>Artikel</h2>
|
||||
</div>
|
||||
<div class="column_content">
|
||||
<table id="order" class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th style="width:13px;"></th>
|
||||
<th style="width:4.5em;">Preis</th>
|
||||
<th style="width:4.5em;">Einheit</th>
|
||||
<th style="width:70px;">Fehlende Einheiten</th>
|
||||
<th id="col_required">Menge</th>
|
||||
<% if not @order.stockit? -%>
|
||||
<th id="col_tolerance">Toleranz</th>
|
||||
<% end %>
|
||||
<th style="width:15px;">Summe</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%-
|
||||
total = 0
|
||||
i = 0
|
||||
@articles_grouped_by_category.each do |category, order_articles|
|
||||
-%>
|
||||
<tr style="background-color:#EFEFEF">
|
||||
<td style="text-align:left"><b><%=h category %></b></td>
|
||||
<td colspan="9"></td>
|
||||
</tr>
|
||||
<%-
|
||||
order_articles.each do |order_article|
|
||||
if Foodsoft.config[:tolerance_is_costly]
|
||||
article_total = @price[i] * (@tolerance[i] + @quantity[i])
|
||||
else
|
||||
article_total = @price[i] * @quantity[i]
|
||||
end
|
||||
total += article_total
|
||||
-%>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %> order-article" valign="top">
|
||||
<td class="name"><%= order_article.article.name %></td>
|
||||
<td><%=h order_article.article.origin %></td>
|
||||
<td><%= number_to_currency(@price[i]) %></td>
|
||||
<td><%= order_article.article.unit %></td>
|
||||
<td>
|
||||
<span id="missing_units_<%= i %>">
|
||||
<%= if @order.stockit?
|
||||
order_article.article.quantity_available
|
||||
else
|
||||
missing_units = @unit[i] - (((@quantity[i] + @others_quantity[i]) % @unit[i]) + @tolerance[i] + @others_tolerance[i])
|
||||
missing_units < 0 ? 0 : missing_units
|
||||
end %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="quantity">
|
||||
<input type="hidden" id="q_<%= i %>" name="<%= "ordered[#{order_article.id}][quantity]" %>" value="<%= @quantity[i] %>" size="2" />
|
||||
<span id="q_used_<%= i %>" class="used"><%= @used_quantity[i] %></span> +
|
||||
<span id="q_unused_<%= i %>" class="unused"><%= @quantity[i] - @used_quantity[i] %></span>
|
||||
<%= button_to_function('+', "increaseQuantity(#{i})") %>
|
||||
<%= button_to_function('-', "decreaseQuantity(#{i})") %>
|
||||
</td>
|
||||
<% if not @order.stockit? -%>
|
||||
<td class="tolerance">
|
||||
<input type="hidden" id="t_<%= i %>" name="<%= "ordered[#{order_article.id}][tolerance]" %>" value="<%= @tolerance[i] %>" size="2" />
|
||||
<% if (@unit[i] > 1) -%>
|
||||
<span id="t_used_<%= i %>" class="used"><%= @used_tolerance[i] %></span> +
|
||||
<span id="t_unused_<%= i %>" class="unused"><%= @tolerance[i] - @used_tolerance[i] %></span>
|
||||
<%= button_to_function('+', "increaseTolerance(#{i})") %>
|
||||
<%= button_to_function('-', "decreaseTolerance(#{i})") %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<% end %>
|
||||
<td id="td_price_<%= i %>" style="text-align:right; padding-right:10px; width:4em"><span id="price_<%= i %>_display"><%= number_to_currency(article_total, :unit => "") %></span> €
|
||||
<div class="article-info">
|
||||
<h3><%= order_article.article.name -%></h3>
|
||||
<div class="right">
|
||||
Volle Gebinde: <span id="units_<%= i %>"><%= order_article.units_to_order %></span><br/>
|
||||
Gesamt-Einheiten: <span id="q_total_<%= i %>"><%= @quantity[i] + @others_quantity[i] %></span><br/>
|
||||
Gesamt-Toleranz: <span id="t_total_<%= i %>"><%= @tolerance[i] + @others_tolerance[i] %></span><br/>
|
||||
</div>
|
||||
<div class="left">
|
||||
Hersteller: <%= order_article.article.manufacturer -%><br />
|
||||
Gebinde: <%= @order.stockit? ? order_article.article.quantity_available : @unit[i] %> * <%=h order_article.article.unit %><br/>
|
||||
Notiz: <%= order_article.article.note -%><br />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%- i = i + 1
|
||||
end
|
||||
end -%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<%= render "order_footer", :total => total %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
// preset data
|
||||
<% if Foodsoft.config[:tolerance_is_costly]
|
||||
for i in 0...@price.size -%>
|
||||
addData(<%= @price[i] %>, <%= @unit[i] %>, <%= @price[i] * (@tolerance[i] + @quantity[i])%>, <%= @others_quantity[i] %>, <%= @others_tolerance[i] %>, <%= @used_quantity[i] %>, 0);
|
||||
<% end
|
||||
else
|
||||
for j in 0...@price.size -%>
|
||||
addData(<%= @price[j] %>, <%= @unit[j] %>, <%= @price[j] * @quantity[j]%>, <%= @others_quantity[j] %>, <%= @others_tolerance[j] %>, <%= @used_quantity[j] %>, 0);
|
||||
<% end
|
||||
end%>
|
||||
setGroupBalance(<%= @availableFunds %>);
|
||||
|
||||
// localization
|
||||
setDecimalSeparator(",");
|
||||
|
||||
// configuration
|
||||
setToleranceBehaviour(<%= Foodsoft.config[:tolerance_is_costly] %>);
|
||||
|
||||
// initialize javascript
|
||||
updateBalance();
|
||||
|
||||
// show article info on row hover
|
||||
<%#*$$('tbody tr').observer('hover', function() {%>
|
||||
|
||||
<%#*});%>
|
||||
//]]>
|
||||
</script>
|
|
@ -14,13 +14,13 @@ var toleranceIsCostly = true; // default tolerance behaviour
|
|||
var price = new Array();
|
||||
var unit = new Array(); // items per order unit
|
||||
var itemTotal = new Array(); // total item price
|
||||
var quantityOthers = new Array();
|
||||
var quantityOthers = new Array();
|
||||
var toleranceOthers = new Array();
|
||||
var itemsAllocated = new Array(); // how many items the group has been allocated and should definitely get
|
||||
var quantityAvailable = new Array(); // stock_order. how many items are currently in stock
|
||||
|
||||
function setDecimalSeparator(character) {
|
||||
decimalSeparator = character;
|
||||
decimalSeparator = character;
|
||||
}
|
||||
|
||||
function setToleranceBehaviour(value) {
|
||||
|
@ -28,147 +28,147 @@ function setToleranceBehaviour(value) {
|
|||
}
|
||||
|
||||
function setGroupBalance(amount) {
|
||||
groupBalance = amount;
|
||||
groupBalance = amount;
|
||||
}
|
||||
|
||||
function addData(itemPrice, itemUnit, itemSubtotal, itemQuantityOthers, itemToleranceOthers, allocated, available) {
|
||||
i = price.length;
|
||||
price[i] = itemPrice;
|
||||
unit[i] = itemUnit;
|
||||
itemTotal[i] = itemSubtotal;
|
||||
quantityOthers[i] = itemQuantityOthers;
|
||||
toleranceOthers[i] = itemToleranceOthers;
|
||||
itemsAllocated[i] = allocated;
|
||||
quantityAvailable[i] = available;
|
||||
i = price.length;
|
||||
price[i] = itemPrice;
|
||||
unit[i] = itemUnit;
|
||||
itemTotal[i] = itemSubtotal;
|
||||
quantityOthers[i] = itemQuantityOthers;
|
||||
toleranceOthers[i] = itemToleranceOthers;
|
||||
itemsAllocated[i] = allocated;
|
||||
quantityAvailable[i] = available;
|
||||
}
|
||||
|
||||
function increaseQuantity(item) {
|
||||
value = Number($('q_' + item).value) + 1;
|
||||
update(item, value, $('t_' + item).value);
|
||||
value = Number($('#q_' + item).val()) + 1;
|
||||
update(item, value, $('#t_' + item).val());
|
||||
}
|
||||
|
||||
function decreaseQuantity(item) {
|
||||
value = Number($('q_' + item).value) - 1;
|
||||
value = Number($('#q_' + item).val()) - 1;
|
||||
if (value >= 0) {
|
||||
update(item, value, $('t_' + item).value);
|
||||
update(item, value, $('#t_' + item).val());
|
||||
}
|
||||
}
|
||||
|
||||
function increaseTolerance(item) {
|
||||
value = Number($('t_' + item).value) + 1;
|
||||
update(item, $('q_' + item).value, value);
|
||||
value = Number($('#t_' + item).val()) + 1;
|
||||
update(item, $('#q_' + item).val(), value);
|
||||
}
|
||||
|
||||
function decreaseTolerance(item) {
|
||||
value = Number($('t_' + item).value) - 1;
|
||||
value = Number($('#t_' + item).val()) - 1;
|
||||
if (value >= 0) {
|
||||
update(item, $('q_' + item).value, value);
|
||||
update(item, $('#q_' + item).val(), value);
|
||||
}
|
||||
}
|
||||
|
||||
function update(item, quantity, tolerance) {
|
||||
// set modification flag
|
||||
modified = true
|
||||
|
||||
// update hidden input fields
|
||||
$('q_' + item).value = quantity;
|
||||
$('t_' + item).value = tolerance;
|
||||
|
||||
// calculate how many units would be ordered in total
|
||||
units = calcUnits(unit[item], quantityOthers[item] + Number(quantity), toleranceOthers[item] + Number(tolerance));
|
||||
if (unitCompletedFromTolerance(unit[item], quantityOthers[item] + Number(quantity), toleranceOthers[item] + Number(tolerance))) {
|
||||
$('units_' + item).update('<span style="color:grey">' + String(units) + "</span>");
|
||||
} else {
|
||||
$('units_' + item).update(String(units));
|
||||
}
|
||||
|
||||
// update used/unused quantity
|
||||
available = Math.max(0, units * unit[item] - quantityOthers[item]);
|
||||
q_used = Math.min(available, quantity);
|
||||
// ensure that at least the amout of items this group has already been allocated is used
|
||||
if (quantity >= itemsAllocated[item] && q_used < itemsAllocated[item]) {
|
||||
q_used = itemsAllocated[item];
|
||||
}
|
||||
$('q_used_' + item).update(String(q_used));
|
||||
$('q_unused_' + item).update(String(quantity - q_used));
|
||||
$('q_total_' + item).update(String(Number(quantity) + quantityOthers[item]));
|
||||
|
||||
// update used/unused tolerance
|
||||
if (unit[item] > 1) {
|
||||
available = Math.max(0, available - q_used - toleranceOthers[item]);
|
||||
t_used = Math.min(available, tolerance);
|
||||
$('t_used_' + item).update(String(t_used));
|
||||
$('t_unused_' + item).update(String(tolerance - t_used));
|
||||
$('t_total_' + item).update(String(Number(tolerance) + toleranceOthers[item]));
|
||||
}
|
||||
|
||||
// update total price
|
||||
// set modification flag
|
||||
modified = true
|
||||
|
||||
// update hidden input fields
|
||||
$('#q_' + item).val(quantity);
|
||||
$('#t_' + item).val(tolerance);
|
||||
|
||||
// calculate how many units would be ordered in total
|
||||
units = calcUnits(unit[item], quantityOthers[item] + Number(quantity), toleranceOthers[item] + Number(tolerance));
|
||||
if (unitCompletedFromTolerance(unit[item], quantityOthers[item] + Number(quantity), toleranceOthers[item] + Number(tolerance))) {
|
||||
$('#units_' + item).html('<span style="color:grey">' + String(units) + "</span>");
|
||||
} else {
|
||||
$('#units_' + item).html(String(units));
|
||||
}
|
||||
|
||||
// update used/unused quantity
|
||||
available = Math.max(0, units * unit[item] - quantityOthers[item]);
|
||||
q_used = Math.min(available, quantity);
|
||||
// ensure that at least the amout of items this group has already been allocated is used
|
||||
if (quantity >= itemsAllocated[item] && q_used < itemsAllocated[item]) {
|
||||
q_used = itemsAllocated[item];
|
||||
}
|
||||
$('#q_used_' + item).html(String(q_used));
|
||||
$('#q_unused_' + item).html(String(quantity - q_used));
|
||||
$('#q_total_' + item).html(String(Number(quantity) + quantityOthers[item]));
|
||||
|
||||
// update used/unused tolerance
|
||||
if (unit[item] > 1) {
|
||||
available = Math.max(0, available - q_used - toleranceOthers[item]);
|
||||
t_used = Math.min(available, tolerance);
|
||||
$('#t_used_' + item).html(String(t_used));
|
||||
$('#t_unused_' + item).html(String(tolerance - t_used));
|
||||
$('#t_total_' + item).html(String(Number(tolerance) + toleranceOthers[item]));
|
||||
}
|
||||
|
||||
// update total price
|
||||
if(toleranceIsCostly == true) {
|
||||
itemTotal[item] = price[item] * (Number(quantity) + Number(tolerance));
|
||||
} else {
|
||||
itemTotal[item] = price[item] * (Number(quantity));
|
||||
}
|
||||
$('price_' + item + '_display').update(asMoney(itemTotal[item]));
|
||||
$('#price_' + item + '_display').html(asMoney(itemTotal[item]));
|
||||
|
||||
// update missing units
|
||||
missing_units = unit[item] - (((quantityOthers[item] + Number(quantity)) % unit[item]) + Number(tolerance) + toleranceOthers[item])
|
||||
if (missing_units < 0) {
|
||||
missing_units = 0;
|
||||
}
|
||||
$('#missing_units_' + item).html(String(missing_units));
|
||||
|
||||
// update missing units
|
||||
missing_units = unit[item] - (((quantityOthers[item] + Number(quantity)) % unit[item]) + Number(tolerance) + toleranceOthers[item])
|
||||
if (missing_units < 0) {
|
||||
missing_units = 0;
|
||||
}
|
||||
$('missing_units_' + item).update(String(missing_units));
|
||||
|
||||
// update balance
|
||||
updateBalance();
|
||||
}
|
||||
}
|
||||
|
||||
function increaseStockQuantity(item) {
|
||||
value = Number($('q_' + item).value) + 1;
|
||||
value = Number($('#q_' + item).val()) + 1;
|
||||
if (value <= quantityAvailable[item] - quantityOthers[item]) {
|
||||
updateStockQuantity(item, value);
|
||||
}
|
||||
}
|
||||
|
||||
function decreaseStockQuantity(item) {
|
||||
value = Number($('q_' + item).value) - 1;
|
||||
value = Number($('#q_' + item).val()) - 1;
|
||||
if (value >= 0) {
|
||||
updateStockQuantity(item, value);
|
||||
}
|
||||
}
|
||||
|
||||
function updateStockQuantity(item, quantity) {
|
||||
// set modification flag
|
||||
modified = true
|
||||
// set modification flag
|
||||
modified = true
|
||||
|
||||
// update hidden input fields
|
||||
$('q_' + item).value = quantity;
|
||||
// update hidden input fields
|
||||
$('#q_' + item).val() = quantity;
|
||||
|
||||
// update used/unused quantity
|
||||
available = Math.max(0, quantityAvailable[item] - quantityOthers[item]);
|
||||
q_used = Math.min(available, quantity);
|
||||
// update used/unused quantity
|
||||
available = Math.max(0, quantityAvailable[item] - quantityOthers[item]);
|
||||
q_used = Math.min(available, quantity);
|
||||
|
||||
// ensure that at least the amout of items this group has already been allocated is used
|
||||
if (quantity >= itemsAllocated[item] && q_used < itemsAllocated[item]) {
|
||||
q_used = itemsAllocated[item];
|
||||
}
|
||||
$('q_used_' + item).update(String(q_used));
|
||||
$('q_total_' + item).update(String(Number(quantity) + quantityOthers[item]));
|
||||
// ensure that at least the amout of items this group has already been allocated is used
|
||||
if (quantity >= itemsAllocated[item] && q_used < itemsAllocated[item]) {
|
||||
q_used = itemsAllocated[item];
|
||||
}
|
||||
$('#q_used_' + item).html(String(q_used));
|
||||
$('#q_total_' + item).html(String(Number(quantity) + quantityOthers[item]));
|
||||
|
||||
// update total price
|
||||
itemTotal[item] = price[item] * (Number(quantity));
|
||||
$('price_' + item + '_display').update(asMoney(itemTotal[item]));
|
||||
// update total price
|
||||
itemTotal[item] = price[item] * (Number(quantity));
|
||||
$('#price_' + item + '_display').html(asMoney(itemTotal[item]));
|
||||
|
||||
// update balance
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
function asMoney(amount) {
|
||||
return String(amount.toFixed(2)).replace(/\./, ",");
|
||||
return String(amount.toFixed(2)).replace(/\./, ",");
|
||||
}
|
||||
|
||||
function calcUnits(unitSize, quantity, tolerance) {
|
||||
units = Math.floor(quantity / unitSize)
|
||||
remainder = quantity % unitSize
|
||||
return units + ((remainder > 0) && (remainder + tolerance >= unitSize) ? 1 : 0)
|
||||
return units + ((remainder > 0) && (remainder + tolerance >= unitSize) ? 1 : 0)
|
||||
}
|
||||
|
||||
function unitCompletedFromTolerance(unitSize, quantity, tolerance) {
|
||||
|
@ -181,25 +181,25 @@ function updateBalance() {
|
|||
total = 0;
|
||||
for (i = 0; i < itemTotal.length; i++) {
|
||||
total += itemTotal[i];
|
||||
}
|
||||
$('total_price').update(asMoney(total));
|
||||
}
|
||||
$('#total_price').html(asMoney(total));
|
||||
balance = groupBalance - total;
|
||||
$('new_balance').update(asMoney(balance));
|
||||
$('total_balance').value = asMoney(balance);
|
||||
$('#new_balance').html(asMoney(balance));
|
||||
$('#total_balance').val(asMoney(balance));
|
||||
// determine bgcolor and submit button state according to balance
|
||||
if (balance < 0) {
|
||||
bgcolor = '#FF0000';
|
||||
$('submit_button').disabled = true;
|
||||
$('#submit_button').disabled = true;
|
||||
} else {
|
||||
bgcolor = '';
|
||||
$('submit_button').disabled = false;
|
||||
$('#submit_button').disabled = false;
|
||||
}
|
||||
// update bgcolor
|
||||
for (i = 0; i < itemTotal.length; i++) {
|
||||
$('td_price_' + i).style.backgroundColor = bgcolor;
|
||||
}
|
||||
}
|
||||
$('#ltd_price_' + i).css('background-color', bgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
function confirmSwitchOrder() {
|
||||
return (!modified || confirm('Änderungen an dieser Bestellung gehen verloren, wenn zu einer anderen Bestellung gewechselt wird.'))
|
||||
return (!modified || confirm('Änderungen an dieser Bestellung gehen verloren, wenn zu einer anderen Bestellung gewechselt wird.'))
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* General rules ... */
|
||||
body {
|
||||
background-color: white;
|
||||
color: black;
|
||||
|
@ -81,6 +80,12 @@ option {
|
|||
span.click-me {
|
||||
cursor: pointer; }
|
||||
|
||||
.left {
|
||||
float: left; }
|
||||
|
||||
.right {
|
||||
float: right; }
|
||||
|
||||
.clear {
|
||||
clear: both; }
|
||||
|
||||
|
@ -88,6 +93,9 @@ span.click-me {
|
|||
color: grey;
|
||||
font-size: 0.9em; }
|
||||
|
||||
.hidden {
|
||||
display: none; }
|
||||
|
||||
#login {
|
||||
margin: auto;
|
||||
width: 27em;
|
||||
|
@ -239,6 +247,12 @@ table {
|
|||
background-color: #ffffc2; }
|
||||
table tr.click-me {
|
||||
cursor: pointer; }
|
||||
table tr.ignored {
|
||||
color: grey; }
|
||||
table tr.success {
|
||||
color: green; }
|
||||
table tr.failed {
|
||||
color: red; }
|
||||
|
||||
table.list tr {
|
||||
border: 1px solid #e3e3e3; }
|
||||
|
@ -378,28 +392,78 @@ span.total {
|
|||
table#order {
|
||||
text-align: center; }
|
||||
table#order input {
|
||||
font-size: 80%; }
|
||||
font-size: 0.9em;
|
||||
font-weight: bolder;
|
||||
background-color: #78b74e;
|
||||
color: white;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
padding: 0; }
|
||||
table#order th#col_required, table#order th#col_tolerance {
|
||||
width: 145px; }
|
||||
width: 140px; }
|
||||
table#order th#col_packages, table#order th#col_left_units {
|
||||
width: 50px; }
|
||||
table#order td.quantity, table#order td.tolerance {
|
||||
text-align: right; }
|
||||
table#order td#col_left_units {
|
||||
color: #ed0606; }
|
||||
table#order td {
|
||||
padding: 0.6em; }
|
||||
table#order td.name, table#order tr.note td {
|
||||
table#order td.name {
|
||||
text-align: left;
|
||||
padding-left: 10px; }
|
||||
table#order tfoot tr {
|
||||
background-color: #e4eed6; }
|
||||
table#order tfoot td {
|
||||
padding-right: 10px; }
|
||||
table#order tr.note {
|
||||
background-color: #fbfbfb;
|
||||
font-size: 0.9em;
|
||||
border-bottom: 1px solid #dddddd; }
|
||||
table#order tr.note td {
|
||||
padding-left: 20px; }
|
||||
|
||||
#order-footer, .article-info {
|
||||
text-align: left;
|
||||
z-index: 1;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
background-color: #e4eed6;
|
||||
border-top: 2px solid #78b74e; }
|
||||
#order-footer #total-sum, .article-info #total-sum {
|
||||
width: 22em;
|
||||
margin: 0.5em 2em 0 0;
|
||||
float: right; }
|
||||
#order-footer #total-sum #order-button, .article-info #total-sum #order-button {
|
||||
margin: 0.5em 0; }
|
||||
#order-footer #total-sum #order-button input, .article-info #total-sum #order-button input {
|
||||
background-color: #78b74e;
|
||||
color: white;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px; }
|
||||
#order-footer #total-sum #order-button input:disabled, .article-info #total-sum #order-button input:disabled {
|
||||
background-color: red; }
|
||||
|
||||
#order-footer {
|
||||
width: 100%;
|
||||
right: 0;
|
||||
left: 0; }
|
||||
|
||||
.article-info {
|
||||
z-index: 2;
|
||||
width: 45em;
|
||||
height: 8em;
|
||||
border: none;
|
||||
left: 30px; }
|
||||
.article-info h3 {
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
margin-bottom: 5px;
|
||||
width: 100%; }
|
||||
.article-info .right {
|
||||
width: 35%; }
|
||||
.article-info .left {
|
||||
width: 60%; }
|
||||
|
||||
tr.order-article .article-info {
|
||||
display: none; }
|
||||
|
||||
tr.order-article:hover .article-info {
|
||||
display: block; }
|
||||
|
||||
#newComment {
|
||||
margin: 1em; }
|
||||
|
@ -451,24 +515,25 @@ ul.autocomplete .informal {
|
|||
text-align: center;
|
||||
margin: 0 10px 10px 0; }
|
||||
|
||||
#wiki_content {
|
||||
border-style: none;
|
||||
color: black;
|
||||
line-height: 1.5em; }
|
||||
|
||||
.wiki_show, .wiki_version, .wiki_new, .wiki_edit, .wiki_all {
|
||||
margin-top: 30px;
|
||||
padding: 10px; }
|
||||
.wiki_show h1, .wiki_version h1, .wiki_new h1, .wiki_edit h1, .wiki_all h1 {
|
||||
padding-left: 0;
|
||||
padding-top: 10px;
|
||||
border-bottom-style: solid; }
|
||||
.wiki_show .column_content, .wiki_version .column_content, .wiki_new .column_content, .wiki_edit .column_content, .wiki_all .column_content {
|
||||
margin-bottom: 0; }
|
||||
|
||||
#wiki_content {
|
||||
border: 1px solid grey;
|
||||
margin-right: 300px;
|
||||
padding: 10px;
|
||||
color: black;
|
||||
line-height: 1.5em;
|
||||
min-height: 400px; }
|
||||
#wiki_content span.editsection {
|
||||
display: none; }
|
||||
#wiki_content h1 {
|
||||
padding-left: 0;
|
||||
padding-top: 10px;
|
||||
border: none;
|
||||
margin-bottom: 10px; }
|
||||
#wiki_content h2, #wiki_content h3, #wiki_content h4, #wiki_content h5, #wiki_content h6 {
|
||||
background: transparent none repeat scroll 0 0;
|
||||
border-bottom: 1px solid #aaaaaa;
|
||||
|
@ -529,7 +594,8 @@ a.new_wiki_link {
|
|||
|
||||
#sidebar {
|
||||
float: right;
|
||||
width: 290px; }
|
||||
width: 290px;
|
||||
margin-top: -60px; }
|
||||
#sidebar #sidebar-links {
|
||||
margin-bottom: 18px;
|
||||
text-align: right; }
|
||||
|
|
|
@ -6,7 +6,7 @@ $lightGrey: #efefef
|
|||
$darkGreen: #78b74e
|
||||
$lightGreen: #e4eed6
|
||||
|
||||
/* General rules ... */
|
||||
// General rules ...
|
||||
body
|
||||
:background-color #fff
|
||||
:color black
|
||||
|
@ -26,17 +26,17 @@ body
|
|||
:border
|
||||
:width 2px
|
||||
:style solid
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
|
||||
a, a:visited
|
||||
:text-decoration underline
|
||||
:color black
|
||||
|
||||
a:hover
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
|
||||
h1, h2
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
|
||||
h1
|
||||
:font-size 2.2em
|
||||
|
@ -46,7 +46,7 @@ h1
|
|||
:border-bottom
|
||||
:width 1px
|
||||
:style dotted
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
|
||||
h2
|
||||
:font-size 1.4em
|
||||
|
@ -90,14 +90,20 @@ option
|
|||
|
||||
span.click-me
|
||||
cursor: pointer
|
||||
|
||||
.left
|
||||
float: left
|
||||
.right
|
||||
float: right
|
||||
.clear
|
||||
clear: both
|
||||
|
||||
.description
|
||||
color: grey
|
||||
font-size: 0.9em
|
||||
|
||||
|
||||
.hidden
|
||||
display: none
|
||||
|
||||
// ********************************* loginpage
|
||||
#login
|
||||
:margin auto
|
||||
|
@ -118,7 +124,7 @@ span.click-me
|
|||
|
||||
|
||||
#logo
|
||||
:background $main_red
|
||||
background: $main_red
|
||||
:height 1.1em
|
||||
:width 8em
|
||||
:padding 0 20px
|
||||
|
@ -130,17 +136,17 @@ span.click-me
|
|||
:margin 0
|
||||
a, a:hover
|
||||
:color white
|
||||
:background-color $main_red
|
||||
background-color: $main_red
|
||||
:text-decoration none
|
||||
a span
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
:background #FFF
|
||||
:padding-right 0.1em
|
||||
:font-weight bold
|
||||
:border-top
|
||||
:width 2px
|
||||
:style dotted
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
|
||||
#logininfo
|
||||
:position absolute
|
||||
|
@ -156,7 +162,7 @@ span.click-me
|
|||
:color #737272
|
||||
:font-weight bold
|
||||
a:hover
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
|
||||
// ************************************* box structure
|
||||
#main
|
||||
|
@ -264,6 +270,12 @@ table
|
|||
:background-color #ffffc2
|
||||
tr.click-me
|
||||
:cursor pointer
|
||||
tr.ignored
|
||||
color: grey
|
||||
tr.success
|
||||
color: green
|
||||
tr.failed
|
||||
color: red
|
||||
|
||||
table.list
|
||||
//:border 2px solid #78b74e
|
||||
|
@ -278,7 +290,7 @@ table tfoot tr
|
|||
:padding-top 0.8em
|
||||
|
||||
tr.edit_inline
|
||||
:background-color $hover_yellow
|
||||
background-color: $hover_yellow
|
||||
td, span
|
||||
:padding 0.5em 0.2em
|
||||
|
||||
|
@ -314,7 +326,7 @@ td.closed
|
|||
td.open
|
||||
background: url(/images/arrow_down_red.png) no-repeat center left
|
||||
|
||||
// ************************************* for edit formulars */
|
||||
// ************************************* for edit formulars
|
||||
div.edit_form
|
||||
:border 2px solid #e3e3e3
|
||||
:background #f5f5f5
|
||||
|
@ -333,7 +345,7 @@ div.edit_form
|
|||
:border
|
||||
:width 3px
|
||||
:style solid
|
||||
:color $main_red
|
||||
color: $main_red
|
||||
|
||||
// ***************************************** other boxes */
|
||||
|
||||
|
@ -372,7 +384,7 @@ div.box_title
|
|||
:font-size 1.3em
|
||||
|
||||
div.column_content
|
||||
:background $boxContent
|
||||
background: $boxContent
|
||||
:color black
|
||||
:padding 10px
|
||||
margin-bottom: 2em
|
||||
|
@ -419,30 +431,76 @@ span.total
|
|||
table#order
|
||||
:text-align center
|
||||
input
|
||||
:font-size 80%
|
||||
font-size: 0.9em
|
||||
font-weight: bolder
|
||||
background-color: #78B74E
|
||||
color: #fff
|
||||
-moz-border-radius: 3px
|
||||
-webkit-border-radius: 3px
|
||||
padding: 0
|
||||
th#col_required, th#col_tolerance
|
||||
:width 145px
|
||||
:width 140px
|
||||
th#col_packages, th#col_left_units
|
||||
:width 50px
|
||||
:width 50px
|
||||
td.quantity, td.tolerance
|
||||
text-align: right
|
||||
td#col_left_units
|
||||
:color #ed0606
|
||||
td
|
||||
:padding 0.6em
|
||||
td.name, tr.note td
|
||||
td.name
|
||||
:text-align left
|
||||
:padding-left 10px
|
||||
tfoot
|
||||
tr
|
||||
:background-color $lightGreen
|
||||
background-color: $lightGreen
|
||||
td
|
||||
:padding-right 10px
|
||||
tr.note
|
||||
:background-color #FBFBFB
|
||||
:font-size 0.9em
|
||||
:border-bottom 1px solid #DDDDDD
|
||||
td
|
||||
:padding-left 20px
|
||||
|
||||
#order-footer, .article-info
|
||||
text-align: left
|
||||
z-index: 1
|
||||
position: fixed
|
||||
bottom: 0
|
||||
background-color: #E4EED6
|
||||
border-top: 2px solid #78B74E
|
||||
//opacity: 0.95
|
||||
#total-sum
|
||||
width: 22em
|
||||
margin: .5em 2em 0 0
|
||||
float: right
|
||||
#order-button
|
||||
margin: .5em 0
|
||||
input
|
||||
background-color: #78B74E
|
||||
color: #fff
|
||||
-moz-border-radius: 3px
|
||||
-webkit-border-radius: 3px
|
||||
input:disabled
|
||||
background-color: red
|
||||
#order-footer
|
||||
width: 100%
|
||||
right: 0
|
||||
left: 0
|
||||
.article-info
|
||||
z-index: 2
|
||||
width: 45em
|
||||
height: 8em
|
||||
border: none
|
||||
left: 30px
|
||||
h3
|
||||
text-align: center
|
||||
margin: 0
|
||||
margin-bottom: 5px
|
||||
width: 100%
|
||||
.right
|
||||
width: 35%
|
||||
.left
|
||||
width: 60%
|
||||
tr.order-article .article-info
|
||||
display: none
|
||||
tr.order-article:hover .article-info
|
||||
display: block
|
||||
|
||||
// ********* Comments
|
||||
#newComment
|
||||
:margin 1em
|
||||
|
@ -498,27 +556,28 @@ ul.autocomplete
|
|||
background-color: #fff
|
||||
text-align: center
|
||||
margin: 0 10px 10px 0
|
||||
|
||||
|
||||
// *** wiki
|
||||
#wiki_content
|
||||
border-style: none
|
||||
color: black
|
||||
line-height: 1.5em
|
||||
|
||||
.wiki_show, .wiki_version, .wiki_new, .wiki_edit, .wiki_all
|
||||
margin-top: 30px
|
||||
padding: 10px
|
||||
.column_content
|
||||
|
||||
#wiki_content
|
||||
border: 1px solid grey
|
||||
margin-right: 300px
|
||||
padding: 10px
|
||||
color: black
|
||||
line-height: 1.5em
|
||||
min-height: 400px
|
||||
span.editsection
|
||||
display: none
|
||||
h1
|
||||
padding-left: 0
|
||||
padding-top: 10px
|
||||
border: none
|
||||
margin-bottom: 10px
|
||||
border-bottom:
|
||||
:style solid
|
||||
.column_content
|
||||
margin-bottom: 0
|
||||
|
||||
#wiki_content
|
||||
min-height: 400px
|
||||
span.editsection
|
||||
display: none
|
||||
h2, h3, h4, h5, h6
|
||||
background: transparent none repeat scroll 0 0
|
||||
border-bottom: 1px solid #AAAAAA
|
||||
|
@ -570,13 +629,14 @@ a.new_wiki_link
|
|||
height: 1em
|
||||
color: #ED0606
|
||||
a
|
||||
:color $main_red
|
||||
:text-decoration none
|
||||
color: $main_red
|
||||
text-decoration: none
|
||||
a:hover
|
||||
:text-decoration underline
|
||||
text-decoration: underline
|
||||
#sidebar
|
||||
float: right
|
||||
width: 290px
|
||||
margin-top: -60px
|
||||
#sidebar-links
|
||||
margin-bottom: 18px
|
||||
text-align: right
|
||||
|
|
Loading…
Reference in a new issue