{{define "title"}}Email {{.Email.ID}} - CMC Sales{{end}} {{define "content"}}
{{if .Email.GmailMessageID}} View in Gmail {{end}} Back to Emails

{{if .Email.Subject}}{{.Email.Subject}}{{else}}(No Subject){{end}}

From: {{if .Email.User}} {{.Email.User.Email}} ({{.Email.User.FirstName}} {{.Email.User.LastName}}) {{else}} Unknown sender {{end}}
Date: {{.Email.Created.Format "2006-01-02 15:04:05"}}
Type: {{if .Email.GmailMessageID}} Gmail {{if and .Email.IsDownloaded (not .Email.IsDownloaded)}} Remote {{else}} Downloaded {{end}} {{else}} Local Email {{end}}
Attachments: {{if gt (len .Attachments) 0}} {{len .Attachments}} files {{else}} None {{end}}
{{if .Email.GmailMessageID}}
Gmail Message ID: {{.Email.GmailMessageID}}
{{end}} {{if .Email.GmailThreadID}}
Gmail Thread ID: {{.Email.GmailThreadID}}
{{end}}
{{if .Email.GmailMessageID}}

Email Content

Loading email content...
{{end}} {{if gt (len .Attachments) 0}}

Attachments

{{range .Attachments}} {{end}}
Name Type Size Date Actions
{{if .IsMessageBody}} {{else}} {{end}} {{.Name}} {{.Type}} {{.Size}} bytes {{.Created.Format "2006-01-02 15:04"}} {{if .GmailAttachmentID}} Download {{else}} Download {{end}}
{{else if .Email.GmailMessageID}}

Attachments

Checking for Gmail attachments...
{{end}}

Associated Records

{{if .Email.Enquiries}}
{{range .Email.Enquiries}} ENQ-{{.}} {{end}}
{{end}} {{if .Email.Invoices}}
{{range .Email.Invoices}} INV-{{.}} {{end}}
{{end}} {{if .Email.PurchaseOrders}}
{{range .Email.PurchaseOrders}} PO-{{.}} {{end}}
{{end}} {{if .Email.Jobs}}
{{range .Email.Jobs}} JOB-{{.}} {{end}}
{{end}} {{if and (not .Email.Enquiries) (not .Email.Invoices) (not .Email.PurchaseOrders) (not .Email.Jobs)}}

No associations found

This email is not associated with any enquiries, invoices, purchase orders, or jobs.

{{end}}

Quick Actions

{{if .Email.GmailMessageID}} {{end}}
{{end}}