Commit 29281064 authored by Dexter Sapugay's avatar Dexter Sapugay

final

parent 2a6949c7
from django.contrib import admin
from .models import Employee, Productivity, Position, History, User, SummaryReport
from .models import Employee, Productivity, Position, History, IPSUser, SummaryReport
admin.site.register(User)
admin.site.register(IPSUser)
admin.site.register(Employee)
admin.site.register(Productivity)
admin.site.register(Position)
......
# Generated by Django 4.2 on 2023-04-04 10:24
# Generated by Django 4.2 on 2023-04-04 18:18
from django.db import migrations, models
import django.db.models.deletion
......@@ -8,78 +8,116 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
]
dependencies = []
operations = [
migrations.CreateModel(
name='Employee',
name="Employee",
fields=[
('employee_id', models.CharField(max_length=10, primary_key=True, serialize=False)),
('employee_fname', models.CharField(max_length=255)),
('employee_mname', models.CharField(blank=True, max_length=255, null=True)),
('employee_lname', models.CharField(max_length=255)),
('employee_sex', models.CharField(max_length=1)),
('employee_bday', models.DateField()),
('employee_email', models.CharField(max_length=255)),
('employee_num', models.CharField(blank=True, max_length=10, null=True)),
('employee_emergnum', models.CharField(blank=True, max_length=10, null=True)),
(
"employee_id",
models.CharField(max_length=10, primary_key=True, serialize=False),
),
("employee_fname", models.CharField(max_length=255)),
(
"employee_mname",
models.CharField(blank=True, max_length=255, null=True),
),
("employee_lname", models.CharField(max_length=255)),
("employee_sex", models.CharField(max_length=1)),
("employee_bday", models.DateField()),
("employee_email", models.CharField(max_length=255)),
(
"employee_num",
models.CharField(blank=True, max_length=10, null=True),
),
(
"employee_emergnum",
models.CharField(blank=True, max_length=10, null=True),
),
],
),
migrations.CreateModel(
name='Position',
name="IPSUser",
fields=[
('position_id', models.CharField(max_length=10, primary_key=True, serialize=False)),
('history_no', models.CharField(max_length=10)),
('position_name', models.CharField(max_length=255)),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("username", models.CharField(max_length=300, unique=True)),
("password", models.CharField(max_length=300)),
("first_name", models.CharField(max_length=300)),
("last_name", models.CharField(max_length=300)),
("birthday", models.DateField()),
("sex", models.CharField(max_length=50)),
],
),
migrations.CreateModel(
name='Productivity',
name="Position",
fields=[
('report_no', models.AutoField(max_length=10, primary_key=True, serialize=False)),
('prod_date', models.DateField(null=True)),
('workinghours', models.DurationField()),
('remarks', models.TextField(blank=True, max_length=2000)),
('prod_score', models.FloatField(null=True)),
('joborder_no', models.CharField(max_length=10)),
('process', models.CharField(max_length=255)),
('status', models.CharField(max_length=255)),
(
"position_id",
models.CharField(max_length=10, primary_key=True, serialize=False),
),
("history_no", models.CharField(max_length=10)),
("position_name", models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='SummaryReport',
name="Productivity",
fields=[
('sr_no', models.AutoField(primary_key=True, serialize=False)),
('prod_score', models.IntegerField()),
('date', models.DateField()),
('totalworkhrs', models.DurationField()),
("report_no", models.AutoField(primary_key=True, serialize=False)),
("prod_date", models.DateField(null=True)),
("workinghours", models.DurationField()),
("remarks", models.TextField(blank=True, max_length=2000)),
("prod_score", models.FloatField(null=True)),
("joborder_no", models.CharField(max_length=10)),
("process", models.CharField(max_length=255)),
("status", models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='User',
name="SummaryReport",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('username', models.CharField(max_length=300, unique=True)),
('password', models.CharField(max_length=300)),
('first_name', models.CharField(max_length=300)),
('last_name', models.CharField(max_length=300)),
('birthday', models.DateField()),
('sex', models.CharField(max_length=50)),
("sr_no", models.AutoField(primary_key=True, serialize=False)),
("employee_name", models.CharField(default="No Name", max_length=255)),
("prod_score", models.FloatField()),
("date", models.DateField()),
("totalworkhrs", models.DurationField()),
],
),
migrations.CreateModel(
name='History',
name="History",
fields=[
('history_no', models.CharField(max_length=10, primary_key=True, serialize=False)),
('employee_fname', models.CharField(max_length=255)),
('employee_mname', models.CharField(blank=True, max_length=255)),
('employee_lname', models.CharField(max_length=255)),
('position_name', models.CharField(max_length=255)),
('position_startdate', models.DateField()),
('position_enddate', models.DateField(null=True)),
('employee', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IPSapp.employee')),
('position', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IPSapp.position')),
(
"history_no",
models.CharField(max_length=10, primary_key=True, serialize=False),
),
("employee_fname", models.CharField(max_length=255)),
("employee_mname", models.CharField(blank=True, max_length=255)),
("employee_lname", models.CharField(max_length=255)),
("position_name", models.CharField(max_length=255)),
("position_startdate", models.DateField()),
("position_enddate", models.DateField(null=True)),
(
"employee",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="IPSapp.employee",
),
),
(
"position",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="IPSapp.position",
),
),
],
),
]
# Generated by Django 4.2 on 2023-04-04 12:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('IPSapp', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='summaryreport',
name='employee_name',
field=models.CharField(default='No Name', max_length=255),
),
migrations.AlterField(
model_name='productivity',
name='report_no',
field=models.AutoField(primary_key=True, serialize=False),
),
]
# Generated by Django 4.2 on 2023-04-04 13:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('IPSapp', '0002_summaryreport_employee_name_and_more'),
]
operations = [
migrations.AlterField(
model_name='summaryreport',
name='prod_score',
field=models.FloatField(),
),
]
......@@ -128,7 +128,7 @@ class SummaryReport(models.Model):
# )
# ]
class User(models.Model):
class IPSUser(models.Model):
username = models.CharField(max_length=300, unique=True)
password = models.CharField(max_length=300)
first_name = models.CharField(max_length=300)
......
......@@ -37,7 +37,7 @@
<p>
Signed in as:
<b
>marc leighton chua
>Bo Caj
<!-- PUT INFO HERE --></b
>
</p>
......@@ -76,7 +76,7 @@
</div>
<div class="sidebar-hover">
<a href="">
<a href="{% url 'signin' %}">
<div class="icon-align sidebar-button">
<i class="gg-log-out"></i>
</div>
......
<table>
<thead>
<tr>
<th>SR No</th>
<th>Employee Name</th>
<th>Date</th>
<th>Prod Score</th>
<th>Total Work Hrs</th>
<!-- add more headers for additional fields -->
</tr>
</thead>
<tbody>
{% for row in csv_data %}
<tr>
<td>{{ row.sr_no}}</td>
<td>{{ row.employee_name}}</td>
<td>{{ row.date}}</td>
<td>{{ row.prod_score }}</td>
<td>{{ row.totalworkhrs }}</td>
<!-- add more cells for additional fields -->
</tr>
{% endfor %}
</tbody>
</table>
......@@ -2,7 +2,7 @@ from django.shortcuts import render, redirect
import io
import csv
from datetime import datetime, timedelta
from .models import Productivity, User, SummaryReport
from .models import Productivity, IPSUser, SummaryReport
from django.contrib import messages
from django.utils.dateparse import parse_date, parse_duration
# from dateutil.parser import parse as parse_date
......@@ -20,7 +20,7 @@ def home(request):
def my_view(request):
user = User.objects.getUsername()
user = IPSUser.objects.getUsername()
return render(request, 'EmployeeProdDB/base.html', {'user': user})
# def show_csv_data2(request):
......@@ -39,11 +39,11 @@ def signup(request):
sex = request.POST.get('sex')
if pword==confirm_pword:
if User.objects.filter(username=uname).exists():
if IPSUser.objects.filter(username=uname).exists():
messages.error(request, 'Username already taken.')
return redirect('signup')
else:
user = User.objects.create(username = uname, password = pword, first_name = fname, last_name = lname, birthday = bday, sex = sex)
user = IPSUser.objects.create(username = uname, password = pword, first_name = fname, last_name = lname, birthday = bday, sex = sex)
user.save()
messages.success(request, 'User account created.')
return redirect('loginpage')
......@@ -60,10 +60,10 @@ def loginpage(request):
uname = request.POST.get('username')
pword = request.POST.get('password')
accountList = User.objects.filter(username = uname)
accountList = IPSUser.objects.filter(username = uname)
if(len(accountList) > 0):
findUser = User.objects.get(username= uname)
findUser = IPSUser.objects.get(username= uname)
if(findUser.getPassword() == pword):
global loggedInUser
......
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