Merge pull request #355 from foodcoop1040/expeted_delivery_date

Add expected delivery date
This commit is contained in:
wvengen 2016-05-04 17:42:29 +02:00
commit 8d5467ab7c
15 changed files with 59 additions and 9 deletions

View file

@ -15,6 +15,7 @@ class OrdersController < ApplicationController
if params['sort'] if params['sort']
sort = case params['sort'] sort = case params['sort']
when "supplier" then "suppliers.name, ends DESC" when "supplier" then "suppliers.name, ends DESC"
when "pickup" then "pickup DESC"
when "ends" then "ends DESC" when "ends" then "ends DESC"
when "supplier_reverse" then "suppliers.name DESC" when "supplier_reverse" then "suppliers.name DESC"
when "ends_reverse" then "ends" when "ends_reverse" then "ends"

View file

@ -33,6 +33,8 @@
%dd= show_user_link(@order.created_by) %dd= show_user_link(@order.created_by)
%dt= heading_helper Order, :ends %dt= heading_helper Order, :ends
%dd= format_time(@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? - unless @order.stockit? or @order.supplier.min_order_quantity.blank?
%dt= heading_helper Supplier, :min_order_quantity, short: true %dt= heading_helper Supplier, :min_order_quantity, short: true
%dd= @order.supplier.min_order_quantity %dd= @order.supplier.min_order_quantity

View file

@ -2,6 +2,7 @@
%thead %thead
%tr %tr
%th= heading_helper Order, :name %th= heading_helper Order, :name
%th= heading_helper Order, :pickup
%th= heading_helper Order, :ends %th= heading_helper Order, :ends
%th= heading_helper GroupOrder, :price %th= heading_helper GroupOrder, :price
%tbody %tbody
@ -10,6 +11,7 @@
- order_class = group_order ? "" : "color:grey" - order_class = group_order ? "" : "color:grey"
%tr{:class=> cycle('even', 'odd', :name => 'orders'), :style => order_class} %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= 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= format_time(order.ends)
%td.numeric= group_order ? number_to_currency(group_order.price) : "--" %td.numeric= group_order ? number_to_currency(group_order.price) : "--"
- if pagination - if pagination

View file

@ -15,6 +15,8 @@
%dd= @order.note %dd= @order.note
%dt= heading_helper Order, :ends %dt= heading_helper Order, :ends
%dd= format_time(@order.ends) %dd= format_time(@order.ends)
%dt= heading_helper Order, :pickup
%dd= format_date(@order.pickup)
%dt= heading_helper GroupOrder, :price %dt= heading_helper GroupOrder, :price
%dd %dd
- if @group_order - if @group_order

View file

@ -4,6 +4,7 @@
= f.input :starts, as: :date_picker_time = f.input :starts, as: :date_picker_time
= f.input :boxfill, as: :date_picker_time if @order.is_boxfill_useful? = f.input :boxfill, as: :date_picker_time if @order.is_boxfill_useful?
= f.input :ends, as: :date_picker_time = 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'} = f.input :note, input_html: {rows: 2, class: 'input-xxlarge'}
%h2= t '.title' %h2= t '.title'

View file

@ -3,6 +3,7 @@
%thead %thead
%tr %tr
%th= sort_link_helper heading_helper(Order, :supplier), "supplier" %th= sort_link_helper heading_helper(Order, :supplier), "supplier"
%th= sort_link_helper heading_helper(Order, :pickup), "pickup"
%th= heading_helper Order, :starts %th= heading_helper Order, :starts
%th= sort_link_helper heading_helper(Order, :ends), "ends" %th= sort_link_helper heading_helper(Order, :ends), "ends"
%th= heading_helper Order, :status %th= heading_helper Order, :status
@ -11,6 +12,7 @@
- @orders.each do |order| - @orders.each do |order|
%tr %tr
%td= order.name %td= order.name
%td= format_date(order.pickup)
%td= format_time(order.starts) %td= format_time(order.starts)
%td= format_time(order.ends) %td= format_time(order.ends)
%td= t(order.state, scope: 'orders.state') %td= t(order.state, scope: 'orders.state')

View file

@ -21,6 +21,7 @@
%thead %thead
%tr %tr
%th= heading_helper Order, :name %th= heading_helper Order, :name
%th= heading_helper Order, :pickup
%th= heading_helper Order, :ends %th= heading_helper Order, :ends
%th= heading_helper Order, :note %th= heading_helper Order, :note
%th{colspan: "2"} %th{colspan: "2"}
@ -30,6 +31,7 @@
- tr_class = " active" if order.expired? - tr_class = " active" if order.expired?
%tr{class: tr_class} %tr{class: tr_class}
%td= order.name %td= order.name
%td= format_date(order.pickup) unless order.pickup.nil?
%td= format_time(order.ends) unless order.ends.nil? %td= format_time(order.ends) unless order.ends.nil?
%td= truncate(order.note) %td= truncate(order.note)
%td= link_to t('.action_end'), finish_order_path(order), %td= link_to t('.action_end'), finish_order_path(order),
@ -50,6 +52,7 @@
- for order in @finished_orders - for order in @finished_orders
%tr %tr
%td= order.name %td= order.name
%td= format_date(order.pickup) unless order.pickup.nil?
%td= format_time(order.ends) %td= format_time(order.ends)
%td= truncate(order.note) %td= truncate(order.note)
%td %td

View file

@ -11,12 +11,23 @@
.well .well
= close_button :alert = close_button :alert
%p %p
= raw t '.description1', - description1 = raw t '.description1_order',
state: t("orders.state.#{@order.state}").capitalize, state: t("orders.state.#{@order.state}").capitalize,
supplier: supplier_link(@order), supplier: supplier_link(@order),
who: show_user_link(@order.created_by), who: show_user_link(@order.created_by)
starts: format_time(@order.starts), - description1 += ' '
ends: format_time(@order.ends) - 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 %br
= raw t '.description2', = raw t '.description2',
ordergroups: ordergroup_count(@order), ordergroups: ordergroup_count(@order),

View file

@ -8,6 +8,7 @@
%thead %thead
%tr %tr
%th= heading_helper Order, :name %th= heading_helper Order, :name
%th= heading_helper Order, :pickup
%th= heading_helper Order, :ends %th= heading_helper Order, :ends
%th= t '.who_ordered' %th= t '.who_ordered'
%th.numeric= heading_helper GroupOrder, :price %th.numeric= heading_helper GroupOrder, :price
@ -16,6 +17,7 @@
- Order.open.each do |order| - Order.open.each do |order|
%tr %tr
%td= link_to_ordering(order) %td= link_to_ordering(order)
%td= format_date(order.pickup) unless order.pickup.nil?
%td= format_time(order.ends) unless order.ends.nil? %td= format_time(order.ends) unless order.ends.nil?
- if group_order = order.group_order(ordergroup) - if group_order = order.group_order(ordergroup)
- total += group_order.price - total += group_order.price
@ -28,7 +30,7 @@
- if total > 0 - if total > 0
%tfooter %tfooter
%tr %tr
%th(colspan="2") %th(colspan="3")
%th= t('.total_sum') + ':' %th= t('.total_sum') + ':'
%th.numeric= number_to_currency(total) %th.numeric= number_to_currency(total)
- else - else

View file

@ -79,6 +79,7 @@ de:
ends: Endet am ends: Endet am
name: Lieferant name: Lieferant
note: Notiz note: Notiz
pickup: Abholung
starts: Läuft vom starts: Läuft vom
status: Status status: Status
supplier: Lieferant supplier: Lieferant
@ -1309,7 +1310,11 @@ de:
Willst Du wirklich die Bestellung %{order} beenden? Willst Du wirklich die Bestellung %{order} beenden?
Es gibt kein zurück. Es gibt kein zurück.
create_invoice: Rechnung anlegen 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." description2: "%{ordergroups} haben %{article_count} Artikel mit einem Gesamtwert von %{net_sum} / %{gross_sum} (netto / brutto) bestellt."
download: download:
article_pdf: Artikel PDF article_pdf: Artikel PDF

View file

@ -80,6 +80,7 @@ en:
ends: Ends at ends: Ends at
name: Supplier name: Supplier
note: Note note: Note
pickup: Pickup
starts: Starts at starts: Starts at
status: Status status: Status
supplier: Supplier supplier: Supplier
@ -1332,7 +1333,11 @@ en:
Do you really want to close the order %{order}? Do you really want to close the order %{order}?
There is no going back. There is no going back.
create_invoice: Add invoice 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)." description2: "%{ordergroups} ordered %{article_count} articles, with a total value of %{net_sum} / %{gross_sum} (net / gross)."
download: download:
article_pdf: Article PDF article_pdf: Article PDF

View file

@ -1306,7 +1306,11 @@ fr:
confirm_delete: Veux-tu vraiment supprimer la commande? confirm_delete: Veux-tu vraiment supprimer la commande?
confirm_end: Veux tu vraiment clôturer la commande %{order}? Pas d'annulation possible. confirm_end: Veux tu vraiment clôturer la commande %{order}? Pas d'annulation possible.
create_invoice: Ajouter une facture 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)" description2: "%{ordergroups} ont commandé %{article_count} articles, pour un montant total de %{net_sum} (net)/ %{gross_sum} (brut)"
download: download:
article_pdf: Liste des articles en PDF article_pdf: Liste des articles en PDF

View file

@ -1301,7 +1301,11 @@ nl:
Wil je de bestelling %{order} echt sluiten? Wil je de bestelling %{order} echt sluiten?
Hierna kan zij niet opnieuw geopend worden. Hierna kan zij niet opnieuw geopend worden.
create_invoice: Factuur toevoegen 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)." description2: "%{ordergroups} hebben %{article_count} artikelen besteld met een totale waarde van %{net_sum} / %{gross_sum} (netto / bruto)."
download: download:
article_pdf: Artikelen PDF article_pdf: Artikelen PDF

View file

@ -0,0 +1,5 @@
class AddPickupToOrder < ActiveRecord::Migration
def change
add_column :orders, :pickup, :date
end
end

View file

@ -229,6 +229,7 @@ ActiveRecord::Schema.define(version: 20160226000000) do
t.decimal "foodcoop_result", precision: 8, scale: 2 t.decimal "foodcoop_result", precision: 8, scale: 2
t.integer "created_by_user_id", limit: 4 t.integer "created_by_user_id", limit: 4
t.datetime "boxfill" t.datetime "boxfill"
t.date "pickup"
t.integer "invoice_id" t.integer "invoice_id"
end end