Dashboard

parent 0081f439
...@@ -118,6 +118,76 @@ ...@@ -118,6 +118,76 @@
<!-- Content Wrapper. Contains page content --> <!-- Content Wrapper. Contains page content -->
<!-- Main content --> <!-- Main content -->
<section class="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 panel-default">
<div class="panel-heading">{{ Viewname }}</div> <div class="panel-heading">{{ Viewname }}</div>
<div class="panel-body text-center"> <div class="panel-body text-center">
......
...@@ -12,14 +12,11 @@ from catalog.models import Purchase ...@@ -12,14 +12,11 @@ from catalog.models import Purchase
def Dashboard(request): def Dashboard(request):
data =[] total = Purchase.objects.filter(purchased=True).count()
compras = Purchase.objects.filter(purchased=True) usuarios = User.objects.filter(is_active=True).count()
total = compras.count() Request = User.objects.filter(is_active=False).count()
data.append({ in_process = Purchase.objects.filter(purchased=True).exclude(progress=100).count()
"Total_compras": total , return render(request, 'dashboard.html', {"Viewname": "Dashboard","Usuarios":usuarios,"Total_compras": total,"Solicitud":Request,"Descargando": in_process})
})
print(total)
return render(request, 'dashboard.html', {"Viewname": "Dashboard","Datos":data})
# ---------------------------------------------------------- # ----------------------------------------------------------
......
...@@ -111,6 +111,7 @@ def report_L2ASCL(request, report, purchase_id): ...@@ -111,6 +111,7 @@ def report_L2ASCL(request, report, purchase_id):
# -------------------------------------------------------------------------------def Reports(request): # -------------------------------------------------------------------------------def Reports(request):
def Reports(request): def Reports(request):
progress = 0 progress = 0
productList = [] productList = []
...@@ -139,6 +140,10 @@ def Reports(request): ...@@ -139,6 +140,10 @@ def Reports(request):
progress = 60 progress = 60
if 'Finalizing...' in open(log_info).read(): if 'Finalizing...' in open(log_info).read():
progress = 100 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: with open(log_info, 'r') as myfile:
log = myfile.read().replace('\n', '') log = myfile.read().replace('\n', '')
...@@ -193,14 +198,6 @@ def Reports(request): ...@@ -193,14 +198,6 @@ def Reports(request):
zip ="" 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}) return render(request, 'Reports.html', {"productList": productList})
...@@ -232,6 +229,9 @@ def wsProcessProgress(request): ...@@ -232,6 +229,9 @@ def wsProcessProgress(request):
if 'Finalizing...' in open(log_info).read(): if 'Finalizing...' in open(log_info).read():
progress = 100 progress = 100
item = Purchase.objects.get(pk=producto['id'])
item.progress = progress
item.save()
productList2.append({ productList2.append({
"purchase_id": producto['id'], "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