Liberacion
This commit is contained in:
32
Templates/IMMEX/modulos/add_SistemaXCliente_Script.html
Normal file
32
Templates/IMMEX/modulos/add_SistemaXCliente_Script.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<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>
|
||||
@@ -4,7 +4,9 @@
|
||||
{% block title %}Add Cliente IMMEX {% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Crear Módulo/Permisos</h2>
|
||||
<h2>Editar Módulo/Permisos</h2>
|
||||
<p><strong>Cliente:</strong>{{object.sistema_cliente}}</p>
|
||||
<hr>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
@@ -36,4 +38,7 @@
|
||||
|
||||
<button type="submit" class="btn btn-outline-success">Guardar</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
{% include 'IMMEX/modulos/add_SistemaXCliente_Script.html' %}
|
||||
{% endblock %}
|
||||
@@ -33,4 +33,11 @@
|
||||
|
||||
<button type="submit" class="btn btn-outline-success">Guardar</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
{% include 'IMMEX/modulos/add_SistemaXCliente_Script.html' %}
|
||||
|
||||
{% endblock scripts %}
|
||||
@@ -31,6 +31,7 @@
|
||||
{% block scripts %}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", ()=>{
|
||||
console.log('edit_cliente.html',window.name)
|
||||
if(window.name ==='popupWin')
|
||||
{
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1>Create a new Sistema IMMEX por cliente</h1>
|
||||
<form method="post">
|
||||
<form method="post" id="sistemaXCliente-form">
|
||||
|
||||
{% csrf_token %}
|
||||
{% if form.non_field_errors %}
|
||||
@@ -63,6 +63,43 @@
|
||||
{% block scripts %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('SISTEMA X CLIENTE', window.name);
|
||||
|
||||
if(window.name==='createSistemaXCliente_popup'){
|
||||
document.querySelector('#sistemaXCliente-form').addEventListener('submit',(event)=>{
|
||||
event.preventDefault();
|
||||
let form = event.target;
|
||||
let url = `{% url 'create_sistemaIMMEX' %}`;
|
||||
let data = new FormData(form);
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('POST',url);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.onreadystatechange = ()=>{
|
||||
if(xhr.readyState===XMLHttpRequest.DONE){
|
||||
if(xhr.status===200){
|
||||
let response = JSON.parse(xhr.responseText);
|
||||
if(response.errors){
|
||||
alert(response.errors);
|
||||
|
||||
}else{
|
||||
window.opener.postMessage({data:response, windowName:'createSistemaXCliente'}, window.location.origin);
|
||||
|
||||
window.close();
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
console.error('Request error', xhr.statusText);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
xhr.send(data);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/*add Sistema*/
|
||||
document.querySelector('#add-sistema-btn').addEventListener('click', function() {
|
||||
let parentWidth = window.innerWidth;
|
||||
@@ -92,11 +129,12 @@
|
||||
popupWin.focus();
|
||||
});
|
||||
|
||||
|
||||
|
||||
window.addEventListener('message', function(event) {
|
||||
let response = event.data.data;
|
||||
|
||||
|
||||
let windowName = event.data.windowName;
|
||||
|
||||
if(windowName==='clientWindow'){
|
||||
let id_cliente = response.id;
|
||||
let Nombre = response.Nombre;
|
||||
|
||||
@@ -10,61 +10,48 @@
|
||||
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
|
||||
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
|
||||
|
||||
<li class="nav-item dropdown {% if request_path == '/' %}active{% endif %}">
|
||||
<li class="nav-item dropdown {% if 'cliente' in request_path or request_path == '/' %}active border py-1 px-1 {% endif %}">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Timbres/Clientes
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="/">Timbres x Cliente</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{% url 'add_cliente' %}">Agregar Cliente</a>
|
||||
|
||||
<a class="dropdown-item" href="#">---</a>
|
||||
<a class="dropdown-item" href="{% url 'add_cliente' %}">Agregar Cliente</a>
|
||||
</div>
|
||||
</li>
|
||||
{% comment %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Contacts</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">#</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" href="#">Disabled</a>
|
||||
</li>
|
||||
|
||||
{% endcomment %}
|
||||
|
||||
<li class="nav-item {% if 'sistemas' in request_path %}active border{% endif %}">
|
||||
<a class="nav-link" href="/sistemas" >Sistemas CFDI</a>
|
||||
</li>
|
||||
<li class="nav-item {% if 'IMMEX/' in request_path %}active border{% endif %}">
|
||||
<a class="nav-link" href="{% url 'sistemasXcli_IMMEX' %}" >Sistemas IMMEX</a>
|
||||
</li>
|
||||
<li class="nav-item {% if 'sistemas' in request_path %}active border{% endif %}">
|
||||
<a class="nav-link" href="/sistemas" >Sistemas CFDI</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown {% if 'IMMEX' in request_path %}active border py-1 px-1 {% endif %}">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
IMMEX
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
|
||||
<a class="dropdown-item" href="{% url 'sistemasXcli_IMMEX' %}">Sistemas</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
{% for group in request.user.groups.all %}
|
||||
{% if group.name == 'admin_soft' %}
|
||||
<a class="dropdown-item" href="{% url 'permisos-clientesModulos' %}">Modulos - Permisos</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
{% for group in request.user.groups.all %}
|
||||
{% if group.name == 'admin_soft' %}
|
||||
<li class="nav-item {% if 'IMMEX/permisos-clientes' in request_path %}active border{% endif %}">
|
||||
<a class="nav-link" href="{% url 'permisos-clientesModulos' %}" >Modulos-Permisos</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin" target="_blank">Admin site</a>
|
||||
</li>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{% include "partials/search_form.html" %}
|
||||
|
||||
<li class="navbar-text mr-2 nav-item dropdown">
|
||||
@@ -73,8 +60,7 @@
|
||||
</a>
|
||||
<div class="dropdown-menu dropleft" aria-labelledby="navbarDropdown">
|
||||
<form method="post" action="{% url 'account_logout' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="dropdown-item">Cerrar sesión</button>
|
||||
</form>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
Reference in New Issue
Block a user