Class: InternalMailer
- Inherits:
-
ApplicationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- InternalMailer
- Includes:
- SendgridSmtpApi::InternalMailerHeaders
- Defined in:
- app/mailers/internal_mailer.rb
Constant Summary collapse
- PARTNER_DISPLAY_NAMES =
{ 'amazon_seller_central' => 'Amazon', 'amazon_vc_seller_api' => 'Amazon Vendor Central', 'mft_gateway_amazon_vc' => 'Amazon Vendor Central', 'commercehub_costco' => 'Costco', 'commercehub_thd' => 'Home Depot', 'commercehub_lowes' => "Lowe's", 'walmart_seller' => 'Walmart', 'wayfair' => 'Wayfair', 'houzz' => 'Houzz', 'mft_gateway_build_com' => 'Build.com', 'mft_gateway_canadian_tire' => 'Canadian Tire', 'mft_gateway_zoro_tools' => 'Zoro Tools', 'leroymerlin_adeo' => 'Leroy Merlin', 'castorama' => 'Castorama', 'bricodepot' => 'Brico Dépôt', 'bricomarche' => 'Bricomarché', 'leclerc' => 'Leclerc', 'maxeda' => 'Maxeda' }.freeze
- DAILY_FOCUS_CC =
%w[epasek@warmlyyours.com jbillen@warmlyyours.com mgodawa@warmlyyours.com].freeze
- DAILY_FOCUS_DIGEST_RECIPIENTS =
Consolidated manager digest (
DailyFocusManagerReportWorker); fixed list — not all sales_manager/sales_director roles. %w[ epasek@warmlyyours.com mgodawa@warmlyyours.com jbillen@warmlyyours.com srosenbaum@warmlyyours.com ].freeze
Instance Method Summary collapse
- #abandoned_cart_problems_alert(problems) ⇒ Object
- #activities_report ⇒ Object
- #address_type_issue_notification(delivery) ⇒ Object
-
#amazon_repricing_report(report_data) ⇒ Object
Sends a summary report after Amazon pricing automation runs.
- #amazon_seller_central_fba_ci_invoices_notification(invoices) ⇒ Object
- #amazon_seller_central_orders_notification(orders) ⇒ Object
- #auto_credit_increase_notification(customer, requested_amount, order = nil) ⇒ Object
- #auto_schema_extraction_report(report_data) ⇒ Object
- #back_order_notification(order) ⇒ Object
- #blog_comment(post_comment) ⇒ Object
- #call_statistics_report(date = nil) ⇒ Object
- #campaign_summary(campaign_emails) ⇒ Object
- #catalog_price_changes_alert(main_catalogs, other_catalogs) ⇒ Object
- #certification_expired(certification) ⇒ Object
- #certification_without_liability_insurance(certification) ⇒ Object
- #checks_approved_notification(payments) ⇒ Object
- #checks_pending_review_notification(payments) ⇒ Object
- #checks_ready_to_print_notification(payments) ⇒ Object
- #commercial_invoice_to_carrier(delivery) ⇒ Object
- #company_holiday_collision_notification(company_holiday, colliding_requests) ⇒ Object
- #confirm_quote_planning(rep, forecasts) ⇒ Object
- #contact_spanish_form(contact, form_params, upload) ⇒ Object
- #course_enrollment_exam(enrollment, passed) ⇒ Object
- #credit_increase_request(customer, requested_amount, reasons, order = nil) ⇒ Object
- #credit_limit_verification_denied_notification(customer, requested_amount, fail_reasons, quote = nil) ⇒ Object
- #credit_request_approved_notification(customer, requested_amount, order = nil) ⇒ Object
- #credit_request_denied_notification(customer, requested_amount, order = nil) ⇒ Object
- #customer_merge_complete(customer_master, user_email: nil, report: {}) ⇒ Object
- #cycle_counts_due(store) ⇒ Object
- #daily_account_activity_report ⇒ Object
- #daily_focus_approved(employee:, conversation:) ⇒ Object
- #daily_focus_digest(conversations:, recipient_emails:) ⇒ Object
- #daily_unprinted_checks_digest(payments) ⇒ Object
- #dealer_locator_communication_report(locator_records, activity_task) ⇒ Object
- #default_url_options ⇒ Object
- #delete_timeoff_event(event) ⇒ Object
- #delivery_automatic_release_failed_notification(delivery) ⇒ Object
- #delivery_automatically_released_notification(delivery) ⇒ Object
- #delivery_pre_pack_cancelled_notification(delivery, cancelled_by: nil) ⇒ Object
- #delivery_pre_packed_notification(delivery) ⇒ Object
- #dropship_delivery_notification(delivery) ⇒ Object
- #edi_orders_notification(orders, partner_name: nil) ⇒ Object
- #email_address_bounced_notification(communication_recipient) ⇒ Object
- #email_rmas_report(start_date, end_date) ⇒ Object
- #empty_promised_date_reminder(po_items) ⇒ Object
- #expired_liability_insurance_card(insurance) ⇒ Object
- #generic_mailer(options) ⇒ Object
- #google_calendar_reconnection_request(employee) ⇒ Object
- #inbound_email_processing_issues(failed_emails = nil) ⇒ Object
- #inventory_adjustment_notification(item_ledger_entries) ⇒ Object
- #inventory_commit_expiration_notification(resource) ⇒ Object
- #inventory_reorder_reminder(records) ⇒ Object
- #items_need_packaging_review_notification(item_ids) ⇒ Object
- #kpi_call_report(department, recipient) ⇒ Object
- #lead_email_report ⇒ Object
-
#legacy_review_link_clicked(link_type:, order_reference:, clicked_at:, request_ip: nil, user_agent: nil) ⇒ Object
Notifies team when a customer clicks a legacy review link from an old email This helps identify customers who need to be sent a new Reviews.io review request.
-
#llm_model_sync_report(report_data) ⇒ Object
Nightly LLM model sync report.
-
#low_stock_warning_advertised_products ⇒ Object
Sends a warning to digital marketing whenever stock is low on any product feed products to google.
- #manual_release_delivery_due_notification(delivery) ⇒ Object
- #marketing_cycle_counts_due(store) ⇒ Object
- #new_buying_group_created(buying_group) ⇒ Object
- #new_certification_request(certification) ⇒ Object
- #new_course_enrollment(enrollment) ⇒ Object
- #new_credit_application(credit_application) ⇒ Object
- #new_delivery_notification(delivery) ⇒ Object
- #new_liability_insurance_card(insurance) ⇒ Object
- #new_time_off_request(time_off_request) ⇒ Object
-
#new_work_schedule_request(work_schedule) ⇒ Object
TIME OFF RELATED ########.
- #new_work_schedule_state(work_schedule) ⇒ Object
- #notify_allocate_reward_to_complete(employee_review) ⇒ Object
- #notify_ar_of_edi_credit_limit_issue(edi_communication_log, msg: nil) ⇒ Object
- #notify_ar_of_new_receipt_created_from_edi_log(receipt, msg: nil) ⇒ Object
- #notify_edi_admin_of_edi_cancel(order, msg = nil) ⇒ Object
- #notify_edi_admin_of_error(edi_communication_log, msg: nil) ⇒ Object
- #notify_edi_admin_of_menard_inventory_error(error_message, item_count: 0) ⇒ Object
- #notify_edi_admin_of_mirakl_error(partner, category, msg) ⇒ Object
- #notify_edi_admin_of_order_status_mismatches(result) ⇒ Object
- #notify_edi_admin_of_warning(subj, msg) ⇒ Object
- #notify_menard_of_pending_discontinue(catalog_item, discontinue_date:, recipients:) ⇒ Object
- #notify_of_activity_assigned(party_assigned, activity) ⇒ Object
- #notify_process_reward_to_complete(employee_review) ⇒ Object
- #notify_sales_commission_to_pending_accounting_review(sales_commission_rep) ⇒ Object
- #notify_sales_commission_to_pending_pay_out(sales_commission_rep) ⇒ Object
- #notify_sales_commission_to_pending_rep_approval(sales_commission_rep) ⇒ Object
- #notify_sales_manager_of_drop_event(customer_drop_event) ⇒ Object
- #online_order_notification(order) ⇒ Object
- #opportunity_copy_complete(target_customer, new_opportunity, user_email: nil, report: {}) ⇒ Object
- #order_profit_review_notification(order) ⇒ Object
- #order_with_insuficient_payment(order) ⇒ Object
- #past_promised_date_reminder(store, po_items) ⇒ Object
- #payment_automatically_authorized(order) ⇒ Object
- #pending_time_off_requests(requests) ⇒ Object
-
#pending_work_schedules(work_schedules) ⇒ Object
def update_work_schedule(work_schedule) @employee = work_schedule.employee @work_schedule = work_schedule @changes = @work_schedule.changes_summary mail(from: 'Heatwave Team heatwaveteam@warmlyyours.com', to: @employee.manager.email, cc: @employee.email, subject: "Work Schedule Update Request for #@employee@employee.full_name") end.
- #plans_ready_to_be_relased(room_plans) ⇒ Object
- #praise_email(praise) ⇒ Object
- #presence_alert(employee_phone_status, report_type) ⇒ Object
-
#price_changed_alert(changes) ⇒ Object
CatalogItem::ScheduledPriceChanger will call this and report if any price changes occurred.
- #promo_item_sync_notification(results) ⇒ Object
- #pto_year_end_rollover(employee:, previous_year:, rollover_data:, non_accruing_leave: nil) ⇒ Object
- #quote_copy_complete(target_opportunity, new_quote, user_email: nil, report: {}) ⇒ Object
- #quote_profit_review_notification(quote) ⇒ Object
- #refurb_item_received(rma, item) ⇒ Object
- #release_authorization_required(order) ⇒ Object
-
#report_mailer(report_command) ⇒ Object
END TIME OFF RELATED ####.
- #request_approved(time_off_request) ⇒ Object
- #request_cancelled(time_off_request) ⇒ Object
- #request_carrier_assignment_notification(order) ⇒ Object
- #request_denied(time_off_request) ⇒ Object
- #review_budgets_alert(event) ⇒ Object
- #rma_needs_inspection(rma) ⇒ Object
- #rma_needs_review_notification(rma) ⇒ Object
- #rma_with_shipping_error_notification(rma) ⇒ Object
- #rmas_in_auto_return_review ⇒ Object
- #rmas_in_awaiting_inspection ⇒ Object
- #rmas_returned_and_need_attention_immediately ⇒ Object
- #rmas_with_credit_memos_not_transmitted_and_are_not_fullyoffset ⇒ Object
- #rmas_with_credit_memos_transmitted_and_are_not_fullyoffset ⇒ Object
- #same_day_design_complete(room_configuration) ⇒ Object
- #same_day_design_request(room_configuration) ⇒ Object
- #scheduler_auth_expired(employee, issues) ⇒ Object
- #scheduler_booking_cancelled(booking) ⇒ Object
- #scheduler_booking_host_notification(booking) ⇒ Object
- #scheduler_booking_reminder(booking, hours_before:) ⇒ Object
- #scheduler_booking_rescheduled(booking, old_starts_at:, old_timezone:) ⇒ Object
- #service_warranty_claim(support_case) ⇒ Object
-
#smart_service_confirmed_notification(support_case) ⇒ Object
def public_link_checker_catalog_item(missing_url, invalid_url) @missing_url = missing_url @invalid_url = invalid_url mail(from: 'Heatwave Team heatwaveteam@warmlyyours.com', to: 'epasek@warmlyyours.com;heatwaveteam@warmlyyours.com', subject: "Public Catalog Items missing URL on #Date.current.to_date") end.
- #smart_service_requested_notification(support_case) ⇒ Object
- #store_item_availability_timed_update(results, destination) ⇒ Object
- #survey_admin_check(survey_enrollment) ⇒ Object
- #survey_employee_notification(survey_enrollment) ⇒ Object
- #tax_exemption_expired(tax_exemption) ⇒ Object
- #tax_exemption_uploaded(tax_exemption) ⇒ Object
- #time_off_attempt(employee, date) ⇒ Object
- #time_off_request(event) ⇒ Object
-
#time_off_request_amount_mismatch(details) ⇒ Object
Alerts the team when a time off request has an amount mismatch This typically indicates a JavaScript race condition in the form submission.
- #time_off_update_alert(time_off) ⇒ Object
- #unable_to_deliver_rma_reminder(rma, communication) ⇒ Object
- #unpaid_invoices(invoices) ⇒ Object
- #work_schedule_update_alert(work_schedule) ⇒ Object
Methods included from SendgridSmtpApi::InternalMailerHeaders
Methods inherited from ApplicationMailer
Instance Method Details
#abandoned_cart_problems_alert(problems) ⇒ Object
112 113 114 115 116 117 118 |
# File 'app/mailers/internal_mailer.rb', line 112 def abandoned_cart_problems_alert(problems) @problems = problems mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'Heatwave Team <heatwaveteam@warmlyyours.com>', subject: 'Unable to send abandoned cart email') end |
#activities_report ⇒ Object
342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'app/mailers/internal_mailer.rb', line 342 def activities_report = {} [:date] = Date.current.to_date [:employee_ids] = [''] [:role_ids] = [''] @report_command = ::Report::ActivityPerformance::Command.new() @results = @report_command.execute mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'jbillen@warmlyyours.com;epasek@warmlyyours.com;srosenbaum@warmlyyours.com', cc: 'heatwaveteam@warmlyyours.com', subject: 'Activities Report') end |
#address_type_issue_notification(delivery) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/mailers/internal_mailer.rb', line 52 def address_type_issue_notification(delivery) @delivery = delivery @order = @delivery.order @address = @delivery.destination_address @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: ADMINISTRATOR_EMAIL, to: @rep.present? ? @rep.email_with_name : @customer.customer_service_manager.email_with_name, cc: delivery.customer.primary_sales_rep.try(:email), subject: "Order with a drop ship delivery awaiting PO transmission #{delivery.name}") end |
#amazon_repricing_report(report_data) ⇒ Object
Sends a summary report after Amazon pricing automation runs.
Reports on price increases, price decreases, and blocked price raises.
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 |
# File 'app/mailers/internal_mailer.rb', line 1461 def amazon_repricing_report(report_data) @report_data = report_data @processed_count = report_data[:processed_count] || 0 @price_increased_count = report_data[:price_increased_count] || 0 @price_lowered_count = report_data[:price_lowered_count] || 0 @flagged_count = report_data[:flagged_count] || 0 @blocked_by_external = report_data[:blocked_by_external] || [] @messages = report_data[:messages] || [] # Skip email if nothing significant happened return null_mail if @processed_count.zero? && @blocked_by_external.empty? # Only send if there were price changes or blocks return null_mail if @price_increased_count.zero? && @price_lowered_count.zero? && @blocked_by_external.empty? subject_parts = [] subject_parts << "#{@price_increased_count} raised" if @price_increased_count.positive? subject_parts << "#{@price_lowered_count} lowered" if @price_lowered_count.positive? subject_parts << "#{@blocked_by_external.size} blocked" if @blocked_by_external.any? subject = "Amazon Repricing Report: #{subject_parts.join(', ')}" mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'ediadmin@warmlyyours.com', cc: 'heatwaveteam@warmlyyours.com', subject: subject) end |
#amazon_seller_central_fba_ci_invoices_notification(invoices) ⇒ Object
798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'app/mailers/internal_mailer.rb', line 798 def amazon_seller_central_fba_ci_invoices_notification(invoices) return null_mail if invoices.blank? @invoices = invoices subject = "Amazon FBA Draft Invoices Created: #{@invoices.map(&:reference_number).join(', ')}" mail(from: 'Accounts Payable <ap@warmlyyours.com>', to: 'orders@warmlyyours.com;ap@warmlyyours.com', cc: 'ediadmin@warmlyyours.com', subject: subject) end |
#amazon_seller_central_orders_notification(orders) ⇒ Object
794 795 796 |
# File 'app/mailers/internal_mailer.rb', line 794 def amazon_seller_central_orders_notification(orders) edi_orders_notification(orders, partner_name: 'Amazon') end |
#auto_credit_increase_notification(customer, requested_amount, order = nil) ⇒ Object
847 848 849 850 851 852 853 854 855 856 857 |
# File 'app/mailers/internal_mailer.rb', line 847 def auto_credit_increase_notification(customer, requested_amount, order = nil) @customer = customer @billing_entity = customer.billing_entity @rep = customer.primary_sales_rep @requested_amount = requested_amount @order = order mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: 'ordernotifications@warmlyyours.com', subject: "Credit automatically increased for #{@customer.full_name}") end |
#auto_schema_extraction_report(report_data) ⇒ Object
1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 |
# File 'app/mailers/internal_mailer.rb', line 1438 def auto_schema_extraction_report(report_data) @report_data = report_data @articles_processed = report_data[:articles_processed] || 0 @errors = report_data[:errors] || 0 @total_articles = report_data[:total_articles] || 0 @message = report_data[:message] || 'No message provided' @processed_articles = report_data[:processed_articles] || [] @error_articles = report_data[:error_articles] || [] mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'Heatwave Team <heatwaveteam@warmlyyours.com>', subject: "Auto Schema Extraction Report - #{@articles_processed} articles processed") end |
#back_order_notification(order) ⇒ Object
694 695 696 697 698 699 700 701 702 703 |
# File 'app/mailers/internal_mailer.rb', line 694 def back_order_notification(order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: "#{ACCOUNTS_RECEIVABLE_EMAIL}, backorders@warmlyyours.com, ordernotifications@warmlyyours.com", cc: @rep&.email_with_name, subject: "Order #{@order.reference_number} went to back order state") end |
#blog_comment(post_comment) ⇒ Object
606 607 608 609 610 611 612 613 614 615 |
# File 'app/mailers/internal_mailer.rb', line 606 def blog_comment(post_comment) @post_comment = post_comment @post = @post_comment.post @user = @post_comment.user mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'blog_comments@warmlyyours.com', cc: @user.present? ? @user.try(:primary_sales_rep).try(:email) : nil, subject: "New Comment on Blog Post '#{@post.subject}'") end |
#call_statistics_report(date = nil) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'app/mailers/internal_mailer.rb', line 156 def call_statistics_report(date = nil) date ||= 1.working.day.ago.to_time = {} [:period1_gteq] = date.beginning_of_day [:period1_lteq] = date.end_of_day [:departments] = ['Accounting', 'Business Development', 'Customer Service', 'Sales', 'Tech Support', 'Warehouse'] [:employee_ids] = [] @result = Report::CallStatistics::Query.report() subject_dep = 'Inbound/Outbound calls per rep.' mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'call_report@warmlyyours.com', cc: 'heatwaveteam@warmlyyours.com', subject: subject_dep) end |
#campaign_summary(campaign_emails) ⇒ Object
1360 1361 1362 1363 1364 1365 1366 1367 1368 |
# File 'app/mailers/internal_mailer.rb', line 1360 def campaign_summary(campaign_emails) @campaign_emails = campaign_emails return null_mail if @campaign_emails.blank? mail(from: ADMINISTRATOR_EMAIL, to: "#{MARKETING_TEAM_EMAIL}, epasek@warmlyyours.com", cc: 'heatwaveteam@warmlyyours.com', subject: 'Heatwave Campaign Manager Monthly Summary') end |
#catalog_price_changes_alert(main_catalogs, other_catalogs) ⇒ Object
1381 1382 1383 1384 1385 1386 1387 1388 |
# File 'app/mailers/internal_mailer.rb', line 1381 def catalog_price_changes_alert(main_catalogs, other_catalogs) @main_catalogs = main_catalogs @other_catalogs = other_catalogs mail(from: ADMINISTRATOR_EMAIL, to: 'pricechangealerts@warmlyyours.com', cc: 'heatwaveteam@warmlyyours.com', subject: 'Catalog Price Changes') end |
#certification_expired(certification) ⇒ Object
1352 1353 1354 1355 1356 1357 1358 |
# File 'app/mailers/internal_mailer.rb', line 1352 def certification_expired(certification) @certification = certification rep = @certification.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "Certification expired for user #{@certification.party.full_name}") end |
#certification_without_liability_insurance(certification) ⇒ Object
1336 1337 1338 1339 1340 1341 1342 |
# File 'app/mailers/internal_mailer.rb', line 1336 def certification_without_liability_insurance(certification) @certification = certification rep = @certification.customer&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}, ap@warmlyyours.com", subject: "Issue with an active certification. Customer #{@certification.customer.reference_number}") end |
#checks_approved_notification(payments) ⇒ Object
940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 |
# File 'app/mailers/internal_mailer.rb', line 940 def checks_approved_notification(payments) @payments = Array(payments) return null_mail if @payments.blank? subject = if @payments.size == 1 payment = @payments.first "Check Approved: #{payment.reference_number} - #{payment.supplier.full_name}" else "#{@payments.size} Checks Approved" end mail(from: "Accounts Payable <#{ACCOUNTS_PAYABLE_EMAIL}>", to: "#{ACCOUNTS_PAYABLE_EMAIL}, heidegw@warmlyyours.com", subject: subject) end |
#checks_pending_review_notification(payments) ⇒ Object
909 910 911 912 913 914 915 916 917 918 |
# File 'app/mailers/internal_mailer.rb', line 909 def checks_pending_review_notification(payments) return null_mail if payments.blank? @payments = payments mail(from: "Accounts Payable <#{ACCOUNTS_PAYABLE_EMAIL}>", to: 'Julia Billen <jbillen@warmlyyours.com>, Venu Adepu <vadepu@warmlyyours.com>', cc: ACCOUNTS_PAYABLE_EMAIL, subject: 'New Checks Need Approval') end |
#checks_ready_to_print_notification(payments) ⇒ Object
920 921 922 923 924 925 926 927 928 |
# File 'app/mailers/internal_mailer.rb', line 920 def checks_ready_to_print_notification(payments) return null_mail if payments.blank? @payments = payments mail(from: 'Accounts Payable <apchecks@warmlyyours.com>', to: 'apchecks@warmlyyours.com', subject: 'New Checks Are Ready To Print') end |
#commercial_invoice_to_carrier(delivery) ⇒ Object
1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 |
# File 'app/mailers/internal_mailer.rb', line 1489 def commercial_invoice_to_carrier(delivery) # RlCarriers # On Tue, Dec 5, 2023 at 10:29 AM Dejanah Cassell <dejanah.cassell@rlcarriers.com> wrote: # I would say email them to transbordersolutiongroup@rlcarriers.com Thank you,Dejanah CassellTransborder/Partner RelationsR&L Carriers, Inc600 Gillam RdWilmington OH 45177888-575-2632 3290Fax : 937-655-3178 # Polaris Transport # On Sat, May 24, 2025 at 5:36AM Dennis Dmitrovic <DDmitrovic@polaristransport.com> wrote: # Hello, # Yes, send docs, in .PDF, under 5mb, with the P# in the subject line to "Customs" <customs@polaristransport.com>. Ensure the broker is listed on the docs and our OCR will read the docs and send the PARS package to the broker. I will only contact if an issue. # Dennis Dmitrovic Customs Clerk # TF: 1‑800‑409‑2269 # 7099 Torbram Road, Mississauga, Ontario, Canada L4T 1G7 # polaristransport.com @delivery = delivery @primary_rep = @delivery.order&.primary_sales_rep to = delivery.carrier_customs_email return unless to.present? identifiers = [] identifiers << "Pro Number: #{delivery.ltl_pro_number}" if delivery.ltl_pro_number.present? if delivery.freight_load_number.present? identifiers << "Load Number: #{delivery.freight_load_number}" elsif delivery.carrier_bol.present? identifiers << "BOL ID: #{delivery.carrier_bol}" end @identifier_string = identifiers.join(', ') ship_ci_pdf = delivery.ship_ci_pdf ["#{ship_ci_pdf.}"] = ship_ci_pdf..data mail(from: 'WarmlyYours Shipping <api.shipping@warmlyyours.com>', to: to, cc: [delivery.customer.primary_sales_rep.try(:email), 'hwinings@warmlyyours.com ', 'vadepu@warmlyyours.com', 'api.shipping@warmlyyours.com'].compact.join(';'), subject: "Customs documents for #{@identifier_string}") end |
#company_holiday_collision_notification(company_holiday, colliding_requests) ⇒ Object
570 571 572 573 574 575 576 577 578 579 580 |
# File 'app/mailers/internal_mailer.rb', line 570 def company_holiday_collision_notification(company_holiday, colliding_requests) @company_holiday = company_holiday @colliding_requests = colliding_requests @company = company_holiday.company mail( from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'heatwaveteam@warmlyyours.com;vadepu@warmlyyours.com', subject: "Company Holiday Created: Time Off Requests Need Review (#{@company_holiday.holiday_name})" ) end |
#confirm_quote_planning(rep, forecasts) ⇒ Object
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 |
# File 'app/mailers/internal_mailer.rb', line 1218 def confirm_quote_planning(rep, forecasts) return null_mail if forecasts.blank? @rep = rep @forecasts = forecasts mail(from: ACCOUNTS_PAYABLE_EMAIL, to: @rep.email_with_name, cc: ACCOUNTS_PAYABLE_EMAIL, subject: 'Quote Stock Reservation Reminder') end |
#contact_spanish_form(contact, form_params, upload) ⇒ Object
1209 1210 1211 1212 1213 1214 1215 1216 |
# File 'app/mailers/internal_mailer.rb', line 1209 def contact_spanish_form(contact, form_params, upload) @upload = upload @contact = contact @content = form_params mail(from: ADMINISTRATOR_EMAIL, to: 'info+en+espanol@warmlyyours.com', subject: 'New contact through spanish form') end |
#course_enrollment_exam(enrollment, passed) ⇒ Object
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
# File 'app/mailers/internal_mailer.rb', line 1304 def course_enrollment_exam(enrollment, passed) @course_enrollment = enrollment @status = (passed ? 'passed' : 'failed') if @course_enrollment.party.is_a?(Contact) rep = @course_enrollment.party.customer.primary_rep elsif @course_enrollment.party.is_a?(Customer) rep = @course_enrollment.party.primary_rep else # This shouldn't happen. Investigate. ErrorReporting.error("Course exam email error. Expecting contact or customer. Got #{@course_enrollment.party.class}") end mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "New course exam taken and #{@status}. Enrollment #{@course_enrollment.id}") end |
#credit_increase_request(customer, requested_amount, reasons, order = nil) ⇒ Object
859 860 861 862 863 864 865 866 867 868 869 870 |
# File 'app/mailers/internal_mailer.rb', line 859 def credit_increase_request(customer, requested_amount, reasons, order = nil) @customer = customer @rep = customer.primary_sales_rep @requested_amount = requested_amount @order = order @reasons = reasons mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: 'ordernotifications@warmlyyours.com', cc: @rep&.email_with_name, subject: "FAILED Credit increase request for #{@customer.full_name}") end |
#credit_limit_verification_denied_notification(customer, requested_amount, fail_reasons, quote = nil) ⇒ Object
896 897 898 899 900 901 902 903 904 905 906 907 |
# File 'app/mailers/internal_mailer.rb', line 896 def credit_limit_verification_denied_notification(customer, requested_amount, fail_reasons, quote = nil) @customer = customer @rep = customer.primary_sales_rep @requested_amount = requested_amount @fail_reasons = fail_reasons @quote = quote mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : @customer.customer_service_manager.email_with_name, cc: 'ordernotifications@warmlyyours.com', subject: "Credit limit check for #{@customer.full_name}") end |
#credit_request_approved_notification(customer, requested_amount, order = nil) ⇒ Object
872 873 874 875 876 877 878 879 880 881 882 |
# File 'app/mailers/internal_mailer.rb', line 872 def credit_request_approved_notification(customer, requested_amount, order = nil) @customer = customer @rep = customer.primary_sales_rep @requested_amount = requested_amount @order = order mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : @customer.customer_service_manager.email_with_name, cc: 'ordernotifications@warmlyyours.com', subject: "APPROVED Credit increase request for #{@customer.full_name}") end |
#credit_request_denied_notification(customer, requested_amount, order = nil) ⇒ Object
884 885 886 887 888 889 890 891 892 893 894 |
# File 'app/mailers/internal_mailer.rb', line 884 def credit_request_denied_notification(customer, requested_amount, order = nil) @customer = customer @rep = customer.primary_sales_rep @requested_amount = requested_amount @order = order mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : @customer.customer_service_manager.email_with_name, cc: 'ordernotifications@warmlyyours.com', subject: "Credit request for #{@customer.full_name} has been denied") end |
#customer_merge_complete(customer_master, user_email: nil, report: {}) ⇒ Object
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 |
# File 'app/mailers/internal_mailer.rb', line 1173 def customer_merge_complete(customer_master, user_email: nil, report: {}) user_email ||= 'heatwaveteam@warmlyyours.com' @customer_master = customer_master @report = report if @report[:customer_errors].blank? && @report[:execution_errors].blank? [user_email, @customer_master.primary_sales_rep&.email].compact.uniq.join(',') mail(from: user_email, to: user_email, subject: "Merge Complete: #{@customer_master} #{@customer_master.full_name}") else mail(from: user_email, to: 'heatwaveteam@warmlyyours.com', cc: user_email, subject: 'Merge Failed') end end |
#cycle_counts_due(store) ⇒ Object
632 633 634 635 636 637 638 |
# File 'app/mailers/internal_mailer.rb', line 632 def cycle_counts_due(store) @cycle_counts = store.cycle_counts.where(state: 'draft', marketing_only: false) mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: store.id == 2 ? 'warehousecanada@warmlyyours.com' : 'warehouseusa@warmlyyours.com', subject: 'You Have Inventory Cycle Counts Due') end |
#daily_account_activity_report ⇒ Object
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'app/mailers/internal_mailer.rb', line 280 def daily_account_activity_report report = AccountDailyActivityReport.for_scheduled_run @report_date = report.date @report_rolling_hours = report.rolling_hours @window_start = report.window_start @window_end = report.window_end created = report.accounts_created_by_group @accounts_created_www = created[:www] @accounts_created_crm = created[:crm] @accounts_created_other = created[:other] @login_events_by_group = report.login_events_by_group subject = if @report_rolling_hours "Account activity — last #{@report_rolling_hours}h (America/Chicago)" else "Daily account activity — #{@report_date.strftime('%Y-%m-%d')} (America/Chicago)" end mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'sysadmin@warmlyyours.com', subject: subject) end |
#daily_focus_approved(employee:, conversation:) ⇒ Object
1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 |
# File 'app/mailers/internal_mailer.rb', line 1648 def daily_focus_approved(employee:, conversation:) @employee = employee @conversation = conversation raw_content = conversation. .where(role: 'assistant') .order(:id) .last &.content @analysis_html = (Assistant::ResponseFormatter.new(raw_content).format if raw_content.present?) mail( from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.email, cc: DAILY_FOCUS_CC, subject: "Your Daily Focus for #{Date.current.strftime('%A, %B %-d')} is ready" ) end |
#daily_focus_digest(conversations:, recipient_emails:) ⇒ Object
1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
# File 'app/mailers/internal_mailer.rb', line 1606 def daily_focus_digest(conversations:, recipient_emails:) @conversations = conversations @date = Date.current @crm_host = CRM_HOSTNAME mail( to: recipient_emails, subject: "Daily Focus Digest — #{@date.strftime('%A, %B %-d, %Y')} (#{conversations.size} reps)" ) end |
#daily_unprinted_checks_digest(payments) ⇒ Object
930 931 932 933 934 935 936 937 938 |
# File 'app/mailers/internal_mailer.rb', line 930 def daily_unprinted_checks_digest(payments) return null_mail if payments.blank? @payments = payments mail(from: 'Accounts Payable <apchecks@warmlyyours.com>', to: %w[heidegw@warmlyyours.com ap@warmlyyours.com], subject: "Daily Unprinted Checks Digest – #{@payments.size} pending") end |
#dealer_locator_communication_report(locator_records, activity_task) ⇒ Object
303 304 305 306 307 308 309 310 |
# File 'app/mailers/internal_mailer.rb', line 303 def dealer_locator_communication_report(locator_records, activity_task) @locator_records = locator_records @activity_task = activity_task mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'epasek@warmlyyours.com', cc: 'heatwaveteam@warmlyyours.com', subject: "Locator Record: #{activity_task}") end |
#default_url_options ⇒ Object
20 21 22 |
# File 'app/mailers/internal_mailer.rb', line 20 def UrlHelper.({ host: CRM_HOSTNAME }) end |
#delete_timeoff_event(event) ⇒ Object
413 414 415 416 417 418 419 420 421 |
# File 'app/mailers/internal_mailer.rb', line 413 def delete_timeoff_event(event) @event = event @employee = @event.employee @time_off = @employee.employee_time_offs.where(year: @event.date.year).last mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.employee_events_email_settings.collect { |es| Employee.find(es.receiver_id).email unless es.receiver_id.nil? }.join(';').to_s, cc: "#{Employee.find(@event.employee_id).email};vadepu@warmlyyours.com", subject: "DELETED #{@event.status.humanize} request for #{Employee.find(@event.employee_id).full_name}") end |
#delivery_automatic_release_failed_notification(delivery) ⇒ Object
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
# File 'app/mailers/internal_mailer.rb', line 1038 def delivery_automatic_release_failed_notification(delivery) @delivery = delivery @order = delivery.order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : 'orders@warmlyyours.com', cc: 'orders@warmlyyours.com, heatwaveteam@warmlyyours.com', subject: "Order #{@order.reference_number} Delivery #{@delivery.id} automatic release FAILED") end |
#delivery_automatically_released_notification(delivery) ⇒ Object
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 |
# File 'app/mailers/internal_mailer.rb', line 1026 def delivery_automatically_released_notification(delivery) @delivery = delivery @order = delivery.order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : 'orders@warmlyyours.com', cc: 'orders@warmlyyours.com', subject: "Future Ship RELEASED #{@order.reference_number} - #{@customer}") end |
#delivery_pre_pack_cancelled_notification(delivery, cancelled_by: nil) ⇒ Object
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 |
# File 'app/mailers/internal_mailer.rb', line 734 def delivery_pre_pack_cancelled_notification(delivery, cancelled_by: nil) @delivery = delivery @quote_or_order = @delivery.order || @delivery.quote @customer = @quote_or_order.customer @cancelled_by = cancelled_by @primary_rep = @quote_or_order.primary_sales_rep warehouse_email = case @delivery.store&.id when 1 then 'warehouseusa@warmlyyours.com' when 2 then 'warehousecanada@warmlyyours.com' end recipients = [warehouse_email] if @primary_rep recipients << "#{@primary_rep.full_name} <#{@primary_rep.email}>" elsif @delivery.prepack_requester recipients << "#{@delivery.prepack_requester.try(:name)} <#{@delivery.prepack_requester.try(:email)}>" end recipients << 'Orders <orders@warmlyyours.com>' if recipients.compact_blank.empty? mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: recipients.compact_blank.join(', '), subject: "CANCELLED: Pre-pack for Delivery #{@delivery.name}") end |
#delivery_pre_packed_notification(delivery) ⇒ Object
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
# File 'app/mailers/internal_mailer.rb', line 715 def delivery_pre_packed_notification(delivery) @delivery = delivery @quote_or_order = @delivery.order || @delivery.quote @customer = @quote_or_order.customer @rma = @delivery.order&.rma @primary_rep = @quote_or_order.primary_sales_rep to = if @primary_rep "#{@primary_rep.full_name} <#{@primary_rep.email}>" elsif @delivery.prepack_requester "#{@delivery.prepack_requester.try(:name)} <#{@delivery.prepack_requester.try(:email)}>" else 'Orders <orders@warmlyyours.com>' end mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: to, subject: "Delivery #{@delivery.name} packaging has been estimated by warehouse") end |
#dropship_delivery_notification(delivery) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/mailers/internal_mailer.rb', line 32 def dropship_delivery_notification(delivery) @order = delivery.order @delivery = delivery mail(from: ADMINISTRATOR_EMAIL, to: ORDERS_EMAIL, cc: delivery.customer.primary_sales_rep.try(:email), subject: "Order with a drop ship delivery awaiting PO transmission #{delivery.name}") end |
#edi_orders_notification(orders, partner_name: nil) ⇒ Object
811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
# File 'app/mailers/internal_mailer.rb', line 811 def edi_orders_notification(orders, partner_name: nil) return null_mail if orders.blank? @orders = orders @partner_name = partner_name || edi_partner_display_name(@orders.first&.edi_orchestrator_partner) subject = "#{@partner_name} Orders Imported into Heatwave: #{@orders.map(&:reference_number).join(', ')}" mail(from: 'Order Notifications <orders@warmlyyours.com>', to: 'orders@warmlyyours.com', cc: 'ediadmin@warmlyyours.com', subject: subject, template_name: 'edi_orders_notification') end |
#email_address_bounced_notification(communication_recipient) ⇒ Object
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 |
# File 'app/mailers/internal_mailer.rb', line 976 def email_address_bounced_notification(communication_recipient) @communication = communication_recipient.communication @email_address = communication_recipient.detail @reason = communication_recipient.state_response sender = @communication.sender_party&.email || @communication.sender @customer = communication_recipient.contact_point.try(:party).try(:customer) @rep = @customer&.primary_sales_rep notify_emails = [sender, @rep&.email].compact.uniq notify_emails << @customer.customer_service_manager.email_with_name if notify_emails.empty? && @customer return null_mail if notify_emails.blank? mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: notify_emails.uniq.join(','), subject: "Email communication bounced for #{@email_address}") end |
#email_rmas_report(start_date, end_date) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'app/mailers/internal_mailer.rb', line 172 def email_rmas_report(start_date, end_date) = {} [:period1_gteq] = start_date [:period1_lteq] = end_date [:company_id] = [] [:customer_ids] = [] [:product_lines] = [] [:report_groupings] = [] [:is_email] = true @result = Report::RmasReport::RmasReport.result() mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'jbillen@warmlyyours.com', cc: 'srosenbaum@warmlyyours.com;heatwaveteam@warmlyyours.com', subject: 'RMAs monthly report') end |
#empty_promised_date_reminder(po_items) ⇒ Object
1238 1239 1240 1241 1242 1243 1244 1245 |
# File 'app/mailers/internal_mailer.rb', line 1238 def empty_promised_date_reminder(po_items) return null_mail if po_items.blank? @po_items = po_items.group_by { |poi| poi.purchase_order } mail(from: "Accounts Payable <#{ACCOUNTS_PAYABLE_EMAIL}>", to: ACCOUNTS_PAYABLE_EMAIL, subject: 'POs With Empty Promised Date Found') end |
#expired_liability_insurance_card(insurance) ⇒ Object
1328 1329 1330 1331 1332 1333 1334 |
# File 'app/mailers/internal_mailer.rb', line 1328 def expired_liability_insurance_card(insurance) @liability_insurance = insurance rep = @liability_insurance.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}, ap@warmlyyours.com", subject: "Expired Liability Insurance card. Customer #{@liability_insurance.customer.reference_number}") end |
#generic_mailer(options) ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/mailers/internal_mailer.rb', line 24 def generic_mailer() @subject = [:subject] || 'No Subject' @body = [:body] || 'Empty' [:from] ||= ADMINISTRATOR_EMAIL [:to] ||= ADMINISTRATOR_EMAIL mail() end |
#google_calendar_reconnection_request(employee) ⇒ Object
536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'app/mailers/internal_mailer.rb', line 536 def google_calendar_reconnection_request(employee) @employee = employee @reconnect_url = Rails.application.routes.url_helpers.user_time_off_url( @employee, host: CRM_HOSTNAME, protocol: 'https' ) mail( to: @employee.email, subject: 'Action Required: Reconnect Your Google Calendar' ) end |
#inbound_email_processing_issues(failed_emails = nil) ⇒ Object
120 121 122 123 124 125 126 |
# File 'app/mailers/internal_mailer.rb', line 120 def inbound_email_processing_issues(failed_emails = nil) @failed_emails = failed_emails || ActionMailbox::InboundEmail.where(status: 'failed') mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'Heatwave Team <heatwaveteam@warmlyyours.com>', subject: 'Inbound Email Processing Issues') end |
#inventory_adjustment_notification(item_ledger_entries) ⇒ Object
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 |
# File 'app/mailers/internal_mailer.rb', line 1003 def inventory_adjustment_notification(item_ledger_entries) item_ledger_entries = [item_ledger_entries].flatten.compact.uniq return null_mail if item_ledger_entries.blank? @item_ledger_entries = item_ledger_entries mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'ap@warmlyyours.com', subject: 'Inventory adjustment alert') end |
#inventory_commit_expiration_notification(resource) ⇒ Object
992 993 994 995 996 997 998 999 1000 1001 |
# File 'app/mailers/internal_mailer.rb', line 992 def inventory_commit_expiration_notification(resource) @resource = resource @resource_class = resource.class.to_s @customer = @resource.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : 'orders@warmlyyours.com', subject: "#{@resource_class} #{@resource.reference_number} inventory reservation has expired") end |
#inventory_reorder_reminder(records) ⇒ Object
1229 1230 1231 1232 1233 1234 1235 1236 |
# File 'app/mailers/internal_mailer.rb', line 1229 def inventory_reorder_reminder(records) return null_mail if records.blank? @records = records mail(from: "Accounts Payable <#{ACCOUNTS_PAYABLE_EMAIL}>", to: ACCOUNTS_PAYABLE_EMAIL, subject: 'Stock Replenishment Reminder') end |
#items_need_packaging_review_notification(item_ids) ⇒ Object
1420 1421 1422 1423 1424 1425 1426 1427 |
# File 'app/mailers/internal_mailer.rb', line 1420 def items_need_packaging_review_notification(item_ids) @items = Item.where(id: item_ids) return null_mail if @items.blank? mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'warehouseusa@warmlyyours.com, warehousecanada@warmlyyours.com', subject: 'Items that need weight review') end |
#kpi_call_report(department, recipient) ⇒ Object
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'app/mailers/internal_mailer.rb', line 233 def kpi_call_report(department, recipient) end_date = Date.current - 3 start_date = end_date.beginning_of_week = {} [:period1_gteq] = start_date [:period1_lteq] = end_date [:departments] = [department] [:employee_ids] = [] @result = Report::KpiCall::KpiCall.result_report() subject_dep = ('KPI Call Report ' + department) mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: recipient, cc: 'jbillen@warmlyyours.com;epasek@warmlyyours.com;mgodawa@warmlyyours.com', subject: subject_dep) end |
#lead_email_report ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'app/mailers/internal_mailer.rb', line 250 def lead_email_report date = Date.current - 3 sql = <<-SQL select timezone('America/Chicago', a.created_at)::date, c.id as customer_id, 'CN' || c.id::varchar as customer_number, c.full_name as customer_name, c.state as customer_state, s.full_name as visit_source_name, at.task_type as lead_activity_type, v.id as visit_id, a.id as activity_id from activities a inner join visits v on v.id = a.visit_id left join sources s on s.id = v.source_id inner join activity_types at on at.id = a.activity_type_id inner join parties c on c.id = a.customer_id where at.task_type LIKE 'LEAD%' and timezone('America/Chicago', a.created_at)::date = '#{date}' order by a.created_at desc SQL @result = ActiveRecord::Base.connection.execute(sql).to_a.map { |r| r.symbolize_keys } mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'jbillen@warmlyyours.com;', subject: 'Leads Created Yesterday') end |
#legacy_review_link_clicked(link_type:, order_reference:, clicked_at:, request_ip: nil, user_agent: nil) ⇒ Object
Notifies team when a customer clicks a legacy review link from an old email
This helps identify customers who need to be sent a new Reviews.io review request
373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'app/mailers/internal_mailer.rb', line 373 def legacy_review_link_clicked(link_type:, order_reference:, clicked_at:, request_ip: nil, user_agent: nil) @link_type = link_type @order_reference = order_reference @clicked_at = clicked_at @request_ip = request_ip @user_agent = user_agent @order = Order.find_by(reference_number: order_reference) if order_reference.present? mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'heatwaveteam@warmlyyours.com', subject: "Legacy Review Link Clicked - Order #{order_reference || 'Unknown'}") end |
#llm_model_sync_report(report_data) ⇒ Object
Nightly LLM model sync report.
Always sent after DailyLlmModelSyncWorker runs.
Includes a stale-defaults action item when LlmDefaults constants are behind.
1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 |
# File 'app/mailers/internal_mailer.rb', line 1538 def llm_model_sync_report(report_data) @models_total = report_data[:models_total] @models_added = report_data[:models_added] @new_models = report_data[:new_models] || [] @synced_at = report_data[:synced_at] @stale_defaults = report_data[:stale_defaults] || {} @unavailable_models = report_data[:unavailable_models] || {} issue_count = @stale_defaults.size + @unavailable_models.size subject = if issue_count > 0 "⚠️ LLM Model Sync — #{issue_count} issue(s) need attention" else "✅ LLM Model Sync — #{@models_total} models, all constants current" end mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'Heatwave Team <heatwaveteam@warmlyyours.com>', subject: subject) end |
#low_stock_warning_advertised_products ⇒ Object
Sends a warning to digital marketing whenever stock is low on any
product feed products to google
1265 1266 1267 1268 1269 1270 1271 1272 1273 |
# File 'app/mailers/internal_mailer.rb', line 1265 def low_stock_warning_advertised_products @low_stock_items = Query::CatalogItemQuery.new.low_stock_for_google_feed return null_mail if @low_stock_items.blank? mail(from: 'Digital Marketing <digitalmarketing@warmlyyours.com>', to: 'Digital Marketing <digitalmarketing@warmlyyours.com>', subject: "Low stock alert for google merchant feed (#{@low_stock_items.size})") end |
#manual_release_delivery_due_notification(delivery) ⇒ Object
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
# File 'app/mailers/internal_mailer.rb', line 1014 def manual_release_delivery_due_notification(delivery) @delivery = delivery @order = delivery.order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : 'orders@warmlyyours.com', cc: 'orders@warmlyyours.com', subject: "Future Ship PAST DUE #{@order.reference_number} - #{@customer}") end |
#marketing_cycle_counts_due(store) ⇒ Object
640 641 642 643 644 645 646 |
# File 'app/mailers/internal_mailer.rb', line 640 def marketing_cycle_counts_due(store) @cycle_counts = store.cycle_counts.where(state: 'draft', marketing_only: true) mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: store.id == 2 ? 'warehousecanada@warmlyyours.com' : 'marketingcyclecounts@warmlyyours.com', subject: "You Have Marketing Inventory Cycle Counts Due For #{store.name}") end |
#new_buying_group_created(buying_group) ⇒ Object
625 626 627 628 629 630 |
# File 'app/mailers/internal_mailer.rb', line 625 def () @buying_group = mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'epasek@warmlyyours.com', subject: "New Buying Group Needs Review - #{@buying_group.name}") end |
#new_certification_request(certification) ⇒ Object
1344 1345 1346 1347 1348 1349 1350 |
# File 'app/mailers/internal_mailer.rb', line 1344 def new_certification_request(certification) @certification = certification rep = @certification.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "New Certification request for user #{@certification.party.full_name}") end |
#new_course_enrollment(enrollment) ⇒ Object
1296 1297 1298 1299 1300 1301 1302 |
# File 'app/mailers/internal_mailer.rb', line 1296 def new_course_enrollment(enrollment) @course_enrollment = enrollment rep = @course_enrollment.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "New Course Enrollment #{@course_enrollment.id}") end |
#new_credit_application(credit_application) ⇒ Object
617 618 619 620 621 622 623 |
# File 'app/mailers/internal_mailer.rb', line 617 def new_credit_application(credit_application) @credit_application = credit_application mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'ar@warmlyyours.com', subject: "New Credit Application Received #{@credit_application.reference_number}") end |
#new_delivery_notification(delivery) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'app/mailers/internal_mailer.rb', line 41 def new_delivery_notification(delivery) @store = delivery.store @delivery = delivery emails = @store.order_notification_emails.map(&:presence).uniq.compact return unless emails.present? mail(from: ORDERS_EMAIL, to: emails, subject: "Order with a drop ship delivery awaiting PO transmission #{delivery.name}") end |
#new_liability_insurance_card(insurance) ⇒ Object
1320 1321 1322 1323 1324 1325 1326 |
# File 'app/mailers/internal_mailer.rb', line 1320 def new_liability_insurance_card(insurance) @liability_insurance = insurance rep = @liability_insurance.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}, ap@warmlyyours.com", subject: "New Liability Insurance card uploaded. Customer #{@liability_insurance.customer.reference_number}") end |
#new_time_off_request(time_off_request) ⇒ Object
502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'app/mailers/internal_mailer.rb', line 502 def new_time_off_request(time_off_request) @time_off_request = time_off_request @employee = @time_off_request.employee notification_recipients = @time_off_request.notification_recipients.join(';') @employee_email = @employee.email mail( to: notification_recipients, cc: "#{@employee_email}", subject: "New Time Off Request: #{@time_off_request.employee.name}" ) end |
#new_work_schedule_request(work_schedule) ⇒ Object
TIME OFF RELATED ########
462 463 464 465 466 467 468 |
# File 'app/mailers/internal_mailer.rb', line 462 def new_work_schedule_request(work_schedule) @employee = work_schedule.employee @work_schedule = work_schedule mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.manager.email, subject: "New Work Schedule pending Approval for #{@employee.full_name}") end |
#new_work_schedule_state(work_schedule) ⇒ Object
470 471 472 473 474 475 476 |
# File 'app/mailers/internal_mailer.rb', line 470 def new_work_schedule_state(work_schedule) @employee = work_schedule.employee @work_schedule = work_schedule mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.email, subject: "Your Work Schedule has been #{@work_schedule.state.titleize}") end |
#notify_allocate_reward_to_complete(employee_review) ⇒ Object
1050 1051 1052 1053 1054 1055 1056 1057 |
# File 'app/mailers/internal_mailer.rb', line 1050 def notify_allocate_reward_to_complete(employee_review) @employee_review = employee_review @review_date = @employee_review.updated_at @salutation = employee_review.employee_record.party.first_name sender = @employee_review.reviewer_email recipient = @employee_review.employee_email mail(from: sender, to: recipient, cc: 'charity@warmlyyours.com', subject: 'Please complete the reward allocation for your review') end |
#notify_ar_of_edi_credit_limit_issue(edi_communication_log, msg: nil) ⇒ Object
1130 1131 1132 1133 1134 1135 1136 |
# File 'app/mailers/internal_mailer.rb', line 1130 def notify_ar_of_edi_credit_limit_issue(edi_communication_log, msg: nil) sender = 'ediadmin@warmlyyours.com' recipient = 'ar@warmlyyours.com' @edi_communication_log = edi_communication_log @msg = msg mail(from: sender, to: recipient, subject: "EDI Order Could Not Be Processed Due To Credit Limit #{@edi_communication_log.partner} #{@edi_communication_log.category}") end |
#notify_ar_of_new_receipt_created_from_edi_log(receipt, msg: nil) ⇒ Object
1164 1165 1166 1167 1168 1169 1170 1171 |
# File 'app/mailers/internal_mailer.rb', line 1164 def notify_ar_of_new_receipt_created_from_edi_log(receipt, msg: nil) sender = 'ediadmin@warmlyyours.com' recipient = 'ar@warmlyyours.com' @receipt = receipt @customer = Customer.find(@receipt.customer_id) @msg = msg mail(from: sender, to: recipient, subject: "Manual attention required to Receipt #{@receipt.id}") end |
#notify_edi_admin_of_edi_cancel(order, msg = nil) ⇒ Object
1138 1139 1140 1141 1142 1143 1144 |
# File 'app/mailers/internal_mailer.rb', line 1138 def notify_edi_admin_of_edi_cancel(order, msg = nil) sender = 'ediadmin@warmlyyours.com' recipient = 'ediadmin@warmlyyours.com' @order = order @msg = msg mail(from: sender, to: recipient, subject: "EDI Order Cancellation #{order.reference_number}") end |
#notify_edi_admin_of_error(edi_communication_log, msg: nil) ⇒ Object
1107 1108 1109 1110 1111 1112 1113 |
# File 'app/mailers/internal_mailer.rb', line 1107 def notify_edi_admin_of_error(edi_communication_log, msg: nil) sender = 'ediadmin@warmlyyours.com' recipient = 'ediadmin@warmlyyours.com' @edi_communication_log = edi_communication_log @msg = msg mail(from: sender, to: recipient, subject: "EDI Processing Error #{@edi_communication_log.partner} #{@edi_communication_log.category}") end |
#notify_edi_admin_of_menard_inventory_error(error_message, item_count: 0) ⇒ Object
1146 1147 1148 1149 1150 1151 1152 |
# File 'app/mailers/internal_mailer.rb', line 1146 def notify_edi_admin_of_menard_inventory_error(, item_count: 0) sender = 'ediadmin@warmlyyours.com' recipient = 'ediadmin@warmlyyours.com' @error_message = @item_count = item_count mail(from: sender, to: recipient, subject: 'Menard Inventory Upload Failed') end |
#notify_edi_admin_of_mirakl_error(partner, category, msg) ⇒ Object
1098 1099 1100 1101 1102 1103 1104 1105 |
# File 'app/mailers/internal_mailer.rb', line 1098 def notify_edi_admin_of_mirakl_error(partner, category, msg) sender = 'ediadmin@warmlyyours.com' recipient = 'ediadmin@warmlyyours.com' @partner = partner @category = category @msg = msg mail(from: sender, to: recipient, subject: "EDI Processing Error #{partner} #{category}") end |
#notify_edi_admin_of_order_status_mismatches(result) ⇒ Object
1115 1116 1117 1118 1119 1120 1121 |
# File 'app/mailers/internal_mailer.rb', line 1115 def notify_edi_admin_of_order_status_mismatches(result) sender = 'ediadmin@warmlyyours.com' recipient = 'ediadmin@warmlyyours.com' @result = result mail(from: sender, to: recipient, subject: "Amazon Order Status Mismatch: #{result.partner} — #{result.mismatches.size} order(s)") end |
#notify_edi_admin_of_warning(subj, msg) ⇒ Object
1123 1124 1125 1126 1127 1128 |
# File 'app/mailers/internal_mailer.rb', line 1123 def notify_edi_admin_of_warning(subj, msg) sender = 'ediadmin@warmlyyours.com' recipient = 'ediadmin@warmlyyours.com' @msg = msg mail(from: sender, to: recipient, subject: "EDI Processing Warning: #{subj}") end |
#notify_menard_of_pending_discontinue(catalog_item, discontinue_date:, recipients:) ⇒ Object
1154 1155 1156 1157 1158 1159 1160 1161 1162 |
# File 'app/mailers/internal_mailer.rb', line 1154 def notify_menard_of_pending_discontinue(catalog_item, discontinue_date:, recipients:) sender = 'ediadmin@warmlyyours.com' @catalog_item = catalog_item @item = catalog_item.store_item.item @discontinue_date = discontinue_date @parent_sku = catalog_item.parent_sku @model_number = catalog_item.third_party_sku.presence || @item.sku mail(from: sender, to: recipients, subject: "WarmlyYours — Pending Discontinue Notice for #{@model_number}") end |
#notify_of_activity_assigned(party_assigned, activity) ⇒ Object
1275 1276 1277 1278 1279 1280 1281 1282 1283 |
# File 'app/mailers/internal_mailer.rb', line 1275 def notify_of_activity_assigned(party_assigned, activity) @party = party_assigned @activity = activity cc = (@party&.employee_record&.department == 'Tech Support' ? 'techteam@warmlyyours.com' : nil) mail(from: ADMINISTRATOR_EMAIL, to: party_assigned.email, cc: cc, subject: "Activity Assigned: #{activity.display_type}") end |
#notify_process_reward_to_complete(employee_review) ⇒ Object
1059 1060 1061 1062 1063 1064 1065 |
# File 'app/mailers/internal_mailer.rb', line 1059 def notify_process_reward_to_complete(employee_review) @employee_review = employee_review @reviewee_name = employee_review.employee_record.party.full_name sender = @employee_review.reviewer_email recipient = 'jbillen@warmlyyours.com' mail(from: sender, to: recipient, subject: "Please process the reward allocation for #{@reviewee_name}") end |
#notify_sales_commission_to_pending_accounting_review(sales_commission_rep) ⇒ Object
1076 1077 1078 1079 1080 1081 |
# File 'app/mailers/internal_mailer.rb', line 1076 def notify_sales_commission_to_pending_accounting_review(sales_commission_rep) @sales_commission_rep = sales_commission_rep sender = Employee.find_by(id: @sales_commission_rep.employee_id)&.email || 'heatwaveteam@warmlyyours.com' recipient = 'vadepu@warmlyyours.com' mail(from: sender, to: recipient, cc: 'epasek@warmlyyours.com,accounting@warmlyyours.com,jbillen@warmlyyours.com', subject: 'Your commission report is now under review') end |
#notify_sales_commission_to_pending_pay_out(sales_commission_rep) ⇒ Object
1083 1084 1085 1086 1087 1088 |
# File 'app/mailers/internal_mailer.rb', line 1083 def notify_sales_commission_to_pending_pay_out(sales_commission_rep) @sales_commission_rep = sales_commission_rep sender = Employee.find_by(id: @sales_commission_rep.employee_id)&.email || 'heatwaveteam@warmlyyours.com' recipient = 'epasek@warmlyyours.com' mail(from: sender, to: recipient, cc: 'epasek@warmlyyours.com,jbillen@warmlyyours.com', subject: 'Your commission has now been filed for payment') end |
#notify_sales_commission_to_pending_rep_approval(sales_commission_rep) ⇒ Object
1067 1068 1069 1070 1071 1072 1073 1074 |
# File 'app/mailers/internal_mailer.rb', line 1067 def notify_sales_commission_to_pending_rep_approval(sales_commission_rep) @sales_commission_rep = sales_commission_rep sender = Employee.find_by(id: @sales_commission_rep.updater_id)&.email || 'heatwaveteam@warmlyyours.com' recipient = Employee.find_by(id: @sales_commission_rep.employee_id)&.email return unless recipient mail(from: sender, to: recipient, cc: 'epasek@warmlyyours.com,jbillen@warmlyyours.com', subject: ('Please approve your commission report for ' + @sales_commission_rep.commission_date.strftime('%b-%Y'))) end |
#notify_sales_manager_of_drop_event(customer_drop_event) ⇒ Object
1090 1091 1092 1093 1094 1095 1096 |
# File 'app/mailers/internal_mailer.rb', line 1090 def notify_sales_manager_of_drop_event(customer_drop_event) @customer_drop_event = customer_drop_event @customer = @customer_drop_event.customer sender = @customer_drop_event&.creator&.email || 'heatwaveteam@warmlyyours.com' recipient = 'epasek@warmlyyours.com' mail(from: sender, to: recipient, subject: "Customer Drop Event Triggered for #{@customer.full_name} [#{@customer.reference_number}] ") end |
#online_order_notification(order) ⇒ Object
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 |
# File 'app/mailers/internal_mailer.rb', line 777 def online_order_notification(order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep subject = if @order.in_cr_hold? || @order. || @order.in_management_hold? "Online Order On Hold #{@order.reference_number}" else "Online Order Confirmation #{@order.reference_number}" end mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: 'ordernotifications@warmlyyours.com', cc: @rep&.email_with_name, subject: subject) end |
#opportunity_copy_complete(target_customer, new_opportunity, user_email: nil, report: {}) ⇒ Object
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 |
# File 'app/mailers/internal_mailer.rb', line 1185 def opportunity_copy_complete(target_customer, new_opportunity, user_email: nil, report: {}) user_email ||= 'heatwaveteam@warmlyyours.com' @target_customer = target_customer @opportunity_created = new_opportunity @report = report if @opportunity_created.present? && @report[:errors].blank? mail(from: user_email, to: user_email, subject: "Opportunity Copy Complete: #{@opportunity_created.name} #{@opportunity_created.reference_number}") else mail(from: user_email, to: 'heatwaveteam@warmlyyours.com', cc: user_email, subject: 'Opportunity Copy Failed') end end |
#order_profit_review_notification(order) ⇒ Object
759 760 761 762 763 764 765 766 |
# File 'app/mailers/internal_mailer.rb', line 759 def order_profit_review_notification(order) @order = order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave <salesmanagers@warmlyyours.com>', to: 'Sales Managers <salesmanagers@warmlyyours.com>, AR <ar@warmlyyours.com>', subject: "Order #{@order.reference_number} requires profit margin review") end |
#order_with_insuficient_payment(order) ⇒ Object
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
# File 'app/mailers/internal_mailer.rb', line 956 def order_with_insuficient_payment(order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep subject = "Order with pending balance #{@order.reference_number}" email_cc = 'orders@warmlyyours.com' email = @rep&.email_with_name email ||= @customer.customer_service_manager&.email_with_name if email.nil? email = 'orders@warmlyyours.com' email_cc = nil end mail(from: 'Orders <orders@warmlyyours.com>', to: email, cc: email_cc, subject: subject) end |
#past_promised_date_reminder(store, po_items) ⇒ Object
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
# File 'app/mailers/internal_mailer.rb', line 1247 def past_promised_date_reminder(store, po_items) return null_mail if po_items.blank? @store = store @po_items = po_items.group_by { |poi| poi.purchase_order } warehouse_email = if store.id == 1 'warehouseusa@warmlyyours.com' elsif store.id == 2 'warehousecanada@warmlyyours.com' end mail(from: "Accounts Payable <#{ACCOUNTS_PAYABLE_EMAIL}>", to: "#{ACCOUNTS_PAYABLE_EMAIL},#{warehouse_email}", subject: "POs Past Promised Date Found (#{store.name})") end |
#payment_automatically_authorized(order) ⇒ Object
837 838 839 840 841 842 843 844 845 |
# File 'app/mailers/internal_mailer.rb', line 837 def (order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep mail(from: 'Orders <orders@warmlyyours.com>', to: 'orders@warmlyyours.com', subject: "Payment automatically authorized for #{@order.reference_number}") end |
#pending_time_off_requests(requests) ⇒ Object
495 496 497 498 499 500 |
# File 'app/mailers/internal_mailer.rb', line 495 def pending_time_off_requests(requests) @pending_time_off_requests = requests mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'epasek@warmlyyours.com;mgodawa@warmlyyours.com;srosenbaum@warmlyyours.com', subject: 'Time Off Requests Pending Approval') end |
#pending_work_schedules(work_schedules) ⇒ Object
def update_work_schedule(work_schedule)
@employee = work_schedule.employee
@work_schedule = work_schedule
@changes = @work_schedule.changes_summary
mail(from: 'Heatwave Team heatwaveteam@warmlyyours.com',
to: @employee.manager.email,
cc: @employee.email,
subject: "Work Schedule Update Request for #InternalMailer.@employee@employee.full_name")
end
488 489 490 491 492 493 |
# File 'app/mailers/internal_mailer.rb', line 488 def pending_work_schedules(work_schedules) @pending_schedules = work_schedules mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'epasek@warmlyyours.com;mgodawa@warmlyyours.com;srosenbaum@warmlyyours.com;vadepu@warmlyyours.com', subject: 'Work Schedules Pending Approval') end |
#plans_ready_to_be_relased(room_plans) ⇒ Object
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 |
# File 'app/mailers/internal_mailer.rb', line 1285 def plans_ready_to_be_relased(room_plans) return null_mail if room_plans.blank? @room_plans = room_plans mail(from: ADMINISTRATOR_EMAIL, to: 'aisayenko@warmlyyours.com', cc: 'techteam@warmlyyours.com', subject: "#{@room_plans.size} plans in Awaiting QC ready to be released.") end |
#praise_email(praise) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/mailers/internal_mailer.rb', line 65 def praise_email(praise) if praise.image&.stored? && (img = praise.image) file_name = img.name || praise.headline.parameterize mime_type = praise.image_mime_type || img.mime_type ext = Mime::Type.lookup(mime_type)&.symbol&.to_s if ext file_name = "#{file_name}.#{ext}" if /^image/.match?(img.mime_type) # Inline it .inline[file_name] = img.data else [file_name] = img.data end end else .inline['be-radiant.png'] = File.read(Rails.public_path.join('images/mailer/be-radiant-logo.png')) end @sender = praise.originating_employee_record.try(:party) @sender ||= praise.creator from_email = @sender.try(:email_with_name) || 'Julia Billen <jbillen@warmlyyours.com>' @praise = praise @recipients = praise.employee_records.select { |er| er.try(:party) } recipient_names = @recipients.map { |r| r.try(:full_name) }.join(',') recipient_names = 'WarmlyYours Staff' if recipient_names.blank? to_email = @recipients.map { |r| r.try(:employee).try(:email) }.join(',') cc_email = @praise.notify_staff? ? 'staff@warmlyyours.com' : 'jbillen@warmlyyours.com' if to_email mail(from: from_email, to: to_email, cc: cc_email, subject: "A new praise for #{recipient_names}") else Rails.logger.warn "! Could not send email for praise #{praise.id}, no recipient email" end end |
#presence_alert(employee_phone_status, report_type) ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'app/mailers/internal_mailer.rb', line 356 def presence_alert(employee_phone_status, report_type) # epasek srosenbaum jcauley when ready recipients = ['callcenter_managers@warmlyyours.com'] if (employee_email = employee_phone_status.employee.email.presence) recipients << employee_email end @employee_phone_status = employee_phone_status @report_type = report_type mail( from: 'Call Center Managers <callcenter_managers@warmlyyours.com>', to: recipients.join(';'), subject: "Presence Alert for #{@employee_phone_status.employee.full_name}" ) end |
#price_changed_alert(changes) ⇒ Object
CatalogItem::ScheduledPriceChanger will call this and report if any price changes occurred
1371 1372 1373 1374 1375 1376 1377 1378 1379 |
# File 'app/mailers/internal_mailer.rb', line 1371 def price_changed_alert(changes) @changes = changes return null_mail if @changes.blank? mail(from: ADMINISTRATOR_EMAIL, to: 'price_alerts@warmlyyours.com', cc: 'heatwaveteam@warmlyyours.com', subject: 'Price Change Alert') end |
#promo_item_sync_notification(results) ⇒ Object
1429 1430 1431 1432 1433 1434 1435 1436 |
# File 'app/mailers/internal_mailer.rb', line 1429 def promo_item_sync_notification(results) return null_mail if results.blank? @results = results mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'Heatwave Team <heatwaveteam@warmlyyours.com>', subject: "Promo Item Sync Results #{I18n.l(Date.current, format: :long)}") end |
#pto_year_end_rollover(employee:, previous_year:, rollover_data:, non_accruing_leave: nil) ⇒ Object
582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
# File 'app/mailers/internal_mailer.rb', line 582 def pto_year_end_rollover(employee:, previous_year:, rollover_data:, non_accruing_leave: nil) @employee = employee @previous_year = previous_year @new_year = previous_year + 1 @data = rollover_data @non_accruing_leave = non_accruing_leave || [] return unless @employee.email.present? mail( to: @employee.email, subject: "🎉 Your #{@previous_year} PTO Summary & #{@new_year} Rollover" ) end |
#quote_copy_complete(target_opportunity, new_quote, user_email: nil, report: {}) ⇒ Object
1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 |
# File 'app/mailers/internal_mailer.rb', line 1197 def quote_copy_complete(target_opportunity, new_quote, user_email: nil, report: {}) user_email ||= 'heatwaveteam@warmlyyours.com' @target_opportunity = target_opportunity @quote_created = new_quote @report = report if @quote_created.present? && @report[:errors].blank? mail(from: user_email, to: user_email, subject: "Quote Copy Complete: #{@quote_created.reference_number_with_name}") else mail(from: user_email, to: 'heatwaveteam@warmlyyours.com', cc: user_email, subject: 'Quote Copy Failed') end end |
#quote_profit_review_notification(quote) ⇒ Object
768 769 770 771 772 773 774 775 |
# File 'app/mailers/internal_mailer.rb', line 768 def quote_profit_review_notification(quote) @quote = quote @customer = @quote.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave <salesmanagers@warmlyyours.com>', to: 'Sales Managers <salesmanagers@warmlyyours.com>, AR <ar@warmlyyours.com>', subject: "Quote #{@quote.reference_number} requires profit margin review") end |
#refurb_item_received(rma, item) ⇒ Object
128 129 130 131 132 133 134 135 136 |
# File 'app/mailers/internal_mailer.rb', line 128 def refurb_item_received(rma, item) @rma = rma @item = item mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'techteam@warmlyyours.com', cc: 'ar@warmlyyours.com', subject: "Refurb Item #{item.sku} Received on RMA #{@rma.rma_number}") end |
#release_authorization_required(order) ⇒ Object
826 827 828 829 830 831 832 833 834 835 |
# File 'app/mailers/internal_mailer.rb', line 826 def (order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: 'ordernotifications@warmlyyours.com', cc: @rep&.email_with_name, subject: "Order #{@order.reference_number} needs release authorization") end |
#report_mailer(report_command) ⇒ Object
END TIME OFF RELATED ####
599 600 601 602 603 604 |
# File 'app/mailers/internal_mailer.rb', line 599 def report_mailer(report_command) report_command.execute @report_command = report_command @report_partial = report_command.email_partial mail(report_command.email_parameters) end |
#request_approved(time_off_request) ⇒ Object
515 516 517 518 519 520 |
# File 'app/mailers/internal_mailer.rb', line 515 def request_approved(time_off_request) @time_off_request = time_off_request @employee = time_off_request.employee notification_recipients = @time_off_request.notification_recipients.join(';') mail(to: @employee.email, cc: notification_recipients, subject: 'Your Time Off Request Has Been Approved') end |
#request_cancelled(time_off_request) ⇒ Object
529 530 531 532 533 534 |
# File 'app/mailers/internal_mailer.rb', line 529 def request_cancelled(time_off_request) @time_off_request = time_off_request @employee = time_off_request.employee notification_recipients = @time_off_request.notification_recipients.join(';') mail(to: @employee.email, cc: notification_recipients, subject: 'Your Time Off Request Has Been Cancelled') end |
#request_carrier_assignment_notification(order) ⇒ Object
705 706 707 708 709 710 711 712 713 |
# File 'app/mailers/internal_mailer.rb', line 705 def request_carrier_assignment_notification(order) @order = order @customer = @order.customer mail(from: 'Orders <orders@warmlyyours.com>', to: 'Orders <orders@warmlyyours.com>', bcc: 'cbillen@warmlyyours.com', subject: "Order #{@order.reference_number} requires carrier assignment") end |
#request_denied(time_off_request) ⇒ Object
522 523 524 525 526 527 |
# File 'app/mailers/internal_mailer.rb', line 522 def request_denied(time_off_request) @time_off_request = time_off_request @employee = time_off_request.employee notification_recipients = @time_off_request.notification_recipients.join(';') mail(to: @employee.email, cc: notification_recipients, subject: 'Your Time Off Request Has Been Denied') end |
#review_budgets_alert(event) ⇒ Object
442 443 444 445 446 447 448 449 450 |
# File 'app/mailers/internal_mailer.rb', line 442 def review_budgets_alert(event) @event = event @employee = @event.employee @time_off = @employee.employee_time_offs.where(year: @event.date.year).last mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'vadepu@warmlyyours.com', cc: (Employee.find(@employee.parent_id).email == 'jbillen@warmlyyours.com' ? @employee.email : Employee.find(@employee.parent_id).email).to_s, subject: "Alert: Review Budgets for #{@employee.full_name}") end |
#rma_needs_inspection(rma) ⇒ Object
676 677 678 679 680 681 682 683 |
# File 'app/mailers/internal_mailer.rb', line 676 def rma_needs_inspection(rma) @rma = rma @customer = @rma.customer mail(from: @rma.rma_inspect_email, to: @rma.rma_inspect_email, subject: "#{@rma.rma_number} needs to be inspected and received") end |
#rma_needs_review_notification(rma) ⇒ Object
667 668 669 670 671 672 673 674 |
# File 'app/mailers/internal_mailer.rb', line 667 def rma_needs_review_notification(rma) @rma = rma @customer = @rma.customer mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: ACCOUNTS_PAYABLE_EMAIL.to_s, subject: "#{@rma.rma_number} needs to be reviewed") end |
#rma_with_shipping_error_notification(rma) ⇒ Object
685 686 687 688 689 690 691 692 |
# File 'app/mailers/internal_mailer.rb', line 685 def rma_with_shipping_error_notification(rma) @rma = rma @customer = @rma.customer mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: ACCOUNTS_PAYABLE_EMAIL.to_s, subject: "#{@rma.rma_number} needs to be reviewed") end |
#rmas_in_auto_return_review ⇒ Object
190 191 192 193 194 195 196 |
# File 'app/mailers/internal_mailer.rb', line 190 def rmas_in_auto_return_review @rmas_list = Rma.in_auto_return_review mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, subject: 'RMAs under auto return review state') end |
#rmas_in_awaiting_inspection ⇒ Object
198 199 200 201 202 203 204 205 |
# File 'app/mailers/internal_mailer.rb', line 198 def rmas_in_awaiting_inspection @rmas_list = Rma.in_awaiting_inspection mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.first, cc: 'warehouseusa@warmlyyours.com;heidegw@warmlyyours.com', subject: 'RMAs that are awaiting inspection') end |
#rmas_returned_and_need_attention_immediately ⇒ Object
207 208 209 210 211 212 213 214 |
# File 'app/mailers/internal_mailer.rb', line 207 def rmas_returned_and_need_attention_immediately @rmas_list = Rma.returned_and_need_attention_immediately mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, cc: 'vadepu@warmlyyours.com', subject: 'RMAs under returned state') end |
#rmas_with_credit_memos_not_transmitted_and_are_not_fullyoffset ⇒ Object
216 217 218 219 220 221 222 223 |
# File 'app/mailers/internal_mailer.rb', line 216 def rmas_with_credit_memos_not_transmitted_and_are_not_fullyoffset @rmas_list = Rma.with_credit_memos_not_transmitted_and_are_not_fullyoffset mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, cc: 'vadepu@warmlyyours.com', subject: 'RMAs need to be refunded') end |
#rmas_with_credit_memos_transmitted_and_are_not_fullyoffset ⇒ Object
225 226 227 228 229 230 231 |
# File 'app/mailers/internal_mailer.rb', line 225 def rmas_with_credit_memos_transmitted_and_are_not_fullyoffset @rmas_list = Rma.with_credit_memos_transmitted_and_are_not_fullyoffset mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, subject: 'Check the status of the credit memos') end |
#same_day_design_complete(room_configuration) ⇒ Object
657 658 659 660 661 662 663 664 665 |
# File 'app/mailers/internal_mailer.rb', line 657 def same_day_design_complete(room_configuration) @room_configuration = room_configuration @customer = @room_configuration.customer @rep = @customer.primary_sales_rep || @customer.sales_manager mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.email, subject: "Same Day Plan Completed for Room #{@room_configuration.reference_number}") end |
#same_day_design_request(room_configuration) ⇒ Object
648 649 650 651 652 653 654 655 |
# File 'app/mailers/internal_mailer.rb', line 648 def same_day_design_request(room_configuration) @room_configuration = room_configuration @customer = @room_configuration.customer mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'hyderabadstaff@warmlyyours.com', subject: "Same Day Design Request for #{@room_configuration.reference_number}") end |
#scheduler_auth_expired(employee, issues) ⇒ Object
1598 1599 1600 1601 1602 1603 1604 |
# File 'app/mailers/internal_mailer.rb', line 1598 def scheduler_auth_expired(employee, issues) @employee = employee @issues = issues mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: employee.email, subject: 'Action Required: Your scheduler integrations need reconnecting') end |
#scheduler_booking_cancelled(booking) ⇒ Object
1567 1568 1569 1570 1571 1572 1573 1574 |
# File 'app/mailers/internal_mailer.rb', line 1567 def scheduler_booking_cancelled(booking) @booking = booking @employee = booking.employee @booking_page = booking.scheduler_booking_page mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.email, subject: "Booking Cancelled: #{@booking_page.name} with #{@booking.guest_name}") end |
#scheduler_booking_host_notification(booking) ⇒ Object
1558 1559 1560 1561 1562 1563 1564 1565 |
# File 'app/mailers/internal_mailer.rb', line 1558 def scheduler_booking_host_notification(booking) @booking = booking @employee = booking.employee @booking_page = booking.scheduler_booking_page mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.email, subject: "New Booking: #{@booking_page.name} with #{@booking.guest_name}") end |
#scheduler_booking_reminder(booking, hours_before:) ⇒ Object
1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 |
# File 'app/mailers/internal_mailer.rb', line 1587 def scheduler_booking_reminder(booking, hours_before:) @booking = booking @employee = booking.employee @booking_page = booking.scheduler_booking_page @hours_before = hours_before time_label = hours_before == 24 ? 'tomorrow' : 'in 1 hour' mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.email, subject: "Reminder: #{@booking_page.name} with #{@booking.guest_name} #{time_label}") end |
#scheduler_booking_rescheduled(booking, old_starts_at:, old_timezone:) ⇒ Object
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 |
# File 'app/mailers/internal_mailer.rb', line 1576 def scheduler_booking_rescheduled(booking, old_starts_at:, old_timezone:) @booking = booking @employee = booking.employee @booking_page = booking.scheduler_booking_page @old_starts_at = old_starts_at.in_time_zone('America/Chicago') @old_timezone = old_timezone mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.email, subject: "Booking Rescheduled: #{@booking_page.name} with #{@booking.guest_name}") end |
#service_warranty_claim(support_case) ⇒ Object
334 335 336 337 338 339 340 |
# File 'app/mailers/internal_mailer.rb', line 334 def service_warranty_claim(support_case) @support_case = support_case mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', cc: 'epasek@warmlyyours.com;srosenbaum@warmlyyours.com;rmatejacabello@warmlyyours.com', to: 'heatwaveteam@warmlyyours.com', subject: "Warranty Claim Service order needs to be manually closed: #{support_case.case_number}") end |
#smart_service_confirmed_notification(support_case) ⇒ Object
def public_link_checker_catalog_item(missing_url, invalid_url)
@missing_url = missing_url
@invalid_url = invalid_url
mail(from: 'Heatwave Team heatwaveteam@warmlyyours.com',
to: 'epasek@warmlyyours.com;heatwaveteam@warmlyyours.com',
subject: "Public Catalog Items missing URL on #Date.current.to_date")
end
327 328 329 330 331 332 |
# File 'app/mailers/internal_mailer.rb', line 327 def smart_service_confirmed_notification(support_case) @support_case = support_case mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'serviceordernotifications@warmlyyours.com', subject: "New SmartService Confirmed: #{support_case.case_number}") end |
#smart_service_requested_notification(support_case) ⇒ Object
312 313 314 315 316 317 |
# File 'app/mailers/internal_mailer.rb', line 312 def smart_service_requested_notification(support_case) @support_case = support_case mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'epasek@warmlyyours.com;srosenbaum@warmlyyours.com;jbillen@warmlyyours.com', subject: "New SmartService Requested: #{support_case.case_number}") end |
#store_item_availability_timed_update(results, destination) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'app/mailers/internal_mailer.rb', line 138 def store_item_availability_timed_update(results, destination) @results = results if destination == :publications @title = 'Publication Status Changes' mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'cwitbeck@warmlyyours.com,pgammeri@warmlyyours.com', cc: 'cbillen@warmlyyours.com', subject: 'Publication Availability Updates') elsif destination == :non_publications @title = 'Store Item Status Changes' mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'vadepu@warmlyyours.com', cc: 'cbillen@warmlyyours.com', subject: 'Store Item Availability Updates') end end |
#survey_admin_check(survey_enrollment) ⇒ Object
386 387 388 389 390 391 392 |
# File 'app/mailers/internal_mailer.rb', line 386 def survey_admin_check(survey_enrollment) @survey_enrollment = survey_enrollment @survey = @survey_enrollment.survey mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'product_reviews@warmlyyours.com;jniemiec@warmlyyours.com', subject: "New Survey completed - #{@survey.name} - #{@survey_enrollment.id}") end |
#survey_employee_notification(survey_enrollment) ⇒ Object
394 395 396 397 398 399 400 401 |
# File 'app/mailers/internal_mailer.rb', line 394 def survey_employee_notification(survey_enrollment) @survey_enrollment = survey_enrollment @employee = @survey_enrollment.employee @survey = @survey_enrollment.survey mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.email, subject: "You have been tagged in a new survey - #{@survey_enrollment.id}") end |
#tax_exemption_expired(tax_exemption) ⇒ Object
1401 1402 1403 1404 1405 1406 1407 1408 |
# File 'app/mailers/internal_mailer.rb', line 1401 def tax_exemption_expired(tax_exemption) @tax_exemption = tax_exemption @customer = @tax_exemption.customer @email = @tax_exemption.notify_emails mail(from: ADMINISTRATOR_EMAIL, to: @email, subject: "Tax Exemption expiring soon #{tax_exemption.id}") end |
#tax_exemption_uploaded(tax_exemption) ⇒ Object
1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 |
# File 'app/mailers/internal_mailer.rb', line 1390 def tax_exemption_uploaded(tax_exemption) @tax_exemption = tax_exemption @customer = @tax_exemption.customer @email = @tax_exemption.notify_emails @sales_rep_email = @customer.primary_sales_rep.try(:email) mail(from: ADMINISTRATOR_EMAIL, to: @email, cc: [@sales_rep_email, 'ar@warmlyyours.com'].compact.uniq.join(', '), subject: "New Tax Exemption card #{tax_exemption.id}") end |
#time_off_attempt(employee, date) ⇒ Object
452 453 454 455 456 457 458 |
# File 'app/mailers/internal_mailer.rb', line 452 def time_off_attempt(employee, date) @employee = Employee.find(employee) @date = date mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: (Employee.find(@employee.parent_id).email == 'jbillen@warmlyyours.com' ? @employee.email : Employee.find(@employee.parent_id).email).to_s, subject: "Time Off attempt on a blocked day from #{@employee.full_name}") end |
#time_off_request(event) ⇒ Object
403 404 405 406 407 408 409 410 411 |
# File 'app/mailers/internal_mailer.rb', line 403 def time_off_request(event) @event = event @employee = @event.employee @time_off = @employee.employee_time_offs.where(year: @event.date.year).last mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @employee.employee_events_email_settings.collect { |es| Employee.find(es.receiver_id).email unless es.receiver_id.nil? }.join(';').to_s, cc: "#{Employee.find(@event.employee_id).email};vadepu@warmlyyours.com", subject: "New #{@event.status.humanize} request for #{Employee.find(@event.employee_id).full_name}") end |
#time_off_request_amount_mismatch(details) ⇒ Object
Alerts the team when a time off request has an amount mismatch
This typically indicates a JavaScript race condition in the form submission
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'app/mailers/internal_mailer.rb', line 551 def time_off_request_amount_mismatch(details) @details = details @employee_name = details[:employee_name] || "Employee ##{details[:employee_id]}" @time_off_type = details[:time_off_type] || 'Unknown' @submitted_amount = details[:submitted_amount] @calculated_amount = details[:calculated_amount] @date_details = details[:date_details] || [] @is_new_record = details[:is_new_record] @start_date = details[:start_date] @end_date = details[:end_date] @notes = details[:notes] mail( from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'heatwaveteam@warmlyyours.com', subject: "Time Off Request Amount Mismatch - #{@employee_name} (#{@submitted_amount} vs #{@calculated_amount} hours)" ) end |
#time_off_update_alert(time_off) ⇒ Object
433 434 435 436 437 438 439 440 |
# File 'app/mailers/internal_mailer.rb', line 433 def time_off_update_alert(time_off) @time_off = time_off @employee = @time_off.employee mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: (Employee.find(@employee.parent_id).email == 'jbillen@warmlyyours.com' ? @employee.email : Employee.find(@employee.parent_id).email).to_s, cc: @employee.email.to_s, subject: "Time Off budgets update for #{@employee.full_name}") end |
#unable_to_deliver_rma_reminder(rma, communication) ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'app/mailers/internal_mailer.rb', line 102 def unable_to_deliver_rma_reminder(rma, communication) @rma = rma @communication = communication mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: rma.customer.try(:primary_sales_rep).try(:email) || 'ar@warmlyyours.com', cc: 'ar@warmlyyours.com', subject: "Unable to send RMA reminder for #{@rma.rma_number}") end |
#unpaid_invoices(invoices) ⇒ Object
1410 1411 1412 1413 1414 1415 1416 1417 1418 |
# File 'app/mailers/internal_mailer.rb', line 1410 def unpaid_invoices(invoices) @invoices = invoices return null_mail if @invoices.blank? mail(from: ADMINISTRATOR_EMAIL, to: ACCOUNTS_RECEIVABLE_EMAIL, cc: 'vadepu@warmlyyours.com, rmatejacabello@warmlyyours.com', subject: "UNPAID INVOICES #{Date.current}") end |
#work_schedule_update_alert(work_schedule) ⇒ Object
423 424 425 426 427 428 429 430 431 |
# File 'app/mailers/internal_mailer.rb', line 423 def work_schedule_update_alert(work_schedule) @work_schedule = work_schedule @employee = @work_schedule.employee @time_off = @work_schedule.employee.employee_time_offs.where(year: Time.current.year).last mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: (Employee.find(@employee.parent_id).email == 'jbillen@warmlyyours.com' ? @employee.email : Employee.find(@employee.parent_id).email).to_s, cc: @employee.email.to_s, subject: "Work Schedule update for #{@employee.full_name}") end |