email template
This commit is contained in:
1 parent
101d8bc623
commit
e11fa6fa5b
10 files changed
+1367
-7127
No files matched your search
@@ -6,6 +6,29 @@ jQuery(document).ready(function($) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Funkcija za prikaz/skrivanje polj za e-pošto po meri
|
||||
function handleEmailSourceChange() {
|
||||
// Za formo za dodajanje
|
||||
if ($('#prize_email_template_id').val() == '0') {
|
||||
$('.custom-email-fields').show();
|
||||
} else {
|
||||
$('.custom-email-fields').hide();
|
||||
}
|
||||
|
||||
// Za modalno okno za urejanje
|
||||
if ($('#edit-prize-email-template-id').val() == '0') {
|
||||
$('.custom-email-fields-edit').show();
|
||||
} else {
|
||||
$('.custom-email-fields-edit').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// Poveži event handler za spremembo izbire predloge
|
||||
$('body').on('change', '#prize_email_template_id, #edit-prize-email-template-id', handleEmailSourceChange);
|
||||
|
||||
// Sproži ob nalaganju strani za formo za dodajanje
|
||||
handleEmailSourceChange();
|
||||
|
||||
// Tab navigation
|
||||
$('.nav-tab').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
@@ -72,6 +95,14 @@ jQuery(document).ready(function($) {
|
||||
$('#edit-prize-email-subject').val(prize.email_subject);
|
||||
$('#edit-prize-email-template').val(prize.email_template);
|
||||
|
||||
// Napolni nova polja
|
||||
$('#edit-funded-account-name').val(prize.funded_account_name);
|
||||
$('#edit-funded-account-value').val(prize.funded_account_value);
|
||||
$('#edit-prize-email-template-id').val(prize.email_template_id);
|
||||
|
||||
// Sproži spremembo, da se pravilno prikažejo/skrijejo polja
|
||||
$('#edit-prize-email-template-id').trigger('change');
|
||||
|
||||
modal.show();
|
||||
} else {
|
||||
alert(response.data.message || 'An error occurred.');
|
||||
@@ -100,6 +131,11 @@ jQuery(document).ready(function($) {
|
||||
discount_value: $('#edit-prize-discount-value').val(),
|
||||
email_subject: $('#edit-prize-email-subject').val(),
|
||||
email_template: $('#edit-prize-email-template').val(),
|
||||
|
||||
// Dodaj nova polja
|
||||
email_template_id: $('#edit-prize-email-template-id').val(),
|
||||
funded_account_name: $('#edit-funded-account-name').val(),
|
||||
funded_account_value: $('#edit-funded-account-value').val()
|
||||
};
|
||||
|
||||
// Debug: preveri wheel_id
|
||||
@@ -282,4 +318,53 @@ jQuery(document).ready(function($) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Upravljanje z wheel_product elementi (preneseno iz edit-wheel-page.php)
|
||||
$('.delete-wheel-product').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
if (!confirm('Ali res želiš izbrisati ta produkt?')) return;
|
||||
var row = $(this).closest('tr');
|
||||
var id = $(this).data('id');
|
||||
$.post(ajaxurl, {
|
||||
action: 'wof_delete_wheel_product',
|
||||
id: id,
|
||||
_ajax_nonce: wheel_admin_nonce._ajax_nonce
|
||||
}, function(response) {
|
||||
if (response.success) {
|
||||
row.fadeOut(300, function() { $(this).remove(); });
|
||||
} else {
|
||||
alert(response.data || 'Napaka pri brisanju.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.spins-editable').on('click', function() {
|
||||
var td = $(this);
|
||||
if (td.find('input').length) return;
|
||||
var current = td.text();
|
||||
var id = td.data('id');
|
||||
var input = $('<input type="number" min="1" style="width:60px;">').val(current);
|
||||
td.html(input);
|
||||
input.focus();
|
||||
input.on('blur', function() {
|
||||
var val = input.val();
|
||||
if (val && val != current) {
|
||||
$.post(ajaxurl, {
|
||||
action: 'wof_update_wheel_product_spins',
|
||||
id: id,
|
||||
spins: val,
|
||||
_ajax_nonce: wheel_admin_nonce._ajax_nonce
|
||||
}, function(response) {
|
||||
if (response.success) {
|
||||
td.text(val);
|
||||
} else {
|
||||
alert(response.data || 'Napaka pri shranjevanju.');
|
||||
td.text(current);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
td.text(current);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user