| 1234567891011121314151617181920212223242526272829 |
- class DocumentPage {
- static InitItemsSection() {
- const $table = $("#document-items-section table");
- const $checkboxes = $table.find("input[type=checkbox]");
- const $allCheckbox = $("#all-items-checkbox");
- $allCheckbox.on("change", () => {
- const checked = $allCheckbox.prop("checked");
- $checkboxes.prop("checked", checked);
- });
- $table.find(".btn-delete-document-item").on("click", event => {
- const documentItemId = $(event.currentTarget).data("document-item-id");
- const confirmed = confirm("Are you sure you want to delete this item?");
- if(confirmed) {
- $.post(window.location + "/delete-item", {
- document_item_id: documentItemId
- }).then(response => {
- toastr.success("Item deleted successfully.");
- $("#document-items-section").html(response.html);
- DocumentPage.InitItemsSection();
- });
- }
- });
- }
- }
- $(() => {
- DocumentPage.InitItemsSection();
- });
|