pdf v2

parent b44620bd
...@@ -3,7 +3,7 @@ from django.shortcuts import HttpResponseRedirect ...@@ -3,7 +3,7 @@ from django.shortcuts import HttpResponseRedirect
from django.urls import reverse from django.urls import reverse
# from django.core.urlresolvers import reverse # from django.core.urlresolvers import reverse
from catalog.models import Publics, Purchase from catalog.models import Purchase
class AuthRequiredMiddleware(object): class AuthRequiredMiddleware(object):
......
...@@ -71,11 +71,10 @@ class Purchase(models.Model): ...@@ -71,11 +71,10 @@ class Purchase(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE)
search = models.ForeignKey(Search, on_delete=models.CASCADE) search = models.ForeignKey(Search, on_delete=models.CASCADE)
productList = models.TextField(verbose_name="JSON Product List") productList = models.TextField(verbose_name="JSON Product List")
name = models.TextField(default="Drawn polygon ")
description = models.TextField(default="")
purchased = models.BooleanField(default=False) purchased = models.BooleanField(default=False)
price = models.FloatField(default=0.0) price = models.FloatField(default=0.0)
progress = models.IntegerField(default=0) progress = models.IntegerField(default=0)
is_public = models.BooleanField(default=False) is_public = models.BooleanField(default=False)
class Publics(models.Model):
url = models.TextField()
Purchase = models.ForeignKey(Purchase, on_delete=models.CASCADE)
\ No newline at end of file
...@@ -153,3 +153,19 @@ function is_public(purchase_id, status) { ...@@ -153,3 +153,19 @@ function is_public(purchase_id, status) {
} }
}); });
}; };
function showEditModal(zone, description, id) {
$('#edit_id').empty();
$('#zone').empty();
$('#description').empty();
$('#zone').val(zone);
$('#description').val(description);
$('#edit_id').val(id);
//$('#myModalTitle').append(name);
$("#editmodal").modal();
}
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
});
\ No newline at end of file
...@@ -144,6 +144,10 @@ ...@@ -144,6 +144,10 @@
<!-- Content Wrapper. Contains page content --> <!-- Content Wrapper. Contains page content -->
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
<!--div id="popover-content-logout" class="hide"-->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Reports</div> <div class="panel-heading">Reports</div>
<div class="panel-body" id="mytable"> <div class="panel-body" id="mytable">
...@@ -163,8 +167,14 @@ ...@@ -163,8 +167,14 @@
<tbody id="table_body"> <tbody id="table_body">
{% for product in productList %} {% for product in productList %}
<tr> <tr>
<td><a href="#" <td>
<a href="#" data-toggle="popover" data-trigger="hover"
data-content="{{ product.search_name }}"
onclick="showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"> {{ product.search_name }}</a> onclick="showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"> {{ product.search_name }}</a>
<a href="#" onclick="showEditModal('{{ product.search_name }}','Descripcion ekiz','{{ product.purchase_id }}')"><span
class="fas fa-pencil-alt"
style="margin:3px 0 0 0"></span></a>
</td> </td>
<td>{{ product.process }}</td> <td>{{ product.process }}</td>
<td>{{ product.purchase_date }}</td> <td>{{ product.purchase_date }}</td>
...@@ -174,7 +184,9 @@ ...@@ -174,7 +184,9 @@
<td>{{ product.size }}</td> <td>{{ product.size }}</td>
<td> <td>
<label class="switch"> <label class="switch">
<input id="{{ product.purchase_id }}" type="checkbox" onclick="change_public({{ product.purchase_id }})" {% if product.is_public %} checked {% endif %}> <input id="{{ product.purchase_id }}" type="checkbox"
onclick="change_public({{ product.purchase_id }})"
{% if product.is_public %} checked {% endif %}>
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
</td> </td>
...@@ -236,6 +248,7 @@ ...@@ -236,6 +248,7 @@
<!-- Copyright --> <!-- Copyright -->
</footer> </footer>
<!-- /.Footer --> <!-- /.Footer -->
<!-- Modals --> <!-- Modals -->
<div id="myModal" class="modal fade" role="dialog"> <div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
...@@ -276,9 +289,51 @@ ...@@ -276,9 +289,51 @@
</div> </div>
</div> </div>
<div id="editmodal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content ">
<div class="modal-body text-center">
<form role="form">
<input type="text" class="form-group-lg" id="edit_id" name="edit_id">
<label>Description:</label>
<br>
<div class="form-group">
<label for="usr">Zone:</label>
<input type="text" class="form-control" id="zone" name="zone" style="text-align:center;">
</div>
<div class="form-group">
<label for="pwd">Description:</label>
<textarea class="form-control" id="description" name="description"
style="text-align:center; resize: none"></textarea>
</div>
</div>
<div class="modal-footer">
<input class="btn btn-primary pull-left " id="phSearchButton" type="submit" value="Save"/>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</form>
</div>
</div>
</div>
</div>
<!-- /.modals --> <!-- /.modals -->
{% endblock %} {% endblock %}
{% block modals %}
{% endblock %}
{% block scripts %} {% block scripts %}
<script src="{% static 'reports/js/Reports_scripts.js' %}"></script> <script src="{% static 'reports/js/Reports_scripts.js' %}"></script>
{% endblock %} {% endblock %}
...@@ -447,9 +447,12 @@ def myBarLegend(drawing, labels): ...@@ -447,9 +447,12 @@ def myBarLegend(drawing, labels):
def PDFGenerator(request, ruta, reporteDir, datasets): def PDFGenerator(request, ruta, reporteDir, datasets):
thumbs = ruta + 'out/' + reporteDir + '/TCI/thumbnails/' thumbs = ruta + 'out/' + reporteDir + '/TCI/thumbnails/'
SCL = ruta + 'out/' + reporteDir + '/SCL/split/' SCL = ruta + 'out/' + reporteDir + '/SCL/split/'
story = [] story = []
# define the style for our paragraph text # define the style for our paragraph text
styles = getSampleStyleSheet() styles = getSampleStyleSheet()
styleN = styles['Normal'] styleN = styles['Normal']
...@@ -459,6 +462,16 @@ def PDFGenerator(request, ruta, reporteDir, datasets): ...@@ -459,6 +462,16 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
im.hAlign = 'CENTER' im.hAlign = 'CENTER'
story.append(im) story.append(im)
# add the title
# story.append(Paragraph("<strong>Results for Vizard Experiment</strong>", styleN))
# story.append(Spacer(1, .25 * 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))
...@@ -491,18 +504,6 @@ def PDFGenerator(request, ruta, reporteDir, datasets): ...@@ -491,18 +504,6 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
story.append(Spacer(1, .5 * inch)) story.append(Spacer(1, .5 * inch))
# add the title
# story.append(Paragraph("<strong>Results for Vizard Experiment</strong>", styleN))
# story.append(Spacer(1, .25 * 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))
# table with images # table with images
story.append(myTable(path1, SCL, file)) story.append(myTable(path1, SCL, file))
story.append(Spacer(1, .5 * inch)) story.append(Spacer(1, .5 * inch))
......
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