pdf v2

parent b44620bd
......@@ -3,7 +3,7 @@ from django.shortcuts import HttpResponseRedirect
from django.urls import reverse
# from django.core.urlresolvers import reverse
from catalog.models import Publics, Purchase
from catalog.models import Purchase
class AuthRequiredMiddleware(object):
......
......@@ -71,11 +71,10 @@ class Purchase(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
search = models.ForeignKey(Search, on_delete=models.CASCADE)
productList = models.TextField(verbose_name="JSON Product List")
name = models.TextField(default="Drawn polygon ")
description = models.TextField(default="")
purchased = models.BooleanField(default=False)
price = models.FloatField(default=0.0)
progress = models.IntegerField(default=0)
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
......@@ -565,7 +565,7 @@ def Pay(request):
# ~ data = {}
# ~ for products in product_list:
# ~ print(products)
# ~ print(products)
# ~ product = json.loads(products['productList'])
# ~ prod_list.append({
# ~ 'purchased': products['purchased'],
......
......@@ -152,4 +152,20 @@ function is_public(purchase_id, status) {
alert("cambiado");
}
});
};
\ No newline at end of file
};
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 @@
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section class="content">
<!--div id="popover-content-logout" class="hide"-->
<div class="panel panel-default">
<div class="panel-heading">Reports</div>
<div class="panel-body" id="mytable">
......@@ -163,8 +167,14 @@
<tbody id="table_body">
{% for product in productList %}
<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>
<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>{{ product.process }}</td>
<td>{{ product.purchase_date }}</td>
......@@ -174,7 +184,9 @@
<td>{{ product.size }}</td>
<td>
<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>
</label>
</td>
......@@ -236,6 +248,7 @@
<!-- Copyright -->
</footer>
<!-- /.Footer -->
<!-- Modals -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
......@@ -276,9 +289,51 @@
</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 -->
{% endblock %}
{% block modals %}
{% endblock %}
{% block scripts %}
<script src="{% static 'reports/js/Reports_scripts.js' %}"></script>
{% endblock %}
......@@ -330,7 +330,7 @@ def dataToTable(name, data):
data.insert(0, name)
return data
# create the table for our document
def myTable(path1, path2, basefile):
#image1 = Image(path1, height=300, width=200, mask='auto')
......@@ -447,9 +447,12 @@ def myBarLegend(drawing, labels):
def PDFGenerator(request, ruta, reporteDir, datasets):
thumbs = ruta + 'out/' + reporteDir + '/TCI/thumbnails/'
SCL = ruta + 'out/' + reporteDir + '/SCL/split/'
story = []
# define the style for our paragraph text
styles = getSampleStyleSheet()
styleN = styles['Normal']
......@@ -459,6 +462,16 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
im.hAlign = 'CENTER'
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())
path, dirs, files = next(os.walk(thumbs))
......@@ -491,18 +504,6 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
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
story.append(myTable(path1, SCL, file))
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