total saldo index

This commit is contained in:
fjrodriguez
2022-11-30 10:12:41 -06:00
parent d91e997fdf
commit 7645eff702
4 changed files with 21 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ TEMPLATES = [
'django.contrib.messages.context_processors.messages',
# `allauth` needs this from django
'django.template.context_processors.request',
'Clientes.saldo_context_proc.get_saldo',
],
},
},

View File

@@ -0,0 +1,11 @@
import requests
from asgiref.sync import sync_to_async
async def req():
results = await sync_to_async(get_saldo, thread_sensitive=True)
def get_saldo(r):
r = requests.get('https://app2.comercio-digital.mx/x3/saldo?usr=SCT050708AD1&pwd=0dcu2SwCv')
return {'saldo':r.text}

View File

@@ -6,4 +6,5 @@ urlpatterns = [
path('timbres_cliente/<str:RFC>/', timbres_cliente, name='timbres_cliente'),
]

View File

@@ -10,7 +10,9 @@
{% block content %}
<div>
<h2>Timbres disponibles Comercio Digital: {{saldo}}</h2>
</div>
<table class="table">
<thead>
<tr>
@@ -29,7 +31,7 @@
<td>{{obj.rfcc}}</td>
<td>
{% if request.user.is_staff %}
<a href="{% url 'timbres_cliente' obj.rfcc %}" class="btn btn-info">View Timbres</a>
<a href="{% url 'timbres_cliente' obj.rfcc %}" class="btn btn-info">View Timbres</a>
{% endif %}
</td>
</tr>
@@ -43,6 +45,10 @@
table_rfcc.addEventListener('click',(event)=>{
document.getElementById('rfcc').checked= table_rfcc.checked? true:false;
})
</script>
{% endblock scripts %}