comments user
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
|
||||
$commentData = $reg->comments->sortByDesc('created_at')->map(fn($c) => [
|
||||
'comment' => $c->comment,
|
||||
'author' => $c->author_name,
|
||||
'created_at' => $c->created_at->diffForHumans(),
|
||||
])->values()->toArray();
|
||||
@endphp
|
||||
@@ -291,6 +292,7 @@ function openDetailPanel(row) {
|
||||
const created = row.dataset.created;
|
||||
const sessions = JSON.parse(row.dataset.sessions || '[]');
|
||||
const comments = JSON.parse(row.dataset.comments || '[]');
|
||||
console.log(comments);
|
||||
|
||||
const countryTitle=row.dataset.countryTitle;
|
||||
const countryFlag=row.dataset.countryFlag;
|
||||
@@ -367,7 +369,7 @@ function renderPanelComments(comments) {
|
||||
el.innerHTML = comments.map(c => `
|
||||
<div class="bg-slate-50 border border-slate-200 rounded-xl px-4 py-3">
|
||||
<div class="flex items-center justify-between mb-1.5">
|
||||
<span class="text-xs font-semibold text-indigo-600">Counselor</span>
|
||||
<span class="text-xs font-semibold text-indigo-600">${escHtml(c.author)}</span>
|
||||
<span class="text-xs text-slate-400">${escHtml(c.created_at)}</span>
|
||||
</div>
|
||||
<p class="text-sm text-slate-700 leading-relaxed">${escHtml(c.comment)}</p>
|
||||
@@ -405,8 +407,9 @@ document.getElementById('panelCommentBtn').addEventListener('click', function ()
|
||||
const list = Array.isArray(r.comments) ? r.comments : Object.values(r.comments || {});
|
||||
renderPanelComments(list.map(c => ({
|
||||
comment: c.comment,
|
||||
author: c.author_name,
|
||||
created_at: c.created_at_human ?? c.created_at,
|
||||
})));
|
||||
})));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user