.email-conversations-show.padded
.row
.col-sm-12.col-md-8
.email-messages-list
- @email_messages.each do |msg|
- lead = msg.lead || Lead.new(email: 'NO LEAD!', id: 'no lead')
- if msg.to
- new_from_email = Ish::EmailTemplate::FROM_EMAILS.select { |p| p.include?( msg.to ) }
- if new_from_email.blank?
- new_from_email = Ish::EmailTemplate::DEFAULT_FROM_EMAIL
- all_ccs = [] + (msg.tos||[]) + (msg.ccs||[]) + (msg.froms||[])
.item.msg-container{ data: { msg: { id: msg.id } } }
.gray.row
.col-md-6
.a From: #{lead.email}
.a to's: #{msg.tos&.join(", ")}
.a cc's: #{msg.ccs&.join(", ")}
.col-md-6
.a msg.id: #{msg.id}
.a object_key: #{msg.object_key}
.a
N photos: #{msg.attachments.length}
.a
N email_attachments:
- msg.email_attachments.each_with_index do |attachment, idx|
- if attachment.filename
.a= link_to attachment.filename, email_attachment_path( attachment )
- else
.a
= link_to '[view]', email_attachment_path( attachment )
"#{attachment.content_type.split(';')[0]} #{attachment.filename} #{idx}"
.position-absolute.top-0.right-0.datetime
.date= msg.date&.strftime('%Y-%m-%d') || 'none'
.time= msg.date&.strftime('%l:%M%P') || 'none'
.row-2
.flexy
= link_to "Expand w/img", ishapi.email_message_path(msg, jwt_token: @jwt_token, load_images: true ), target: msg.message_id, class: 'preview-btn', data: { msg: { id: msg.id.to_s } }
\- or -
= link_to "Expand", ishapi.email_message_path(msg, jwt_token: @jwt_token ), target: msg.message_id, class: 'preview-btn', data: { msg: { id: msg.id.to_s } }
= msg.preview_str
.ml-200.to-expand
- if msg.attachments.present?
.attachments
- msg.attachments.map do |att|
.item
%h5= att.photo.original_filename
= image_tag att.photo.url(:original)
%iframe{ name: msg.message_id }
= render 'ish_manager/email_contexts/form_reply', lead: lead
.collapse-expand.wco-collapse Reply
.bordered.mt-3.wco-collapsed
- new_ctx = Ctx.new({ email_template: Tmpl.blank_template })
- new_ctx[:lead_id] = lead.id
- new_ctx[:from_email] = new_from_email
- new_ctx[:subject] = msg.subject
- new_ctx[:body] = Ish::EmailTemplate::SIGNATURE + ActionView::Base.full_sanitizer.sanitize( msg.part_html )
- new_ctx[:cc] = all_ccs.join(', ')
= render 'ish_manager/email_contexts/form', ctx: new_ctx
-# = button_to 'Reply'
-# = button_to 'Reply All'
-# = button_to 'New Template'
-# = button_to 'Schedule Reply'
-# = render 'ish_manager/email_templates/form_schedule_mini'
.col-sm-12.col-md-4
.header
= link_to '[<<-]', email_conversations_path
%i.material-icons mail
.subject #{@email_conversation.subject}
(#{@email_conversation.email_messages.all.count})
.tags-list
%b Tags (#{@email_conversation.tags.length}):
-# = @email_conversation.wp_term_ids
- @email_conversation.tags.each do |tag|
.chip= link_to "[#{tag.term_id}] #{tag.name}", category_path( tag )
.leads-list
%b Leads (#{@email_conversation.leads.length}):
- @email_conversation.leads.each do |lead|
.item
= link_to "#{lead.id} #{lead.email}", lead_path(lead)
\(ctxs:
= link_to email_contexts_for_lead_path( lead ) do
= lead.email_contexts.count
%i.fa.fa-envelope
.relative.inline-block
%i.fa.fa-plus.expand-next
.expand-hide= render 'ish_manager/email_contexts/form', ctx: Ctx.new({ lead_id: lead.id, email_template: Tmpl.blank })
\)
.relative.inline-block
%i.fa.fa-clock-o.expand-next{ style: "color: red;" }
.expand-hide= render 'ish_manager/scheduled_email_actions/form', scheduled_email_action: Sch.new({ lead_id: lead.id })
.actions.email-conversation-actions
= form_tag Ishapi::Engine.routes.url_helpers.email_conversations_path, method: :delete do
= hidden_field_tag :jwt_token, @jwt_token
= hidden_field_tag 'ids[]', @email_conversation.id
= submit_tag 'Delete', data: { confirm: 'Are you sure?' }