    .then(result => {
            if (result.error) {
                throw new Error(result.error);
            }
            
            // Success - close modal and reload page
            closeEditCaseModal();
            window.location.reload();
        })
        .catch(error => {
            // Restore button and show error
            submitBtn.innerHTML = originalText;
            submitBtn.disabled = false;
            
            alert('Error saving case: ' + error.message);
        });
    }
