From 4d8c07cb6d56b2e0d69575fabdaef93886a9d610 Mon Sep 17 00:00:00 2001 From: Dan Gleason Date: Tue, 3 Jan 2023 14:35:36 -0500 Subject: [PATCH] updated submission logic on table --- pages/contributors.js | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/pages/contributors.js b/pages/contributors.js index c031c57..7edce52 100755 --- a/pages/contributors.js +++ b/pages/contributors.js @@ -25,7 +25,7 @@ const CSV = () => { const [values, setValues] = useState([]); const [modalData, setModalData] = useState(""); const [showModal, setShowModal] = useState(false); - + const [ submission, setSubmission ] = useState(""); const [isEditing, setIsEditing] = useState(false); const [editingStudent, setEditingStudent] = useState(null); const [dataSource, setDataSource] = useState([ @@ -90,7 +90,7 @@ const CSV = () => { render: (record) => { return ( <> - {record !== ""? + {record !== "" ? handleModalOpen(record)}>View Submission : "No Submission" @@ -135,7 +135,7 @@ const CSV = () => { const handleModalOpen = (data) => { setModalData(data); - console.log("data", data) + console.log("data is", data) setShowModal(true); }; @@ -240,6 +240,7 @@ const CSV = () => { name: name, email: email, submitted: submitted, + submission: submission, // starts as an empty string notes: notes, }; @@ -274,7 +275,7 @@ const CSV = () => {
{ @@ -293,6 +294,7 @@ const CSV = () => { resetEditing(); }} > + { @@ -301,6 +303,7 @@ const CSV = () => { }); }} /> + { @@ -309,6 +312,7 @@ const CSV = () => { }); }} /> + { + setEditingStudent((pre) => { + return { ...pre, submission: e.target.value }; + }); + }} + /> + { @@ -336,6 +351,9 @@ const CSV = () => { }); }} /> + + + { onOk={handleOk} onCancel={handleCancel} > - setName(e.target.value)}/> - setEmail(e.target.value)}/> - setName(e.target.value)}/> + setEmail(e.target.value)}/> + setNotes(e.target.value)} /> + setSubmission(e.target.value)}/> + setNotes(e.target.value)} />