Commit 1ee72f60 authored by Felizia Tiburcio's avatar Felizia Tiburcio

add alphabetical query

parent abd497af
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Schedule{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<h1 class='view-title'>Schedule </h1>
<div id="filter-system-navbar">
<ul class="navigation">
<li class="navbar-item"><a href="{% url 'schedule' %}">Show All</a></li>
<li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li>
<li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li>
<li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li>
<li class="navbar-item"><a href="{% url 'alphabetical_query' %}">Employee</a></li>
</ul>
</div>
<table id="scheduling-table">
<tr>
<th>Week</th>
<th>Staff</th>
<th>Role</th>
<th>Day-Mgr</th>
</tr>
{% for a in alphabetical %}
<tr>
<td> {{a.role_date}}</td>
<td> {{a.employee.employee_name}} </td>
<td> {{a.role_description}} </td>
<td> {{a.is_manager}} </td>
</tr>
{% endfor %}
</table>
{% endblock %}
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li> <li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li>
<li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li> <li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li>
<li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li> <li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li>
<li class="navbar-item"><a href="{% url 'alphabetical_query' %}">Employee</a></li>
</ul> </ul>
</div> </div>
<table id="scheduling-table"> <table id="scheduling-table">
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li> <li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li>
<li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li> <li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li>
<li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li> <li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li>
<li class="navbar-item"><a href="{% url 'alphabetical_query' %}">Employee</a></li>
</ul> </ul>
</div> </div>
<table id="scheduling-table"> <table id="scheduling-table">
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
<li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li> <li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li>
<li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li> <li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li>
<li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li> <li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li>
<li class="navbar-item"><a href="{% url 'alphabetical_query' %}">Employee</a></li>
</ul> </ul>
</div> </div>
<table id="scheduling-table"> <table id="scheduling-table">
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
<li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li> <li class="navbar-item"><a href="{% url 'manager_query' %}">Manager (Y/N)</a></li>
<li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li> <li class="navbar-item"><a href="{% url 'week_query' %}">Week</a></li>
<li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li> <li class="navbar-item"><a href="{% url 'role_query' %}">Role</a></li>
<li class="navbar-item"><a href="{% url 'alphabetical_query' %}">Employee</a></li>
</ul> </ul>
</div> </div>
......
...@@ -9,9 +9,10 @@ urlpatterns = [ ...@@ -9,9 +9,10 @@ urlpatterns = [
path('report', report, name='report'), path('report', report, name='report'),
path('receipt', receipt, name='receipt'), path('receipt', receipt, name='receipt'),
path('addorder', addorder, name='addorder'), path('addorder', addorder, name='addorder'),
path('addinventory', addinventory, name='addinventory') path('addinventory', addinventory, name='addinventory'),
path('manager_query', manager_query, name='manager_query'), path('manager_query', manager_query, name='manager_query'),
path('week_query', week_query, name = 'week_query'), path('week_query', week_query, name='week_query'),
path('role_query', role_query, name = 'role_query') path('role_query', role_query, name='role_query'),
path('alphabetical_query', alphabetical_query, name='alphabetical_query')
] ]
...@@ -23,8 +23,6 @@ def inventory(request): ...@@ -23,8 +23,6 @@ def inventory(request):
def schedule(request): def schedule(request):
all_values = EmployeeRole.objects.all() all_values = EmployeeRole.objects.all()
# 2: FILTER EMPLOYEES AND ROLES IN ALPHABETICAL ORDER - felizia
employee_role_order_query = EmployeeRole.objects.all().order_by('role_description')
# 5: FILTER EMPLOYEES AND ROLES BY DATE IN ORDER - xx # 5: FILTER EMPLOYEES AND ROLES BY DATE IN ORDER - xx
date_order_query = EmployeeRole.objects.all().order_by('role_date') date_order_query = EmployeeRole.objects.all().order_by('role_date')
...@@ -35,29 +33,50 @@ def schedule(request): ...@@ -35,29 +33,50 @@ def schedule(request):
) )
# 1: FILTER EMPLOYEES BY MANAGER FOR THE DAY - mate # 1: FILTER EMPLOYEES BY MANAGER FOR THE DAY - mate
def manager_query(request): def manager_query(request):
ismanager_query = EmployeeRole.objects.all().filter(is_manager='Y') ismanager_query = EmployeeRole.objects.all().filter(is_manager='Y')
return render(request, "blizzardblast/templates/queries/manager_query.html", {'manager': ismanager_query}) return render(request, "blizzardblast/templates/queries/manager_query.html", {'manager': ismanager_query})
# 3 : FILTER BY WEEK - dedz # 3 : FILTER BY WEEK - dedz
def week_query(request): def week_query(request):
week_query1 = EmployeeRole.objects.all().filter(role_date__range=["2025-09-01", "2025-09-06"]).order_by('role_date') week_query1 = EmployeeRole.objects.all().filter(
week_query2 = EmployeeRole.objects.all().filter(role_date__range=["2025-09-08", "2025-09-13"]).order_by('role_date') role_date__range=["2025-09-01", "2025-09-06"]).order_by('role_date')
week_query2 = EmployeeRole.objects.all().filter(
role_date__range=["2025-09-08", "2025-09-13"]).order_by('role_date')
return render(request, "blizzardblast/templates/queries/week_query.html", { return render(request, "blizzardblast/templates/queries/week_query.html", {
'week_query1': week_query1, 'week_query2': week_query2 'week_query1': week_query1, 'week_query2': week_query2
} }
) )
# 4: FILTER EMPLOYEES BY ROLES - xtine # 4: FILTER EMPLOYEES BY ROLES - xtine
def role_query(request): def role_query(request):
role_query1 = EmployeeRole.objects.all().filter(role_description='Cashier') role_query1 = EmployeeRole.objects.all().filter(role_description='Cashier')
role_query2 = EmployeeRole.objects.all().filter(role_description='Preparation') role_query2 = EmployeeRole.objects.all().filter(role_description='Preparation')
role_query3 = EmployeeRole.objects.all().filter(role_description='Cleaning') role_query3 = EmployeeRole.objects.all().filter(role_description='Cleaning')
return render(request, "blizzardblast/templates/queries/role_query.html", { return render(request, "blizzardblast/templates/queries/role_query.html", {
'cashier': role_query1, 'preparation':role_query2, 'cleaning':role_query3 'cashier': role_query1, 'preparation': role_query2, 'cleaning': role_query3
} }
) )
def alphabetical_query(request):
# 2: FILTER EMPLOYEES IN ALPHABETICAL ORDER - felizia
alphabetical_query = EmployeeRole.objects.order_by(
'employee__employee_name')
for i in alphabetical_query:
print(i)
return render(request, "blizzardblast/templates/queries/alphabetical_query.html", {
'alphabetical': alphabetical_query
})
def report(request): def report(request):
return render(request, "blizzardblast/templates/report.html") return render(request, "blizzardblast/templates/report.html")
...@@ -66,6 +85,7 @@ def addorder(request): ...@@ -66,6 +85,7 @@ def addorder(request):
form = AddOrderForm() form = AddOrderForm()
return render(request, "blizzardblast/templates/addorder.html", {'form': form}) return render(request, "blizzardblast/templates/addorder.html", {'form': form})
def addinventory(request): def addinventory(request):
form = AddInventoryForm() form = AddInventoryForm()
return render(request, "blizzardblast/templates/addinventory.html", {'inventory_form':form}) return render(request, "blizzardblast/templates/addinventory.html", {'inventory_form': form})
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