()
| 663 | } |
| 664 | |
| 665 | function showAddNewsModal() { |
| 666 | const content = ` |
| 667 | <form id="addNewsForm"> |
| 668 | <div class="form-group"> |
| 669 | <label>Sarlavha</label> |
| 670 | <input type="text" id="newsTitle" required> |
| 671 | </div> |
| 672 | <div class="form-group"> |
| 673 | <label>Matn</label> |
| 674 | <textarea id="newsContent" rows="5" required style="width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: var(--border-radius);"></textarea> |
| 675 | </div> |
| 676 | <div class="form-group"> |
| 677 | <label>Rasm</label> |
| 678 | <input type="file" id="newsImage" accept="image/*"> |
| 679 | </div> |
| 680 | <div class="form-group"> |
| 681 | <button type="submit" class="btn btn-primary">Qo'shish</button> |
| 682 | <button type="button" class="btn btn-secondary" onclick="closeModal()">Bekor qilish</button> |
| 683 | </div> |
| 684 | </form> |
| 685 | ` |
| 686 | |
| 687 | showModal("Yangi Yangilik Qo'shish", content) |
| 688 | |
| 689 | document.getElementById("addNewsForm").addEventListener("submit", (e) => { |
| 690 | e.preventDefault() |
| 691 | addNews() |
| 692 | }) |
| 693 | } |
| 694 | |
| 695 | function closeModal() { |
| 696 | document.getElementById("modal").classList.remove("show") |
no test coverage detected