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>
|
||||
|
||||
Reference in New Issue
Block a user