Skip to content

Commit

Permalink
include delivery day in supplier email
Browse files Browse the repository at this point in the history
  • Loading branch information
wvengen committed Mar 8, 2014
1 parent 6faf560 commit a6e2ba9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
9 changes: 7 additions & 2 deletions app/controllers/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@ def destroy
def finish
@order = Order.find params[:id]
if request.post?
message = params[:send_order_comment]
messages = []
if params[:send_order_contact]
message = "#{I18n.t('orders.finish.contact_person')}: #{params[:send_order_contact]}\n\n" + message
messages << "#{I18n.t('orders.finish.contact_person')}: #{params[:send_order_contact]}"
end
if params[:send_delivered_on]
messages << "#{I18n.t('orders.finish.label_delivered_on')}: #{params[:send_delivered_on]}"
end
message = params[:send_order_comment]
message = messages.join("\n") + "\n" + message if messages
@order.finish!(@current_user, message)
flash[:notice] = I18n.t('orders.finish.notice')
render :action => 'finished'
Expand Down
18 changes: 11 additions & 7 deletions app/views/orders/_finish.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@

- else
- will_send = true
%p
%i.icon-ok{style: 'color: green'}
= t('.confirm_end_send')
%br
%span{style: 'margin-top: 0; margin-left: 20px; color: #666; font-size: 80%;'}= @order.order_send_emails.join(', ')
%p
%label{for: 'send_order_contact'}= t '.label_contact'
- contact_info = [@current_user.name, @current_user.phone].reject(&:blank?).join(', ')
- contact_info = (params[:send_order_contact] or [@current_user.name, @current_user.phone].reject(&:blank?).join(', '))
= text_field_tag 'send_order_contact', contact_info, style: 'width: 100%', required: true
%p
%label{for: 'send_delivered_on'}= t '.label_delivered_on'
- delivered_on = params[:delivered_on]
- delivered_on ||= format_date(@order.pickup) if @order.pickup
= text_field_tag 'send_delivered_on', delivered_on, style: 'width: 100%', required: true
%label{for: 'send_order_comment'}= t '.label_note'
= text_area_tag 'send_order_comment', nil, {rows: 5, style: 'width: 100%'}
= text_area_tag 'send_order_comment', nil, {rows: 5, style: 'width: 100%; margin-bottom: 0.5em'}
%p
= t('.confirm_end_send')
%br
%span{style: 'margin-top: 0; color: #666; font-size: 80%;'}= @order.order_send_emails.join(', ')

.modal-footer
= link_to t('ui.cancel'), '#', class: 'btn', data: {dismiss: 'modal'}
Expand Down
3 changes: 2 additions & 1 deletion config/locales/zzz-foodcoop-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ en:
other: Other
orders:
finish:
confirm_end: Do you really want to close the order %{order}? There is no going back.
confirm_end: Do you really want to close the order? There is no going back.
confirm_end_send: The order will be sent to the supplier.
confirm_end_send_not: The order will be closed. It will not be sent to the supplier.
confirm_end_send_not_manual: The order will be closed. You do not need to send it to the supplier.
confirm_end_send_manual: To place the order, download the Fax in the following screen and send it to the supplier.
contact_person: Contact person
label_contact: Contact person (+phone)
label_delivered_on: Delivery day
label_note: 'If you like, you can enter a note for the supplier:'
submit_close: Close order
submit_send: Close & send order to supplier
Expand Down

0 comments on commit a6e2ba9

Please sign in to comment.