Step 13 - content request continued

2 min czytania

Public fill page

Build the public fill page at /kanban/form/:requestId (outside the auth shell, ensureSignedIn() with anonymous auth). Layout: an intro header (requester name, task title, deadline banner - red when overdue), a left table of contents listing pages and their fields with filled/submitted marks (click scrolls to the field), and the current page's sections rendered by type: text inputs, a markdown editor with a small toolbar (bold, italic, heading, list, link) and preview for longText, file upload/remove (Storage path workspaces/{workspaceId}/kanban-form-{requestId}/{uploaderUid}/..., respondents may only write under their own uid segment), a signature canvas (pointer events drawn to canvas, saved as PNG data URL), date and dateRange with validation, star rating, color swatches, and table with add/remove row.

Answers autosave with a 900 ms debounce into answers.{sectionId}, with a saving/saved/error indicator, and flush on page unload. Validation messages for required, email format, url format, and range order. Keep the whole page usable on a phone.

Review workflow

Implement the request review workflow. Filling side: each page has a "Submit page" button enabled when its required fields validate; submitting writes pageStates.{pageId} = { status: 'submitted', submittedAt }. Submitting the LAST remaining page flips the request's status to 'completed' with completedAt. A recipient may also "Revise page" - a silent self-withdraw back to draft WITHOUT setting reopenedAt (this distinction drives emails later).

Requester side: a review screen (linked from the task panel) showing live answers per page, page progress "x of y pages", the deadline (editable - changing it must clear reminderSentAt so the reminder re-arms), copy-link, delete request (also delete its uploaded Storage files), and per page a "Send back for changes" action that sets the page's status to 'draft' with a fresh reopenedAt timestamp. Both sides share a per-page comment thread (reuse the comment component from the cards, lazily created per page, thread ids stored on the request under discussionGroups.{pageId}).

Form emails and reminders

Add Cloud Functions for the request lifecycle emails. (1) onDocumentUpdated on kanbanFormRequests: when a page transitions to 'submitted', email the REQUESTER (with a "everything is in" variant when that submit completed the whole request); when a page goes back to 'draft' WITH a fresh reopenedAt, email the RECIPIENT the fill link again; a self-revise (draft without a new reopenedAt) notifies nobody. (2) A daily scheduled function (09:00, configurable timezone) that emails recipients whose still-unfilled request has dueAt within the next 48 hours - but skip requests created less than 12 hours ago (grace period), and stamp reminderSentAt so each deadline reminds exactly once (the requester clearing/moving the deadline resets it).

All emails: HTML + plain text, in the language stamped on the request at creation time, from a shared translations map so adding a language later is one file. Test the transitions with the emulator.

Dyskusja

Komentarze: 0

Brak komentarzy. Rozpocznij dyskusję.