Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
moshe742 committed Jul 29, 2024
1 parent 86ac269 commit f80c443
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
3 changes: 3 additions & 0 deletions djang/importer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class Kupot(models.Model):
track_number = models.CharField(max_length=255)
track_code = models.CharField(max_length=255, null=True)

def __str__(self):
return f'{self.company} {self.track}'

class Reports(models.Model):
kupa = models.ForeignKey(Kupot, on_delete=models.CASCADE)
report_date = models.DateField()
Expand Down
10 changes: 10 additions & 0 deletions djang/importer/templates/importer/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
10 changes: 10 additions & 0 deletions djang/importer/templates/importer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends 'importer/base.html' %}
{% block content %}
רשימת החברות:
<br>
<select size= 10 onchange='window.location.replace("/"+this.options[this.selectedIndex].innerHTML)'>
{% for company in company_list %}
<option >{{ company.company }}</option>
{% endfor %}
</select>
{% endblock %}
7 changes: 7 additions & 0 deletions djang/importer/templates/importer/kupa.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
רשימת מסלולים ל-{{ company_name }}:<br>
<select size = 10 onchange=window.location.replace("/\duchot/"+this.options[this.selectedIndex].value+"/"+this.options[this.selectedIndex].innerHTML)>
{% for company in company_list %}
<option value="{{ company.id }}">{{ company.track }}</option>
{% endfor %}
</select><br>
<button onclick='window.location.replace("/")'>Home</button>
10 changes: 5 additions & 5 deletions djang/importer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

root="/"


def companies(request):
output = "רשימת החברות:<br><select size= 10 onchange='window.location.replace(\"/\"+this.options[this.selectedIndex].innerHTML)'>"
company_list = models.Kupot.objects.values("company").distinct().order_by("company")
for k in company_list:
output = output+"<option >"+k["company"]+"</option>"
output = output+"</select>"
return HttpResponse(output)
return render(request, 'importer/index.html', context={'company_list': company_list})


def kupot(request, company_name):
output = "רשימת מסלולים ל"+company_name+":<br><select size = 10 \
Expand All @@ -19,7 +18,8 @@ def kupot(request, company_name):
for k in company_list:
output = output+"<option value="+str(k["id"])+">"+k["track"]+"</option>"
output = output+"</select><br><button onclick='window.location.replace(\"/\")'>Home</button>"
return HttpResponse(output)
return render(request, 'importer/kupa.html', context={'company_name': company_name, 'company_list': company_list})
# return HttpResponse(output)

def duchot(request, kupa_id, kupa):
output = "רשימת דוח\"ות ל"+str(kupa)+":<br><select size = 10 onchange='window.location.replace(\"/tabs/\"+this.options[this.selectedIndex].value+\"/\"+this.options[this.selectedIndex].innerHTML)'>"
Expand Down

0 comments on commit f80c443

Please sign in to comment.