(id)
| 760 | } |
| 761 | |
| 762 | function 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 | |
| 803 | function updateStudent(id) { |
| 804 | const student = sampleData.students.find((s) => s.id === id) |
nothing calls this directly
no test coverage detected