Merge branch 'orderfooter'

This commit is contained in:
Benjamin Meichsner 2010-02-09 21:07:12 +01:00
commit 48ee593d8d
9 changed files with 307 additions and 172 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ config/environments/development.rb
capfile capfile
config/environments/fcschinke09.rb config/environments/fcschinke09.rb
*.swp *.swp
public/**/*_cached.*

View file

@ -3,16 +3,12 @@
%head %head
%meta{"http-equiv" => "content-type", :content => "text/html;charset=UTF-8"} %meta{"http-equiv" => "content-type", :content => "text/html;charset=UTF-8"}
%title= "FoodSoft - " + (yield(:title) or controller.controller_name) %title= "FoodSoft - " + (yield(:title) or controller.controller_name)
= stylesheet_link_tag 'foodsoft' = stylesheet_link_tag 'main', 'rails_messages', 'nav', :cache => "all_cached"
= stylesheet_link_tag "print", :media => "print" = stylesheet_link_tag "print", :media => "print"
<!--[if lte IE 7]> <!--[if lte IE 7]>
= stylesheet_link_tag 'ie_hacks' = stylesheet_link_tag 'ie_hacks'
<![endif]--> <![endif]-->
= javascript_include_tag 'prototype' = javascript_include_tag 'prototype', 'effects', 'controls', 'application', 'ordering', :cache => "all_cached"
= javascript_include_tag 'effects'
= javascript_include_tag 'controls'
= javascript_include_tag 'application'
= javascript_include_tag('ordering') if (controller.controller_name == "ordering")
= yield(:head) = yield(:head)
%body %body
#logininfo= render :partial => 'shared/loginInfo' #logininfo= render :partial => 'shared/loginInfo'

View file

@ -1,7 +1,7 @@
<%= render :partial => 'order_head' %> <%= render :partial => 'order_head' %>
<div class="single_column" style="clear:both;"> <% form_tag(:action => 'saveOrder', :id => @order) do %>
<% form_tag(:action => 'saveOrder', :id => @order) do %> <div class="single_column" style="clear:both;margin-bottom:7em;">
<div class="box_title"> <div class="box_title">
<h2>Artikel</h2> <h2>Artikel</h2>
</div> </div>
@ -10,124 +10,140 @@
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th></th> <th style="width:13px;"></th>
<th>Herstellerin</th>
<th style="width:7em;">Gebinde</th>
<th style="width:4.5em;">Preis</th> <th style="width:4.5em;">Preis</th>
<th id="col_packages"><acronym title="insgesamt bestellte Gebinde">Best</acronym></th> <th style="width:7em;">Fehlende Einheiten</th>
<th id="col_required">Menge</th> <th id="col_required">Menge</th>
<th id="col_tolerance">Toleranz</th> <% if not @order.stockit? -%>
<th>Summe</th> <th id="col_tolerance">Toleranz</th>
<% end %>
<th style="width:15px;">Summe</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<%- <%-
total = 0 total = 0
i = 0 i = 0
@articles_grouped_by_category.each do |category, order_articles| @articles_grouped_by_category.each do |category, order_articles|
-%> -%>
<tr style="background-color:#EFEFEF"> <tr style="background-color:#EFEFEF">
<td style="text-align:left"><b><%=h category %></b></td> <td style="text-align:left"><b><%=h category %></b></td>
<td colspan="9"></td> <td colspan="9"></td>
</tr> </tr>
<%- <%-
order_articles.each do |order_article| order_articles.each do |order_article|
if Foodsoft.config[:tolerance_is_costly] if Foodsoft.config[:tolerance_is_costly]
article_total = @price[i] * (@tolerance[i] + @quantity[i]) 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><span id="missing_units_<%= i %>"><%= if @order.stockit?
order_article.article.quantity_available
else else
article_total = @price[i] * @quantity[i] missing_units = @unit[i] - (((@quantity[i] + @others_quantity[i]) % @unit[i]) + @tolerance[i] + @others_tolerance[i])
end missing_units < 0 ? 0 : missing_units
total += article_total end%></span></td>
-%> <td class="quantity">
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top">
<td class="name">
<% unless order_article.article.note.blank? %>
<%= order_article.article.name %> <%= image_tag "lamp_grey.png", {:alt => "Notiz zeigen", :size => "15x16", :border => "0", :onmouseover => "$('note_#{i}').show();", :onmouseout => "$('note_#{i}').hide();" }%>
<% else %>
<%= order_article.article.name %>
<% end %>
</td>
<td><%=h order_article.article.origin %></td>
<td><%=h truncate order_article.article.manufacturer, :length => 11 %></td>
<td><%= @order.stockit? ? order_article.article.quantity_available : @unit[i] %> * <%=h order_article.article.unit %></td>
<td><%= number_to_currency(@price[i]) %></td>
<td id="units_<%= i %>"><%= order_article.units_to_order %></td>
<td style="text-align:right;">
<input type="hidden" id="q_<%= i %>" name="<%= "ordered[#{order_article.id}][quantity]" %>" value="<%= @quantity[i] %>" size="2" /> <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_used_<%= i %>" class="used"><%= @used_quantity[i] %></span> +
<span id="q_unused_<%= i %>" class="unused"><%= @quantity[i] - @used_quantity[i] %></span> <span id="q_unused_<%= i %>" class="unused"><%= @quantity[i] - @used_quantity[i] %></span>
<span class="total">(<span id="q_total_<%= i %>"><%= @quantity[i] + @others_quantity[i] %></span>)</span>
<%= button_to_function('+', "increaseQuantity(#{i})") %> <%= button_to_function('+', "increaseQuantity(#{i})") %>
<%= button_to_function('-', "decreaseQuantity(#{i})") %> <%= button_to_function('-', "decreaseQuantity(#{i})") %>
</td> </td>
<td style="text-align:right;"> <% if not @order.stockit? -%>
<input type="hidden" id="t_<%= i %>" name="<%= "ordered[#{order_article.id}][tolerance]" %>" value="<%= @tolerance[i] %>" size="2" /> <td class="tolerance">
<% if (@unit[i] > 1) -%> <input type="hidden" id="t_<%= i %>" name="<%= "ordered[#{order_article.id}][tolerance]" %>" value="<%= @tolerance[i] %>" size="2" />
<span id="t_used_<%= i %>" class="used"><%= @used_tolerance[i] %></span> + <% if (@unit[i] > 1) -%>
<span id="t_unused_<%= i %>" class="unused"><%= @tolerance[i] - @used_tolerance[i] %></span> <span id="t_used_<%= i %>" class="used"><%= @used_tolerance[i] %></span> +
<span class="total">(<span id="t_total_<%= i %>"><%= @tolerance[i] + @others_tolerance[i] %></span>)</span> <span id="t_unused_<%= i %>" class="unused"><%= @tolerance[i] - @used_tolerance[i] %></span>
<%= button_to_function('+', "increaseTolerance(#{i})") %> <%= button_to_function('+', "increaseTolerance(#{i})") %>
<%= button_to_function('-', "decreaseTolerance(#{i})") %> <%= button_to_function('-', "decreaseTolerance(#{i})") %>
<% end -%> <% end -%>
</td> </td>
<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> €</td> <% end %>
</tr> <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> €
<% unless order_article.article.note.blank? -%> <div class="article-info">
<tr id="note_<%= i %>" class="note" style="display:none"> <h3><%= order_article.article.name -%></h3>
<td colspan="10"><%=h order_article.article.note %> | <%=h order_article.article.manufacturer %></td> <div class="right">
</tr> Volle Gebinde: <span id="units_<%= i %>"><%= order_article.units_to_order %></span><br/>
<% end -%> Gesamt-Einheiten: <span id="q_total_<%= i %>"><%= @quantity[i] + @others_quantity[i] %></span><br/>
<%- i = i + 1 Gesamt-Toleranz: <span id="t_total_<%= i %>"><%= @tolerance[i] + @others_tolerance[i] %></span><br/>
end </div>
end -%> <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> </tbody>
<tfoot>
<tr>
<td colspan="6"></td>
<td colspan="3" class="currency">Gesamtbetrag: <span id="total_price"><%= total %></span> €</td>
</tr>
<tr>
<td colspan="6"></td>
<td colspan="3" class="currency">Verfügbares Guthaben: <%= number_to_currency(@availableFunds) %></td>
</tr>
<tr>
<td colspan="6"></td>
<td colspan="3" class="currency">Neuer Kontostand: <strong><span id="new_balance"><%= @ordergroup.account_balance - total %></span> €</strong></td>
</tr>
<tr>
<td style="text-align:left;"><%= link_to_top %></td>
<td colspan="5"></td>
<td colspan="3" style="text-align:right;"><span style="font-size:1.2em"><%= submit_tag( "Bestellung speichern", :id => 'submit_button' ) %></span> | <%= link_to "Abbrechen", :controller => 'ordering' %></td>
</tr>
</tfoot>
</table> </table>
</div> </div>
<input type="hidden" id="total_balance" name="total_balance" value="<%= @ordergroup.account_balance - total %>"/> </div>
<input type="hidden" name="version" value="<%= @version %>"/> <div id="order-footer">
<% end %> <div id="info-box">
</div> </div>
<div id="total-sum">
<table>
<tr>
<td>Gesamtbetrag:</td>
<td class="currency"><span id="total_price"><%= total %></span> €</td>
</tr>
<tr>
<td>Verfügbares Guthaben:</td>
<td class="currency"><%= number_to_currency(@availableFunds) %></td>
</tr>
<tr>
<td>Neuer Kontostand:</td>
<td class="currency"><strong><span id="new_balance"><%= @ordergroup.account_balance - total %></span> €</strong></td>
</tr>
</table>
<div id="order-button">
<%= submit_tag( "Bestellung speichern", :id => 'submit_button' ) %></span> oder <%= link_to "abbrechen", :controller => 'ordering' %>
</div>
</div>
</div>
<input type="hidden" id="total_balance" name="total_balance" value="<%= @ordergroup.account_balance - total %>"/>
<input type="hidden" name="version" value="<%= @version %>"/>
<% end %>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
// preset data // preset data
<% if Foodsoft.config[:tolerance_is_costly] <% if Foodsoft.config[:tolerance_is_costly]
for i in 0...@price.size -%> 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); addData(<%= @price[i] %>, <%= @unit[i] %>, <%= @price[i] * (@tolerance[i] + @quantity[i])%>, <%= @others_quantity[i] %>, <%= @others_tolerance[i] %>, <%= @used_quantity[i] %>, 0);
<% end <% end
else else
for j in 0...@price.size -%> 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); addData(<%= @price[j] %>, <%= @unit[j] %>, <%= @price[j] * @quantity[j]%>, <%= @others_quantity[j] %>, <%= @others_tolerance[j] %>, <%= @used_quantity[j] %>, 0);
<% end <% end
end%> end%>
setGroupBalance(<%= @availableFunds %>); setGroupBalance(<%= @availableFunds %>);
// localization // localization
setDecimalSeparator(","); setDecimalSeparator(",");
// configuration // configuration
setToleranceBehaviour(<%= Foodsoft.config[:tolerance_is_costly] %>); setToleranceBehaviour(<%= Foodsoft.config[:tolerance_is_costly] %>);
// initialize javascript // initialize javascript
updateBalance(); updateBalance();
//]]>
// show article info on row hover
<%#*$$('tbody tr').observer('hover', function() {%>
<%#*});%>
//]]>
</script> </script>

View file

@ -1,28 +0,0 @@
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_view.debug_rjs = true
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Configure an SMTP server for email sending in development mode:
# (cf. http://rails.rubyonrails.com/classes/ActionMailer/Base.html for info on options)
config.action_mailer.smtp_settings = {
:address => "smtp.gmx.net",
:port => 25,
:domain => "gmx.net",
:authentication => :login,
:user_name => "benjamin.meichsner@gmx.de",
:password => "ben234go"
}

View file

@ -110,6 +110,13 @@ function update(item, quantity, tolerance) {
} }
$('price_' + item + '_display').update(asMoney(itemTotal[item])); $('price_' + item + '_display').update(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).update(String(missing_units));
// update balance // update balance
updateBalance(); updateBalance();
} }

View file

@ -1,5 +0,0 @@
/* FoodSoft Style-Sheet */
@import "main.css";
@import "rails_messages.css";
@import "nav.css";

View file

@ -81,6 +81,12 @@ option {
span.click-me { span.click-me {
cursor: pointer; } cursor: pointer; }
.left {
float: left; }
.right {
float: right; }
.clear { .clear {
clear: both; } clear: both; }
@ -387,28 +393,74 @@ span.total {
table#order { table#order {
text-align: center; } text-align: center; }
table#order input { table#order 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; }
table#order th#col_required, table#order th#col_tolerance { table#order th#col_required, table#order th#col_tolerance {
width: 145px; } width: 165px; }
table#order th#col_packages, table#order th#col_left_units { table#order th#col_packages, table#order th#col_left_units {
width: 50px; } width: 50px; }
table#order td.quantity, table#order td.tolerance {
text-align: right; }
table#order td#col_left_units { table#order td#col_left_units {
color: #ed0606; } color: #ed0606; }
table#order td { table#order td {
padding: 0.6em; } padding: 0.6em; }
table#order td.name, table#order tr.note td { table#order td.name {
text-align: left; text-align: left;
padding-left: 10px; } padding-left: 10px; }
table#order tfoot tr { table#order tfoot tr {
background-color: #e4eed6; } background-color: #e4eed6; }
table#order tfoot td { table#order tfoot td {
padding-right: 10px; } padding-right: 10px; }
table#order tr.note {
background-color: #FBFBFB; #order-footer, .article-info {
font-size: 0.9em; text-align: left;
border-bottom: 1px solid #DDDDDD; } z-index: 1;
table#order tr.note td { position: fixed;
padding-left: 20px; } bottom: 0;
background-color: #E4EED6;
border-top: 2px solid #78B74E; }
#order-footer #total-sum, .article-info #total-sum {
width: 22em;
margin: .5em 2em 0 0;
float: right; }
#order-footer #total-sum #order-button, .article-info #total-sum #order-button {
margin: .5em 0; }
#order-footer #total-sum #order-button input, .article-info #total-sum #order-button input {
background-color: #78B74E;
color: #fff;
-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%; }
tr.order-article .article-info {
display: none; }
tr.order-article:hover .article-info {
display: block; }
#newComment { #newComment {
margin: 1em; } margin: 1em; }

View file

@ -81,6 +81,12 @@ option {
span.click-me { span.click-me {
cursor: pointer; } cursor: pointer; }
.left {
float: left; }
.right {
float: right; }
.clear { .clear {
clear: both; } clear: both; }
@ -387,28 +393,74 @@ span.total {
table#order { table#order {
text-align: center; } text-align: center; }
table#order input { table#order 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; }
table#order th#col_required, table#order th#col_tolerance { table#order th#col_required, table#order th#col_tolerance {
width: 145px; } width: 165px; }
table#order th#col_packages, table#order th#col_left_units { table#order th#col_packages, table#order th#col_left_units {
width: 50px; } width: 50px; }
table#order td.quantity, table#order td.tolerance {
text-align: right; }
table#order td#col_left_units { table#order td#col_left_units {
color: #ed0606; } color: #ed0606; }
table#order td { table#order td {
padding: 0.6em; } padding: 0.6em; }
table#order td.name, table#order tr.note td { table#order td.name {
text-align: left; text-align: left;
padding-left: 10px; } padding-left: 10px; }
table#order tfoot tr { table#order tfoot tr {
background-color: #e4eed6; } background-color: #e4eed6; }
table#order tfoot td { table#order tfoot td {
padding-right: 10px; } padding-right: 10px; }
table#order tr.note {
background-color: #FBFBFB; #order-footer, .article-info {
font-size: 0.9em; text-align: left;
border-bottom: 1px solid #DDDDDD; } z-index: 1;
table#order tr.note td { position: fixed;
padding-left: 20px; } bottom: 0;
background-color: #E4EED6;
border-top: 2px solid #78B74E; }
#order-footer #total-sum, .article-info #total-sum {
width: 22em;
margin: .5em 2em 0 0;
float: right; }
#order-footer #total-sum #order-button, .article-info #total-sum #order-button {
margin: .5em 0; }
#order-footer #total-sum #order-button input, .article-info #total-sum #order-button input {
background-color: #78B74E;
color: #fff;
-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%; }
tr.order-article .article-info {
display: none; }
tr.order-article:hover .article-info {
display: block; }
#newComment { #newComment {
margin: 1em; } margin: 1em; }

View file

@ -90,7 +90,10 @@ option
span.click-me span.click-me
cursor: pointer cursor: pointer
.left
float: left
.right
float: right
.clear .clear
clear: both clear: both
@ -428,16 +431,24 @@ span.total
table#order table#order
:text-align center :text-align center
input 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 th#col_required, th#col_tolerance
:width 145px :width 165px
th#col_packages, th#col_left_units th#col_packages, th#col_left_units
:width 50px :width 50px
td.quantity, td.tolerance
text-align: right
td#col_left_units td#col_left_units
:color #ed0606 :color #ed0606
td td
:padding 0.6em :padding 0.6em
td.name, tr.note td td.name
:text-align left :text-align left
:padding-left 10px :padding-left 10px
tfoot tfoot
@ -445,13 +456,46 @@ table#order
:background-color = !lightGreen :background-color = !lightGreen
td td
:padding-right 10px :padding-right 10px
tr.note #order-footer, .article-info
:background-color #FBFBFB text-align: left
:font-size 0.9em z-index: 1
:border-bottom 1px solid #DDDDDD position: fixed
td bottom: 0
:padding-left 20px 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%
tr.order-article .article-info
display: none
tr.order-article:hover .article-info
display: block
// ********* Comments // ********* Comments
#newComment #newComment
:margin 1em :margin 1em