feat(manager): schedule a dolist report from manager
This commit is contained in:
parent
1947fcf72b
commit
deb40caae1
4 changed files with 33 additions and 1 deletions
|
@ -1,4 +1,25 @@
|
||||||
module Manager
|
module Manager
|
||||||
class EmailEventsController < Manager::ApplicationController
|
class EmailEventsController < Manager::ApplicationController
|
||||||
|
def index
|
||||||
|
@dolist_enabled = Dolist::API.new.properly_configured?
|
||||||
|
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_dolist_report
|
||||||
|
email = current_super_admin.email
|
||||||
|
|
||||||
|
DolistReportJob.perform_later(email)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
@message = "Le rapport sera envoyé sur #{email}. Il peut prendre plus d'1h pour être généré."
|
||||||
|
|
||||||
|
format.turbo_stream
|
||||||
|
|
||||||
|
format.html do
|
||||||
|
redirect_to manager_email_events_path, notice: @message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
7
app/views/manager/email_events/_index_footer.html.erb
Normal file
7
app/views/manager/email_events/_index_footer.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<footer class="main-content__body">
|
||||||
|
<% if @dolist_enabled %>
|
||||||
|
<%= form_tag(generate_dolist_report_manager_email_events_path, id: "dolist-report-form", data: { turbo: true }) do %>
|
||||||
|
<button>Recevoir un rapport Dolist</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</footer>
|
|
@ -0,0 +1,2 @@
|
||||||
|
= turbo_stream.morph "dolist-report-form" do
|
||||||
|
= @message
|
|
@ -65,7 +65,9 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :team_accounts, only: [:index, :show]
|
resources :team_accounts, only: [:index, :show]
|
||||||
|
|
||||||
resources :email_events, only: [:index, :show]
|
resources :email_events, only: [:index, :show] do
|
||||||
|
post :generate_dolist_report, on: :collection
|
||||||
|
end
|
||||||
|
|
||||||
resources :dubious_procedures, only: [:index]
|
resources :dubious_procedures, only: [:index]
|
||||||
resources :outdated_procedures, only: [:index] do
|
resources :outdated_procedures, only: [:index] do
|
||||||
|
|
Loading…
Reference in a new issue