MCPcopy Create free account
hub / github.com/Muhammadsiddiq-code/Admin-dashboard / editStudent

Function editStudent

app.js:762–801  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

760}
761
762function editStudent(id) {
763 const student = sampleData.students.find((s) => s.id === id)
764 if (student) {
765 const content = `
766 <form id="editStudentForm">
767 <div class="form-group">
768 <label>Ism Familiya</label>
769 <input type="text" id="editStudentName" value="${student.name}" required>
770 </div>
771 <div class="form-group">
772 <label>Sinf</label>
773 <select id="editStudentClass" required>
774 <option value="9-A" ${student.class === "9-A" ? "selected" : ""}>9-A</option>
775 <option value="10-A" ${student.class === "10-A" ? "selected" : ""}>10-A</option>
776 <option value="11-A" ${student.class === "11-A" ? "selected" : ""}>11-A</option>
777 </select>
778 </div>
779 <div class="form-group">
780 <label>Telefon</label>
781 <input type="tel" id="editStudentPhone" value="${student.phone}" required>
782 </div>
783 <div class="form-group">
784 <label>Email</label>
785 <input type="email" id="editStudentEmail" value="${student.email}" required>
786 </div>
787 <div class="form-group">
788 <button type="submit" class="btn btn-primary">Saqlash</button>
789 <button type="button" class="btn btn-secondary" onclick="closeModal()">Bekor qilish</button>
790 </div>
791 </form>
792 `
793
794 showModal("O'quvchini Tahrirlash", content)
795
796 document.getElementById("editStudentForm").addEventListener("submit", (e) => {
797 e.preventDefault()
798 updateStudent(id)
799 })
800 }
801}
802
803function updateStudent(id) {
804 const student = sampleData.students.find((s) => s.id === id)

Callers

nothing calls this directly

Calls 2

showModalFunction · 0.85
updateStudentFunction · 0.85

Tested by

no test coverage detected