Files
AS_timbres/Templates/IMMEX/modulos/add_SistemaXCliente_Script.html
fjrodriguez 98a58d5eea Liberacion
2024-02-01 11:41:05 -06:00

32 lines
1.1 KiB
HTML

<script>
document.addEventListener("DOMContentLoaded", ()=>{
document.querySelector('#add-sistema-cliente').addEventListener('click', function() {
let parentWidth = window.innerWidth;
let parentHeight = window.innerHeight;
let childWidth = 800;
let childHeight = 600;
let left =(parentWidth - childWidth);
let top = (parentHeight - childHeight);
let popupWin = window.open("{% url 'create_sistemaIMMEX' %}", "createSistemaXCliente_popup", "width=" + childWidth + ",height=" + childHeight + ",left=" + left + ",top=" + top);
popupWin.focus();
});
window.addEventListener('message', (event)=>{
let response = event.data.data;
let windowName = event.data.windowName;
if(windowName==='createSistemaXCliente'){
let option = '<option value="' + response.id + '" selected>'+response.cliente+', ' + response.nombre + '</option>';
document.querySelector('#id_sistema_cliente').insertAdjacentHTML('beforeend', option);
}
});
});
</script>