32 lines
1.1 KiB
HTML
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> |