Copy of snippet "NEW TO DO"

Inspired by a bunch of ideas on "To-Do, Task" lists.

EXISTING & COMPLETED TASKS
IDNAMEDESCRIPTION
{note: preview=no}{run: tasks={dbselect: SELECT name, Completed, Description, row_id, rowid() AS `Row ID`, Added, Finished FROM Todo ORDER BY row_id ASC; space=7tx9nPt9M9H1yNcMLU1AzM; menu=no; multiple=yes}}{endnote}
{repeat: for (task, i) in tasks}
{=row_id}{=task.name}{row_id=task.row_id}{=task.description} {if: not task.completed}{note: preview=no}{Finished={time: MM/DD/YYYY}}{endnote}{button: {dbupdate: UPDATE Todo SET Completed=yes, Finished=@finished Where row_id=@row_id; space=7tx9nPt9M9H1yNcMLU1AzM; instant=yes; autoaddfields=no}
tasks=merge(slice(tasks,1,i-1), [["name": task.name, "description": task.description, "row_id": row_id, "completed": yes]], slice(tasks,i+1,count(tasks)))
; label="Mark done"}{else}Done{endif}
{endrepeat}
{note: preview=no}{dbupdate: UPDATE Todo SET completed=yes Where row_id=@row_id; space=7tx9nPt9M9H1yNcMLU1AzM; autoaddfields=yes}{endnote}
{note: preview=no}{Finished={time: MM/DD/YYYY}}{endnote}

ADD NEW TASK TO LIST
{formtext: name=new_task; cols=10}{formtext: name=new_description; cols=20}{note: preview=no}{formtoggle: name=toggle}{run: {dbinsert: INSERT INTO Todo SET name=@new_task, Description=@new_description, added=@added; space=7tx9nPt9M9H1yNcMLU1AzM; autoaddfields=yes; instant=yes}
}{endformtoggle}{if: new_task<>""}{Added={time: MM/DD/YYYY}}{endif}{endnote}{if: toggle = no}{button: toggle = yes; label=✍️}
{else}{button: toggle = no
; label=↩️}{endif}



{dbinsert: INSERT INTO Todo SET name=@new_task, Description=@new_description; space=7tx9nPt9M9H1yNcMLU1AzM; autoaddfields=yes}