All checks were successful
		
		
	
	Run unit tests / copyright_notice (pull_request) Successful in 56s
				
			Run unit tests / rubocop (pull_request) Successful in 1m10s
				
			Run unit tests / check-licenses (pull_request) Successful in 1m20s
				
			Run unit tests / unit_tests (pull_request) Successful in 2m3s
				
			Run unit tests / build-static-assets (pull_request) Successful in 9m10s
				
			
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # Copyright (C) 2024-2025 LibreWeddingPlanner contributors
 | |
| 
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| class AdminMailer < ApplicationMailer
 | |
|   def attendance_change_email
 | |
|     @guest = Guest.find(params[:guest_id])
 | |
|     ActsAsTenant.with_tenant(@guest.wedding) do
 | |
|       mail(
 | |
|         to: recipients,
 | |
|         subject: I18n.t(
 | |
|           'admin_mailer.attendance_change_email.subject',
 | |
|           name: @guest.name,
 | |
|           status: I18n.t("active_record.attributes.guest/status.#{@guest.status}")
 | |
|         )
 | |
|       )
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   def invitations_pdf_email
 | |
|     ActsAsTenant.with_tenant(Wedding.find(params[:wedding_id])) do
 | |
|       invitations = Invitation.includes(:guests).all
 | |
| 
 | |
|       pdf_html = ActionController::Base.new.render_to_string(
 | |
|         template: 'invitations/sheet',
 | |
|         layout: 'pdf',
 | |
|         locals: { invitations: }
 | |
|       )
 | |
|       pdf = WickedPdf.new.pdf_from_string(pdf_html)
 | |
| 
 | |
|       attachments["invitations_#{Time.current.strftime('%Y%m%d_%H%M%S')}.pdf"] = pdf
 | |
| 
 | |
|       mail(
 | |
|         to: recipients,
 | |
|         subject: I18n.t('admin_mailer.invitations_pdf_email.subject')
 | |
|       )
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def recipients
 | |
|     ActsAsTenant.current_tenant.users.pluck(:email)
 | |
|   end
 | |
| end
 |