adding client notes
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-07-17 17:10:04 +02:00
parent feae470fba
commit 6b3cd0da17
8 changed files with 178 additions and 7 deletions

View File

@ -218,7 +218,7 @@ function followupRowHTML(c) {
<td>${c.daysSinceLastActivity != null ? c.daysSinceLastActivity : '—'}</td>
<td class="followup-note-cell">
<textarea class="followup-note-input" rows="2" data-client="${code}"
placeholder="Follow-up note…">${esc(c.note || '')}</textarea>
maxlength="200" placeholder="Follow-up note…">${esc(c.note || '')}</textarea>
<div class="followup-note-actions">
<button type="button" class="btn btn-sm btn-primary save-note-btn" data-client="${code}">Save note</button>
</div>
@ -282,10 +282,17 @@ async function archiveFromFollowup(clientCode) {
async function saveNote(clientCode, ta) {
if (!ta) return;
const note = ta.value.trim();
if (note.length > 200) {
showToast('Note must be at most 200 characters', 'error');
return;
}
try {
await apiPut('analytics.php', { clientCode, note: ta.value.trim() });
const res = await apiPut('analytics.php', { clientCode, note });
const saved = res?.note ?? note;
ta.value = saved;
const row = staleClients.find(c => c.clientCode === clientCode);
if (row) row.note = ta.value.trim();
if (row) row.note = saved;
showToast('Note saved', 'success');
} catch (e) {
showToast(e.message, 'error');