first of segunda
This commit is contained in:
@@ -119,7 +119,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
<!-- Button trigger modal -->
|
||||
<button class="btn btn-primary w-100" onclick="addValues('{{obj.RFC}}')" type="button" data-toggle="modal" data-target="#exampleModalCenter">
|
||||
<button class="btn btn-primary w-100" onclick="addValues('{{obj.RFC}}'); retriveEmails('{{obj.RFC}}');" type="button" data-toggle="modal" data-target="#exampleModalCenter">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope-plus" viewBox="0 0 16 16">
|
||||
<path d="M2 2a2 2 0 0 0-2 2v8.01A2 2 0 0 0 2 14h5.5a.5.5 0 0 0 0-1H2a1 1 0 0 1-.966-.741l5.64-3.471L8 9.583l7-4.2V8.5a.5.5 0 0 0 1 0V4a2 2 0 0 0-2-2H2Zm3.708 6.208L1 11.105V5.383l4.708 2.825ZM1 4.217V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v.217l-7 4.2-7-4.2Z"/>
|
||||
<path d="M16 12.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Zm-3.5-2a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1a.5.5 0 0 0-.5-.5Z"/>
|
||||
@@ -136,11 +136,13 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
||||
|
||||
|
||||
<!-- Modal EMAIL-->
|
||||
<div class="modal fade" data-backdrop="static" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<form enctype="multipart/form-data" id="id_form" action="{% url 'send_timbres_Email' %}" method="post">
|
||||
<form enctype="multipart/form-data" id="id_form" action="{% url 'send_timbres_Email' %}?mes={{mes}}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
@@ -152,8 +154,19 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="email"><strong> Email </strong></label>
|
||||
<input type="email" name="email" id="email_add" autocomplete="off" class="form-control" placeholder="Email">
|
||||
<label for="email"><strong>Email</strong></label>
|
||||
<!--input type="email" name="email" id="email_add" autocomplete="off" class="form-control" placeholder="Email"-->
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="email" name="email" id="email_add" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="button-addon2">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" type="button" data-toggle="modal" data-target="#exampleModalCenter2" id="button-addon2" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
|
||||
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -161,13 +174,13 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
<input type="text" name="subject" maxlength="100" id="subject_add" autocomplete="off" class="form-control" placeholder="Subject">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adjunto"><strong> Adjunto</strong></label>
|
||||
<label for="adjunto"><strong>Adjunto</strong></label>
|
||||
<!--input type="file" name="adjunto" multiple="" id="adjunto_add" autocomplete="off" class="form-control" placeholder="Adjunto"-->
|
||||
{{emailForm.adjunto}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message"><strong> Message </strong></label>
|
||||
<textarea name="message" cols="40" rows="10" id="message_add" autocomplete="off" class="form-control" placeholder="Message" ></textarea>
|
||||
<label for="message"><strong>Message</strong></label>
|
||||
<textarea name="message" cols="40" rows="10" id="message_add" autocomplete="off" class="form-control" placeholder="Message" required></textarea>
|
||||
</div>
|
||||
<div hidden class="form-group">
|
||||
<label for="RFC"><strong> Rfc </strong></label>
|
||||
@@ -190,12 +203,94 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Modal LISTA EMAILS-->
|
||||
<div class="modal fade bd-example-modal-lg" id="exampleModalCenter2" tabindex="-1" role="contentinfo" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalCenterTitle">Lista email</h5>
|
||||
<button id="close_emails_list" type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="table-responsive">
|
||||
<table id="email_list" class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">EMAIL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_body" style="cursor: pointer;">
|
||||
<!--This is a exaple append js rows structure---->
|
||||
<!--tr class="table_row"><td id="1">@Mark</td></tr-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<h1>Footer</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
|
||||
function retriveEmails(RFC){
|
||||
fetch(`{% url 'Retrive_Cliente_Email' %}?RFC=${RFC}`,{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Requested-With':'XMLHttpRequest',
|
||||
},
|
||||
credentials:"same-origin"
|
||||
})
|
||||
.then(res=>{
|
||||
return res.json()
|
||||
})
|
||||
.then(data=>{
|
||||
|
||||
if(table_body.querySelectorAll('tr').length >0){
|
||||
const table_rows = document.querySelectorAll('.table_row')
|
||||
table_rows.forEach((rem)=>{
|
||||
rem.remove()
|
||||
})
|
||||
}
|
||||
const re = Object.values(data['data'])
|
||||
re.forEach((val,index)=>{
|
||||
console.log('val',val.email, index)
|
||||
const row = document.createElement("tr")
|
||||
row.setAttribute("class","table_row")
|
||||
const cell = document.createElement("td")
|
||||
cell.setAttribute("id",index)
|
||||
const cellText = document.createTextNode(`${val.email}`)
|
||||
cell.appendChild(cellText)
|
||||
row.appendChild(cell)
|
||||
|
||||
table_body.appendChild(row)
|
||||
})
|
||||
|
||||
email_list.appendChild(table_body)
|
||||
const table_rows = document.querySelectorAll('.table_row')
|
||||
table_rows.forEach((box)=>{
|
||||
box.addEventListener('click',(event)=>{
|
||||
email_add.value=event.target.textContent
|
||||
close_emails_list.click()
|
||||
})
|
||||
|
||||
})
|
||||
})//.then(data)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
let filters = document.getElementById('id_filters').textContent
|
||||
console.log(filters)
|
||||
|
||||
function aclick(event,RFC ,cuantos){
|
||||
|
||||
if( parseInt(cuantos)===0){
|
||||
@@ -253,7 +348,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
fsize = id_adjunto.files.item(i).size
|
||||
|
||||
fsize +=fsize;
|
||||
console.log(((fsize/1024)/1024))
|
||||
|
||||
if( 25 <= ((fsize/1024)/1024) ){
|
||||
alert('Limite excedido de 25 MegaBytes adjuntos');
|
||||
id_adjunto.value=''
|
||||
@@ -270,8 +365,9 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
})
|
||||
|
||||
function addValues(RFC){
|
||||
|
||||
RFC_add.value = RFC
|
||||
console.log('RFC', RFC)
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -25,20 +25,35 @@
|
||||
|
||||
<th scope="col">
|
||||
PAC
|
||||
<select id="table_select_PAC" class="form-control form-control-sm">
|
||||
<select id="table_select_PAC" class="form-control form-control-sm my_event_cls">
|
||||
<option value="00">Todos</option>
|
||||
<option value="01">EDICOM</option>
|
||||
<option value="02">Comercio Dig.</option>
|
||||
<!--option value="01">EDICOM</option>
|
||||
<option value="02">Comercio Dig.</option-->
|
||||
</select>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<input id="table_tipo" name="tipo" value="True" type="checkbox" class="form-check-input" >
|
||||
<input id="table_tipo" name="tipo" value="True" type="checkbox" class="form-check-input my_event_cls" >
|
||||
Tipo CFDI
|
||||
</th>
|
||||
<th scope="col">Serie/Folio</th>
|
||||
<th scope="col">
|
||||
<input id="table_fecha" name="fecha" value="True" type="checkbox" class="form-check-input" >
|
||||
<input id="table_fecha" name="fecha" value="True" type="checkbox" class="form-check-input my_event_cls" >
|
||||
Fecha
|
||||
<select id="table_select_Meses" class="form-control form-control-sm my_event_cls">
|
||||
<option value="00">Todos</option>
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -56,29 +71,125 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id='id_filters' style="display: None;">{% 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>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
window.addEventListener("load", (event)=>{
|
||||
let PAC = '{{PAC}}'
|
||||
if(PAC !="None"){
|
||||
table_select_PAC.value=PAC
|
||||
<script>
|
||||
function get_pacs(){
|
||||
url = "{% url 'PACS_Retrive_RFCS' %}"
|
||||
fetch(url, {
|
||||
method: 'GET',
|
||||
headers:{
|
||||
'Content-Type':'application/json',
|
||||
'X-Requested-With':'XMLHttpRequest',
|
||||
},
|
||||
credentials:"same-origin"
|
||||
})
|
||||
.then(res=>{
|
||||
return res.json()
|
||||
})
|
||||
.then(data=>{
|
||||
let arr = data['PACS']
|
||||
let pacs = [...new Set(arr.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]
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<!--end functions-->
|
||||
<script>
|
||||
let filters = document.getElementById('id_filters').textContent
|
||||
let mes = Object.values(filters.split('&'))
|
||||
let PAC = Object.values(filters.split('&'))
|
||||
let tipo = Object.values(filters.split('&'))
|
||||
let lsearch = Object.values(filters.split('&'))
|
||||
let ldatepicker = Object.values(filters.split('&'))
|
||||
let ldatepickerFin = Object.values(filters.split('&'))
|
||||
let anc = document.getElementById('home_id')
|
||||
let ref=''
|
||||
|
||||
mes.filter(val=> val.length >0)
|
||||
.filter(val=>val.includes('mes'))
|
||||
.forEach((val,index)=>{
|
||||
table_select_Meses.value= val.split('=')[1]
|
||||
})
|
||||
|
||||
|
||||
tipo.filter(val=>val.includes('tipo'))
|
||||
.forEach((val,index)=>{
|
||||
|
||||
table_tipo.checked= val.split('=')[1] ==='on' ?true:false
|
||||
})
|
||||
|
||||
lsearch.filter(val=>val.includes('search'))
|
||||
.forEach((val,index)=>{
|
||||
search.value = val.split('=')[1]
|
||||
})
|
||||
|
||||
ldatepicker.filter(val=>val.includes('datepicker'))
|
||||
.forEach((val,index)=>{
|
||||
datepicker.value=val.split('=')[1]
|
||||
})
|
||||
|
||||
ldatepickerFin.filter(val=>val.includes('datepicker'))
|
||||
.forEach((val,index)=>{
|
||||
datepickerFin.value=val.split('=')[1]
|
||||
})
|
||||
|
||||
window.addEventListener('load',event=>{
|
||||
get_pacs()
|
||||
})
|
||||
document.querySelectorAll('.my_event_cls').forEach(item=>{
|
||||
if(item.id==='datepicker' || item.id==='datepickerFin'){
|
||||
item.addEventListener('focusout',event=>{
|
||||
ref=`?PAC=${table_select_PAC.value}`
|
||||
ref+=`&mes=${table_select_Meses.value}`
|
||||
ref+=`&tipo=${table_tipo.checked}`
|
||||
ref+=`&search=${search.value}`
|
||||
ref+=`&datepicker=${datepicker.value}`
|
||||
ref+=`&datepickerFin=${datepickerFin.value}`
|
||||
})
|
||||
|
||||
}else{
|
||||
item.addEventListener('change', event=>{
|
||||
ref=`?PAC=${table_select_PAC.value}`
|
||||
ref+=`&mes=${table_select_Meses.value}`
|
||||
ref+=`&tipo=${table_tipo.checked}`
|
||||
ref+=`&search=${search.value}`
|
||||
ref+=`&datepicker=${datepicker.value}`
|
||||
ref+=`&datepickerFin=${datepickerFin.value}`
|
||||
})
|
||||
}
|
||||
})
|
||||
let filters = document.getElementById('id_filters').textContent
|
||||
|
||||
table_select_PAC.addEventListener('change',(event)=>{
|
||||
let anc = document.getElementById('home_id')
|
||||
anc.href=''
|
||||
let url = `?PAC=${event.target.value}${filters}`
|
||||
anc.href=url
|
||||
|
||||
|
||||
table_select_PAC.addEventListener('change',(event)=>{
|
||||
|
||||
anc.href=''
|
||||
anc.href=ref
|
||||
anc.click()
|
||||
})
|
||||
table_select_Meses.addEventListener('change',(event)=>{
|
||||
anc.href=''
|
||||
anc.href=ref
|
||||
console.log(ref)
|
||||
anc.click()
|
||||
|
||||
})
|
||||
|
||||
table_tipo.addEventListener('click', (event)=>{
|
||||
document.getElementById('tipo').checked = table_tipo.checked? true:false;
|
||||
if(table_fecha.checked){
|
||||
|
||||
Reference in New Issue
Block a user