whatapp-go-pvnet/frontend/templates/admin_conversations_thread.pages.tmpl
2025-05-09 16:09:06 +02:00

63 lines
1.5 KiB
Cheetah

{{ define "admin_conversations_thread.pages.tmpl" }}
<div class="chat-thread">
{{ range .Conversations }}
{{ if not .ParentID }}
<div class="bubble {{ if eq .Direction "inbound" }}left{{ else }}right{{ end }}">
<div class="meta">
<small><strong>{{ .From }}</strong> — {{ .CreatedAt.Format "2006-01-02 15:04:05" }}</small>
</div>
<div class="content">{{ .Content }}</div>
</div>
{{ range $i, $c := $.Conversations }}
{{ if and $c.ParentID (eq (printf "%d" $c.ParentID) (printf "%d" .ID)) }}
<div class="bubble reply {{ if eq $c.Direction "inbound" }}left{{ else }}right{{ end }}">
<div class="meta">
<small><strong>{{ $c.From }}</strong> — {{ $c.CreatedAt.Format "2006-01-02 15:04:05" }}</small>
</div>
<div class="content">{{ $c.Content }}</div>
</div>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</div>
<style>
.chat-thread {
padding: 1rem;
background: #f5f5f5;
border: 1px solid #ccc;
border-radius: 0.5rem;
max-height: 600px;
overflow-y: auto;
}
.bubble {
padding: 0.5rem 1rem;
margin-bottom: 0.5rem;
border-radius: 1rem;
max-width: 75%;
clear: both;
display: inline-block;
}
.bubble.left {
background-color: #e0e0e0;
float: left;
}
.bubble.right {
background-color: #d1e7dd;
float: right;
}
.bubble.reply {
margin-left: 2rem;
margin-right: 2rem;
opacity: 0.9;
}
.meta {
font-size: 0.75rem;
color: #666;
margin-bottom: 0.25rem;
}
</style>
{{ end }}