Commit iniziale di eminuxCRM: CRM Rails con pipeline, campagne email e Docker.
Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
require "csv"
|
||||
|
||||
class CsvExport
|
||||
def self.organizations(scope)
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << %w[id list_position name team_gender streaming_status region province website email status lead_source commercial_fit source_url verified_at assigned_user notes created_at]
|
||||
scope.includes(:assigned_user).find_each do |org|
|
||||
csv << [
|
||||
org.id, org.list_position, org.name, org.team_gender, org.streaming_status, org.region,
|
||||
org.province, org.website, org.email, org.status, org.lead_source, org.commercial_fit,
|
||||
org.source_url, org.verified_at, org.assigned_user&.full_name, org.notes, org.created_at
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.contacts(scope)
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << %w[id organization_name first_name last_name role email phone mobile preferred_contact_method primary_contact notes]
|
||||
scope.includes(:organization).find_each do |contact|
|
||||
csv << [
|
||||
contact.id, contact.organization.name, contact.first_name, contact.last_name, contact.role,
|
||||
contact.email, contact.phone, contact.mobile, contact.preferred_contact_method,
|
||||
contact.primary_contact, contact.notes
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.opportunities(scope)
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << %w[id organization_name name pipeline_stage ab_variant send_status sent_on outcome demo_trial converted estimated_value product assigned_user notes]
|
||||
scope.includes(:organization, :assigned_user).find_each do |opp|
|
||||
csv << [
|
||||
opp.id, opp.organization.name, opp.name, opp.pipeline_stage, opp.ab_variant, opp.send_status,
|
||||
opp.sent_on, opp.outcome, opp.demo_trial, opp.converted, opp.estimated_value, opp.product,
|
||||
opp.assigned_user&.full_name, opp.notes
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user