Bug 40908: Remove JS confirmation, fix link, fix modal

To test:
1. Without the patch:

-Clicking delete from the Actions button -> delete pops up both a JS alert and a BS confirmation modal. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up both a JS alert and a BS confirmation modal. The deletion does NOT work.

-The "Cancel" button in the delete-item-modal does nothing.

2. APPLY THE PATCH:

-Clicking delete from the Actions button -> 1 modal for confirmation. The deletion works.

-Clicking the "Delete item" button that appears when you hover over any cell pops up only a modal confirmation. The deletion works.

-The "Cancel" button in the delete-item-modal properly closes the modal.

Signed-off-by: Jason <jvasche@roundrocktexas.gov>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2025-09-30 12:41:48 +00:00
parent 168f52f99b
commit 51f2b5e12d
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 10 additions and 12 deletions

View File

@ -23,7 +23,7 @@
</div>
<div class="modal-footer">
<button id="delete-item-modal-btn-submit" type="button" class="btn btn-primary"><i class="fa fa-exclamation-circle"></i> Delete item</button>
<button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button>
<button class="btn btn-default deny cancel" href="#" data-bs-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button>
</div>
</div>
</div>

View File

@ -35,7 +35,7 @@ $(document).ready(function () {
);
$(edit_link).text(LABEL_EDIT_ITEM);
var delete_link = $(
'<a class="delete" data-item="' +
'<a class="delete" data-itemnumber="' +
num_rowid +
'" href="#"></a>'
);
@ -153,18 +153,16 @@ $(document).ready(function () {
$(document).on("click", ".delete", function (e) {
e.preventDefault();
if (confirmDelete(MSG_CONFIRM_DELETE_ITEM)) {
var itemnumber = $(this).data("itemnumber");
var hasSerialItem = $(this).data("has-serial-item");
var itemnumber = $(this).data("itemnumber");
var hasSerialItem = $(this).data("has-serial-item");
$("#delete-item-itemnumber").val(itemnumber);
$("#delete_associated_serial_issues").attr("checked", false);
$("#delete-item-modal-btn-submit").data("item", itemnumber);
if (!hasSerialItem) {
$(".form-group").hide();
}
$("#delete-item-modal").modal("show");
$("#delete-item-itemnumber").val(itemnumber);
$("#delete_associated_serial_issues").attr("checked", false);
$("#delete-item-modal-btn-submit").data("item", itemnumber);
if (!hasSerialItem) {
$(".form-group").hide();
}
$("#delete-item-modal").modal("show");
});
$(document).on("click", "#delete-item-modal-btn-submit", function (e) {
e.preventDefault();