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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue