Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expected delivery date #355

Merged
merged 1 commit into from
May 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def index
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"
Expand Down
2 changes: 2 additions & 0 deletions app/views/group_orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/group_orders/_orders.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/group_orders/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/views/orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions app/views/orders/_orders.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand Down
3 changes: 3 additions & 0 deletions app/views/orders/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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),
Expand All @@ -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
Expand Down
19 changes: 15 additions & 4 deletions app/views/orders/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 3 additions & 1 deletion app/views/shared/_open_orders.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ de:
ends: Endet am
name: Lieferant
note: Notiz
pickup: Abholung
starts: Läuft vom
status: Status
supplier: Lieferant
Expand Down Expand Up @@ -1310,7 +1311,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
Expand Down
7 changes: 6 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ en:
ends: Ends at
name: Supplier
note: Note
pickup: Pickup
starts: Starts at
status: Status
supplier: Supplier
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,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
Expand Down
6 changes: 5 additions & 1 deletion config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,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
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20160217152621_add_pickup_to_order.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPickupToOrder < ActiveRecord::Migration
def change
add_column :orders, :pickup, :date
end
end
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
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

Expand Down