143 lines
4.4 KiB
HTML
143 lines
4.4 KiB
HTML
|
|
|
|
{% extends "base.html" %}
|
|
|
|
{% block title %}Timbres{% endblock title %}
|
|
|
|
{% block titlePage %}
|
|
Timbres disponibles Comercio Digital: {{saldo.saldo}}
|
|
{% endblock titlePage %}
|
|
|
|
{% block content %}
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
|
|
<th scope="col">
|
|
<input id="table_rfcc" name="rfcc" value="True" type="checkbox" class="form-check-input" >
|
|
Cliente RFC
|
|
</th>
|
|
<th>Nombre</th>
|
|
<th>
|
|
<div class="d-flex align-items-center">
|
|
Totales Mes
|
|
<div style="display:none" id="spinner_id" class="spinner-border ml-auto spinner-border-sm" role="status" aria-hidden="true"></div>
|
|
</div>
|
|
|
|
<select id="table_select" class="form-control form-control-sm">
|
|
<option value="01">Enero
|
|
</option>
|
|
<option value="02">Febrero
|
|
</option>
|
|
<option value="03">Marzo
|
|
</option>
|
|
<option value="04">Abril
|
|
</option>
|
|
<option value="05">Mayo
|
|
</option>
|
|
<option value="06">Junio
|
|
</option>
|
|
<option value="07">Julio
|
|
</option>
|
|
<option value="08">Agosto
|
|
</option>
|
|
<option value="09">Septiembre
|
|
</option>
|
|
<option value="10">Octubre
|
|
</option>
|
|
<option value="11">Noviembre
|
|
</option>
|
|
<option value="12">Diciembre
|
|
</option>
|
|
</select>
|
|
|
|
</th>
|
|
<th>Estado</th>
|
|
<th scope="col">actions</th>
|
|
<th>
|
|
<a target="_blank" rel="noopener noreferrer" href="{% url 'export_Excel' %}?mes={{mes}}">Excel Todos los clientes X Mes </a>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for obj in lista %}
|
|
<tr class="{% if not obj.Activo %}table-danger{% endif %}">
|
|
<td >
|
|
<a href="{% url 'update_cliente' obj.pk %}">{{obj.RFC}}</a>
|
|
</td>
|
|
<td>{{obj.Nombre}} </td>
|
|
<td>
|
|
{{obj.conteo_mes}}
|
|
</td>
|
|
|
|
<td>
|
|
{% if obj.Activo %}
|
|
Activo
|
|
{% else %}
|
|
Inactivo
|
|
{% endif %}
|
|
</td>
|
|
|
|
<td>
|
|
{% if request.user.is_staff %}
|
|
<a href="{% url 'timbres_cliente' obj.RFC %}" class="btn btn-info">Ver Timbres</a>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<button class="btn btn-outline-info" id ="id_b_{{obj.RFC}}" onclick="aclick(event, '{{obj.RFC}}','{{obj.conteo_mes}}')">Excel</button>
|
|
<a style="display: none;" id="id_a_{{obj.RFC}}" target="_blank" rel="noopener noreferrer" href="{% url 'export_Excel' %}?RFC={{obj.RFC}}&mes={{mes}}">Excel</a>
|
|
|
|
<a href="{% url 'send_timbres_Email' %}?RFC={{obj.RFC}}&mes={{mes}}" >Email Timbres</a>
|
|
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
|
|
|
{% endblock content %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
let filters = document.getElementById('id_filters').textContent
|
|
console.log(filters)
|
|
function aclick(event,RFC ,cuantos){
|
|
|
|
if( parseInt(cuantos)===0){
|
|
|
|
alert(`No hay timbres de este mes para el cliente ${RFC}`)
|
|
}else{
|
|
document.getElementById(`id_a_${RFC}`).click()
|
|
}
|
|
}
|
|
|
|
table_rfcc.addEventListener('click',(event)=>{
|
|
document.getElementById('rfcc').checked= table_rfcc.checked? true:false;
|
|
})
|
|
|
|
window.addEventListener("load", (event)=>{
|
|
let mes ='{{mes}}'
|
|
|
|
if(mes !="None"){
|
|
document.getElementById('table_select').value='{{mes}}'
|
|
mes_id.value='{{mes}}'
|
|
}else{
|
|
document.getElementById('table_select').value='{{fecha|date:"m"}}'
|
|
mes_id.value='{{fecha|date:"m"}}'
|
|
}
|
|
})
|
|
|
|
document.getElementById('table_select').addEventListener('change',(event)=>{
|
|
spinner_id.setAttribute('style','display:inline;')
|
|
let anc = document.getElementById('home_id')
|
|
anc.href=''
|
|
let url = `?mes=${event.target.value}${filters}`
|
|
anc.href=url
|
|
anc.click()
|
|
})
|
|
|
|
</script>
|
|
|
|
{% endblock scripts %} |