Admin - Mensajes y footer

This commit is contained in:
2020-04-16 16:27:20 -04:00
parent 080577d002
commit 575693def1
10 changed files with 107 additions and 11 deletions

View File

@ -21,6 +21,7 @@
@endif
/>
</div>
<div id="transparencia_message" class="ui message transition hidden"></div>
<div class="ui basic modal" id="doc_form">
<i class="close icon"></i>
<div class="inverted dark-blue header">
@ -33,6 +34,7 @@
</div>
<div id="mod" class="field"></div>
<button class="ui button">Subir</button>
<div id="documento_message"></div>
</form>
</div>
</div>
@ -57,10 +59,13 @@
cache: false,
processData: false,
success: function(data) {
if (data.estado == true) {
if (data.estado != true) {
$('#doc_form').find('.header').html('')
$('#doc_form').find('form').find("[name='filename']").val('')
$('#doc_form').modal('hide')
} else {
$('#documento_message').html('Error al subir el archivo.')
$('#documento_message').show()
}
}
})
@ -90,16 +95,47 @@
})
}
$(document).ready(function() {
$('#transparencia_message').hide()
$('#transparencia').checkbox()
$('#transparencia').click(function() {
var status = $(this).checkbox('is checked')
$.post('{{$urls->base}}/admin/transparencia', {'activo': status}, function(data) {}, 'json')
$.post('{{$urls->base}}/admin/transparencia', {'activo': status}, function(data) {
var msg = ['<i class="close icon"></i>']
if (data.estado == 'ok') {
if (data.informacion.activo == 'true') {
msg.push('Activado')
} else {
msg.push('Desactivado')
}
$('#transparencia_message').addClass('success')
} else {
msg.push('No se ha podido')
if (data.informacion.activo == 'true') {
msg.push('activar')
} else {
msg.push('desactivar')
}
$('#transparencia_message').addClass('error')
}
msg.push('correctamente.')
$('#transparencia_message').html(msg.join(' '))
$('#transparencia_message').removeClass('hidden')
$('#transparencia_message').show()
$('#transparencia_message').find('.close').click(function() {
$('#transparencia_message').html('')
$('#transparencia_message').addClass('hidden')
$('#transparencia_message').removeClass('success error')
$('#transparencia_message').hide()
})
}, 'json')
})
$('#doc_form').modal({
onHidden: function() {
$('#mod').html('')
}
})
$('#documento_message').hide()
$('.form_link').click(function() {
var link = $(this).attr('data-link')
var title = $(this).attr('data-title')