Filter year index view
This commit is contained in:
@@ -18,38 +18,56 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
</th>
|
||||
<th>Nombre</th>
|
||||
<th>
|
||||
<div class="d-flex align-items-center">
|
||||
Total x mes
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="">
|
||||
<a data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||
Total x mes
|
||||
</a>
|
||||
<strong>
|
||||
<small>Filtrado: Mes:{{mes}}, Año:{{year}}, PAC:<label id="lbl_pac"></label></small>
|
||||
</strong>
|
||||
</div>
|
||||
<div style="display:none;" id="spinner_id" class="spinner-border ml-auto spinner-border-sm" role="status" aria-hidden="true"></div>
|
||||
</div>
|
||||
<select style="display:inline" id="table_select_anio" class="form-control form-control-sm">
|
||||
<!--option value="0"></option-->
|
||||
</select>
|
||||
<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>
|
||||
|
||||
<div class="collapse" id="collapseExample">
|
||||
<div class="card card-body">
|
||||
<!--PACS-->
|
||||
<select id="table_select_PAC" class="form-control form-control-sm my_event_cls">
|
||||
<option value="00">Todos</option>
|
||||
<!--option value="01">EDICOM</option-->
|
||||
</select>
|
||||
<!--ANIOS-->
|
||||
<select style="display:inline" id="table_select_anio" class="form-control form-control-sm">
|
||||
<!--option value="0"></option-->
|
||||
</select>
|
||||
|
||||
<!--MESES-->
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<th>Estado</th>
|
||||
<th scope="col">
|
||||
@@ -139,7 +157,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id='id_filters' style="display: inline;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
||||
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
||||
|
||||
|
||||
<!-- Modal EMAIL-->
|
||||
@@ -289,8 +307,47 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
let filters = document.getElementById('id_filters').textContent
|
||||
let mes ='{{mes}}'
|
||||
let year = parseInt('{{year}}')
|
||||
let anc = document.getElementById('home_id')
|
||||
let PAC = Object.values(filters.split('&'))
|
||||
PAC.filter(val=>{
|
||||
lbl_pac.innerHTML="Todos"
|
||||
if(val.length >0){
|
||||
lbl_pac.innerHTML= val.split('=')[1]=="" ? "Todos" :val.split('=')[1]
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
/*-------------------------Carga los pacs*/
|
||||
fetch("{% url 'PACS_Retrive_RFCS' %}",{
|
||||
method:'GET',
|
||||
headers:{
|
||||
'Content-Type':'application/json',
|
||||
'X-Requested-With':'XMLHttpRequest',
|
||||
},
|
||||
credentials:"same-origin"
|
||||
})
|
||||
.then(res=>{
|
||||
return res.json()
|
||||
})
|
||||
.then(data=>{
|
||||
let pacs = [...new Set(data['PACS'].map((arr)=>arr.rfcp) )]
|
||||
|
||||
pacs.forEach((val,index)=>{
|
||||
let option = document.createElement('option')
|
||||
option.value=val
|
||||
option.text=val
|
||||
table_select_PAC.add(option)
|
||||
PAC.filter(val=>val.includes('PAC'))
|
||||
.forEach((val,index)=>{
|
||||
table_select_PAC.value = val.split('=')[1]
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(error=>{
|
||||
console.log(error)
|
||||
})
|
||||
/*----------------------fin carga pacs*/
|
||||
|
||||
function aclick(event,RFC ,cuantos){
|
||||
|
||||
@@ -338,7 +395,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
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}&year=${year}${filters}`
|
||||
@@ -353,7 +410,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
table_select_anio.addEventListener('change',(event)=>{
|
||||
spinner_id.setAttribute('style','display:inline;')
|
||||
|
||||
let anc = document.getElementById('home_id')
|
||||
|
||||
anc.href=''
|
||||
|
||||
let url = `?mes=${mes}&year=${event.target.value}${filters}`
|
||||
@@ -364,6 +421,17 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
},1000)
|
||||
})
|
||||
|
||||
table_select_PAC.addEventListener('change',(event)=>{
|
||||
spinner_id.setAttribute('style','display:inline;');
|
||||
anc.href='';
|
||||
let url =`?mes=${mes}&year=${year}&PAC=${event.target.value}`
|
||||
setTimeout(()=>{
|
||||
anc.href=url
|
||||
anc.click()
|
||||
},1000)
|
||||
|
||||
})
|
||||
|
||||
enviar_btn.addEventListener('click',(e)=>{
|
||||
|
||||
if(id_form.checkValidity()){
|
||||
|
||||
Reference in New Issue
Block a user