Skip to content

Commit a8fbd9f

Browse files
authored
Update
1 parent 7aa8d12 commit a8fbd9f

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

assets/js/admin.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
jQuery(document).ready(function($) {
66
'use strict';
77

8-
const SCG_Admin = {
8+
var SCG_Admin = {
99

1010
init: function() {
1111
this.bindEvents();
@@ -20,18 +20,18 @@ jQuery(document).ready(function($) {
2020
$('#coupon_prefix').on('input', this.formatPrefix);
2121

2222
// Number input validation
23-
$('#number_of_coupons').on('input', this.validateCouponCount);
23+
$('#number_of_coupons').on('input', this.validateNumberInput);
2424

2525
// Product selection change
2626
$('#product_id').on('change', this.handleProductChange);
2727
},
2828

2929
handleFormSubmission: function(e) {
30-
const $form = $(this);
31-
const $submitBtn = $form.find('.button-primary');
30+
var $form = $(this);
31+
var $submitBtn = $form.find('.button-primary');
3232

3333
// Validate form before submission
34-
if (!SCG_Admin.validateForm($form)) {
34+
if (!SCG_Admin.validateForm()) {
3535
e.preventDefault();
3636
return false;
3737
}
@@ -41,9 +41,9 @@ jQuery(document).ready(function($) {
4141
$submitBtn.prop('disabled', true);
4242

4343
// Show confirmation for large batches
44-
const couponCount = parseInt($('#number_of_coupons').val(), 10);
44+
var couponCount = parseInt($('#number_of_coupons').val(), 10);
4545
if (couponCount > 25) {
46-
const confirmed = confirm(
46+
var confirmed = confirm(
4747
'You are about to generate ' + couponCount + ' coupons. ' +
4848
'This may take a while and could potentially timeout depending on your server settings. Do you want to continue?'
4949
);
@@ -55,6 +55,17 @@ jQuery(document).ready(function($) {
5555
return false;
5656
}
5757
}
58+
59+
return true;
60+
},
61+
62+
if (!confirmed) {
63+
$form.removeClass('loading');
64+
$submitBtn.prop('disabled', false);
65+
e.preventDefault();
66+
return false;
67+
}
68+
}
5869
},
5970

6071
formatPrefix: function() {

free-gift-bulk-coupon-generator.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
2-
/ * Requires at least: 6.5
3-
* Tested up to: 6.8
4-
* Plugin Name: WC Free Gift Coupons Bulk Coupon Generator
2+
/* Plugin Name: WC Free Gift Coupons Bulk Coupon Generator
53
* Plugin URI: https://github.com/EngineScript/WC-Free-Gift-Coupons-Bulk-Coupons-Generator
64
* Description: Generate bulk free gift coupon codes that work with the Free Gift Coupons for WooCommerce plugin. Creates coupons with the proper data structure for free gift functionality.
75
* Version: 1.0.0

0 commit comments

Comments
 (0)