Implementado Cambiar Nombre Hermandad y Precios Modificables desde Admin de Django del DP de Hermandad

This commit is contained in:
adevopg
2024-11-13 19:29:45 +01:00
parent e26ed74ac2
commit ca25e51d18
9 changed files with 240 additions and 39 deletions
@@ -0,0 +1,79 @@
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
};
$(function(){
$(".toggle-token").click(function() {
$(this).toggleClass("fa-eye fa-eye-slash");
var type = $(this).hasClass("fa-eye-slash") ? "text" : "password";
$("#security-token").attr("type", type);
});
});
function doRefresh() {
$("#nw-rename-guild-form").load(document.URL + " #nw-rename-guild-form>*", function(){
$.getScript('nw-js-handlers/rename_guild_response.js');
});
}
$(function(){
$('select').on('change', function(){
var select = $(this);
select.css('color', select.children('option:selected').css('color'));
});
});
$(function(){
$('.rename-guild-button').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$("#rename-guild-response").empty();
var button = $(this);
var buttonoriginal = button.html();
var bValue = button.data('id');
var data = {renameguild : bValue};
data = $("#nw-rename-guild-form").serialize() + '&' + $.param(data);
var conf = confirm("¿Estás seguro de renombrar la hermandad seleccionada?");
if (conf === true) {
changeButton(button, 'Renombrando hermandad');
$.ajax({
type: 'POST',
url: '',
data: data,
dataType: 'json',
success: function(data) {
$("#rename-guild-response").append(data.message).hide().slideDown();
if (data.success === true) {
button.html("Hermandad renombrada");
button.css("color","#d79602");
setTimeout(function() {
$("#nw-rename-guild-form")[0].reset();
restoreButton(button, buttonoriginal);
doRefresh();
}, 5000);
}
else {
setTimeout(function() {
$("#rename-guild-response").slideUp( function() {
$("#rename-guild-response").empty();
restoreButton(button, buttonoriginal);
});
}, 5000);
}
},
error: function() {
setTimeout(function() {
alert("Algo ha salido mal. Por favor intente más tarde");
window.location.reload();
}, 2000);
}
});
};
});
});