mirror of https://github.com/docusealco/docuseal
				
				
				
			
							parent
							
								
									41d3eaf582
								
							
						
					
					
						commit
						2f74caf16a
					
				| @ -1,6 +1,6 @@ | |||||||
| # frozen_string_literal: true | # frozen_string_literal: true | ||||||
| 
 | 
 | ||||||
| class EmailSettingsController < ApplicationController | class EmailSmtpSettingsController < ApplicationController | ||||||
|   before_action :load_encrypted_config |   before_action :load_encrypted_config | ||||||
|   authorize_resource :encrypted_config, only: :index |   authorize_resource :encrypted_config, only: :index | ||||||
|   authorize_resource :encrypted_config, parent: false, only: :create |   authorize_resource :encrypted_config, parent: false, only: :create | ||||||
| @ -0,0 +1,46 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
|  | class NotificationsSettingsController < ApplicationController | ||||||
|  |   before_action :load_bcc_config, only: :index | ||||||
|  |   before_action :load_reminder_config, only: :index | ||||||
|  |   authorize_resource :bcc_config, only: :index | ||||||
|  |   authorize_resource :reminder_config, only: :index | ||||||
|  | 
 | ||||||
|  |   before_action :build_account_config, only: :create | ||||||
|  |   authorize_resource :account_config, only: :create | ||||||
|  | 
 | ||||||
|  |   def index; end | ||||||
|  | 
 | ||||||
|  |   def create | ||||||
|  |     if @account_config.save | ||||||
|  |       redirect_back fallback_location: settings_notifications_path, notice: 'Changes have been saved' | ||||||
|  |     else | ||||||
|  |       redirect_back fallback_location: settings_notifications_path, alert: 'Unable to save' | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   private | ||||||
|  | 
 | ||||||
|  |   def build_account_config | ||||||
|  |     @account_config = | ||||||
|  |       AccountConfig.find_or_initialize_by(account: current_account, key: email_config_params[:key]) | ||||||
|  | 
 | ||||||
|  |     @account_config.assign_attributes(email_config_params) | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   def load_bcc_config | ||||||
|  |     @bcc_config = | ||||||
|  |       AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::BCC_EMAILS) | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   def load_reminder_config | ||||||
|  |     @reminder_config = | ||||||
|  |       AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::SUBMITTER_REMAILERS) | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   def email_config_params | ||||||
|  |     params.require(:account_config).permit!.tap do |attrs| | ||||||
|  |       attrs[:key] = nil unless attrs[:key].in?([AccountConfig::BCC_EMAILS, AccountConfig::SUBMITTER_REMAILERS]) | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
| @ -0,0 +1,19 @@ | |||||||
|  | <%= form_for config, url: settings_notifications_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %> | ||||||
|  |   <%= f.hidden_field :key %> | ||||||
|  |   <div class="form-control"> | ||||||
|  |     <%= f.label :value, class: 'label' do %> | ||||||
|  |       <span class="flex items-center space-x-1"> | ||||||
|  |         <span> | ||||||
|  |           Completed documents BCC address | ||||||
|  |         </span> | ||||||
|  |         <span class="tooltip" data-tip="Send email copy with completed documents to a specified BCC address."> | ||||||
|  |           <%= svg_icon('info_circle', class: 'w-4 h-4') %> | ||||||
|  |         </span> | ||||||
|  |       </span> | ||||||
|  |     <% end %> | ||||||
|  |     <%= f.email_field :value, autocomplete: 'off', class: 'base-input' %> | ||||||
|  |   </div> | ||||||
|  |   <div class="form-control pt-2"> | ||||||
|  |     <%= f.button button_title(title: 'Save', disabled_with: 'Updating'), class: 'base-button' %> | ||||||
|  |   </div> | ||||||
|  | <% end %> | ||||||
| @ -0,0 +1 @@ | |||||||
|  | <%= render 'reminder_placeholder' %> | ||||||
| @ -0,0 +1,29 @@ | |||||||
|  | <%= form_for config, url: settings_notifications_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %> | ||||||
|  |   <%= f.hidden_field :key %> | ||||||
|  |   <div class="form-control"> | ||||||
|  |     <% record = Struct.new(:first_duration, :second_duration, :third_duration).new(*(f.object.value || {}).values_at('first_duration', 'second_duration', 'third_duration')) %> | ||||||
|  |     <div class="flex space-x-4"> | ||||||
|  |       <div class="w-full"> | ||||||
|  |         <%= f.fields_for :value, record  do |ff| %> | ||||||
|  |           <%= ff.label :first_duration, 'First reminder in', class: 'label' %> | ||||||
|  |           <%= ff.select :first_duration, AccountConfigs::REMINDER_DURATIONS.invert, { include_blank: 'None' }, class: 'base-select' %> | ||||||
|  |         <% end %> | ||||||
|  |       </div> | ||||||
|  |       <div class="w-full"> | ||||||
|  |         <%= f.fields_for :value, record  do |ff| %> | ||||||
|  |           <%= ff.label :second_duration, 'Second reminder in', class: 'label' %> | ||||||
|  |           <%= ff.select :second_duration, AccountConfigs::REMINDER_DURATIONS.invert, { include_blank: 'None' }, class: 'base-select' %> | ||||||
|  |         <% end %> | ||||||
|  |       </div> | ||||||
|  |       <div class="w-full"> | ||||||
|  |         <%= f.fields_for :value, record  do |ff| %> | ||||||
|  |           <%= ff.label :third_duration, 'Third reminder in', class: 'label' %> | ||||||
|  |           <%= ff.select :third_duration, AccountConfigs::REMINDER_DURATIONS.invert, { include_blank: 'None' }, class: 'base-select' %> | ||||||
|  |         <% end %> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  |   <div class="form-control pt-4"> | ||||||
|  |     <%= f.button button_title(title: 'Save', disabled_with: 'Updating'), class: 'base-button' %> | ||||||
|  |   </div> | ||||||
|  | <% end %> | ||||||
| @ -0,0 +1,11 @@ | |||||||
|  | <div class="alert my-4"> | ||||||
|  |   <%= svg_icon('info_circle', class: 'w-6 h-6') %> | ||||||
|  |   <div> | ||||||
|  |     <p class="font-bold">Unlock with DocuSeal Pro</p> | ||||||
|  |     <p> | ||||||
|  |       Send automatic email reminders to your recipients. | ||||||
|  |       <br> | ||||||
|  |       <a class="link font-medium" target="_blank" href="<%= "#{Docuseal::CONSOLE_URL}/#{Docuseal.multitenant? ? 'plans' : 'on_premise'}" %>">Learn More</a> | ||||||
|  |     </p> | ||||||
|  |   </div> | ||||||
|  | </div> | ||||||
| @ -0,0 +1,14 @@ | |||||||
|  | <div class="flex flex-wrap space-y-4 md:flex-nowrap md:space-y-0"> | ||||||
|  |   <%= render 'shared/settings_nav' %> | ||||||
|  |   <div class="flex-grow max-w-xl mx-auto"> | ||||||
|  |     <h1 class="text-4xl font-bold mb-4">Email Notifications</h1> | ||||||
|  |     <%= render 'email_stats' %> | ||||||
|  |     <%= render 'bcc_form', config: @bcc_config %> | ||||||
|  |     <div class="flex justify-between items-end mb-4 mt-8"> | ||||||
|  |       <h2 class="text-3xl font-bold">Signature Email Reminders</h2> | ||||||
|  |     </div> | ||||||
|  |     <%= render 'reminder_banner' %> | ||||||
|  |     <%= render 'reminder_form', config: @reminder_config %> | ||||||
|  |   </div> | ||||||
|  |   <div class="w-0 md:w-52"></div> | ||||||
|  | </div> | ||||||
| @ -1,6 +1,7 @@ | |||||||
| queues: | queues: | ||||||
|   - [default, 1] |   - [default, 1] | ||||||
|   - [mailers, 1] |   - [mailers, 1] | ||||||
|  |   - [recurrent, 1] | ||||||
| 
 | 
 | ||||||
| production: | production: | ||||||
|   :concurrency: 15 |   :concurrency: 15 | ||||||
|  | |||||||
					Loading…
					
					
				
		Reference in new issue