Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

With tailwind.css #45

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 47 additions & 35 deletions src/src/pages/PF/StudentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ function StudentList() {

const [showModal, setShowModal] = useState(false);
const [isEdit, setIsEdit] = useState(false);
const [gonEdit, setGonEdit] = useState("");

const [ID, setID] = useState("");
const [name, setName] = useState("");
const [group, setGroup] = useState("");
const [section, setSection] = useState("");

// const [Email,] = useState(sessionStorage.getItem("Email"));
const [classId,] = useState(sessionStorage.getItem("classId"));
Expand Down Expand Up @@ -129,17 +135,37 @@ function StudentList() {
}

const handleEditStudent = async (toEdit) => {
setShowModal(true);
console.log(toEdit)
setIsEdit(true);
setID(toEdit["ID"]);
setName(toEdit["Name (English)"]);
setSection(toEdit["Section"]);
setGroup(toEdit["Group"]);
console.log(toEdit["ID"]);
setShowModal(true);
document.getElementById("SID").disabled = true;

}

const handleChangeGonEdit = async (k, v) => {
var x = gonEdit
x[k] = v
console.log(x)
setGonEdit(x)
}

const handleAddStudent = async () => {
setShowModal(true);
setIsEdit(false)
setIsEdit(false);
document.getElementById("SID").disabled = false
setID("");
setName("");
setGroup("");
setSection("");
}

const UpdateStudent = async () => {

}

const RemoveStudent = async () => {
Expand Down Expand Up @@ -271,52 +297,38 @@ function StudentList() {
<button type="button" className="btn-close" onClick={handleCloseModal} aria-label="Close"></button>
</div>
<div className="modal-body">
{isEdit ? (<form>
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
<input type="text" class="form-control" id="nameEdit" placeholder="Enter name"/>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Section</label>
<input type="text" class="form-control" id="sectionEdit" placeholder="Enter section"/>
<form>
<div className="form-group">
<label htmlFor="studentId">Student ID</label>
<input type="text" className="form-control" id="SID" placeholder="Student ID" value={ID} onChange={(e) => {setID(e.target.value)}}/>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Group</label>
<input type="text" class="form-control" id="groupEdit" placeholder="Enter group"/>
</div>
</form>
) : (<form>
<div class="form-group">
<label for="exampleInputEmail1">Stundent ID</label>
<input type="text" class="form-control" id="studentIdAdd" placeholder="Enter student"/>
<div className="form-group">
<label htmlFor="exampleInputEmail1">Name</label>
<input type="text" className="form-control" id="nameEdit" placeholder="Enter name" value={name} onChange={(e) => {setName(e.target.value)}}/>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
<input type="text" class="form-control" id="nameAdd" placeholder="Enter name"/>
<div className="form-group">
<label htmlFor="exampleInputEmail1">Section</label>
<input type="text" className="form-control" id="sectionEdit" placeholder="Enter section" value={section} onChange={(e) => {setSection(e.target.value)}}/>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Section</label>
<input type="text" class="form-control" id="sectionAdd" placeholder="Enter section"/>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Group</label>
<input type="text" class="form-control" id="groupAdd" placeholder="Enter group"/>
<div className="form-group">
<label htmlFor="exampleInputEmail1">Group</label>
<input type="text" className="form-control" id="groupEdit" placeholder="Enter group" value={group} onChange={(e) => {setGroup(e.target.value)}}/>
</div>
</form>
)}

</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" style={{justifyContent: "flex-start"}} onClick={handleCloseModal}>
<div className="modal-footer" style={{justifyContent: "flex-start"}}>
<button type="button" className="btn btn-outline-secondary" onClick={handleCloseModal}>
Cancel
</button>
{isEdit ? (
<button type="button" className="btn btn-secondary" style={{justifyContent: "flex-start"}} onClick={handleCloseModal}>
<button type="button" className="btn btn-danger" onClick={handleCloseModal}>
Remove
</button>
):(
""
)}
<button type="button" className="btn btn-secondary" style={{justifyContent: "flex-start"}} onClick={handleCloseModal}>
<button type="button" className="btn btn-success" onClick={handleCloseModal}>
Save
</button>

Expand Down
Loading