diff --git a/app/assets/javascripts/ordering.js b/app/assets/javascripts/ordering.js index a3dd1050..1097f8a7 100644 --- a/app/assets/javascripts/ordering.js +++ b/app/assets/javascripts/ordering.js @@ -179,17 +179,13 @@ function updateBalance() { var balance = groupBalance - total; $('#new_balance').html(I18n.l("currency", balance)); $('#total_balance').val(I18n.l("currency", balance)); - // determine bgcolor and submit button state according to balance - var bgcolor = ''; if (balance < minimumBalance) { - bgcolor = '#FF0000'; $('#submit_button').attr('disabled', 'disabled') + $('#balance-alert').css('display', 'block') + } else { $('#submit_button').removeAttr('disabled') - } - // update bgcolor - for (i in itemTotal) { - $('#td_price_' + i).css('background-color', bgcolor); + $('#balance-alert').css('display', 'none') } } diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index ebd30b20..3d98e4a5 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -230,7 +230,7 @@ table { margin: .5em 0; input:disabled { - background-color: red; } + background-color: gray; } } } } @@ -278,13 +278,14 @@ tr.order-article .article-info { display: none; } -tr.order-article:focus{ - background-color: #E4EED6; -} tr.order-article:focus .article-info { display: block; } +tr.order-article:focus { + background-color: #E9E9E9; +} + // ********* Articles tr.just-updated { diff --git a/app/assets/stylesheets/list.missing.css b/app/assets/stylesheets/list.missing.css index 4eea5d78..2dc36577 100644 --- a/app/assets/stylesheets/list.missing.css +++ b/app/assets/stylesheets/list.missing.css @@ -1,11 +1,23 @@ -.list .missing-many td, .list .missing-many:hover td { - background-color: #ebbebe; +.missing-many td { + background-color: #ffc590aa; } -.list .missing-few td, .list .missing-few:hover td { - background-color: #ffee75; +.missing-many:hover td, .missing-many:focus td { + background-color: #ffc590; } -.list .missing-none td, .list .missing-none:hover td { - background-color: #E4EED6; +.missing-few td { + background-color: #fcf488aa; +} + +.missing-few:hover td, .missing-few:focus td { + background-color: #fcf488; +} + +.missing-none td { + background-color: #d0f6ffaa; +} + +.missing-none:hover td, .missing-none:focus td { + background-color: #d0f6ff; } diff --git a/app/views/group_orders/_explanations.haml b/app/views/group_orders/_explanations.haml new file mode 100644 index 00000000..30e5b91c --- /dev/null +++ b/app/views/group_orders/_explanations.haml @@ -0,0 +1,15 @@ +%h4= t '.title' +%hr +%table.table-condensed + %thead + %th= t '.package_fill_level' + %tbody + %tr{class: "missing-none"} + %td= t '.missing_none' + %tr{class: "missing-few"} + %td= t '.missing_few' + %tr{class: "missing-many"} + %td= t '.missing_many' +%hr + %b= t('.tolerance') + ':' + = t '.tolerance_explained' \ No newline at end of file diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index 0cd27c76..c7317ac7 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -11,170 +11,140 @@ var listjsResetPlugin = ['reset', {highlightClass: 'btn-primary'}]; var listjsDelayPlugin = ['delay', {delayedSearchTime: 500}]; new List(document.body, { - valueNames: ['name'], - engine: 'unlist', - plugins: [listjsResetPlugin, listjsDelayPlugin], - // make large pages work too (as we don't have paging - articles may disappear!) - page: 10000, - indexAsync: true + valueNames: ['name'], + engine: 'unlist', + plugins: [listjsResetPlugin, listjsDelayPlugin], + // make large pages work too (as we don't have paging - articles may disappear!) + page: 10000, + indexAsync: true }); }); - title t('.title'), false +.alert.alert-error#balance-alert{style: ('display:none')} + =t 'group_orders.errors.balance_alert' .row-fluid - .well.pull-left - = close_button :alert - %h2= @order.name - %dl.dl-horizontal - - unless @order.note.blank? - %dt= heading_helper Order, :note - %dd= @order.note - %dt= heading_helper Order, :created_by - %dd= show_user_link(@order.created_by) - %dt= heading_helper Order, :ends - %dd= format_time(@order.ends) - %dt= heading_helper Order, :pickup - %dd= format_date(@order.pickup) - - unless @order.stockit? or @order.supplier.min_order_quantity.blank? - %dt= heading_helper Supplier, :min_order_quantity, short: true - %dd= @order.supplier.min_order_quantity - %dt= t '.sum_amount' - %dd= number_to_currency @order.sum - - unless @group_order.new_record? - %dt= heading_helper GroupOrder, :updated_by - %dd - = show_user(@group_order.updated_by) - (#{format_time(@group_order.updated_on)}) - %dt= heading_helper Ordergroup, :account_balance - %dd= number_to_currency(@ordering_data[:account_balance]) - - unless FoodsoftConfig[:charge_members_manually] - %dt= heading_helper Ordergroup, :available_funds - %dd= number_to_currency(@ordering_data[:available_funds]) - - .well.pull-right - = close_button :alert - = render 'switch_order', current_order: @order - -.row-fluid - .well.clear - .form-search + .span2 + .well + = render 'switch_order', current_order: @order + .well + = render 'explanations' + .well.span9 + %h2.span9= t '.sub_title', order_name: @order.name + .span3 + %table.table-condensed + -if @order.ends + %tr + %td= heading_helper(Order, :ends) + ': ' + %td= format_time(@order.ends) + - unless @order.stockit? or @order.supplier.min_order_quantity.blank? + %tr + %td= heading_helper(Supplier, :min_order_quantity) + %td= number_to_currency(@order.supplier.min_order_quantity) + %tr + %td= t('group_orders.form.sum_amount') + ':' + %td= number_to_currency(@order.sum) + %hr + .form-search.pull-right .input-append = text_field_tag :article, params[:article], placeholder: t('.search_article'), class: 'search-query delayed-search resettable' %button.add-on.btn.reset-search{:type => :button, :title => t('.reset_article_search')} %i.icon.icon-remove - -= form_for @group_order do |f| - = f.hidden_field :lock_version - = f.hidden_field :order_id - = f.hidden_field :updated_by_user_id - = f.hidden_field :ordergroup_id - %table.table - %thead - %tr - %th= heading_helper Article, :name - - if @order.stockit? - %th{style: 'width:120px'}= heading_helper StockArticle, :supplier - %th{style: "width:13px;"} - %th{style: "width:4.5em;"}= t '.price' - %th{style: "width:4.5em;"}= heading_helper Article, :unit - - unless @order.stockit? - %th{style: "width:70px;"}= heading_helper OrderArticle, :missing_units, short: true - %th#col_required= heading_helper GroupOrderArticle, :quantity - %th#col_tolerance= heading_helper GroupOrderArticle, :tolerance - - else - %th(style="width:20px")= heading_helper StockArticle, :available - %th#col_required= heading_helper GroupOrderArticle, :quantity - %th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price - %tbody.list - - @order.articles_grouped_by_category.each do |category, order_articles| - %tr.list-heading.article-category - %td - = category - %i.icon-tag - %td{colspan: "9"} - - order_articles.each do |order_article| - %tr{class: "#{cycle('even', 'odd', name: 'articles')} order-article #{get_missing_units_css_class(@ordering_data[:order_articles][order_article.id][:missing_units])}", valign: "top", tabindex: "0"} - %td.name= order_article.article.name + = form_for @group_order do |f| + = f.hidden_field :lock_version + = f.hidden_field :order_id + = f.hidden_field :updated_by_user_id + = f.hidden_field :ordergroup_id + %table.table + %thead + %tr + %th= heading_helper Article, :name - if @order.stockit? - %td= truncate order_article.article.supplier.name, length: 15 - %td= h order_article.article.origin - %td= number_to_currency(@ordering_data[:order_articles][order_article.id][:price]) - %td= order_article.article.unit - %td - - if @order.stockit? - = @ordering_data[:order_articles][order_article.id][:quantity_available] - - else - %span{id: "missing_units_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:missing_units] + %th{style: 'width:120px'}= heading_helper StockArticle, :supplier + %th{style: "width:13px;"} + %th{style: "width:4.5em;"}= t '.price' + %th{style: "width:4.5em;"}= heading_helper Article, :unit + - unless @order.stockit? + %th{style: "width:70px;"}= heading_helper OrderArticle, :missing_units, short: true + %th#col_required= heading_helper GroupOrderArticle, :quantity + %th#col_tolerance= heading_helper GroupOrderArticle, :tolerance + - else + %th(style="width:20px")= heading_helper StockArticle, :available + %th#col_required= heading_helper GroupOrderArticle, :quantity + %th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price + %tbody.list + - @order.articles_grouped_by_category.each do | category, order_articles| + %tr.list-heading.article-category + %td + = category + %i.icon-tag + %td{colspan: "9"} + - order_articles.each do |order_article| + %tr{class: "#{cycle('even', 'odd', name: 'articles')} order-article #{get_missing_units_css_class(@ordering_data[:order_articles][order_article.id][:missing_units])}", valign: "top", tabindex: "0"} + %td.name= order_article.article.name + - if @order.stockit? + %td= truncate order_article.article.supplier.name, length: 15 + %td= h order_article.article.origin + %td= number_to_currency(@ordering_data[:order_articles][order_article.id][:price]) + %td= order_article.article.unit + %td + - if @order.stockit? + = @ordering_data[:order_articles][order_article.id][:quantity_available] + - else + %span{id: "missing_units_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:missing_units] - %td.quantity - %input{id: "q_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][quantity]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:quantity], 'data-min' => (@ordering_data[:order_articles][order_article.id][:quantity] if @order.boxfill?), 'data-max' => (@ordering_data[:order_articles][order_article.id][:quantity]+@ordering_data[:order_articles][order_article.id][:missing_units] if @order.boxfill?)}/ - %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] - .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.quantity + .outer{style: "diyplay: inline-block; float: left; width: 50px;"} + %input{id: "q_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][quantity]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:quantity], 'data-min' => (@ordering_data[:order_articles][order_article.id][:quantity] if @order.boxfill?), 'data-max' => (@ordering_data[:order_articles][order_article.id][:quantity]+@ordering_data[:order_articles][order_article.id][:missing_units] if @order.boxfill?)}/ + %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] + .btn-group + %a.btn.btn-ordering{'data-decrease_quantity' => order_article.id} + %i.icon-minus + %a.btn.btn-ordering{'data-increase_quantity' => order_article.id} + %i.icon-plus - %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]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:tolerance], 'data-min' => (@ordering_data[:order_articles][order_article.id][:tolerance] if @order.boxfill?)}/ - - if (@ordering_data[:order_articles][order_article.id][:unit] > 1) - %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] - .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.tolerance{style: ('display:none' if @order.stockit?)} + %input{id: "t_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][tolerance]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:tolerance], 'data-min' => (@ordering_data[:order_articles][order_article.id][:tolerance] if @order.boxfill?)}/ + - if (@ordering_data[:order_articles][order_article.id][:unit] > 1) + %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] + .btn-group + %a.btn.btn-ordering{'data-decrease_tolerance' => order_article.id} + %i.icon-minus + %a.btn.btn-ordering{'data-increase_tolerance' => order_article.id} + %i.icon-plus - %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]) - .article-info - .article-name= order_article.article.name - .pull-right - = t('.units_full') + ':' - %span{id: "units_#{order_article.id}"}= order_article.units_to_order - %br/ - = t('.units_total') + ':' - %span{id: "q_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] + @ordering_data[:order_articles][order_article.id][:others_quantity] - %br/ - = t('.total_tolerance') + ':' - %span{id: "t_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] + @ordering_data[:order_articles][order_article.id][:others_tolerance] - %br/ - .pull-left - #{heading_helper Article, :manufacturer}: #{order_article.article.manufacturer} - %br/ - #{heading_helper Article, :units}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit} - %br/ - #{heading_helper Article, :note}: #{order_article.article.note} - %br/ - #order-footer - #info-box - #total-sum - %table - %tr - %td= t('.total_sum_amount') + ':' - %td.currency - %span#total_price= number_to_currency(@group_order.price) - %tr - - if FoodsoftConfig[:charge_members_manually] - - old_balance = @ordering_data[:account_balance] - %td= heading_helper(Ordergroup, :account_balance) + ':' - %td.currency= number_to_currency(@ordering_data[:account_balance]) - - else - - old_balance = @ordering_data[:available_funds] - %td= heading_helper(Ordergroup, :available_funds) + ':' - %td.currency= number_to_currency(@ordering_data[:available_funds]) - %tr - %td= t('.new_funds') + ':' - %td.currency - %strong - %span#new_balance= number_to_currency(old_balance - @group_order.price) - #order-button - = submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' ) - #{link_to t('ui.or_cancel'), group_orders_path} - %input#total_balance{name: "total_balance", type: "hidden", value: @ordergroup.account_balance - @group_order.price}/ - %input{name: "version", type: "hidden", value: @version}/ + %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]) + .article-info + .article-name= order_article.article.name + .pull-right + = t('.units_full') + ':' + %span{id: "units_#{order_article.id}"}= order_article.units_to_order + %br/ + = t('.units_total') + ':' + %span{id: "q_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] + @ordering_data[:order_articles][order_article.id][:others_quantity] + %br/ + = t('.total_tolerance') + ':' + %span{id: "t_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] + @ordering_data[:order_articles][order_article.id][:others_tolerance] + %br/ + .pull-left + #{heading_helper Article, :manufacturer}: #{order_article.article.manufacturer} + %br/ + #{heading_helper Article, :units}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit} + %br/ + #{heading_helper Article, :note}: #{order_article.article.note} + %br/ + #order-footer + #info-box + #total-sum + = render 'total_sum' + #order-button + = submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' ) + #{link_to t('ui.or_cancel'), group_orders_path} + %input#total_balance{name: "total_balance", type: "hidden", value: @ordergroup.account_balance - @group_order.price}/ + %input{name: "version", type: "hidden", value: @version}/ diff --git a/app/views/group_orders/_switch_order.html.haml b/app/views/group_orders/_switch_order.html.haml index 76443524..70234b39 100644 --- a/app/views/group_orders/_switch_order.html.haml +++ b/app/views/group_orders/_switch_order.html.haml @@ -1,9 +1,10 @@ -- orders = Order.open.started.reject{ |order| order == current_order } +- orders = Order.open.started - unless orders.empty? - %h2= t '.title' - %ul.unstyled + %ul.nav.nav-pills.nav-stacked + .nav-header= t '.title' + %li= link_to t('ui.overview'), :group_orders - orders.each do |order| - %li - = link_to_ordering(order, 'data-confirm_switch_order' => true) - - if order.ends - = t '.remaining', remaining: time_ago_in_words(order.ends) + .btn-small.pull-right + =link_to_ordering(order, style: (order == current_order ? 'color: white' : '' ), 'data-confirm_switch_order' => true){ t 'ui.edit' } + %li( class="#{ order == current_order ? 'active' : ''}") + =link_to_ordering(order, show: true, 'data-confirm_switch_order' => true) \ No newline at end of file diff --git a/app/views/group_orders/_total_sum.haml b/app/views/group_orders/_total_sum.haml new file mode 100644 index 00000000..28911b32 --- /dev/null +++ b/app/views/group_orders/_total_sum.haml @@ -0,0 +1,19 @@ +%table + %tr + %td= t('group_orders.form.total_sum_amount') + ':' + %td.currency + %span#total_price= number_to_currency(@group_order.price) + %tr + - if FoodsoftConfig[:charge_members_manually] + - old_balance = @ordering_data[:account_balance] + %td= heading_helper(Ordergroup, :account_balance) + ':' + %td.currency= number_to_currency(@ordering_data[:account_balance]) + - else + - old_balance = @ordering_data[:available_funds] + %td= heading_helper(Ordergroup, :available_funds) + ':' + %td.currency= number_to_currency(@ordering_data[:available_funds]) + %tr + %td= t('group_orders.form.new_funds') + ':' + %td.currency + %strong + %span#new_balance= number_to_currency(old_balance - @group_order.price) diff --git a/app/views/group_orders/index.html.haml b/app/views/group_orders/index.html.haml index 158bc06c..55c97c81 100644 --- a/app/views/group_orders/index.html.haml +++ b/app/views/group_orders/index.html.haml @@ -18,22 +18,27 @@ %th= heading_helper Ordergroup, :available_funds %th.numeric= number_to_currency(@ordergroup.get_available_funds) -= render :partial => "shared/open_orders", :locals => {:ordergroup => @ordergroup} - -// finished orders +.row-fluid + .span9 + = render :partial => "shared/open_orders", :locals => {:ordergroup => @ordergroup} + // finished orders - unless @finished_not_closed_orders_including_group_order.empty? - %section - %h2= t '.finished_orders.title' - = render partial: 'orders', locals: {orders: @finished_not_closed_orders_including_group_order, pagination: false} - - if @ordergroup.value_of_finished_orders > 0 - %p - = t('.finished_orders.total_sum') + ':' - %b= number_to_currency(@ordergroup.value_of_finished_orders) + .row-fluid + .span9 + %section + %h2= t '.finished_orders.title' + = render partial: 'orders', locals: {orders: @finished_not_closed_orders_including_group_order, pagination: false} + - if @ordergroup.value_of_finished_orders > 0 + %p + = t('.finished_orders.total_sum') + ':' + %b= number_to_currency(@ordergroup.value_of_finished_orders) // closed orders - unless @closed_orders_including_group_order.empty? - %section - %h2= t '.closed_orders.title' - = render partial: 'orders', locals: {orders: @closed_orders_including_group_order, pagination: false} - %br/ - = link_to t('.closed_orders.more'), archive_group_orders_path + .row-fluid + .span9 + %section + %h2= t '.closed_orders.title' + = render partial: 'orders', locals: {orders: @closed_orders_including_group_order, pagination: false} + %br/ + = link_to t('.closed_orders.more'), archive_group_orders_path diff --git a/app/views/group_orders/show.html.haml b/app/views/group_orders/show.html.haml index 8c9678d7..b9d4f674 100644 --- a/app/views/group_orders/show.html.haml +++ b/app/views/group_orders/show.html.haml @@ -7,107 +7,115 @@ - title t('.title', order: @order.name) .row-fluid - .well.pull-left - // Order summary + + .well.span2 + = render 'switch_order', current_order: @order + .well.span9 + %h2= t '.articles.title' %dl.dl-horizontal + // Name %dt= heading_helper Order, :name %dd= @order.name - %dt= heading_helper Order, :note - %dd= @order.note + // Order Ends %dt= heading_helper Order, :ends %dd= format_time(@order.ends) - %dt= heading_helper Order, :pickup - %dd= format_date(@order.pickup) - %dt= heading_helper GroupOrder, :price - %dd - - if @group_order - = number_to_currency(@group_order.price) - - else - = t '.not_ordered' - - if @group_order && @group_order.transport - %dt= heading_helper GroupOrder, :transport - %dd= number_to_currency(@group_order.transport) - %dt= heading_helper GroupOrder, :total - %dd= number_to_currency(@group_order.total) + // Pickup + - unless @order.pickup.blank? + %dt= heading_helper Order, :pickup + %dd= format_date(@order.pickup) + // Min Order Quantity + - unless @order.stockit? or @order.supplier.min_order_quantity.blank? + %dt= heading_helper Supplier, :min_order_quantity, short: true + %dd= @order.supplier.min_order_quantity + // Group Order Sum Amount + %dt= t 'group_orders.form.sum_amount' + %dd= number_to_currency @order.sum + // Created By + %dt= heading_helper Order, :created_by + %dd= show_user_link(@order.created_by) + // Updated By + - unless @group_order.new_record? + %dt= heading_helper GroupOrder, :updated_by + %dd + = show_user(@group_order.updated_by) + (#{format_time(@group_order.updated_on)}) + // Closed By - if @order.closed? %dt= heading_helper Order, :closed_by %dd= show_user_link @order.updated_by - %p= link_to t('.comment'), "#comments" + // Note + - unless @order.note.blank? + %dt= heading_helper Order, :note + %dd= @order.note - .well.pull-right - = close_button :alert - = render 'switch_order', current_order: @order - -// Article box -%section - %h2= t '.articles.title' - .column_content#result - - if @group_order - %p.pull-right= link_to t('.articles.show_hide'), '#', 'data-toggle-this' => 'tr.ignored' - %p= link_to(t('.articles.edit_order'), edit_group_order_path(@group_order, order_id: @order.id), class: 'btn btn-primary') if @order.open? - %table.table.table-hover - %thead - %tr - %th{style: "width:40%"}= heading_helper Article, :name - %th= heading_helper Article, :units - %th= t '.articles.unit_price' - %th - %abbr{title: t('.articles.ordered_title')}= t '.articles.ordered' - %th - %abbr{title: t('.articles.order_nopen_title')} - - if @order.open? - = t '.articles.order_open' - - else - = t '.articles.order_not_open' - %th= heading_helper GroupOrderArticle, :total_price - %tbody - - for category_name, order_articles in @order.articles_grouped_by_category - %tr.article-category - %td - = category_name - %i.icon-tag - %td{colspan: "9"} - - order_articles.each do |oa| - - # get the order-results for the ordergroup - - r = get_order_results(oa, @group_order.id) - %tr{class: cycle('even', 'odd', name: 'articles') + " " + order_article_class_name(r[:quantity], r[:tolerance], r[:result])} - %td{style: "width:40%"} - = oa.article.name + // Article box + %section + .column_content#result + - if @group_order + %p= link_to t('.articles.show_hide'), '#', 'data-toggle-this' => 'tr.ignored' + %table.table.table-hover + %thead + %tr + %th{style: "width:40%"}= heading_helper Article, :name + %th= heading_helper Article, :units + %th= t '.articles.unit_price' + %th + %abbr{title: t('.articles.ordered_title')}= t '.articles.ordered' + %th + %abbr{title: t('.articles.order_nopen_title')} + - if @order.open? + = t '.articles.order_open' + - else + = t '.articles.order_not_open' + %th= heading_helper GroupOrderArticle, :total_price + %tbody + - for category_name, order_articles in @order.articles_grouped_by_category + %tr.article-category + %td + = category_name + %i.icon-tag + %td{colspan: "9"} + - order_articles.each do |oa| + - # get the order-results for the ordergroup + - r = get_order_results(oa, @group_order.id) + %tr{class: cycle('even', 'odd', name: 'articles') + " " + order_article_class_name(r[:quantity], r[:tolerance], r[:result])} + %td{style: "width:40%"} + = oa.article.name + - unless oa.article.note.blank? + = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) + %td= "#{oa.price.unit_quantity} x #{oa.article.unit}" + %td= number_to_currency(oa.price.fc_price) + %td + = r[:quantity] + = "+ #{r[:tolerance]}" if oa.price.unit_quantity > 1 + %td= r[:result] > 0 ? r[:result] : "0" + %td= number_to_currency(r[:sub_total]) - unless oa.article.note.blank? - = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) - %td= "#{oa.price.unit_quantity} x #{oa.article.unit}" - %td= number_to_currency(oa.price.fc_price) - %td - = r[:quantity] - = "+ #{r[:tolerance]}" if oa.price.unit_quantity > 1 - %td= r[:result] > 0 ? r[:result] : "0" - %td= number_to_currency(r[:sub_total]) - - unless oa.article.note.blank? - %tr{id: "note_#{oa.id}", class: "note even", style: "display:none"} - %td{colspan: "6"}=h oa.article.note - %tr{class: cycle('even', 'odd', name: 'articles')} - %th{colspan: "5"}= heading_helper GroupOrder, :price - %th= number_to_currency(@group_order.price) - - if @group_order.transport - %tr{class: cycle('even', 'odd', name: 'articles')} - %td{colspan: "5"}= heading_helper GroupOrder, :transport - %td= number_to_currency(@group_order.transport) - %tr{class: cycle('even', 'odd', name: 'articles')} - %th{colspan: "5"}= heading_helper GroupOrder, :total - %th= number_to_currency(@group_order.total) - %br/ - = link_to_top - - else - - if @order.open? - = t '.articles.not_ordered_msg' - = link_to t('.articles.order_now'), action: "order", id: @order - - else - = t '.articles.order_closed_msg' - + %tr{id: "note_#{oa.id}", class: "note even", style: "display:none"} + %td{colspan: "6"}=h oa.article.note + %tr{class: cycle('even', 'odd', name: 'articles')} + %th{colspan: "5"}= heading_helper GroupOrder, :price + %th= number_to_currency(@group_order.price) + - if @group_order.transport + %tr{class: cycle('even', 'odd', name: 'articles')} + %td{colspan: "5"}= heading_helper GroupOrder, :transport + %td= number_to_currency(@group_order.transport) + %tr{class: cycle('even', 'odd', name: 'articles')} + %th{colspan: "5"}= heading_helper GroupOrder, :total + %th= number_to_currency(@group_order.total) + %br/ + = link_to_top + %p.pull-right= link_to(t('.articles.edit_order'), edit_group_order_path(@group_order, order_id: @order.id), class: 'btn btn-primary') if @order.open? + - else + - if @order.open? + = t '.articles.not_ordered_msg' + = link_to t('.articles.order_now'), action: "order", id: @order + - else + = t '.articles.order_closed_msg' // Comments box -%section - %h2= t '.comments.title' - #comments - = render 'shared/comments', comments: @order.comments - #new_comment= render 'order_comments/form', order_comment: @order.comments.build(user: current_user) - = link_to_top +%hr +%h2= t '.comments.title' +#comments + = render 'shared/comments', comments: @order.comments +#new_comment= render 'order_comments/form', order_comment: @order.comments.build(user: current_user) += link_to_top \ No newline at end of file diff --git a/app/views/shared/_open_orders.html.haml b/app/views/shared/_open_orders.html.haml index cef00797..80e4621f 100644 --- a/app/views/shared/_open_orders.html.haml +++ b/app/views/shared/_open_orders.html.haml @@ -9,6 +9,7 @@ %thead %tr %th= heading_helper Order, :name + %th %th= heading_helper Order, :pickup %th= heading_helper Order, :ends %th= t '.who_ordered' @@ -17,21 +18,23 @@ - total = 0 - orders.each do |order| %tr - %td= link_to_ordering(order) + %td + = link_to_ordering(order, show: true) + %td + .btn-small= link_to_ordering(order){ t 'ui.edit' } %td= format_date(order.pickup) unless order.pickup.nil? %td= format_time(order.ends) unless order.ends.nil? - if group_order = order.group_order(ordergroup) - total += group_order.price %td= "#{show_user group_order.updated_by} (#{format_time(group_order.updated_on)})" %td.numeric - = link_to_ordering(order, show: true) do - = number_to_currency(group_order.price) + = number_to_currency(group_order.price) - else %td{:colspan => 2} - if total > 0 %tfooter %tr - %th(colspan="3") + %th(colspan="4") %th= t('.total_sum') + ':' %th.numeric= number_to_currency(total) - else diff --git a/config/locales/de.yml b/config/locales/de.yml index 9d51bdf1..89a69005 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1046,9 +1046,23 @@ de: error_stale: In der Zwischenzeit hat jemand anderes auch bestellt, daher konnte die Bestellung nicht aktualisiert werden. notice: Die Bestellung wurde gespeichert. errors: + balance_alert: Kontostand im Minus closed: Diese Bestellung ist bereits abgeschlossen. no_member: Du bist kein Mitglieder einer Bestellgruppe. notfound: Fehlerhafte URL, das ist nicht Deine Bestellung. + explanations: + package_fill_level: | + Gebindefüllstand + missing_none: | + Voll + missing_few: | + Wenig fehlt + missing_many: | + Viel fehlt + title: Erklärungen + tolerance_explained: | + Zusätzliche Menge die du bestellen würdest, damit das Gebinde voll wird. + tolerance: Toleranz form: action_save: Bestellung speichern new_funds: Neuer Kontostand @@ -1057,6 +1071,7 @@ de: search_article: Artikel suchen... sum_amount: Gesamtbestellmenge bisher title: Bestellen + sub_title: Bestellung für %{order_name} aufgeben total_sum_amount: Gesamtbetrag total_tolerance: Gesamt-Toleranz units: Gebinde @@ -1100,7 +1115,6 @@ de: sum: Summe title: Dein Bestellergebnis für %{order} switch_order: - remaining: "noch %{remaining}" title: Laufende Bestellungen update: error_general: Die Bestellung konnte nicht aktualisiert werden, da ein Fehler auftrat. diff --git a/config/locales/en.yml b/config/locales/en.yml index ec6baab5..cb7a54c1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1048,9 +1048,23 @@ en: error_stale: Someone else has ordered in the meantime, couldn't update the order. notice: The order was saved. errors: + balance_alert: Negative account balance closed: This order is already closed. no_member: You are not a member of an ordergroup. notfound: Incorrect URL, this is not your order. + explanations: + title: Explanations + tolerance: Tolerance + package_fill_level: | + Package Fill Level + missing_none: | + No more missing + missing_few: | + Few missing + missing_many: | + Many missing + tolerance_explained: | + Additional amount you would buy to fill a wholesale package form: action_save: Save order new_funds: New account balance @@ -1059,6 +1073,7 @@ en: search_article: Search for articles... sum_amount: Current amount title: Orders + sub_title: Place order for %{order_name} total_sum_amount: Total amount total_tolerance: Total tolerance units: Units @@ -1102,7 +1117,6 @@ en: sum: Sum title: Your order result for %{order} switch_order: - remaining: "%{remaining} remaining" title: Current orders update: error_general: The order couldn’t be updated due to a bug. diff --git a/config/locales/nl.yml b/config/locales/nl.yml index facd55d0..f441d15d 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1018,6 +1018,7 @@ nl: error_stale: In de tussentijd heeft iemand anders ook bestelt, daarom kon de bestelling niet bijgewerkt worden. notice: Bestelling opgeslagen. errors: + balance_alert: Accountsaldo in het rood closed: Deze bestelling is al gesloten. no_member: Je bent geen lid van dit huishouden. notfound: Foute URL, dit is niet jouw bestelling. @@ -1029,6 +1030,7 @@ nl: search_article: Artikelen zoeken... sum_amount: Huidig totaalbedrag title: Bestellen + sub_title: Plaats bestelling voor %{order_name} total_sum_amount: Totalbedrag total_tolerance: Totale tolerantie units: Eenheden @@ -1072,7 +1074,6 @@ nl: sum: Som title: Jouw bestelling voor %{order} switch_order: - remaining: "nog %{remaining}" title: Lopende bestellingen update: error_general: Er is een probleem opgetreden, de bestelling kon niet bijgewerkt worden.