diff --git a/notes-workspace.html b/notes-workspace.html index 365d9fd..c84efab 100644 --- a/notes-workspace.html +++ b/notes-workspace.html @@ -160,12 +160,15 @@ +
@@ -244,6 +247,7 @@ const titleInput = document.getElementById('titleInput'); const typeInput = document.getElementById('typeInput'); const jobNumberInput = document.getElementById('jobNumberInput'); + const jobNoteToggle = document.getElementById('jobNoteToggle'); const bodyInput = document.getElementById('bodyInput'); const shareInput = document.getElementById('shareInput'); const searchInput = document.getElementById('searchInput'); @@ -622,6 +626,10 @@ if (!bodyPlain) throw new Error('Note body is required'); const noteType = typeInput.value.trim() || 'personal'; const jobNumber = jobNumberInput.value.trim(); + const isJobNote = !!jobNoteToggle.checked; + if (isJobNote && !jobNumber) { + throw new Error('Job Number is required when Classify as Job Note is enabled'); + } const sharedWith = normalizeShares(shareInput.value); const html = bodyPlain @@ -640,7 +648,7 @@ userId: user?.id || '', shared: sharedWith.length > 0, shared_with: sharedWith, - job_note: noteType === 'job' || !!jobNumber, + job_note: isJobNote, hidden: false, }; @@ -762,6 +770,7 @@ titleInput.value = ''; typeInput.value = 'personal'; jobNumberInput.value = ''; + jobNoteToggle.checked = false; bodyInput.value = ''; shareInput.value = ''; pendingAttachments = []; @@ -784,8 +793,10 @@ selectedNote = note; selectedMeta.textContent = `Selected: ${note.id}`; titleInput.value = String(note.title || ''); - typeInput.value = String(note.type || 'personal'); + const normalizedType = String(note.type || 'personal'); + typeInput.value = normalizedType === 'job' ? 'general' : normalizedType; jobNumberInput.value = String(note.Job_Number || ''); + jobNoteToggle.checked = toBoolFlag(note.job_note) || String(note.type || '').toLowerCase() === 'job'; bodyInput.value = String(note.body_plain || ''); shareInput.value = normalizeShares(note.shared_with).join(', '); pendingAttachments = [];