Dashboard

parent 0081f439
......@@ -118,6 +118,76 @@
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-lg-3 col-6">
<!-- small card -->
<div class="small-box bg-info">
<div class="inner">
<h3>{{ Total_compras }}</h3>
<p>Purchases</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small card -->
<div class="small-box bg-success">
<div class="inner">
<h3>{{ Usuarios }}</h3>
<p>Active Users</p>
</div>
<div class="icon">
<i class="fa fa-users"></i>
</div>
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small card -->
<div class="small-box bg-warning">
<div class="inner">
<h3>{{ Solicitud }}</h3>
<p>User Registrations</p>
</div>
<div class="icon">
<i class="fa fa-user-plus"></i>
</div>
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small card -->
<div class="small-box bg-danger">
<div class="inner">
<h3>{{ Descargando }}</h3>
<p>Downloading process</p>
</div>
<div class="icon">
<i class="fa fa-download"></i>
</div>
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
<!-- ./col -->
</div>
<div class="panel panel-default">
<div class="panel-heading">{{ Viewname }}</div>
<div class="panel-body text-center">
......
......@@ -12,14 +12,11 @@ from catalog.models import Purchase
def Dashboard(request):
data =[]
compras = Purchase.objects.filter(purchased=True)
total = compras.count()
data.append({
"Total_compras": total ,
})
print(total)
return render(request, 'dashboard.html', {"Viewname": "Dashboard","Datos":data})
total = Purchase.objects.filter(purchased=True).count()
usuarios = User.objects.filter(is_active=True).count()
Request = User.objects.filter(is_active=False).count()
in_process = Purchase.objects.filter(purchased=True).exclude(progress=100).count()
return render(request, 'dashboard.html', {"Viewname": "Dashboard","Usuarios":usuarios,"Total_compras": total,"Solicitud":Request,"Descargando": in_process})
# ----------------------------------------------------------
......
......@@ -111,6 +111,7 @@ def report_L2ASCL(request, report, purchase_id):
# -------------------------------------------------------------------------------def Reports(request):
def Reports(request):
progress = 0
productList = []
......@@ -139,6 +140,10 @@ def Reports(request):
progress = 60
if 'Finalizing...' in open(log_info).read():
progress = 100
#item = Purchase.objects.filter(pk=producto['id'])
item = Purchase.objects.get(pk=producto['id'])
item.progress = progress
item.save()
with open(log_info, 'r') as myfile:
log = myfile.read().replace('\n', '')
......@@ -193,14 +198,6 @@ def Reports(request):
zip =""
##############################################
# paginacion #
##############################################
#paginator = Paginator(productList, 3) # Show 25 contacts per page
#page = request.GET.get('page')
#productList = paginator.get_page(page)
return render(request, 'Reports.html', {"productList": productList})
......@@ -232,6 +229,9 @@ def wsProcessProgress(request):
if 'Finalizing...' in open(log_info).read():
progress = 100
item = Purchase.objects.get(pk=producto['id'])
item.progress = progress
item.save()
productList2.append({
"purchase_id": producto['id'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment