Ultimo Commit antes del apagon (Respaldo)
This commit is contained in:
97
Templates/IMMEX/xclientes/edit_cliente.html
Normal file
97
Templates/IMMEX/xclientes/edit_cliente.html
Normal file
@@ -0,0 +1,97 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Add Cliente IMMEX {% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<form method="POST" action="." id="cliente-form">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label for="{{form.RFC.name}}"><strong> {{form.RFC.label|capfirst}} </strong></label>
|
||||
{% render_field form.RFC id+="add" id+=form.RFC.name placeholder=form.RFC.label class="form-control" type="text" autocomplete="off" %}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="{{form.Nombre.name}}"><strong> {{form.Nombre.label|capfirst}} </strong></label>
|
||||
{% render_field form.Nombre id+="add" id+=form.Nombre.name placeholder=form.Nombre.label class="form-control" type="text" autocomplete="off" %}
|
||||
</div>
|
||||
|
||||
<div class="form-group form-check">
|
||||
{% render_field form.Activo class+="form-checkbox" type="checkbox" %}
|
||||
<label class="form-check-label" for="{{form.Activo.label}}">Activo</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{% render_field form.fecha_baja.label %}
|
||||
{% render_field form.fecha_baja placeholder=form.fecha_baja.label class+="form-control" type="date" %}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", ()=>{
|
||||
if(window.name ==='popupWin')
|
||||
{
|
||||
|
||||
document.querySelector("#cliente-form").addEventListener('submit',(event)=>{
|
||||
event.preventDefault();
|
||||
let form= event.target;
|
||||
let url = `{% url 'ClientesIMMEX_Create' %}`;
|
||||
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:'clientWindow'},window.location.origin);
|
||||
window.close();
|
||||
}
|
||||
}else{
|
||||
console.error('Request error ',xhr.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send(data);
|
||||
|
||||
});
|
||||
}else{
|
||||
console.log('not popupWin')
|
||||
}
|
||||
})
|
||||
|
||||
window.addEventListener("load", (event)=>{
|
||||
if(!id_Activo.checked){
|
||||
id_fecha_baja.setAttribute('required','')
|
||||
}else{
|
||||
id_fecha_baja.removeAttribute('requied')
|
||||
}
|
||||
})
|
||||
|
||||
id_fecha_baja.addEventListener('click',(event)=>{
|
||||
|
||||
if(id_Activo.checked){
|
||||
event.preventDefault()
|
||||
alert('El cliente esta activo necesita deseleccionar "Activo" y colocar fecha baja.')
|
||||
return
|
||||
}
|
||||
})
|
||||
id_Activo.addEventListener('click', (event)=>{
|
||||
|
||||
if(id_Activo.checked){
|
||||
id_fecha_baja.value=''
|
||||
id_fecha_baja.removeAttribute('required')
|
||||
|
||||
}else{
|
||||
id_fecha_baja.setAttribute('required','')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{% endblock scripts %}
|
||||
|
||||
35
Templates/IMMEX/xclientes/lista.html
Normal file
35
Templates/IMMEX/xclientes/lista.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
|
||||
{% block title %}
|
||||
Sistemas Clientes IMMEX
|
||||
{% endblock title %}
|
||||
|
||||
|
||||
|
||||
{% block content %}
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Sistema</th>
|
||||
<th scope="col">Cliente</th>
|
||||
<th scope="col">No. Licencias</th>
|
||||
<th><a class="btn btn-outline-info" href="{% url 'create_sistemaIMMEX' %}">Agregar Sistema por cliente</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for row in object_list %}
|
||||
<tr>
|
||||
<th scope="row">{{row.id}}</th>
|
||||
<td>{{row.id_sistema}}</td>
|
||||
<td>{{row.cliente}}</td>
|
||||
<td>{{row.num_licencias}}</td>
|
||||
<td><a href="#" class="btn btn-info">Detalles</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock content %}
|
||||
|
||||
121
Templates/IMMEX/xclientes/sistema_create_IMMEX.html
Normal file
121
Templates/IMMEX/xclientes/sistema_create_IMMEX.html
Normal file
@@ -0,0 +1,121 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<h1>Create a new Sistema IMMEX por cliente</h1>
|
||||
<form method="post">
|
||||
|
||||
{% csrf_token %}
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{% for error in form.non_field_errors %}
|
||||
<p>{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="">
|
||||
<div class="form-group">
|
||||
<div class="form">
|
||||
{{ form.id_sistema.label }}
|
||||
{{ form.id_sistema }}
|
||||
<button id="add-sistema-btn" type="button" class="btn btn-info">Add Sistema</button>
|
||||
{% if form.id_sistema.errors %}
|
||||
<ul class="errorlist">
|
||||
{% for error in form.id_sistema.errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ form.cliente.label}}
|
||||
{{ form.cliente }}
|
||||
<button id="add-cliente-btn" type="button" class="btn btn-info">Add Cliente</button>
|
||||
{% if form.cliente.errors %}
|
||||
<ul class="errorlist">
|
||||
{% for error in form.cliente.errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ form.num_licencias.label }}
|
||||
{{ form.num_licencias }}
|
||||
{% if form.num_licencias.errors %}
|
||||
<ul class="errorlist">
|
||||
{% for error in form.num_licencias.errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<button class="btn btn-success" type="submit">Create</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
/*add Sistema*/
|
||||
document.querySelector('#add-sistema-btn').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_sistemas_form' %}", "popupWin", "width=" + childWidth + ",height=" + childHeight + ",left=" + left + ",top=" + top);
|
||||
popupWin.focus();
|
||||
});
|
||||
|
||||
/*Add cliente*/
|
||||
document.querySelector("#add-cliente-btn").addEventListener('click',()=>{
|
||||
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 'ClientesIMMEX_Create' %}", "popupWin", "width=" + childWidth + ",height=" + childHeight + ",left=" + left + ",top=" + top);
|
||||
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;
|
||||
let option= `<option value="${id_cliente}" selected> ${Nombre}</option>`;
|
||||
document.querySelector("#id_cliente").insertAdjacentHTML('beforeend',option);
|
||||
|
||||
}
|
||||
else if (windowName==='sistemaWindow'){
|
||||
let id_sistema = response.id;
|
||||
let nombre_sistema = response.nombre_sistema;
|
||||
let version = response.version;
|
||||
let option = '<option value="' + id_sistema + '" selected>' + nombre_sistema + ', version ' + version + '</option>';
|
||||
document.querySelector('#id_id_sistema').insertAdjacentHTML('beforeend', option);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock scripts %}
|
||||
|
||||
0
Templates/IMMEX/xclientes/sistema_create_from.html
Normal file
0
Templates/IMMEX/xclientes/sistema_create_from.html
Normal file
@@ -1,14 +1,16 @@
|
||||
{% with request_path=request.path|slice:'/' %}
|
||||
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<a id="home_id" class="navbar-brand" href="/"><img height="25px" class="center" src="https://aduanasoft.com/wp-content/uploads/2019/01/aslogo-1.png" id="icon" alt="User Icon" /></a>
|
||||
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
|
||||
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
|
||||
|
||||
|
||||
<li class="nav-item dropdown active">
|
||||
<li class="nav-item dropdown {% if request_path == '/' %}active{% endif %}">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Timbres/Clientes
|
||||
</a>
|
||||
@@ -41,9 +43,14 @@
|
||||
</li>
|
||||
|
||||
{% endcomment %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/sistemas" target="_blank">Sistemas</a>
|
||||
|
||||
<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>
|
||||
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin" target="_blank">Admin site</a>
|
||||
@@ -75,4 +82,5 @@
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
{% endwith%}
|
||||
Reference in New Issue
Block a user