- Complete mail-in payment gateway for Event Tickets Commerce - Support for check payments with collapsible checkout interface - Admin interface for managing check payments and order status - Professional asset organization with proper WordPress enqueuing - Order management with status tracking (pending, received, bounced) - Template system with responsive design and accessibility features - Integration with Event Tickets Commerce order system - Settings page for configuring payment instructions and addresses
63 lines
No EOL
1.5 KiB
JavaScript
63 lines
No EOL
1.5 KiB
JavaScript
/**
|
|
* Mail-In Payment Gateway Admin JavaScript
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
(function($) {
|
|
'use strict';
|
|
|
|
$(document).ready(function() {
|
|
// Confirmation dialogs for admin actions
|
|
$('.et-mail-in-mark-received').on('click', function(e) {
|
|
const confirmMessage = etMailInAdmin.strings.confirm_received || 'Are you sure you want to mark this check as received?';
|
|
if (!confirm(confirmMessage)) {
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
});
|
|
|
|
$('.et-mail-in-mark-bounced').on('click', function(e) {
|
|
const confirmMessage = etMailInAdmin.strings.confirm_bounced || 'Are you sure you want to mark this check as bounced?';
|
|
if (!confirm(confirmMessage)) {
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
});
|
|
|
|
// Auto-hide admin notices after 5 seconds
|
|
setTimeout(function() {
|
|
$('.notice.is-dismissible').fadeOut();
|
|
}, 5000);
|
|
|
|
// Enhanced form validation
|
|
$('form[data-et-mail-in-form]').on('submit', function(e) {
|
|
const form = $(this);
|
|
const requiredFields = form.find('[required]');
|
|
let hasErrors = false;
|
|
|
|
requiredFields.each(function() {
|
|
const field = $(this);
|
|
const value = field.val().trim();
|
|
|
|
if (!value) {
|
|
field.addClass('error');
|
|
hasErrors = true;
|
|
} else {
|
|
field.removeClass('error');
|
|
}
|
|
});
|
|
|
|
if (hasErrors) {
|
|
e.preventDefault();
|
|
alert('Please fill in all required fields.');
|
|
return false;
|
|
}
|
|
});
|
|
|
|
// Remove error styling on input
|
|
$('input, textarea, select').on('input change', function() {
|
|
$(this).removeClass('error');
|
|
});
|
|
});
|
|
|
|
})(jQuery); |