// app-item.jsx — ItemCard: one agenda item's note form (function () { const { useState } = React; const { STATUSES, PRESENTERS } = window.MeetingData; function uid() { return "a_" + Math.random().toString(36).slice(2, 9); } function VoteTally({ vote, onChange }) { function set(field, val) { const v = val.replace(/[^0-9]/g, ""); onChange(Object.assign({}, vote, { [field]: v })); } return (
{[["for", "For"], ["against", "Against"], ["abstain", "Abstain"]].map(([f, label]) => ( ))}
); } function ItemCard({ item, index, active, onPatch, onRegister }) { const [showVote, setShowVote] = useState(item.vote.recorded); function patch(changes) { onPatch(item.id, changes); } function addAction() { patch({ actions: item.actions.concat([{ id: uid(), text: "", owner: "", due: "" }]) }); } function patchAction(id, changes) { patch({ actions: item.actions.map((a) => (a.id === id ? Object.assign({}, a, changes) : a)) }); } function removeAction(id) { patch({ actions: item.actions.filter((a) => a.id !== id) }); } const filled = (item.notes && item.notes.trim()) || item.status || item.vote.recorded || item.actions.length; const lvl = item.level || (item.isSub ? 1 : 0); return (
onRegister && onRegister(item.id, el)} data-screen-label={"Item " + (item.number || item.title.slice(0, 20))} >
{item.number ? {item.number} : } patch({ title: e.target.value })} placeholder="Agenda item" />
patch({ notes: v })} />
Decision
{STATUSES.map((s) => ( ))}
{!showVote ? ( ) : ( { patch({ vote: v }); if (!v.recorded) setShowVote(false); }} /> )}
Action items
{item.actions.length > 0 && (
    {item.actions.map((a) => (
  • patchAction(a.id, { text: e.target.value })} placeholder="Task to be done" /> patchAction(a.id, { owner: e.target.value })} placeholder="Owner" /> patchAction(a.id, { due: e.target.value })} />
  • ))}
)}
); } window.ItemCard = ItemCard; })();