Skip to content

Commit

Permalink
Merge pull request #10 from OmarMAshour/scanner-home
Browse files Browse the repository at this point in the history
scanner in index
  • Loading branch information
OmarMAshour committed Oct 23, 2022
2 parents 3845052 + 5105544 commit 08a8199
Show file tree
Hide file tree
Showing 10 changed files with 11,315 additions and 28 deletions.
5 changes: 3 additions & 2 deletions conf/api.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[Wine Info]
url = https://coop-dev.test.apimanagement.eu20.hana.ondemand.com/AZT-WeinattributeCAH-1/findByCodes
api_key = QPpI9dqbAYy0GGfGUCUQFbcD8TG25y5t
info_url=https://coop-dev.test.apimanagement.eu20.hana.ondemand.com/AZT-WeinattributeCAH-1/findByCodes
barcode_url=https://coop-dev.test.apimanagement.eu20.hana.ondemand.com/getProductByGTIN/AVE-PIMGetProduct-5
api_key=QPpI9dqbAYy0GGfGUCUQFbcD8TG25y5t
Binary file modified coop_challenge/__pycache__/views.cpython-310.pyc
Binary file not shown.
12 changes: 9 additions & 3 deletions coop_challenge/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ def find_by_article_ids(self, article_ids: List[str], keys: List[str] = None) ->
return [{key: product[key] for key in keys} for product in products]


def fetchData(article_id):
if __name__ == "__main__":
fetcher = Fetcher()
items = fetcher.find_for_labels(article_ids=[article_id])
return items[0]
items = fetcher.find_for_labels(article_ids=["1007906010"])

print(items)

# def fetchData(article_id):
# fetcher = Fetcher()
# items = fetcher.find_for_labels(article_ids=[article_id])
# return items[0]
11,256 changes: 11,256 additions & 0 deletions coop_challenge/static/coop_challenge/js/html5-qrcode.js

Large diffs are not rendered by default.

19 changes: 0 additions & 19 deletions coop_challenge/static/coop_challenge/js/html5-qrcode.min.js

This file was deleted.

3 changes: 1 addition & 2 deletions coop_challenge/templates/coop_challenge/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="author" content="">

<title>Wine Manager</title>

<script src="{% static 'coop_challenge/js/html5-qrcode.js' %}"></script>
<!-- Bootstrap core CSS -->
<link href="{% static 'coop_challenge/css/bootstrap.css' %}" rel="stylesheet">
<link href="{% static 'coop_challenge/css/bootstrap-reboot.min.css' %}" rel="stylesheet">
Expand Down Expand Up @@ -70,7 +70,6 @@
</nav>

<main id="mainscreen" role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
hiiiii
{% block body %}

{% endblock %}
Expand Down
23 changes: 23 additions & 0 deletions coop_challenge/templates/coop_challenge/scanner_1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends 'coop_challenge/base.html' %}

{% block body %}
<script src="js/html5-qrcode.js"></script>
<div class="d-flex justify-content-center">
<div style="width: 60%" id="reader"></div>
</div>

<div id="resultScan" class="d-flex justify-content-center">

</div>

<script>
function onScanSuccess(decodedText, decodedResult) {
html5QrcodeScanner.clear();
$("#resultScan").html("<div class='row d-flex justify-content-center' style='width: 60%; margin-top: 100px;'><div class='col-5 d-flex justify-content-center'><button class='btn btn-primary btn-lg'>Print label</button></div><div class='col-5 d-flex justify-content-center'><button class='btn btn-primary btn-lg'>Print sheet</button></div></div>");
}

var html5QrcodeScanner = new Html5QrcodeScanner(
"reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess);
</script>
{% endblock %}
4 changes: 2 additions & 2 deletions coop_challenge/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.http import FileResponse
# Create your views here.
def viewIndex(request):
tryPDF()
# tryPDF()
# return FileResponse(open(tryPDF(), 'rb'), content_type='application/pdf')

return render(request, 'coop_challenge/base.html', {})
return render(request, 'coop_challenge/scanner_1.html', {})
21 changes: 21 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta name="author" content="">

<title>TroVino</title>
<script src="js/html5-qrcode.js"></script>

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">
Expand Down Expand Up @@ -65,6 +66,26 @@

<main id="mainscreen" role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">

<div class="d-flex justify-content-center">
<div style="width: 60%" id="reader"></div>
</div>

<div id="resultScan" class="d-flex justify-content-center">

</div>

<script>
function onScanSuccess(decodedText, decodedResult) {
html5QrcodeScanner.clear();
$("#resultScan").html("<div class='row d-flex justify-content-center' style='width: 60%; margin-top: 100px;'><div class='col-5 d-flex justify-content-center'><button class='btn btn-primary btn-lg'>Print label</button></div><div class='col-5 d-flex justify-content-center'><button class='btn btn-primary btn-lg'>Print sheet</button></div></div>");
}

var html5QrcodeScanner = new Html5QrcodeScanner(
"reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess);
</script>


</main>
</div>
</div>
Expand Down
Binary file modified testPDF.pdf
Binary file not shown.

0 comments on commit 08a8199

Please sign in to comment.