Commit de12c436 authored by Martina Therese R. Reyes's avatar Martina Therese R. Reyes

Merge branch 'MateBranch'

parents 51830b93 7b8e0d88
*.pyc
.env
*.sql
\ No newline at end of file
......@@ -42,6 +42,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main'
]
MIDDLEWARE = [
......@@ -91,7 +92,6 @@ DATABASES = {
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
......
......@@ -75,7 +75,7 @@ ul {
/* ======= HEADING ======= */
header {
padding: 0.5rem;
animation: gradient 1s 1s infinite;
animation: gradient 5s 5s infinite;
color: #FEFCFD;
}
......@@ -215,7 +215,7 @@ header {
color:#FEFCFD;
}
#order-table, #receipt-table {
#order-table, #receipt-table, #scheduling-table {
display: flex;
justify-content: center;
}
......
......@@ -7,6 +7,24 @@
{% endblock %}
{% block content %}
<h1 class='view-title'>Schedule </h1>
<table id="scheduling-table">
<tr>
<th>Week</th>
<th>Staff</th>
<th>Role</th>
<th>Day-Mgr</th>
</tr>
{% for m in manager%}
<tr>
<td> {{m.role_date}}</td>
<td> {{m.employee.employee_name}} </td>
<td> {{m.role_description}} </td>
<td> {{m.is_manager}} </td>
</tr>
{% endfor %}
</table>
{% endblock %}
# Generated by Django 3.1.7 on 2021-12-12 06:02
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Employee',
fields=[
('employee_id', models.IntegerField(primary_key=True, serialize=False)),
('employee_name', models.CharField(max_length=255)),
],
options={
'db_table': 'employee',
'managed': False,
},
),
migrations.CreateModel(
name='Employeerole',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('role_date', models.DateField()),
('role_description', models.CharField(choices=[('Cashier', 'Cashier'), ('Preparation', 'Preparation'), ('Cleaning', 'Cleaning')], max_length=20)),
('is_manager', models.CharField(max_length=1)),
],
options={
'db_table': 'employeerole',
'managed': False,
},
),
]
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from django.db import models
# Create your models here.
class Employee(models.Model):
employee_id = models.IntegerField(primary_key=True)
employee_name = models.CharField(max_length=255)
class Meta:
managed = False
db_table = 'employee'
class EmployeeRole(models.Model):
ROLES = [
('Cashier', 'Cashier'),
('Preparation', 'Preparation'),
('Cleaning', 'Cleaning'),
]
IS_MANAGER = [
('Y', 'Y'),
('N', 'N'),
]
role_id = models.AutoField(primary_key=True)
role_date = models.DateField()
employee = models.ForeignKey(Employee, models.DO_NOTHING)
role_description = models.CharField(max_length=20, choices=ROLES)
is_manager = models.CharField(max_length=1, choices=IS_MANAGER)
def employeename(self):
return self.employee.employee_name
class Meta:
managed = False
db_table = 'employeerole'
......@@ -2,26 +2,55 @@ from django.shortcuts import render
from django.http import HttpResponse
from .forms import AddInventoryForm, AddOrderForm
from .models import *
def homepage(request):
return render(request, "blizzardblast/templates/index.html")
def order(request):
return render(request, "blizzardblast/templates/order.html")
def receipt(request):
return render(request, "blizzardblast/templates/receipt.html")
def inventory(request):
return render(request, "blizzardblast/templates/inventory.html")
def schedule(request):
return render(request, "blizzardblast/templates/schedule.html")
# 1: FILTER EMPLOYEES BY MANAGER FOR THE DAY - mate
ismanager_query = EmployeeRole.objects.all().filter(is_manager='Y')
# 2: FILTER EMPLOYEES AND ROLES IN ALPHABETICAL ORDER - felizia
employee_role_order_query = EmployeeRole.objects.all().order_by('role_description')
# 3 : FILTER BY WEEK - dedz
week_query1 = EmployeeRole.objects.all().filter(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')
# 4: FILTER EMPLOYEES BY ROLES - xtine
role_query1 = EmployeeRole.objects.all().filter(role_description='Cashier')
role_query2 = EmployeeRole.objects.all().filter(role_description='Preparation')
role_query3 = EmployeeRole.objects.all().filter(role_description='Cleaning')
# 5: FILTER EMPLOYEES AND ROLES BY DATE IN ORDER - xx
date_order_query = EmployeeRole.objects.all().order_by('role_date')
return render(request, "blizzardblast/templates/schedule.html", {
'manager': ismanager_query
}
)
def report(request):
return render(request, "blizzardblast/templates/report.html")
def addorder(request):
form = AddOrderForm()
return render(request, "blizzardblast/templates/addorder.html", {'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