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