Save the timestamp of the last mail to supplier and confirm resending it
This commit is contained in:
parent
9a3ab1458e
commit
f509f85327
6 changed files with 13 additions and 2 deletions
|
@ -118,6 +118,7 @@ class OrdersController < ApplicationController
|
|||
def send_result_to_supplier
|
||||
order = Order.find(params[:id])
|
||||
Mailer.order_result_supplier(@current_user, order).deliver_now
|
||||
order.update!(last_sent_mail: Time.now)
|
||||
redirect_to order, notice: I18n.t('orders.send_to_supplier.notice')
|
||||
rescue => error
|
||||
redirect_to order, alert: I18n.t('errors.general_msg', :msg => error.message)
|
||||
|
|
|
@ -87,7 +87,9 @@
|
|||
= link_to t('.stock_order'), new_group_order_path(:order_id => @order.id, :stock_order => true), class: 'btn'
|
||||
= link_to t('ui.edit'), edit_order_path(@order), class: 'btn'
|
||||
- elsif not @order.closed? and not @order.stockit?
|
||||
= link_to t('.send_to_supplier'), send_result_to_supplier_order_path(@order), method: :post, class: 'btn btn-primary'
|
||||
= link_to t('.send_to_supplier'), send_result_to_supplier_order_path(@order), method: :post,
|
||||
class: "btn#{' btn-primary' unless @order.last_sent_mail}",
|
||||
data: {confirm: @order.last_sent_mail && t('.confirm_send_to_supplier', when: format_time(@order.last_sent_mail)) }
|
||||
= receive_button @order
|
||||
- unless @order.closed?
|
||||
= link_to t('ui.delete'), @order, data: {confirm: t('.confirm_delete')}, method: :delete,
|
||||
|
|
|
@ -1444,6 +1444,7 @@ de:
|
|||
confirm_end: |-
|
||||
Willst Du wirklich die Bestellung %{order} beenden?
|
||||
Es gibt kein zurück.
|
||||
confirm_send_to_supplier: Die Bestellung wurde bereit am %{when} zur Lieferantin geschickt. Willst du sie wirklich erneut schicken?
|
||||
create_invoice: Rechnung anlegen
|
||||
description1_order: "%{state} Bestellung von %{supplier} angelegt von %{who},"
|
||||
description1_period:
|
||||
|
|
|
@ -1454,6 +1454,7 @@ en:
|
|||
confirm_end: |-
|
||||
Do you really want to close the order %{order}?
|
||||
There is no going back.
|
||||
confirm_send_to_supplier: The order has been sent to the supplier already on %{when}. Do you really want to send it again?
|
||||
create_invoice: Add invoice
|
||||
description1_order: "%{state} order from %{supplier} opened by %{who},"
|
||||
description1_period:
|
||||
|
|
5
db/migrate/20171001000000_add_last_sent_mail_to_order.rb
Normal file
5
db/migrate/20171001000000_add_last_sent_mail_to_order.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddLastSentMailToOrder < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :orders, :last_sent_mail, :datetime
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170801000000) do
|
||||
ActiveRecord::Schema.define(version: 20171001000000) do
|
||||
|
||||
create_table "article_categories", force: :cascade do |t|
|
||||
t.string "name", limit: 255, default: "", null: false
|
||||
|
@ -243,6 +243,7 @@ ActiveRecord::Schema.define(version: 20170801000000) do
|
|||
t.datetime "boxfill"
|
||||
t.date "pickup"
|
||||
t.integer "invoice_id"
|
||||
t.datetime "last_sent_mail"
|
||||
end
|
||||
|
||||
add_index "orders", ["state"], name: "index_orders_on_state", using: :btree
|
||||
|
|
Loading…
Reference in a new issue