58 lines
2.5 KiB
Go
58 lines
2.5 KiB
Go
package transcript
|
|
|
|
const HTMLTemplate = `<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>Transcript {{.Ticket.Type}}-{{printf "%04d" .Ticket.TicketNumber}}</title>
|
|
<style>
|
|
*{box-sizing:border-box;margin:0;padding:0;}
|
|
body{background:#36393f;color:#dcddde;font-family:'Segoe UI',Arial,sans-serif;font-size:14px;line-height:1.5;}
|
|
.header{background:#2f3136;padding:16px 24px;border-bottom:1px solid #202225;}
|
|
.header h1{color:#fff;font-size:1.1em;margin-bottom:4px;}
|
|
.header p{color:#b9bbbe;font-size:.85em;margin-top:2px;}
|
|
.messages{padding:8px 0;}
|
|
.message{display:flex;padding:6px 16px;gap:12px;}
|
|
.message:hover{background:#32353b;}
|
|
.avatar{width:40px;height:40px;border-radius:50%;flex-shrink:0;object-fit:cover;}
|
|
.avatar-placeholder{width:40px;height:40px;border-radius:50%;flex-shrink:0;background:#5865f2;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;font-size:1.1em;}
|
|
.msg-body{flex:1;min-width:0;}
|
|
.msg-header{display:flex;align-items:baseline;gap:8px;margin-bottom:2px;}
|
|
.author{font-weight:700;color:#fff;font-size:.9em;}
|
|
.timestamp{color:#72767d;font-size:.75em;}
|
|
.text{color:#dcddde;word-break:break-word;white-space:pre-wrap;}
|
|
.attachment{margin-top:4px;}
|
|
.attachment a{color:#00b0f4;text-decoration:none;font-size:.85em;}
|
|
.attachment a:hover{text-decoration:underline;}
|
|
.footer{text-align:center;color:#72767d;font-size:.8em;padding:12px;border-top:1px solid #202225;margin-top:8px;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>Transcript — {{.Ticket.Type}}-{{printf "%04d" .Ticket.TicketNumber}}</h1>
|
|
<p>Utilisateur : {{.Ticket.UserID}} | Ouvert le : {{.Ticket.OpenedAt.Format "02/01/2006 à 15:04 UTC"}}</p>
|
|
<p>Généré le {{.Generated}} | {{len .Messages}} messages</p>
|
|
</div>
|
|
<div class="messages">
|
|
{{range .Messages}}
|
|
<div class="message">
|
|
{{if .AuthorAvatar}}<img class="avatar" src="{{.AuthorAvatar}}" alt="" onerror="this.style.display='none'">
|
|
{{else}}<div class="avatar-placeholder">{{.AuthorInitial}}</div>{{end}}
|
|
<div class="msg-body">
|
|
<div class="msg-header">
|
|
<span class="author">{{.AuthorName}}</span>
|
|
<span class="timestamp">{{.Timestamp}}</span>
|
|
</div>
|
|
{{if .Content}}<div class="text">{{.Content}}</div>{{end}}
|
|
{{range .Attachments}}
|
|
<div class="attachment">📎 <a href="{{.URL}}" target="_blank" rel="noopener">{{.Name}}</a></div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
<div class="footer">Bot Ticket — Transcript généré automatiquement</div>
|
|
</body>
|
|
</html>`
|