Commit 0d413ed0 authored by Emmanuel René Huchim Puc's avatar Emmanuel René Huchim Puc

Merge branch 'dev' of gitlab.geoint.mx:mario.chirinos/GeoInt_SIDT into multi-select

parents 06c7c471 a62942d0
{% extends "base_top.html" %}
{% load staticfiles %}
{% block headMedia %}
<link rel="stylesheet" href="{% static 'catalog/css/body.css' %}" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
{% endblock %}
{% block messages %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
</ul>
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
{% endblock %}
{% block notifications %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 10 notifications</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
</a>
</li>
</li>
</ul>
</li>
<li class="footer"><a href="#">View all</a></li>
</ul>
{% endblock %}
{% block tasks %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul c{% load static %}lass="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar"
aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
{% endblock %}
{% block sidebar %}
{% include 'administration_aside.html' %}
{% endblock %}
{% block user %}
{% include "user_button.html" %}
{% endblock %}
{% block content %}
<div class="wrapper" style="background-color: #ecf0f5;">
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<div class="panel panel-default">
<div class="panel-heading">{{ Viewname }}</div>
<div class="panel-body text-center">
<div class="row col-md-1 pull-right ">
<a class="btn btn-success btn-sm col-md-6 col-sm-6 col-xs-6 col-lg-6 col-xl-6">New</a>
<br>
<br>
</div>
<table data-toggle="table" id="example" class="table table-striped table-bordered"
style="width:100%">
<thead>
<th>ID</th>
<th>Name</th>
<th>Acronym</th>
<th>Status</th>
<th>Actions</th>
</thead>
<tbody>
{% for platform in platforms %}
<tr>
<td>{{ platform.id }}</td>
<td>{{ platform.name }}</td>
<td>{{ platform.acronym }}</td>
<form method="post" action="{% url 'update' %}">
{% csrf_token %}
<input type="hidden" name="request_path" value="{{ request.path }}">
<input type="hidden" name="user_id" value="{{ user.user_id }}">
<td>
<input type="checkbox" name="is_superuser" value="1"
{% if not request.user.is_superuser %}disabled{% endif %}
{% if platform.status == True %}checked{% endif %}>
</td>
<td>
<button {% if not request.user.is_superuser %}disabled{% endif %} title="save" type="submit" class="btn btn-success"><i
class="fa fa-save"></i></button>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
<!-- /.content -->
</div>
<footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute">
<!-- Footer Elements -->
<div class="container">
<!-- Social buttons
<ul class="list-unstyled list-inline text-center">
<li class="list-inline-item">
<a class="btn-floating btn-fb mx-1">
<i class="fa fa-faceboo"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-tw mx-1">
<i class="fa fa-twitter"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-gplus mx-1">
<i class="fa fa-google-plus"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-li mx-1">
<i class="fa fa-linkedin"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-dribbble mx-1">
<i class="fa fa-dribbble"> </i>
</a>
</li>
</ul>
<!-- Social buttons -->
</div>
<!-- Footer Elements -->
<!-- Copyright -->
<div class="footer-copyright text-center py-3">© 2019 Copyright:
<a href="http://geoint.mx/"> Centro de Investigación en Ciencias de Información Geoespacial.</a>
</div>
<!-- Copyright -->
</footer>
{% if messages %}
<div class="container col-md-2 col-lg-2 col-xs-2 col-sm-2" style="bottom: 0; right: 0;position: absolute">
{% for message in messages %}
<div {% if message.tags %} class="fade in alert alert-dismissible alert-{{ message.tags }}"{% endif %}>
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>{{ message.tags }}!</strong> {{ message }}.
</div>
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% block templates %}{% include "templates.html" %}{% endblock %}
{% block scripts %}
<script>
$(document).ready(function () {
$('#example').DataTable
({
language:
{
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate":
{
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria":
{
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
},
responsive:
{
details:
{
type: 'column',
target: 'tr'
}
},
columnDefs:
[{
className: 'control',
orderable: false,
targets: 0
}],
order: [1, 'asc']
});
});
</script>
{% endblock %}
\ No newline at end of file
{% extends "base_top.html" %}
{% load staticfiles %}
{% block headMedia %}
<link rel="stylesheet" href="{% static 'catalog/css/body.css' %}" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
{% endblock %}
{% block messages %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
</ul>
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
{% endblock %}
{% block notifications %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 10 notifications</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
</a>
</li>
</li>
</ul>
</li>
<li class="footer"><a href="#">View all</a></li>
</ul>
{% endblock %}
{% block tasks %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul c{% load static %}lass="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar"
aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
{% endblock %}
{% block sidebar %}
{% include 'administration_aside.html' %}
{% endblock %}
{% block user %}
{% include "user_button.html" %}
{% endblock %}
{% block content %}
<div class="wrapper" style="background-color: #ecf0f5;">
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<div class="panel panel-default">
<div class="panel-heading">{{ Viewname }}</div>
<div class="panel-body text-center">
<table data-toggle="table" id="example" class="table table-striped table-bordered"
style="width:100%">
<thead>
<th>ID</th>
<th>Name</th>
<th>Platform</th>
<th>Product Level</th>
<th>Status</th>
<th>Actions</th>
</thead>
<tbody>
{% for process in process %}
<tr>
<td>{{ process.id }}</td>
<td>{{ process.name }}</td>
<td>{{ process.platform_id }}</td>
<td>{{ process.product_level }}</td>
<form method="post" action="{% url 'update' %}">
{% csrf_token %}
<input type="hidden" name="request_path" value="{{ request.path }}">
<input type="hidden" name="user_id" value="{{ user.user_id }}">
<td>
<input type="checkbox" name="status" value="1"
{% if not request.user.is_superuser %}disabled{% endif %}
{% if process.status == True %}checked{% endif %}>
</td>
<td>
<button {% if not request.user.is_superuser %}disabled{% endif %} title="save" type="submit" class="btn btn-success"><i
class="fa fa-save"></i></button>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
<!-- /.content -->
</div>
<footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute">
<!-- Footer Elements -->
<div class="container">
<!-- Social buttons
<ul class="list-unstyled list-inline text-center">
<li class="list-inline-item">
<a class="btn-floating btn-fb mx-1">
<i class="fa fa-faceboo"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-tw mx-1">
<i class="fa fa-twitter"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-gplus mx-1">
<i class="fa fa-google-plus"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-li mx-1">
<i class="fa fa-linkedin"> </i>
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-dribbble mx-1">
<i class="fa fa-dribbble"> </i>
</a>
</li>
</ul>
<!-- Social buttons -->
</div>
<!-- Footer Elements -->
<!-- Copyright -->
<div class="footer-copyright text-center py-3">© 2019 Copyright:
<a href="http://geoint.mx/"> Centro de Investigación en Ciencias de Información Geoespacial.</a>
</div>
<!-- Copyright -->
</footer>
{% endblock %}
{% block templates %}{% include "templates.html" %}{% endblock %}
{% block scripts %}
<script>
$(document).ready(function () {
$('#example').DataTable();
});
</script>
{% endblock %}
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<br> <br>
<ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<li> <li>
<a class="treeview " href="{{ BASE_URL }}/administration"> <a class="treeview " href="{% url 'Dashboard' %}">
<i class="fa fa-home"></i> <i class="fa fa-home"></i>
<span>Dashboard</span> <span>Dashboard</span>
<span class="pull-right-container"> <span class="pull-right-container">
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</a> </a>
</li> </li>
<li> <li>
<a class="treeview " href="../../administration/request"> <a class="treeview " href="{% url 'request' %}">
<i class="fa fa-user-plus"></i> <i class="fa fa-user-plus"></i>
<span>Request</span> <span>Request</span>
<span class="pull-right-container"> <span class="pull-right-container">
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</a> </a>
</li> </li>
<li> <li>
<a class="treeview " href="../../administration/users"> <a class="treeview " href="{% url 'active_users' %}">
<i class="fa fa-users"></i> <i class="fa fa-users"></i>
<span>Active users</span> <span>Active users</span>
<span class="pull-right-container"> <span class="pull-right-container">
...@@ -29,6 +29,24 @@ ...@@ -29,6 +29,24 @@
</a> </a>
</li> </li>
<li> <li>
<a class="treeview " href="{% url 'all_process' %}">
<i class="fa fa-sync-alt"></i>
<span>Catalog of Process</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
</a>
</li>
<li>
<a class="treeview " href="{% url 'all_platform' %}">
<i class="fa fa-satellite"></i>
<span>Catalog of Platforms</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
</a>
</li>
<!--li>
<a class="treeview " href="#" onclick="window.history.back();"> <a class="treeview " href="#" onclick="window.history.back();">
<i class="fa fa-backward"></i> <i class="fa fa-backward"></i>
<span>Back</span> <span>Back</span>
...@@ -36,6 +54,6 @@ ...@@ -36,6 +54,6 @@
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
</a> </a>
</li> </li-->
</ul> </ul>
</div> </div>
\ No newline at end of file
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<script src="{% static 'js/Chart.min.js' %}"></script> <script src="{% static 'js/Chart.min.js' %}"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
{% endblock %} {% endblock %}
{% block messages %} {% block messages %}
...@@ -146,7 +147,7 @@ ...@@ -146,7 +147,7 @@
<span class="info-box-text">Active Users</span> <span class="info-box-text">Active Users</span>
<span class="info-box-number">{{ Usuarios }}</span> <span class="info-box-number">{{ Usuarios }}</span>
<span class="info-box-more pull-right"> <span class="info-box-more pull-right">
<a href="../../administration/users" class="small-box-footer"> <a href="{% url 'active_users' %}" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i> More info <i class="fa fa-arrow-circle-right"></i>
</a> </a>
</span> </span>
...@@ -168,7 +169,7 @@ ...@@ -168,7 +169,7 @@
<span class="info-box-text">User Registrations</span> <span class="info-box-text">User Registrations</span>
<span class="info-box-number">{{ Solicitud }}</span> <span class="info-box-number">{{ Solicitud }}</span>
<span class="info-box-more pull-right"> <span class="info-box-more pull-right">
<a href="../../administration/request" class="small-box-footer"> <a href="{% url 'request' %}" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i> More info <i class="fa fa-arrow-circle-right"></i>
</a> </a>
</span> </span>
...@@ -186,15 +187,13 @@ ...@@ -186,15 +187,13 @@
<span class="info-box-text">Processing</span> <span class="info-box-text">Processing</span>
<span class="info-box-number">{{ Descargando }}</span> <span class="info-box-number">{{ Descargando }}</span>
<span class="info-box-more pull-right"> <span class="info-box-more pull-right">
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span> </span>
</div> </div>
<!-- /.info-box-content --> <!-- /.info-box-content -->
</div> </div>
<!-- /.info-box --> <!-- /.info-box -->
</div> </div>
<div class="col-md-2 col-sm-6 col-xs-12"> <div class="col-md-2 col-sm-6 col-xs-12">
<div class="info-box"> <div class="info-box">
...@@ -204,9 +203,6 @@ ...@@ -204,9 +203,6 @@
<span class="info-box-text">Repsat Storage</span> <span class="info-box-text">Repsat Storage</span>
<span class="info-box-number">{{ size_repsat }}</span> <span class="info-box-number">{{ size_repsat }}</span>
<span class="info-box-more pull-right"> <span class="info-box-more pull-right">
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span> </span>
</div> </div>
<!-- /.info-box-content --> <!-- /.info-box-content -->
...@@ -222,9 +218,6 @@ ...@@ -222,9 +218,6 @@
<span class="info-box-text">Sentinel Storage</span> <span class="info-box-text">Sentinel Storage</span>
<span class="info-box-number">{{ size_sentinel }}</span> <span class="info-box-number">{{ size_sentinel }}</span>
<span class="info-box-more pull-right"> <span class="info-box-more pull-right">
<a href="#" class="small-box-footer">
More info <i class="fa fa-arrow-circle-right"></i>
</a>
</span> </span>
</div> </div>
<!-- /.info-box-content --> <!-- /.info-box-content -->
...@@ -248,15 +241,14 @@ ...@@ -248,15 +241,14 @@
<!-- /.box-header --> <!-- /.box-header -->
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8 col-xs-12 col-sm-12">
<p class="text-center"> <p class="text-center">
<strong>Today {% now "jS F Y" %}</strong> <strong>Today {% now "jS F Y" %}</strong>
</p> </p>
<div class="chart"> <div class="chart ">
<!-- Sales Chart Canvas --> <!-- Sales Chart Canvas -->
<canvas id="salesChart" style="height: 142px; width: 814px;" width="814" <canvas id="salesChart" style="height: 142px; width: 814px;" width="814" height="170"></canvas>
height="142"></canvas>
</div> </div>
<!-- /.chart-responsive --> <!-- /.chart-responsive -->
</div> </div>
...@@ -405,6 +397,13 @@ ...@@ -405,6 +397,13 @@
<!-- /.content --> <!-- /.content -->
</div> </div>
{% endblock %}
{% block footer %}
<footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute"> <footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute">
<!-- Footer Elements --> <!-- Footer Elements -->
<div class="container"> <div class="container">
...@@ -447,21 +446,7 @@ ...@@ -447,21 +446,7 @@
<!-- Copyright --> <!-- Copyright -->
</footer> </footer>
{% if messages %}
<div class="container col-md-2 col-lg-2 col-xs-2 col-sm-2" style="bottom: 0; right: 0;position: absolute">
{% for message in messages %}
<div {% if message.tags %} class="fade in alert alert-dismissible alert-{{ message.tags }}"{% endif %}>
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>{{ message.tags }}!</strong> {{ message }}.
</div>
{% endfor %}
</div>
{% endif %}
<div id="ol"></div>
{% endblock %} {% endblock %}
{% block templates %} {% block templates %}
...@@ -488,20 +473,11 @@ ...@@ -488,20 +473,11 @@
{% endfor %} {% endfor %}
], ],
backgroundColor: [ backgroundColor: [
'rgba(255, 99, 132, 0.2)', 'rgba(222, 130, 50, 0.2)'
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
], ],
borderColor: [ borderColor: [
'rgba(255,99,132,1)', 'rgba(222, 130, 50,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
], ],
borderWidth: 1 borderWidth: 1
}] }]
...@@ -518,7 +494,6 @@ ...@@ -518,7 +494,6 @@
}); });
// mostrar imagen al dar click en los puntos // mostrar imagen al dar click en los puntos
document.getElementById("salesChart").onclick = function (evt) { document.getElementById("salesChart").onclick = function (evt) {
// activePoints = myChart.getElementsAtEvent(evt); // activePoints = myChart.getElementsAtEvent(evt);
...@@ -539,35 +514,34 @@ ...@@ -539,35 +514,34 @@
console.log("hola"); console.log("hola");
$('#mostrar').empty(); $('#mostrar').empty();
$('#mostrar').append("<table class=\"table table-hover\" id=\"example\">"+ $('#mostrar').append("<table class=\"table table-hover\" id=\"example\">" +
"<thead>" + "<thead>" +
"<tr>" + "<tr>" +
"<th class=\"text-center\">User ID</th>" + "<th class=\"text-center\">User ID</th>" +
"<th class=\"text-center\">User</th>" + "<th class=\"text-center\">User</th>" +
"<th class=\"text-center\">E-Mail</th>" + "<th class=\"text-center\">E-Mail</th>" +
"<th class=\"text-center\">Purchases</th>" + "<th class=\"text-center\">Purchases</th>" +
"<th class=\"text-center\">Storage</th>" + //"<th class=\"text-center\">Storage</th>" +
"<th class=\"text-center\">Downloads in process</th>" + "<th class=\"text-center\">Downloads in process</th>" +
"</tr>" + "</tr>" +
"</thead>" + "</thead>" +
"<tbody id=\"tbody\" class=\"text-center\">"); "<tbody id=\"tbody\" class=\"text-center\">");
$.each(data, function (key, val) { $.each(data, function (key, val) {
$("#tbody").append("<tr>"+ $("#tbody").append("<tr>" +
"<td>"+val['user_id']+"</td>"+ "<td>" + val['user_id'] + "</td>" +
"<td>"+val['username']+"</td>"+ "<td>" + val['username'] + "</td>" +
"<td>"+val['email']+"</td>"+ "<td>" + val['email'] + "</td>" +
"<td>"+val['purchases']+"</td>"+ "<td>" + val['purchases'] + "</td>" +
"<td>"+val['storage']+"</td>"+ //"<td>"+val['storage']+"</td>"+
"<td>"+val['in_process']+"</td>"+ "<td>" + val['in_process'] + "</td>" +
"</tr>" "</tr>"
); );
}); });
$('#mostrar').append("</tbody>" + $('#mostrar').append("</tbody>" +
"</table>"); "</table>");
$('#example').DataTable({ $('#example').DataTable({});
});
} }
}); });
......
...@@ -238,51 +238,7 @@ ...@@ -238,51 +238,7 @@
{% block scripts %} {% block scripts %}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#example').DataTable $('#example').DataTable();
({
language:
{
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate":
{
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria":
{
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
},
responsive:
{
details:
{
type: 'column',
target: 'tr'
}
},
columnDefs:
[{
className: 'control',
orderable: false,
targets: 0
}],
order: [1, 'asc']
});
}); });
</script> </script>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -4,8 +4,10 @@ from . import views ...@@ -4,8 +4,10 @@ from . import views
urlpatterns = [ urlpatterns = [
url(r'^$', views.Dashboard, name='Dashboard'), url(r'^$', views.Dashboard, name='Dashboard'),
url(r'^request/$', views.Request_users, name='Request'), url(r'^request/$', views.Request_users, name='request'),
url(r'^update/$', views.update_user, name='update'), url(r'^update/$', views.update_user, name='update'),
url(r'^users/$', views.active_users, name='users'), url(r'^users/$', views.active_users, name='active_users'),
url(r'^platform/$', views.all_Platform, name='all_platform'),
url(r'^process/$', views.all_Process, name='all_process'),
url(r'^ws/report_table$', views.wsPurchasesPM, name='wsPurchasesPM'), url(r'^ws/report_table$', views.wsPurchasesPM, name='wsPurchasesPM'),
] ]
\ No newline at end of file
...@@ -13,7 +13,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpRequest, Http404 ...@@ -13,7 +13,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpRequest, Http404
# Create your views here. # Create your views here.
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from catalog.models import Purchase, Search from catalog.models import Purchase, Search, Platform, Process
from catalog.views import config from catalog.views import config
USERS_PATH = config['PATHS']['PATH_NAS'] USERS_PATH = config['PATHS']['PATH_NAS']
...@@ -250,4 +250,32 @@ def best_unit_size(bytes_size): ...@@ -250,4 +250,32 @@ def best_unit_size(bytes_size):
return str(round(bu_size,2))+" "+unit return str(round(bu_size,2))+" "+unit
#------------------------------------------------ #------------------------------------------------
def all_Platform (request):
platforms = Platform.objects.all()
platforms_list=[]
for platform in platforms:
platforms_list.append({
"id": platform.id,
"name": platform.name,
"acronym": platform.acronym,
"status": platform.status,
})
return render(request,"Platform.html",{'platforms': platforms_list})
#------------------------------------------------
def all_Process (request):
process = Process.objects.values('id','name','status','platform__name','productLevel')
process_list = []
for process in process:
process_list.append({
"id": process['id'],
"name": process['name'],
"platform_id": process['platform__name'],
"product_level": process['productLevel'],
"status": process['status'],
})
return render(request, "Process.html", {'process': process_list})
...@@ -9,7 +9,7 @@ from catalog.models import Process ...@@ -9,7 +9,7 @@ from catalog.models import Process
#from django.contrib.auth.models import User #from django.contrib.auth.models import User
#from buscador.models import Investigador, Reto #from buscador.models import Investigador, Reto
all_process = Process.objects.all() all_process = Process.objects.filter(status=True)
platforms = [ ] platforms = [ ]
......
...@@ -10,6 +10,7 @@ from django.db import models ...@@ -10,6 +10,7 @@ from django.db import models
class Platform(models.Model): class Platform(models.Model):
name = models.CharField(max_length=64) name = models.CharField(max_length=64)
acronym = models.CharField(max_length=16) acronym = models.CharField(max_length=16)
status = models.BooleanField(default=True)
class Polygon(models.Model): class Polygon(models.Model):
...@@ -53,6 +54,7 @@ class Process(models.Model): ...@@ -53,6 +54,7 @@ class Process(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
platform = models.ForeignKey(Platform, on_delete=models.CASCADE, default='') platform = models.ForeignKey(Platform, on_delete=models.CASCADE, default='')
productLevel = models.CharField(max_length=8, default='') productLevel = models.CharField(max_length=8, default='')
status = models.BooleanField(default=True)
class Search(models.Model): class Search(models.Model):
......
...@@ -33,3 +33,7 @@ html, body ...@@ -33,3 +33,7 @@ html, body
text-decoration: none; text-decoration: none;
color: black; color: black;
} }
#cloudPercentageSelector {
background: transparent;
}
{% extends "data_top.html" %}
{% load static %}
{% block content %}
<div class="wrapper">
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-6">
<!-- AREA CHART -->
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Area Km²</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart">
<canvas id="areaChart" style="height:250px"></canvas>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
<!-- DONUT CHART -->
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">Donut Chart</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<canvas id="pieChart" style="height:250px"></canvas>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col (LEFT) -->
<div class="col-md-6">
<!-- LINE CHART -->
<!-- BAR CHART -->
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Bar Chart</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart">
<canvas id="barChart" style="height:230px"></canvas>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">MAP</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapsexite"><i
class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart">
<img id="satImage" src="{% static 'tmpImages/20180219_TCI_60m.jpg' %}" height="512px"/>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col (RIGHT) -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 2.4.0
</div>
<strong>Copyright &copy; 2014-2016 <a href="https://adminlte.io">Almsaeed Studio</a>.</strong> All rights
reserved.
</footer>
{% endblock %}
{% block scripts %}
<!-- page script -->
<script>
var ctx = document.getElementById("areaChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'Line',
data: {
labels: [{{labels}}],
datasets: [{
label: 'Vegetacion (4)',
data: {{vegetation}},
backgroundColor: [
'rgba(0, 250, 132, 0.5)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
},
{
label: 'No Vegetacion (5)',
data: {{novegetation}},
backgroundColor: [
'rgba(155, 250, 0, 0.5)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
events: ['click'],
onClick: areaChartonClick,
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
function areaChartonClick(e, element) {
console.log(e);
console.log(element);
console.log(element[0]._index);
console.log(myChart);
console.log(myChart.config.data.labels[element[0]._index]);
document.getElementById("satImage").src = "../../static/tmpImages/" + myChart.config.data.labels[element[0]._index] + "_TCI_60m.jpg"
};
</script>
{% endblock %}
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
<!-- jsPDF --> <!-- jsPDF -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.debug.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.debug.js'></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
{% block headMedia %}{% endblock %} {% block headMedia %}{% endblock %}
</head> </head>
<body class="hold-transition skin-yellow sidebar-mini"> <body class="hold-transition skin-yellow sidebar-mini">
...@@ -31,7 +34,8 @@ ...@@ -31,7 +34,8 @@
<div class="wrmapper"> <div class="wrmapper">
<header class="main-header"> <header class="main-header">
<!-- Logo --> <!-- Logo -->
<a {% if request.user.is_authenticated %}href="{{ BASE_URL }}/catalog" {% else %} href="../../../" {% endif %}class="logo"> <a {% if request.user.is_authenticated %}href="{{ BASE_URL }}/catalog" {% else %}
href="../../../" {% endif %}class="logo">
<!-- mini logo for sidebar mini 50x50 pixels --> <!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>G</b>eo</span> <span class="logo-mini"><b>G</b>eo</span>
<!-- logo for regular state and mobile devices --> <!-- logo for regular state and mobile devices -->
...@@ -45,44 +49,44 @@ ...@@ -45,44 +49,44 @@
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
</a> </a>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<div class="navbar-custom-menu"> <div class="navbar-custom-menu">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
{% if request.user.is_superuser or request.user.is_staff %} {% if request.user.is_superuser or request.user.is_staff %}
<a href="../../../administration" title="super user"><i <a href="../../../administration" title="super user"><i
class="fa fa-gears"></i></a> class="fa fa-gears"></i></a>
{% endif %} {% endif %}
</li> </li>
<!-- Messages: style can be found in dropdown.less--> <!-- Messages: style can be found in dropdown.less-->
<!-- <li class="dropdown messages-menu"> --> <!-- <li class="dropdown messages-menu"> -->
{#% block messages %#}{#% endblock %#} {#% block messages %#}{#% endblock %#}
<!-- </li> --> <!-- </li> -->
<!-- Notifications: style can be found in dropdown.less --> <!-- Notifications: style can be found in dropdown.less -->
<!-- <li class="dropdown notifications-menu"> --> <!-- <li class="dropdown notifications-menu"> -->
{#% block notifications %#}{#% endblock %#} {#% block notifications %#}{#% endblock %#}
<!-- </li> --> <!-- </li> -->
<!-- Tasks: style can be found in dropdown.less --> <!-- Tasks: style can be found in dropdown.less -->
<!-- <li class="dropdown tasks-menu"> --> <!-- <li class="dropdown tasks-menu"> -->
{#% block tasks %}{% endblock %#} {#% block tasks %}{% endblock %#}
<!-- </li> --> <!-- </li> -->
<!-- History --> <!-- History -->
<li class="dropdown user user-menu"> <li class="dropdown user user-menu">
{% block history %} {% block history %}
{% endblock %} {% endblock %}
</li> </li>
<!-- History --> <!-- History -->
<!-- User Account: style can be found in dropdown.less --> <!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu"> <li class="dropdown user user-menu">
{% block user %}{% endblock %} {% block user %}{% endblock %}
</li> </li>
<!-- Control Sidebar Toggle Button --> <!-- Control Sidebar Toggle Button -->
<li>{% if showcart %} <li>{% if showcart %}
<a id="product-list-toggle" href="#" data-toggle="control-sidebar"><i <a id="product-list-toggle" href="#" data-toggle="control-sidebar"><i
class="fa fa-shopping-cart"></i></a> class="fa fa-shopping-cart"></i></a>
{% endif %} {% endif %}
</li> </li>
</ul> </ul>
</div> </div>
{% endif %} {% endif %}
</nav> </nav>
</header> </header>
...@@ -113,38 +117,40 @@ ...@@ -113,38 +117,40 @@
<aside class="control-sidebar control-sidebar-dark"> <aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs --> <!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs"> <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li id="globe" class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-globe"></i></a></li> <li id="globe" class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i
<li id="cart"><a href="#control-sidebar-settings-tab" onclick="updateCart()" data-toggle="tab"><i class="fa fa-shopping-cart"></i></a> class="fa fa-globe"></i></a></li>
<li id="cart"><a href="#control-sidebar-settings-tab" onclick="updateCart()" data-toggle="tab"><i
class="fa fa-shopping-cart"></i></a>
</li> </li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<!-- Home tab content --> <!-- Home tab content -->
<div class="tab-pane active" id="control-sidebar-home-tab"> <div class="tab-pane active" id="control-sidebar-home-tab">
<form id='product-to-cart-form' role="form" method="post"> <form id='product-to-cart-form' role="form" method="post">
{% csrf_token %} {% csrf_token %}
<div class="container"> <div class="container">
<div class="sidebar-title"> <div class="sidebar-title">
<h3><b>Products</b></h3> <h3><b>Products</b></h3>
</div> </div>
<div class="sidebar-button"> <div class="sidebar-button">
<button type="submit" name="search" id="add-cart" class="btn btn-primary"> <button type="submit" name="search" id="add-cart" class="btn btn-primary">
Add to cart Add to cart
</button> </button>
</div> </div>
</div> </div>
<!-- this ul element is filled with data --> <!-- this ul element is filled with data -->
<ul id="product-list-globe" class="control-sidebar-menu" data-widget="tree"></ul> <ul id="product-list-globe" class="control-sidebar-menu" data-widget="tree"></ul>
<!-- /.control-sidebar-menu --> <!-- /.control-sidebar-menu -->
</form> </form>
</div> </div>
<!-- /.tab-pane --> <!-- /.tab-pane -->
<!-- Stats tab content --> <!-- Stats tab content -->
<div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div> <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
<!-- /.tab-pane --> <!-- /.tab-pane -->
<!-- Settings tab content --> <!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab"> <div class="tab-pane" id="control-sidebar-settings-tab">
{% comment %}<form id='purchased-product-form' role="form" method="post"> {% comment %}<form id='purchased-product-form' role="form" method="post">
{% csrf_token %} {% csrf_token %}
<div class="container"> <div class="container">
<div class="sidebar-title"> <div class="sidebar-title">
...@@ -159,22 +165,22 @@ ...@@ -159,22 +165,22 @@
<!-- this ul element is filled with data --> <!-- this ul element is filled with data -->
<ul id="product-list-cart" class="sidebar-menu" data-widget="tree"></ul> <ul id="product-list-cart" class="sidebar-menu" data-widget="tree"></ul>
</form>{% endcomment %} </form>{% endcomment %}
<div class="container"> <div class="container">
<div class="sidebar-title"> <div class="sidebar-title">
<h3><b>My cart</b></h3> <h3><b>My cart</b></h3>
</div> </div>
<div class="sidebar-button"> <div class="sidebar-button">
{% comment %}<button type="submit" name="search" id="purchase" class="btn btn-primary"> {% comment %}<button type="submit" name="search" id="purchase" class="btn btn-primary">
Purchase Purchase
</button>{% endcomment %} </button>{% endcomment %}
{% comment %}<a href="cart" id="purchase" class="btn btn-primary">Purchase</a>{% endcomment %} {% comment %}<a href="cart" id="purchase" class="btn btn-primary">Purchase</a>{% endcomment %}
<button onclick="location.href='cart'" id="purchase" class="btn btn-primary">Purchase</button> <button onclick="location.href='cart'" id="purchase" class="btn btn-primary">Purchase</button>
</div>
</div> </div>
</div> <!-- this ul element is filled with data -->
<!-- this ul element is filled with data --> <ul id="product-list-cart" class="control-sidebar-menu" data-widget="tree"></ul>
<ul id="product-list-cart" class="control-sidebar-menu" data-widget="tree"></ul> </div>
</div> <!-- /.tab-pane -->
<!-- /.tab-pane -->
</div> </div>
</aside> </aside>
<!-- /.control-sidebar --> <!-- /.control-sidebar -->
...@@ -202,6 +208,17 @@ ...@@ -202,6 +208,17 @@
{% block footer %}{% endblock %} {% block footer %}{% endblock %}
{% block scripts %}{% endblock %} {% block scripts %}{% endblock %}
<div id="ol"></div>
{% if messages %}
<div class="container col-md-2 col-lg-2 col-xs-2 col-sm-2" style="bottom: 0; right: 0;position: absolute">
{% for message in messages %}
<div {% if message.tags %} class="fade in alert alert-dismissible alert-{{ message.tags }}"{% endif %}>
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>{{ message.tags }}!</strong> {{ message }}.
</div>
{% endfor %}
</div>
{% endif %}
</body> </body>
</html> </html>
...@@ -219,18 +219,18 @@ ...@@ -219,18 +219,18 @@
</tfoot> </tfoot>
</table> </table>
<div class="text-center"> <div class="text-center">
<a href="../pay"> <a href="../pay" class="btn btn-danger">PAY
<input type="image" <!--input type="image"
src="https://www.sandbox.paypal.com/es_XC/MX/i/btn/btn_buynowCC_LG.gif" src="https://www.sandbox.paypal.com/es_XC/MX/i/btn/btn_buynowCC_LG.gif"
border="0" name="submit" border="0" name="submit"
alt="PayPal, la forma más segura y rápida de pagar en línea."> alt="PayPal, la forma más segura y rápida de pagar en línea.">
<img alt="" border="0" <img alt="" border="0"
src="https://www.sandbox.paypal.com/es_XC/i/scr/pixel.gif" width="1" src="https://www.sandbox.paypal.com/es_XC/i/scr/pixel.gif" width="1"
height="1"> height="1"-->
</a> </a>
<!--form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1"> <input type="hidden" name="upload" value="1">
<input type="hidden" name="business" <input type="hidden" name="business"
...@@ -247,9 +247,9 @@ ...@@ -247,9 +247,9 @@
{% endfor %} {% endfor %}
<input type='hidden' name='cancel_return' <input type='hidden' name='cancel_return'
value='../reports'> value='http://repsat.geoint.mx/catalog/cart/'>
<input type='hidden' name='return' <input type='hidden' name='return'
value='../catalog/cart'> value='http://repsat.geoint.mx/catalog/cart/'>
<input type="hidden" name="notify_url" value="http://repsat.geoint.mx/catalog/ipn/"> <input type="hidden" name="notify_url" value="http://repsat.geoint.mx/catalog/ipn/">
<input type="image" <input type="image"
src="https://www.sandbox.paypal.com/es_XC/MX/i/btn/btn_buynowCC_LG.gif" src="https://www.sandbox.paypal.com/es_XC/MX/i/btn/btn_buynowCC_LG.gif"
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
height="1"> height="1">
</form> </form>
<!--form method="post" action="http://repsat.geoint.mx/catalog/ipn/"> <form method="post" action="http://repsat.geoint.mx/catalog/ipn/">
<input type="text" name="nombre" value=""> <input type="text" name="nombre" value="">
<input type="submit"> <input type="submit">
</form> </form>
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
<form method="post" action="../ipn/"> <form method="post" action="../ipn/">
<input type="text" name="nombre" value=""> <input type="text" name="nombre" value="">
<input type="submit"> <input type="submit">
</form--> </form>
</div> </div>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<!-- History element --> <!-- History element -->
<li> <li>
<a class="treeview " href="../../../users"> <a class="treeview " href="{% url 'users' %}">
<i class="fa fa-user-circle"></i> <i class="fa fa-user-circle"></i>
<span>Profile</span> <span>Profile</span>
<span class="pull-right-container"> <span class="pull-right-container">
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<!-- End History element --> <!-- End History element -->
<!-- History element --> <!-- History element -->
<li> <li>
<a class="treeview " href="{{ BASE_URL }}/reports"> <a class="treeview " href="{% url 'reports' %}">
<i class="fa fa-history"></i> <i class="fa fa-history"></i>
<span>Shopping History</span> <span>Shopping History</span>
<span class="pull-right-container"> <span class="pull-right-container">
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</a> </a>
</li> </li>
<li> <li>
<a class="treeview " href="{{ BASE_URL }}/catalog/cart"> <a class="treeview " href="{% url 'show-cart' %}">
<i class="fa fa-shopping-cart"></i> <i class="fa fa-shopping-cart"></i>
<span>View shopping cart</span> <span>View shopping cart</span>
<span class="pull-right-container"> <span class="pull-right-container">
......
...@@ -293,40 +293,6 @@ def delFromCart(request): ...@@ -293,40 +293,6 @@ def delFromCart(request):
product_list = Purchase.objects.filter(user=user, id=request.POST['id']).delete() product_list = Purchase.objects.filter(user=user, id=request.POST['id']).delete()
return HttpResponse(status=204) return HttpResponse(status=204)
##-------------------------------------------------------------------------------
# def L2ASCL_data(request):
# with open("/home/mario/NAS_MarioCh/mario_repsat_test/T15QZD_sclData.json") as f:
# json_data = OrderedDict(json.load(f))
# graphData = dict()
# graphData['type']="line"
# data=dict()
# data['labels'] = [ k for k,v in sorted(json_data.items()) ]
# data['datasets'] = list()
# labels = set()
# for d in json_data:
# labels |= set(json_data[d].keys())
# labels.remove('date')
# labelNames = ["No Data", "Saturated", "Shadows", "Cloud Shadows", "Vegetation",
# "Not-Vegetated", "Whater", "Unclassified", "Cloud Medium Probablilty", "Cloud Hight Probablilty", "Thin Cirrus", "Snow"]
# colors = ["Black", "Red", "DarkGray", "Brown", "Green", "Yellow", "Blue", "Grey", "LightGray", "White", "Aqua", "Pink"]
# for l in labels:
# item = dict()
# item['label'] = labelNames[int(l)]
# if l == "0":
# item['hidden'] = "true"
# item['data'] = [ v[l] * 60*60/1000000. for k,v in sorted(json_data.items()) if l in v]
# item['backgroundColor']=colors[int(l)]
# data['datasets'].append(item)
# graphData['data']=data
## graphData['options']['responsive']=True
## graphData['options']['maintainAspectRatio']=False
# print( json.dumps(graphData).encode("utf-8"))
# return render(request, 'L2ASCL_data.html', {"graphData":json.dumps(graphData).encode("utf-8")})
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
def wsReportImages(request): def wsReportImages(request):
print(request.GET) print(request.GET)
...@@ -618,10 +584,12 @@ def IPN(request): ...@@ -618,10 +584,12 @@ def IPN(request):
PATH_USERS = config['PATHS']['PATH_USERS'] PATH_USERS = config['PATHS']['PATH_USERS']
f = open(PATH_USERS+"myfile.txt", "w") f = open(PATH_USERS+"myfile.txt", "w")
x = request.POST.dict() x = request.POST.dict()
f.write('variables') f.write('variables\n')
#f.write(request.META['HTTP_REFERER']+'\n')
for key, value in x.items(): for key, value in x.items():
f.write(key+": "+value+'\n') f.write(key+": "+value+'\n')
return redirect('../../') #return redirect('../../')
return HttpResponseRedirect(reverse('map'))
#print("content-type: text/html\r\n\r\n") #print("content-type: text/html\r\n\r\n")
#if request.POST.get['payment_status'] == 'Completed': #if request.POST.get['payment_status'] == 'Completed':
...@@ -657,41 +625,6 @@ def IPN(request): ...@@ -657,41 +625,6 @@ def IPN(request):
# f.write("\n") # f.write("\n")
# f.close() # f.close()
# -----------------------------------------------------------------------
# def Pay3(request):
# VERIFY_URL_PROD = 'https://ipnpb.paypal.com/cgi-bin/webscr'
# VERIFY_URL_TEST = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'
#
# # Switch as appropriate
# VERIFY_URL = VERIFY_URL_TEST
#
# # CGI preamble
# print('content-type: text/plain')
# print()
#
# # Read and parse query string
# param_str = sys.stdin.readline().strip()
# params = urllib.parse.parse_qsl(param_str)
#
# # Add '_notify-validate' parameter
# params.append(('cmd', '_notify-validate'))
#
# # Post back to PayPal for validation
#
# headers = {'content-type': 'application/x-www-form-urlencoded',
# 'user-agent': 'Python-IPN-Verification-Script'}
# r = requests.post(VERIFY_URL, params=params, headers=headers, verify=True)
# r.raise_for_status()
#
# # Check return message and take action as needed
# if r.text == 'VERIFIED':
# pass
# elif r.text == 'INVALID':
# pass
# else:
# pass
# return redirect("https://google.com.mx")
# ------------------------------------------------------ # ------------------------------------------------------
def Registration(request): def Registration(request):
#user = User.objects.filter(email=request.POST['email']) #user = User.objects.filter(email=request.POST['email'])
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<br> <br>
<ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<li> <li>
<a class="treeview " href="{{ BASE_URL }}/catalog"> <a class="treeview " href="{% url 'map' %}">
<i class="fa fa-map"></i> <i class="fa fa-map"></i>
<span>Home</span> <span>Home</span>
<span class="pull-right-container"> <span class="pull-right-container">
...@@ -226,15 +226,22 @@ ...@@ -226,15 +226,22 @@
{% if product.initial_folder %} {% if product.initial_folder %}
href="../reports/{{ product.purchase_id }}" href="../reports/{{ product.purchase_id }}"
{% endif %} {% endif %}
class="btn btn-success btn-sm col-md-6 col-xs-6 col-sm-6 col-lg-6 col-xl-6"> class="btn btn-success btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
</a> </a>
<a title="Download zip" {% if product.progress == 100 %} <a title="Download zip" {% if product.progress == 100 %}
href="../../static/reports/tmpImages/repsat_test_dev/{{ request.user.email }}/{{ product.purchase_id }}/myzip.zip" href="../../static/reports/tmpImages/repsat_test_dev/{{ request.user.email }}/{{ product.purchase_id }}/myzip.zip"
{% else %} {% else %}
href="#" href="#"
{% endif %} class="btn btn-warning btn-sm col-md-6 col-xs-6 col-sm-6 col-lg-6 col-xl-6"> {% endif %} class="btn btn-warning btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4">
<i class="fa fa-file-zip-o"></i> <i class="fa fa-file-zip-o"></i>
</a>
<a title="Download PDF" {% if product.progress == 100 %}
href="{% url 'PDF' product.purchase_id %}"
{% else %}
href="#"
{% endif %} class="btn btn-info btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4" target="_blank" download="{{ product.search_name }} ({{ product.purchase_date }}).pdf">
<i class="fa fa-file-pdf-o"></i>
</a> </a>
<!--a title="View Log" href="#" class="btn btn-info" <!--a title="View Log" href="#" class="btn btn-info"
onclick="openmodal('{{ product.log_info }}')"> onclick="openmodal('{{ product.log_info }}')">
......
...@@ -160,27 +160,29 @@ ...@@ -160,27 +160,29 @@
</a> </a>
<ul class="treeview-menu sidebar-form"> <ul class="treeview-menu sidebar-form">
<li> <li>
<a class="treeview submenu" href="#"> <a class="treeview submenu" href="../../static/reports/tmpImages/repsat_test_dev/{{ email }}/{{ purchaseID }}/myzip.zip">
<i class="fa fa-file-code-o"></i> <i class="fa fa-file-zip-o"></i>
<span>Export to JSON</span> <span>Export to Zip</span>
<span class="pull-right-container"> <span class="pull-right-container">
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
</a> </a>
</li> </li>
<li> <li>
<a class="treeview submenu" href="#" id="downloadPdf"> <a class="treeview submenu" href="#">
<i class="fa fa-file-pdf-o"></i> <i class="fa fa-file-code-o"></i>
<span>Export to PDF</span> <span>Export to JSON</span>
<span class="pull-right-container"> <span class="pull-right-container">
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
</a> </a>
</li> </li>
<li> <li>
<a class="treeview submenu" href="../../static/reports/tmpImages/repsat_test_dev/{{ email }}/{{ purchaseID }}/{{ zone }}.pdf" id="downloadPdf" target="_blank"> <a class="treeview submenu" href="{% url 'PDF' purchaseID %}" target="_blank" download="{{ searchInfo.title }} ({{ searchInfo.purchase_date }}).pdf">
<i class="fa fa-file-pdf-o"></i> <i class="fa fa-file-pdf-o"></i>
<span>Export to PDF v2</span> <span>Export to PDF</span>
<span class="pull-right-container"> <span class="pull-right-container">
<span class="label label-primary pull-right"></span> <span class="label label-primary pull-right"></span>
</span> </span>
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
</div> </div>
</div> </div>
<div id="selectLeft" class="container floating-panel" style="position:absolute; display:none; bottom: 50px; left: 30%; width: 300px; z-index: 1000"> <div id="selectLeft" class="container floating-panel" style="position:absolute; display:none; bottom: 50px; left: 30%; width: 300px; z-index: 1000">
<div class="select"> <div class="select">
<select onchange="selectLeft(this.value)" id="selectLeftCompare"> <select onchange="selectLeft(this.value)" id="selectLeftCompare">
...@@ -142,8 +142,8 @@ ...@@ -142,8 +142,8 @@
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
</div> </div>
<div id="selectRight" class="container floating-panel" style="position:absolute; display:none; bottom: 50px; left: 75%; width: 300px; z-index: 1000"> <div id="selectRight" class="container floating-panel" style="position:absolute; display:none; bottom: 50px; left: 75%; width: 300px; z-index: 1000">
<div class="select"> <div class="select">
<select onchange="selectRight(this.value)" id="selectRightCompare"> <select onchange="selectRight(this.value)" id="selectRightCompare">
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
</div> </div>
<div id="reportPage" class="wrapper" style="background-color: #ecf0f5"> <div id="reportPage" class="wrapper" style="background-color: #ecf0f5">
<div id="minimap" class="minimap"></div> <div id="minimap" class="minimap"></div>
......
...@@ -16,4 +16,5 @@ urlpatterns = [ ...@@ -16,4 +16,5 @@ urlpatterns = [
url(r'^ws/process_progress$', views.wsProcessProgress, name='wsProcessProgress'), url(r'^ws/process_progress$', views.wsProcessProgress, name='wsProcessProgress'),
url(r'^ws/is_public', views.wsIs_Public, name='wsIs_Public'), url(r'^ws/is_public', views.wsIs_Public, name='wsIs_Public'),
url(r'^ws/wsEditTitle', views.wsEditTitle, name='wsEditTitle'), url(r'^ws/wsEditTitle', views.wsEditTitle, name='wsEditTitle'),
url(r'^ws/PDF/(?P<purchase_id>(\d+))$', views.PDFGenerator, name='PDF'),
] ]
...@@ -9,7 +9,7 @@ import xml.etree.ElementTree as ET ...@@ -9,7 +9,7 @@ import xml.etree.ElementTree as ET
from collections import OrderedDict from collections import OrderedDict
from datetime import datetime from datetime import datetime
from django.http import HttpResponse, Http404, JsonResponse from django.http import HttpResponse, Http404, JsonResponse, FileResponse, HttpRequest
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from reportlab.lib.pagesizes import letter from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas from reportlab.pdfgen import canvas
...@@ -19,17 +19,17 @@ from GeoInt_SIDT.settings import BASE_URL ...@@ -19,17 +19,17 @@ from GeoInt_SIDT.settings import BASE_URL
from administration.views import best_unit_size from administration.views import best_unit_size
from catalog.models import Purchase from catalog.models import Purchase
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.pagesizes import letter from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch from reportlab.lib.units import inch
from reportlab.lib import colors from reportlab.lib import colors
from reportlab.platypus import Paragraph, Frame, Spacer, Image, Table, TableStyle, SimpleDocTemplate, PageBreak from reportlab.platypus import Paragraph, Frame, Spacer, Image, Table, TableStyle, SimpleDocTemplate, PageBreak
from reportlab.graphics.charts.barcharts import VerticalBarChart from reportlab.graphics.charts.barcharts import VerticalBarChart
from reportlab.graphics.shapes import Drawing, String from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.textlabels import Label, LabelOffset
from reportlab.graphics.charts.legends import Legend from reportlab.graphics.charts.legends import Legend
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
########### lee archivo de configuración ################ ########### lee archivo de configuración ################
...@@ -48,7 +48,7 @@ def report_L2ASCL(request, purchase_id): ...@@ -48,7 +48,7 @@ def report_L2ASCL(request, purchase_id):
reporteDir = 'mask' reporteDir = 'mask'
folders = "" folders = ""
purchase = Purchase.objects.values('user__email', 'is_public', 'name', 'search__search_name', purchase = Purchase.objects.values('user__email', 'is_public', 'name', 'search__search_name',
'search__process_id__name').get(pk=purchase_id) 'search__process_id__name','description','aggreg_date').get(pk=purchase_id)
email = purchase['user__email'] email = purchase['user__email']
path = USERS_PATH + email + '/' + purchase_id + '/' path = USERS_PATH + email + '/' + purchase_id + '/'
scl_data_path = USERS_PATH + email + "/" + purchase_id + "/scl_data.json" scl_data_path = USERS_PATH + email + "/" + purchase_id + "/scl_data.json"
...@@ -71,19 +71,24 @@ def report_L2ASCL(request, purchase_id): ...@@ -71,19 +71,24 @@ def report_L2ASCL(request, purchase_id):
"title": purchase['name'], "title": purchase['name'],
#"title": purchase['search__search_name'], #"title": purchase['search__search_name'],
"process": purchase['search__process_id__name'], "process": purchase['search__process_id__name'],
"purchase_date": purchase['aggreg_date'],
"startDate": startDate, "startDate": startDate,
"endDate": endDate, "endDate": endDate,
"clouds": dataProduct['clouds'], "clouds": dataProduct['clouds'],
"platform": dataProduct['platform'], "platform": dataProduct['platform'],
"productLevel": dataProduct['productLevel'], "productLevel": dataProduct['productLevel'],
"polygon": dataProduct['wkt'], "polygon": dataProduct['wkt'],
"description": purchase['description'],
"report_name": "SCL Image Classification Data(Km²)" "report_name": "SCL Image Classification Data(Km²)"
} }
if os.path.exists(path + reporteDir + ".pdf"): if os.path.exists(path + reporteDir + ".pdf"):
print ("si existe") print ("si existe")
else: else:
PDFGenerator(request, path, reporteDir, datasets,searchInfo) #PDFGenerator(request, path, reporteDir, datasets,searchInfo)
pass
return render(request, template, {"graphData": json.dumps(graphData), return render(request, template, {"graphData": json.dumps(graphData),
"searchInfo": searchInfo, "IMAGE_PATH": image_path, "searchInfo": searchInfo, "IMAGE_PATH": image_path,
...@@ -103,6 +108,9 @@ def Reports(request): ...@@ -103,6 +108,9 @@ def Reports(request):
size = 0 size = 0
folders = [] folders = []
zip = "" zip = ""
product_list = Purchase.objects.values('id', 'productList', 'aggreg_date', 'search__clouds', 'search__startDate', product_list = Purchase.objects.values('id', 'productList', 'aggreg_date', 'search__clouds', 'search__startDate',
'search__endDate', 'search__process_id__name', 'search__search_name', 'search__endDate', 'search__process_id__name', 'search__search_name',
'is_public','name','description').filter( 'is_public','name','description').filter(
...@@ -158,7 +166,7 @@ def Reports(request): ...@@ -158,7 +166,7 @@ def Reports(request):
# else: # else:
# initial_folder = folders.pop(0) + "_sclData" # initial_folder = folders.pop(0) + "_sclData"
print(initial_folder)
zip_path = USERS_PATH + request.user.email + "/" + str(producto['id']) zip_path = USERS_PATH + request.user.email + "/" + str(producto['id'])
# print(zip_path) # print(zip_path)
...@@ -334,14 +342,21 @@ def dataToTable(name, data): ...@@ -334,14 +342,21 @@ def dataToTable(name, data):
data.insert(0, name) data.insert(0, name)
return data return data
def mergeimages(path,file):
from PIL import Image
layer1 = Image.open(path + file[:8] + "_SCL_60m_0.tif")
for i in range(10):
layer2 = Image.open(path + file[:8] + "_SCL_60m_" + str(i) + ".tif")
nueva = Image.alpha_composite(layer1, layer2)
layer1 = nueva
nueva.save(path + file[:8] + "_SCL_60m_10.tif")
return path+file[:8]+"_SCL_60m_10.tif"
# create the table for our document # create the table for our document
def myTable(path1, path2, basefile): def myTable(path1, path2, basefile):
#image1 = Image(path1, height=300, width=200, mask='auto')
image1 = Image(path1) image1 = Image(path1)
if image1.imageWidth < image1.imageHeight: if image1.imageWidth < image1.imageHeight:
print ("mas alto que ancho")
image2 = Image(path1, height=300, width=200, mask='auto') image2 = Image(path1, height=300, width=200, mask='auto')
else: else:
image2 = Image(path1, height=150, width=400, mask='auto') image2 = Image(path1, height=150, width=400, mask='auto')
...@@ -351,8 +366,10 @@ def myTable(path1, path2, basefile): ...@@ -351,8 +366,10 @@ def myTable(path1, path2, basefile):
if file.startswith(basefile[:8]): if file.startswith(basefile[:8]):
if file.endswith('.tif') and not file.endswith('0.tif'): if file.endswith('.tif') and not file.endswith('0.tif'):
# image2 = Image(path2 + file, height=300, width=200, mask='auto') if image1.imageWidth < image1.imageHeight:
image3 = image2 image3 = Image(mergeimages(path2, file), height=300, width=200, mask='auto')
else:
image3 = Image(mergeimages(path2, file), height=150, width=400, mask='auto')
if image1.imageWidth < image1.imageHeight: if image1.imageWidth < image1.imageHeight:
data = [['TCI', 'SCL'], [image2, image3]] data = [['TCI', 'SCL'], [image2, image3]]
...@@ -449,18 +466,52 @@ def myBarLegend(drawing, labels): ...@@ -449,18 +466,52 @@ def myBarLegend(drawing, labels):
return d return d
@csrf_exempt
#def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
def PDFGenerator(request,purchase_id):
def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo): purchase = Purchase.objects.values('user__email', 'is_public', 'name', 'search__search_name',
thumbs = ruta + 'out/' + reporteDir + '/TCI/thumbnails/' 'search__process_id__name', 'description').get(pk=purchase_id)
SCL = ruta + 'out/' + reporteDir + '/SCL/split/' email = purchase['user__email']
ruta = USERS_PATH + email + '/' + purchase_id + '/'
thumbs = ruta + 'out/mask/TCI/thumbnails/'
SCL = ruta + 'out/mask/SCL/split/'
reporteDir = "mask"
with open(USERS_PATH + email + "/" + purchase_id + "/findProducts.json") as p:
dataProduct = json.load(p)
startDate = str(dataProduct['startDate'])[:4] + '-' + str(dataProduct['startDate'])[4:6] + '-' + str(
dataProduct['startDate'])[6:8]
endDate = str(dataProduct['endDate'])[:4] + '-' + str(dataProduct['endDate'])[4:6] + '-' + str(
dataProduct['endDate'])[6:8]
scl_data_path = USERS_PATH + email + "/" + purchase_id + "/scl_data.json"
graphData, label, defaultLabel, defaultDataset, datasets = ProcessChartData(scl_data_path)
searchInfo = {
"title": purchase['name'],
# "title": purchase['search__search_name'],
"process": purchase['search__process_id__name'],
"startDate": startDate,
"endDate": endDate,
"clouds": dataProduct['clouds'],
"platform": dataProduct['platform'],
"productLevel": dataProduct['productLevel'],
"polygon": dataProduct['wkt'],
"description": purchase['description'],
"report_name": "SCL Image Classification Data(Km²)"
}
story = [] story = []
#story.append(tileinfo("hola"))
# define the style for our paragraph text # define the style for our paragraph text
styles = getSampleStyleSheet() styles = getSampleStyleSheet()
styles2 = getSampleStyleSheet() styles2 = getSampleStyleSheet()
styles3 = getSampleStyleSheet()
styleN = styles['Normal'] styleN = styles['Normal']
styleN.alignment = 1 styleN.alignment = 1
styleN.fontSize=25 styleN.fontSize=25
...@@ -468,6 +519,11 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo): ...@@ -468,6 +519,11 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
style2 = styles2['Normal'] style2 = styles2['Normal']
style2.alignment = 1 style2.alignment = 1
style2.fontSize = 15 style2.fontSize = 15
style2.leading = 20
style3 = styles3['Normal']
style3.alignment = 1
style3.fontSize = 19
# Header # Header
im = Image(USERS_PATH + 'header.png', width=300, height=70) im = Image(USERS_PATH + 'header.png', width=300, height=70)
...@@ -475,32 +531,31 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo): ...@@ -475,32 +531,31 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
story.append(im) story.append(im)
story.append(Spacer(1, 1.5 * inch)) story.append(Spacer(1, 1.5 * inch))
# add the title # add the title
story.append(Paragraph("<strong>"+searchInfo['report_name']+"</strong>", styleN,)) story.append(Paragraph("<strong>"+searchInfo['report_name']+"</strong>", styleN,))
story.append(Spacer(1, .60 * inch)) story.append(Spacer(1, .50 * inch))
story.append(Paragraph("<strong>"+searchInfo['title']+"</strong>", styleN,)) story.append(Paragraph("<strong>"+searchInfo['title']+"</strong>", style3,))
story.append(Spacer(1, .40 * inch)) story.append(Spacer(1, .30 * inch))
story.append(Paragraph("<strong>("+searchInfo['startDate']+" - "+searchInfo['endDate']+")</strong>", style2,)) story.append(Paragraph("<strong>("+searchInfo['startDate']+" - "+searchInfo['endDate']+")</strong>", style2,))
story.append(Spacer(1, .60 * inch)) story.append(Spacer(1, .60 * inch))
story.append(Paragraph("<strong>Platform: "+searchInfo['platform']+"</strong>", style2,)) story.append(Paragraph("<strong>Platform: "+searchInfo['platform']+"</strong>", style2,))
story.append(Spacer(1, .40 * inch)) story.append(Spacer(1, .40 * inch))
story.append(Paragraph("<strong>Product level: "+searchInfo['productLevel']+"</strong>", style2,)) story.append(Paragraph("<strong>Product level: "+searchInfo['productLevel']+"</strong>", style2,))
story.append(Spacer(1, .40 * inch)) story.append(Spacer(1, .40 * inch))
story.append(Paragraph("<strong>Process:"+searchInfo['process']+"</strong>", style2,)) story.append(Paragraph("<strong>Process: "+searchInfo['process']+"</strong>", style2,))
story.append(Spacer(1, .40 * inch)) story.append(Spacer(1, .40 * inch))
story.append(Paragraph("<strong>Clouds: "+str(searchInfo['clouds'])+" %</strong>", style2,)) story.append(Paragraph("<strong>Clouds: "+str(searchInfo['clouds'])+" %</strong>", style2,))
story.append(Spacer(1, .70 * inch))
story.append(Paragraph("<strong>Description: </strong>", style2, ))
story.append(Spacer(1, .10 * inch))
story.append(Paragraph(searchInfo['description'], style2,))
story.append(Spacer(1, .40 * inch)) story.append(Spacer(1, .40 * inch))
# convert data to paragraph form and then add paragraphs
#story.append(Paragraph(dataToParagraph(subject1, results1), styleN))
#story.append(Spacer(1, .25 * inch))
#story.append(Paragraph(dataToParagraph(subject2, results2), styleN))
#story.append(Spacer(1, .5 * inch))
story.append(PageBreak()) story.append(PageBreak())
path, dirs, files = next(os.walk(thumbs)) path, dirs, files = next(os.walk(thumbs))
print (len(files))
for index, file in enumerate(files): for index, file in enumerate(files):
values = [] values = []
labels = [] labels = []
...@@ -516,12 +571,10 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo): ...@@ -516,12 +571,10 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
labels.append(data['label']) labels.append(data['label'])
path1 = thumbs + file path1 = thumbs + file
# Header
# Header
# print (width)
#########################33
im = Image(USERS_PATH + 'header.png', width=300, height=70) im = Image(USERS_PATH + 'header.png', width=300, height=70)
im.hAlign = 'CENTER' im.hAlign = 'CENTER'
...@@ -534,9 +587,8 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo): ...@@ -534,9 +587,8 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
story.append(Spacer(1, .5 * inch)) story.append(Spacer(1, .5 * inch))
# add barchart and legend # add barchart and legend
# drawing = myBarChart(values[:len(values) - 1], maxi, file)
drawing = myBarChart(values, maxi, file) drawing = myBarChart(values, maxi, file)
# drawing = myBarLegend(drawing, labels[:len(labels) - 1])
drawing = myBarLegend(drawing, labels) drawing = myBarLegend(drawing, labels)
drawing.hAlign = 'CENTER' drawing.hAlign = 'CENTER'
story.append(drawing) story.append(drawing)
...@@ -544,9 +596,12 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo): ...@@ -544,9 +596,12 @@ def PDFGenerator(request, ruta, reporteDir, datasets,searchInfo):
story.append(PageBreak()) story.append(PageBreak())
# build our document with the list of flowables we put together # build our document with the list of flowables we put together
doc = SimpleDocTemplate(ruta + reporteDir + ".pdf", pagesize=letter, topMargin=0) doc = SimpleDocTemplate(ruta + reporteDir + ".pdf", pagesize=letter, topMargin=5, title=searchInfo['report_name']+" "+searchInfo['title'],)
doc.build(story) doc.build(story)
pass #return HttpResponse (request.POST.get('ruta'))
return FileResponse(open(ruta + reporteDir + ".pdf", 'rb'), content_type='application/pdf')
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------
...@@ -617,7 +672,6 @@ def wsEditTitle(request): ...@@ -617,7 +672,6 @@ def wsEditTitle(request):
purchase.name = request.GET.get("zone") purchase.name = request.GET.get("zone")
purchase.description = request.GET.get("description") purchase.description = request.GET.get("description")
purchase.save() purchase.save()
print ("hola")
return HttpResponse("hola") return HttpResponse("hola")
else: else:
raise Http404 raise Http404
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
User Profile User Profile
</h1> </h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="../"><i class="fa fa-home"></i> Home</a></li> <li><a href="{% url 'map' %}"><i class="fa fa-home"></i> Home</a></li>
<li class="active">User profile</li> <li class="active">User profile</li>
</ol> </ol>
</section> </section>
...@@ -368,7 +368,8 @@ ...@@ -368,7 +368,8 @@
type: 'POST', type: 'POST',
dataType: "json", dataType: "json",
data: {'title': label, "user_id": $('#user_id').val()}, data: {'title': label, "user_id": $('#user_id').val()},
url: '../../users/ws/report_table', //url: '../../users/ws/report_table',
url: '{% url "wsPurchasesPM" %}',
success: function (data) { success: function (data) {
console.log(data); console.log(data);
$('#mostrar').empty(); $('#mostrar').empty();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<br> <br>
<ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<li> <li>
<a class="treeview " href="{{ BASE_URL }}/reports"> <a class="treeview " href="{% url 'reports' %}">
<i class="fa fa-files-o"></i> <i class="fa fa-files-o"></i>
<span>Reports</span> <span>Reports</span>
<span class="pull-right-container"> <span class="pull-right-container">
......
...@@ -35,14 +35,14 @@ def Users(request): ...@@ -35,14 +35,14 @@ def Users(request):
purchases = Purchase.objects.filter(user_id=user.id) purchases = Purchase.objects.filter(user_id=user.id)
in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100) in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100)
bytes_size = 0 #bytes_size = 0
for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/" + user.email): #for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/" + user.email):
for filename in files: # for filename in files:
bytes_size += os.lstat(os.path.join(path, filename)).st_size # bytes_size += os.lstat(os.path.join(path, filename)).st_size
for directory in directories: # for directory in directories:
bytes_size += os.lstat(os.path.join(path, directory)).st_size # bytes_size += os.lstat(os.path.join(path, directory)).st_size
bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/" + user.email) #bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/" + user.email)
size_repsat = best_unit_size(bytes_size) #size_repsat = best_unit_size(bytes_size)
user_data.append({ user_data.append({
"user_id": user.id, "user_id": user.id,
...@@ -50,7 +50,7 @@ def Users(request): ...@@ -50,7 +50,7 @@ def Users(request):
"searches": searches.count(), "searches": searches.count(),
"purchases": purchases.count(), "purchases": purchases.count(),
"in_process": in_process.count(), "in_process": in_process.count(),
"size": size_repsat, #"size": size_repsat,
}) })
for search in Search.objects.values('search_name').filter(user_id=user.id).annotate( for search in Search.objects.values('search_name').filter(user_id=user.id).annotate(
...@@ -155,13 +155,13 @@ def User_id(request, user_id): ...@@ -155,13 +155,13 @@ def User_id(request, user_id):
in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100) in_process = Purchase.objects.filter(user_id=user.id).exclude(progress=100)
bytes_size = 0 bytes_size = 0
for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/"+user.email): #for path, directories, files in os.walk(USERS_PATH + "repsat_test_dev/"+user.email):
for filename in files: # for filename in files:
bytes_size += os.lstat(os.path.join(path, filename)).st_size # bytes_size += os.lstat(os.path.join(path, filename)).st_size
for directory in directories: # for directory in directories:
bytes_size += os.lstat(os.path.join(path, directory)).st_size # bytes_size += os.lstat(os.path.join(path, directory)).st_size
bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/"+user.email) #bytes_size += os.path.getsize(USERS_PATH + "repsat_test_dev/"+user.email)
size_repsat = best_unit_size(bytes_size) #size_repsat = best_unit_size(bytes_size)
user_data.append({ user_data.append({
"user_id": user.id, "user_id": user.id,
...@@ -169,7 +169,7 @@ def User_id(request, user_id): ...@@ -169,7 +169,7 @@ def User_id(request, user_id):
"searches": searches.count(), "searches": searches.count(),
"purchases": purchases.count(), "purchases": purchases.count(),
"in_process": in_process.count(), "in_process": in_process.count(),
"size": size_repsat, #"size": size_repsat,
}) })
for search in Search.objects.values('search_name').filter(user_id=user.id).annotate( for search in Search.objects.values('search_name').filter(user_id=user.id).annotate(
...@@ -269,13 +269,13 @@ def wsPurchasesPM(request): ...@@ -269,13 +269,13 @@ def wsPurchasesPM(request):
table_data = [] table_data = []
data = Purchase.objects.values('user_id', 'search__endDate', 'search__startDate', 'aggreg_date', data = Purchase.objects.values('user_id', 'search__endDate', 'search__startDate', 'aggreg_date',
'search__process_id__name', 'search__search_name').filter( 'search__process_id__name', 'name').filter(
user_id=request.POST.get('user_id'), purchased=True, user_id=request.POST.get('user_id'), purchased=True,
aggreg_date__month=to_if(request.POST.get('title'))).order_by('aggreg_date') aggreg_date__month=to_if(request.POST.get('title'))).order_by('aggreg_date')
for producto in data: for producto in data:
table_data.append({ table_data.append({
"search_name": producto['search__search_name'], "search_name": producto['name'],
"process": producto['search__process_id__name'], "process": producto['search__process_id__name'],
"purchase_date": str(producto['aggreg_date'])[:10], "purchase_date": str(producto['aggreg_date'])[:10],
"startDate": str(producto['search__startDate'])[:10], "startDate": str(producto['search__startDate'])[:10],
......
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