diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index a1e69ee0..f8e4f2a5 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -15,6 +15,7 @@ class OrdersController < ApplicationController if params['sort'] sort = case params['sort'] when "supplier" then "suppliers.name, ends DESC" + when "pickup" then "pickup DESC" when "ends" then "ends DESC" when "supplier_reverse" then "suppliers.name DESC" when "ends_reverse" then "ends" diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index ad36077f..38a6496d 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -33,6 +33,8 @@ %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 diff --git a/app/views/group_orders/_orders.html.haml b/app/views/group_orders/_orders.html.haml index 96e22706..db00d6bd 100644 --- a/app/views/group_orders/_orders.html.haml +++ b/app/views/group_orders/_orders.html.haml @@ -2,6 +2,7 @@ %thead %tr %th= heading_helper Order, :name + %th= heading_helper Order, :pickup %th= heading_helper Order, :ends %th= heading_helper GroupOrder, :price %tbody @@ -10,6 +11,7 @@ - order_class = group_order ? "" : "color:grey" %tr{:class=> cycle('even', 'odd', :name => 'orders'), :style => order_class} %td= group_order.present? ? link_to(order.name, group_order_path(group_order)) : order.name + %td= format_date(order.pickup) %td= format_time(order.ends) %td.numeric= group_order ? number_to_currency(group_order.price) : "--" - if pagination diff --git a/app/views/group_orders/show.html.haml b/app/views/group_orders/show.html.haml index 8af79e6a..adc98b2f 100644 --- a/app/views/group_orders/show.html.haml +++ b/app/views/group_orders/show.html.haml @@ -15,6 +15,8 @@ %dd= @order.note %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 diff --git a/app/views/orders/_form.html.haml b/app/views/orders/_form.html.haml index 95fdebf3..0f3606a5 100644 --- a/app/views/orders/_form.html.haml +++ b/app/views/orders/_form.html.haml @@ -4,6 +4,7 @@ = f.input :starts, as: :date_picker_time = f.input :boxfill, as: :date_picker_time if @order.is_boxfill_useful? = f.input :ends, as: :date_picker_time + = f.input :pickup, as: :date_picker, input_html: {class: 'input-small'} = f.input :note, input_html: {rows: 2, class: 'input-xxlarge'} %h2= t '.title' diff --git a/app/views/orders/_orders.html.haml b/app/views/orders/_orders.html.haml index 36581491..38c92a29 100644 --- a/app/views/orders/_orders.html.haml +++ b/app/views/orders/_orders.html.haml @@ -3,6 +3,7 @@ %thead %tr %th= sort_link_helper heading_helper(Order, :supplier), "supplier" + %th= sort_link_helper heading_helper(Order, :pickup), "pickup" %th= heading_helper Order, :starts %th= sort_link_helper heading_helper(Order, :ends), "ends" %th= heading_helper Order, :status @@ -11,6 +12,7 @@ - @orders.each do |order| %tr %td= order.name + %td= format_date(order.pickup) %td= format_time(order.starts) %td= format_time(order.ends) %td= t(order.state, scope: 'orders.state') diff --git a/app/views/orders/index.html.haml b/app/views/orders/index.html.haml index f0cd8bfa..a1a87bb5 100644 --- a/app/views/orders/index.html.haml +++ b/app/views/orders/index.html.haml @@ -21,6 +21,7 @@ %thead %tr %th= heading_helper Order, :name + %th= heading_helper Order, :pickup %th= heading_helper Order, :ends %th= heading_helper Order, :note %th{colspan: "2"} @@ -30,6 +31,7 @@ - tr_class = " active" if order.expired? %tr{class: tr_class} %td= order.name + %td= format_date(order.pickup) unless order.pickup.nil? %td= format_time(order.ends) unless order.ends.nil? %td= truncate(order.note) %td= link_to t('.action_end'), finish_order_path(order), @@ -50,6 +52,7 @@ - for order in @finished_orders %tr %td= order.name + %td= format_date(order.pickup) unless order.pickup.nil? %td= format_time(order.ends) %td= truncate(order.note) %td diff --git a/app/views/orders/show.html.haml b/app/views/orders/show.html.haml index bca9a21c..b2db94f1 100644 --- a/app/views/orders/show.html.haml +++ b/app/views/orders/show.html.haml @@ -11,12 +11,23 @@ .well = close_button :alert %p - = raw t '.description1', + - description1 = raw t '.description1_order', state: t("orders.state.#{@order.state}").capitalize, supplier: supplier_link(@order), - who: show_user_link(@order.created_by), - starts: format_time(@order.starts), - ends: format_time(@order.ends) + who: show_user_link(@order.created_by) + - description1 += ' ' + - if @order.ends + - description1 += raw t '.description1_period.starts_ends', + starts: format_time(@order.starts), + ends: format_time(@order.ends) + - else + - description1 += raw t '.description1_period.starts', + starts: format_time(@order.starts) + - if @order.pickup + - description1 += ' ' + - description1 += raw t '.description1_period.pickup', + pickup: format_date(@order.pickup) + = description1 + '.' %br = raw t '.description2', ordergroups: ordergroup_count(@order), diff --git a/app/views/shared/_open_orders.html.haml b/app/views/shared/_open_orders.html.haml index eddc82ab..86871c6a 100644 --- a/app/views/shared/_open_orders.html.haml +++ b/app/views/shared/_open_orders.html.haml @@ -8,6 +8,7 @@ %thead %tr %th= heading_helper Order, :name + %th= heading_helper Order, :pickup %th= heading_helper Order, :ends %th= t '.who_ordered' %th.numeric= heading_helper GroupOrder, :price @@ -16,6 +17,7 @@ - Order.open.each do |order| %tr %td= link_to_ordering(order) + %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 @@ -28,7 +30,7 @@ - if total > 0 %tfooter %tr - %th(colspan="2") + %th(colspan="3") %th= t('.total_sum') + ':' %th.numeric= number_to_currency(total) - else diff --git a/config/locales/de.yml b/config/locales/de.yml index 711905dc..7128c274 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -79,6 +79,7 @@ de: ends: Endet am name: Lieferant note: Notiz + pickup: Abholung starts: Läuft vom status: Status supplier: Lieferant @@ -1309,7 +1310,11 @@ de: Willst Du wirklich die Bestellung %{order} beenden? Es gibt kein zurück. create_invoice: Rechnung anlegen - description1: "%{state} Bestellung von %{supplier} angelegt von %{who}, läuft von %{starts} bis %{ends}." + description1_order: "%{state} Bestellung von %{supplier} angelegt von %{who}," + description1_period: + starts: "läuft von %{starts}" + starts_ends: "läuft von %{starts} bis %{ends}" + pickup: "und kann am %{pickup} abgeholt werden" description2: "%{ordergroups} haben %{article_count} Artikel mit einem Gesamtwert von %{net_sum} / %{gross_sum} (netto / brutto) bestellt." download: article_pdf: Artikel PDF diff --git a/config/locales/en.yml b/config/locales/en.yml index 7bb3a224..e8db8367 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -80,6 +80,7 @@ en: ends: Ends at name: Supplier note: Note + pickup: Pickup starts: Starts at status: Status supplier: Supplier @@ -1332,7 +1333,11 @@ en: Do you really want to close the order %{order}? There is no going back. create_invoice: Add invoice - description1: "%{state} order from %{supplier} created by %{who}, open from %{starts} until %{ends}." + description1_order: "%{state} order from %{supplier} created by %{who}," + description1_period: + starts: "open from %{starts}" + starts_ends: "open from %{starts} until %{ends}" + pickup: "and can be picked up on %{pickup}" description2: "%{ordergroups} ordered %{article_count} articles, with a total value of %{net_sum} / %{gross_sum} (net / gross)." download: article_pdf: Article PDF diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 680a0570..322ae0a1 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1306,7 +1306,11 @@ fr: confirm_delete: Veux-tu vraiment supprimer la commande? confirm_end: Veux tu vraiment clôturer la commande %{order}? Pas d'annulation possible. create_invoice: Ajouter une facture - description1: Commande %{state} de %{supplier} créée par %{who}, ouverte du %{starts} au %{ends}. + description1_order: "Commande %{state} de %{supplier} créée par %{who}," + description1_period: + starts: "ouverte du %{starts}" + starts_ends: "ouverte du %{starts} au %{ends}" + pickup: description2: "%{ordergroups} ont commandé %{article_count} articles, pour un montant total de %{net_sum} (net)/ %{gross_sum} (brut)" download: article_pdf: Liste des articles en PDF diff --git a/config/locales/nl.yml b/config/locales/nl.yml index c2ba7765..a4eb7400 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1301,7 +1301,11 @@ nl: Wil je de bestelling %{order} echt sluiten? Hierna kan zij niet opnieuw geopend worden. create_invoice: Factuur toevoegen - description1: "%{state} bestelling van %{supplier}, geopend door %{who}, open van %{starts} tot %{ends}." + description1_order: "%{state} bestelling van %{supplier}, geopend door %{who}," + description1_period: + starts: "open van %{starts}" + starts_ends: "open van %{starts} tot %{ends}" + pickup: description2: "%{ordergroups} hebben %{article_count} artikelen besteld met een totale waarde van %{net_sum} / %{gross_sum} (netto / bruto)." download: article_pdf: Artikelen PDF diff --git a/db/migrate/20160217152621_add_pickup_to_order.rb b/db/migrate/20160217152621_add_pickup_to_order.rb new file mode 100644 index 00000000..62feb344 --- /dev/null +++ b/db/migrate/20160217152621_add_pickup_to_order.rb @@ -0,0 +1,5 @@ +class AddPickupToOrder < ActiveRecord::Migration + def change + add_column :orders, :pickup, :date + end +end diff --git a/db/schema.rb b/db/schema.rb index 70d9234b..6f00ff8a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -229,6 +229,7 @@ ActiveRecord::Schema.define(version: 20160226000000) do t.decimal "foodcoop_result", precision: 8, scale: 2 t.integer "created_by_user_id", limit: 4 t.datetime "boxfill" + t.date "pickup" t.integer "invoice_id" end