diff --git a/front_end/src/Components/Notes/NotesCell.jsx b/front_end/src/Components/Notes/NotesCell.jsx new file mode 100644 index 00000000..6652cbe6 --- /dev/null +++ b/front_end/src/Components/Notes/NotesCell.jsx @@ -0,0 +1,110 @@ +import React, { useState } from "react"; +import { getURLSegment, postJsonData } from "../../Util"; + +const Modal = ({ isOpen, notes, employee_no, onClose, onSave }) => { + const [currentNotes, setCurrentNotes] = useState(notes); + + if (!isOpen) return null; + + const handleSubmit = async (e) => { + e.preventDefault(); + const financialYear = getURLSegment(0); + const costCentre = getURLSegment(1); + const response = await postJsonData( + `/payroll/api/${costCentre}/${financialYear}/employees/notes`, + { + employee_no, + notes: currentNotes, + }, + ); + console.log(response.status); + if (response.status === 204) { + onSave(currentNotes); + onClose(); + } + }; + + return ( +
+
+
+

+ {notes ? "Edit Notes" : "Add Notes"} +

+
+
+ + Notes will be reset at the end of the {getURLSegment(0)} financial + year + +
+
+
+ +