window.addEventListener('load', function() { $('#searchForm').on('submit', function(e) { const searchKeyword = $("#searchText").val(); const selectedCountry = $("#countryFilter").val(); if (!searchKeyword) { $('#searchText').attr('disabled', 'disabled'); } if (!selectedCountry) { $('#countryFilter').attr('disabled', 'disabled'); } return true; }); $('.btn-remove').on('click', function(e) { e.preventDefault(); const itemId = $(this).data('id'); const phone = $(this).data('phone'); $modal = $('#remove-phone-warning-modal'); $modal.find('h4.modal-title').text(`Removing address: ${phone}`); $modal.find('#removeBtn').data('id', itemId); }); $('#removeBtn').on('click', function(e) { e.preventDefault(); const itemId = $(this).data('id'); window.__api__.remove(`/phone_farm_phones/remove/${itemId}`, itemId); }) });