Commit 72d2568a authored by DwyxE's avatar DwyxE

new branch; venv outside, already has sql database'

parent 18d13410
"""
ASGI config for IPS project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'IPS.settings')
application = get_asgi_application()
"""
Django settings for IPS project.
Generated by 'django-admin startproject' using Django 4.2.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-kwmcqkkl8+5nwz=w*wdku)*x=3bvkx8n&xiw$%jh0!+ru3*r(y'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'IPSapp'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'IPS.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'IPS.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'USER': 'root',
'NAME': 'IPD',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3306',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Hongkong'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = 'static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
"""
URL configuration for IPS project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('IPSapp.urls')),
]
"""
WSGI config for IPS project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'IPS.settings')
application = get_wsgi_application()
from django.contrib import admin
from .models import Employee, Productivity, Position, History, User, SummaryReport
admin.site.register(User)
admin.site.register(Employee)
admin.site.register(Productivity)
admin.site.register(Position)
admin.site.register(History)
admin.site.register(SummaryReport)
from django.apps import AppConfig
class IpsappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'IPSapp'
# Generated by Django 4.2 on 2023-04-04 09:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
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)),
],
),
migrations.CreateModel(
name='Position',
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)),
],
),
migrations.CreateModel(
name='Productivity',
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)),
],
),
migrations.CreateModel(
name='SummaryReport',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('prod_score', models.IntegerField()),
('date', models.DateField()),
('totalworkhrs', models.DurationField()),
],
),
migrations.CreateModel(
name='User',
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)),
],
),
migrations.CreateModel(
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')),
],
),
]
from django.db import models
#from .employee import Employee
class Upload(models.Model):
file = models.FileField(upload_to='Uploaded CSV/')
class Meta:
app_label = 'your_app_name'
class Employee(models.Model):
employee_id = models.CharField(max_length=10, primary_key=True)
employee_fname = models.CharField(max_length=255)
employee_mname = models.CharField(max_length=255, blank=True, 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(max_length=10, blank=True, null=True)
employee_emergnum = models.CharField(max_length=10, blank=True, null=True)
# class Meta:
# db_table = 'employee'
class Productivity(models.Model):
report_no = models.AutoField(max_length=10, primary_key=True)
#employee = models.ForeignKey('Employee', on_delete=models.CASCADE)
prod_date = models.DateField(null=True)
workinghours = models.DurationField()
remarks = models.TextField(max_length=2000, blank=True)
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)
# class Meta:
# constraints = [
# models.ForeignKeyConstraint(
# ['employee_id'],
# ['employee.employee_id'],
# name='productivity_fk'
# )
# ]
#class JobOrder(models.Model):
#joborder_no = models.CharField(max_length=10, primary_key=True)
#report_no = models.ForeignKey('Productivity', on_delete=models.CASCADE)
#process = models.CharField(max_length=255)
#status = models.CharField(max_length=255)
class Position(models.Model):
position_id = models.CharField(max_length=10, primary_key=True)
history_no = models.CharField(max_length=10)
position_name = models.CharField(max_length=255)
# class Meta:
# constraints = [
# models.ForeignKeyConstraint(
# ['history_no'],
# ['history.history_no'],
# name='position_fk'
# )
# ]
class History(models.Model):
history_no = models.CharField(max_length=10, primary_key=True)
employee = models.ForeignKey('Employee', on_delete=models.CASCADE)
position = models.ForeignKey('Position', on_delete=models.CASCADE)
employee_fname = models.CharField(max_length=255)
employee_mname = models.CharField(max_length=255, blank=True)
employee_lname = models.CharField(max_length=255)
position_name = models.CharField(max_length=255)
position_startdate = models.DateField()
position_enddate = models.DateField(null=True)
# class Meta:
# constraints = [
# models.ForeignKeyConstraint(
# ['employee_id'],
# ['employee.employee_id'],
# name='history_fk1'
# ),
# models.ForeignKeyConstraint(
# ['position_id'],
# ['position.position_id'],
# name='history_fk2'
# )
# ]
# class SummaryPR(models.Model):
# productivity_score = models.IntegerField()
# date = models.DateField()
# totalworkhrs = models.DurationField()
class SummaryReport(models.Model):
prod_score = models.IntegerField()
date = models.DateField()
totalworkhrs = models.DurationField()
# class Meta:
# constraints = [
# models.ForeignKeyConstraint(
# ['employee_id'],
# ['employee.employee_id'],
# name='dashboard_fk1'
# ),
# models.ForeignKeyConstraint(
# ['report_no'],
# ['productivity.report_no'],
# name='dashboard_fk2'
# )
# ]
class User(models.Model):
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)
objects = models.Manager()
def getUsername(self):
return self.username
def getPassword(self):
return self.password
def getFirstName(self):
return self.first_name
def getLastName(self):
return self.last_name
def getBirthday(self):
return self.birthday
def getSex(self):
return self.sex
def __str__(self):
return "pk: " + str(self.pk) + ": " + self.username + ", " + self.first_name + " " + self.last_name + ", " + str(self.birthday) + ", " + self.sex
@import url('https://unpkg.com/css.gg@2.0.0/icons/css/list.css');
@import url('https://unpkg.com/css.gg@2.0.0/icons/css/user-add.css');
@import url('https://unpkg.com/css.gg@2.0.0/icons/css/import.css');
@import url('https://unpkg.com/css.gg@2.0.0/icons/css/log-out.css');
body {
font-family: Helvetica ;
}
.left-align-cont {
flex-direction: column;
align-items: left;
}
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
}
.base-logo {
width: 60px;
height: auto;
display: flex;
align-items: center;
padding-bottom: 5px;
}
.base-logo img {
width: 100%;
height: auto;
}
.left-align-cont {
flex-direction: column;
align-items: left;
}
.base-header {
background-color: #00802B;
color: white;
text-transform: uppercase;
font-family: Helvetica, Arial, sans-serif;
padding: 16px 16px 16px;
display: flex;
justify-content: space-between;
}
/* NOT WORKING */
.logo-padding {
/* padding-right: 10px; */
margin-right: 10px;
}
.user-identifier {
font-size: 18px;
text-transform:none;
align-items: center;
display: flex;
margin-right: 20px;
}
.user-identifier p {
margin-bottom: unset;
}
.user-identifier b {
text-transform: capitalize;
}
.column-direction {
flex-direction: column;
align-items: center;
}
.base-header-align {
display: flex;
margin-left: 5px;
}
.base-name-align {
display: flex;
flex-direction: column;
margin-left: 10px;
}
.base-name-align h2 {
display: inline;
}
.sidebar {
height: 100%;
width: 85px;
position: fixed;
top: 102.4;
left: 0;
background-color: #461E0A;
color: white;
z-index: 1;
overflow-x: hidden;
}
.sidebar-button {
padding: 8px;
font-size: 24px;
display: flex;
justify-content: center;
flex-direction: column;
}
.sidebar p {
font-size: 12px;
text-align: center;
}
.sidebar-icon-placing {
display: flex;
justify-content: space-between;
height: 82%;
}
.sidebar a {
text-decoration: none;
color: white;
}
.sidebar-hover:hover {
background-color: #2C1206;
color: white;
}
.icon-align {
width: 100%;
align-items: center;
}
.main {
margin-left: 85px;
}
.search-and-add-cont {
margin: 30px 50px 0px;
display: flex;
/* flex-direction: column; */
justify-content: space-between;
}
.search-and-add-cont button {
border-radius: 4px;
border: 1px solid black;
padding: 5px 10px;
}
.searchbar {
width: 78%;
}
.searchbar input {
border-radius: 4px;
border: 1px solid black;
padding: 5px 10px;
margin-right: 20px;
width: 100%;
height: 100%;
}
.login-borders {
border-radius: 4px;
}
.add-profile-button {
width: 200px;
height: 50px;
background-color: #00802B;
color: white;
}
\ No newline at end of file
/*!
* Bootstrap Reboot v4.1.3 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
@-ms-viewport {
width: device-width;
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
}
[tabindex="-1"]:focus {
outline: 0 !important;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
border-bottom: 0;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: .5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
dfn {
font-style: italic;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -.25em;
}
sup {
top: -.5em;
}
a {
color: #007bff;
text-decoration: none;
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
a:hover {
color: #0056b3;
text-decoration: underline;
}
a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):focus {
outline: 0;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
}
pre {
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
-ms-overflow-style: scrollbar;
}
figure {
margin: 0 0 1rem;
}
img {
vertical-align: middle;
border-style: none;
}
svg {
overflow: hidden;
vertical-align: middle;
}
table {
border-collapse: collapse;
}
caption {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
color: #6c757d;
text-align: left;
caption-side: bottom;
}
th {
text-align: inherit;
}
label {
display: inline-block;
margin-bottom: 0.5rem;
}
button {
border-radius: 0;
}
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html [type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
input[type="radio"],
input[type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
-webkit-appearance: listbox;
}
textarea {
overflow: auto;
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
max-width: 100%;
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit;
color: inherit;
white-space: normal;
}
progress {
vertical-align: baseline;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
outline-offset: -2px;
-webkit-appearance: none;
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
summary {
display: list-item;
cursor: pointer;
}
template {
display: none;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */
\ No newline at end of file
/*!
* Bootstrap Reboot v4.1.3 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.media {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start; }
.media-body {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1; }
.stretched-link::after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
pointer-events: auto;
content: "";
background-color: rgba(0, 0, 0, 0); }
@import url('https://unpkg.com/css.gg@2.0.0/icons/css/search.css');
body {
font-family: Helvetica ;
}
.search-and-add-cont {
margin: 30px 50px 0px;
display: flex;
/* flex-direction: column; */
justify-content: space-between;
}
.search-and-add-cont button {
border-radius: 4px;
border: 1px solid black;
padding: 5px 10px;
}
.searchbar {
width: 78%;
}
.searchbar input {
border-radius: 4px;
border: 1px solid black;
padding: 5px 10px;
margin-right: 20px;
width: 100%;
height: 100%;
}
.login-borders {
border-radius: 4px;
}
.add-button {
}
.add-profile-button {
width: 200px;
height: 50px;
background-color: #00802B;
color: white;
border: none;
}
#employee {
width: 91.5%;
margin-top: 30px;
margin-left: 50px;
/* display: flex;
/* flex-direction: column; */
/* justify-content: space-between; */
}
#employee th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #00802D;
color: white;
}
#employee td, #employee th {
border: 1px solid #ddd;
padding: 8px;
}
#employee tr:nth-child(even){
background-color: #f2f2f2;
}
#employee tr:hover {
background-color: #ddd;
}
\ No newline at end of file
body {
font-family: Helvetica ;
}
.centercont {
margin: auto;
display: flex;
justify-content: center;
}
.loginheader {
background-color: #00802B;
color: white;
text-transform: uppercase;
font-family: Helvetica, Arial, sans-serif;
}
.loginheader span {
font-size: 14px;
}
.headertextcontainer {
margin-top: 16px;
}
.login-logo {
margin: 20px;
}
.login-logo img {
width: 150px;
height: auto;
}
.column-direction {
flex-direction: column;
align-items: center;
}
.column-direction b {
font-size: 24px;
}
.login-input-align {
margin: 5px;
}
.login-input-align input {
border-radius: 8px;
border: 1px solid black;
padding: 5px 10px;
margin: 5px;
}
.login-box {
width: 350px;
}
.login-button {
width: 200px;
border: 1px solid white;
padding: 5px 10px;
margin-top: 10px;
font-weight: bold;
}
.login-borders {
border-radius: 4px;
}
.button-login {
background-color: #00802B;
color: white;
}
.button-cancel {
background-color: white;
border: 1px solid black;
}
\ No newline at end of file
#topbar {
background-color: #00802b;
width: 100%;
height: 100px;
}
#topbar-text {
float: none;
font-family: Arial, Helvetica, sans-serif;
}
\ No newline at end of file
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="{% static 'css/style.css' %}" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="{% static 'css/base.css' %}" />
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<div class="base-header">
<div class="base-header-align">
<div class="base-logo">
<a href="#"
><img
src="{% static 'images/topc_logo.jpg' %}"
class="img logo rounded-circle"
/></a>
</div>
<div class="base-name-align">
<span>Thousand Oaks Packaging Corporation</span>
<h2>Employee Performance</h2>
</div>
</div>
<div class="user-identifier">
<p>
Signed in as:
<b
>test user
<!-- PUT INFO HERE --></b
>
</p>
</div>
</div>
<div class="sidebar">
<div class="sidebar-icon-placing sidebar-button">
<div>
<div class="sidebar-hover">
<a href="">
<div class="icon-align sidebar-button">
<i class="gg-list"></i>
</div>
<p>Record List</p>
</a>
</div>
<div class="sidebar-hover">
<a href="">
<div class="icon-align sidebar-button">
<i class="gg-user-add"></i>
</div>
<p>Add Profile</p>
</a>
</div>
<div class="sidebar-hover">
<a href="">
<div class="icon-align sidebar-button">
<i class="gg-import"></i>
</div>
<p>Import Data</p>
</a>
</div>
</div>
<div class="sidebar-hover">
<a href="">
<div class="icon-align sidebar-button">
<i class="gg-log-out"></i>
</div>
<p>Log Out</p>
</a>
</div>
</div>
</div>
<div class="main">{% block content %}{% endblock %}</div>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js"
integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
crossorigin="anonymous"
></script>
<footer>
<p class="footer">
Copyright &copy;
<script>
document.write(new Date().getFullYear());
</script>
</p>
</footer>
</body>
</html>
{% extends 'base.html' %}
{% block content %}
<div id="chart-container">
{{ chart|safe }}
</div>
{% endblock %}
\ No newline at end of file
{% extends 'EmployeeProdDB/base.html' %} {% load static %} {% block content %}
<head>
<title>Login</title>
<link rel="stylesheet" href="{% static 'css/style.css' %}" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
crossorigin="anonymous"
/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="{% static 'css/home.css' %}" />
<title>Home Page</title>
</head>
<body>
<div class="search-and-add-cont">
<div class="searchbar">
<input placeholder='&#xf002 Search Name' />
</div>
<div class="add-button">
<button type="submit" class="login-borders add-profile-button">
Add Profile
</button>
</div>
</div>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js"
integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
crossorigin="anonymous"
></script>
<!-- TABLE -->
<table id="employee">
<tr>
<th>ID</th>
<th>Employee Name</th>
<th>Last Record Update</th>
<th>Position</th>
<th>Team</th>
</tr>
<tr><td>1</td>
<td>Juan Dela Cruz</td>
<td>Jan 12, 2022</td>
<td>Packager</td>
<td>Juan Dela Paz</td>
</tr>
<tr>
<td>2</td>
<td>Jacob Vitug</td>
<td>Jan 12, 2022</td>
<td>Packager</td>
<td>Marc Chua</td>
</tr>
</table>
</body>
{% endblock %}
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<title>Login</title>
<link rel="stylesheet" href="{% static 'css/style.css' %}"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="{% static 'css/loginpage.css' %}">
</head>
<body>
<div class="loginheader centercont">
<div class="headertextcontainer">
<span>Thousand Oaks Packaging Corporation</span>
<h2>Employee Performance</h2>
</div>
</div>
<!-- {% block content %} -->
<div class="centercont column-direction">
<div class="login-logo">
<a href="#"><img src="{% static 'images/topc_logo.jpg' %}" class="img logo rounded-circle"></a>
</div>
<b>Sign In</b>
<div class="login-box centercont">
<form method="POST" action="{% url 'loginpage' %}">{% csrf_token %}
<div class="login-input-align">
<div class="form-group has-feedback">
<input type="text" name="username" id="username" placeholder="Enter Username">
</div>
<div class="form-group has-feedback">
<input type="password" name="password" id="password" placeholder="Enter Password">
</div>
</div>
<!-- <input type="submit"> -->
<div class="centercont column-direction">
<button type="submit" class="login-button login-borders button-login">Log In</button>
<button type="submit" class="login-button login-borders button-cancel">Cancel</button>
</div>
</form>
</div>
</div>
{% endblock content %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
{% if messages %}
{% for m in messages %}
<div class="alert alert-info" style="color: red; font-family:'Poppins';">{{m}}</div>
{% endfor %}
{% endif %}
<table>
<thead>
<tr>
<th>Report Number</th>
<th>Employee ID</th>
<th>Prod Date</th>
<th>Working Hours</th>
<th>Remarks</th>
<th>Prod Score</th>
<!-- add more headers for additional fields -->
</tr>
</thead>
<tbody>
{% for row in csv_data %}
<tr>
<td>{{ row.report_no }}</td>
<td>{{ row.employee_id }}</td>
<td>{{ row.prod_date }}</td>
<td>{{ row.workinghours }}</td>
<td>{{ row.remarks }}</td>
<td>{{ row.prod_score }}</td>
<!-- add more cells for additional fields -->
</tr>
{% endfor %}
</tbody>
</table>
<table>
<thead>
<tr>
<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.date}}</td>
<td>{{ row.productivity_score }}</td>
<td>{{ row.totalworkhrs }}</td>
<!-- add more cells for additional fields -->
</tr>
{% endfor %}
</tbody>
</table>
{% load static %}
<!doctype html>
<head>
<title> Sign up </title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="{% static 'css/style_signup.css' %}">
<link rel="stylesheet" href="{% static 'css/bootstrap-4.1.3-dist/css/bootstrap.css' %}">
<link rel="icon" href="{% static 'images/halalan_2022_logo.png' %}" sizes="9x16">
</head>
<body>
<section class="h-100 gradient-form" style="background-color: #eee;">
<div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-xl-10">
<div class="card rounded-3 text-black">
<div class="row g-0">
<div class="col-lg-6">
<div class="card-body p-md-5 mx-md-4">
<div class="text-center">
<img src="{% static 'images/halalan_2022_logo.png' %}" style="width: 150px;" alt="logo">
</div>
{% include 'EmployeeProdDB/messages.html' %}
<div class="row">
{% block content %}
{% endblock %}
</div>
<form method="POST" action="{% url 'signup' %}">{% csrf_token %}
<h5 class="mb-4" style="font-family:'Poppins';">Sign up</h5>
<label class="form-label" for="username" style="font-family:'Poppins';">Username: </label>
<input class ="form-control" type="text" name="username" id="username" placeholder="Enter username@email.com" Required>
<br>
<label class="form-label" for="password" style="font-family:'Poppins';">Password: </label>
<input class ="form-control" type="password" name="password" id="password" minlength="8" placeholder="Enter Password (min. 8 characters)" Required>
<br>
<label class="form-label" for="confirm_password" style="font-family:'Poppins';">Confirm Password: </label>
<input class ="form-control" type="password" name="confirm_password" id="confirm_password" minlength="8" placeholder="Confirm Password" Required>
<br>
<label class="form-label" for="first_name" style="font-family:'Poppins';">First name: </label>
<input class ="form-control" type="text" name="first_name" id="first_name" placeholder="Enter Firstname" Required>
<br>
<label class="form-label" for="last_name" style="font-family:'Poppins';">Last name: </label>
<input class ="form-control" type="text" name="last_name" id="last_name" placeholder="Enter Lastname" Required>
<br>
<label class="form-label" for="birthday" style="font-family:'Poppins';">Birthday: </label>
<input class ="form-control" type="text" name="birthday" id="birthday" placeholder= "format (yyyy-mm-dd)" Required>
<br>
<label class="form-label" for="sex" style="font-family:'Poppins';">Sex: </label>
<input class ="form-control" type="text" name="sex" id="sex" placeholder="Enter sex" Required>
<br>
<div class="text-center">
<button id=signupbtn class="btn btn-success btn-block fa-lg gradient-custom-2 mb-3" type="submit" style="font-family:'Poppins';">Submit</button>
</div>
</form>
<div class="text-center">
<a href="{% url 'loginpage' %}"><button class="btn btn-primary btn-block fa-lg gradient-custom-2 mb-3" style="font-family:'Poppins';">Go back to Login</button></a>
</div>
</div>
</div>
<div class="col-lg-6 d-flex align-items-center gradient-custom-2">
<div class="text-white px-3 py-4 p-md-5 mx-md-4"><img src="{% static 'images/voting.png' %}" style="width: 300px;">
<h5 class="mb-4" style="font-family:'Poppins';">Exercise your Right to Vote!</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="{% static 'css/bootstrap-4.1.3-dist/js/bootstrap.min.js' %}"></script>
</body>
</html>
\ No newline at end of file
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
<label for="csv_file">Upload a CSV file:</label>
<input type="file" name="csv_file" accept=".csv">
<input type="submit" value="Upload">
</form>
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.loginpage, name='loginpage'),
path('home/', views.home, name='home'),
path('upload_csv/', views.upload_csv, name = 'upload_csv'),
path('show_csv_data/', views.show_csv_data, name ='show_csv_data'),
path('signup/', views.signup, name='signup'),
path('show_csv_data2/', views.show_csv_data2, name='show_csv_data2')
#path('', views.login_page, name='loginpage'),
]
\ No newline at end of file
from django.shortcuts import render, redirect
import io
import csv
from datetime import datetime, timedelta
from .models import Productivity, User, SummaryReport
from django.contrib import messages
from django.utils.dateparse import parse_date, parse_duration
# from dateutil.parser import parse as parse_date
from django.views.generic import View
# from chartjs.views.lines import BaseLineChartView
# import Chart from 'chart.js/auto';
def home(request):
return render(request, 'EmployeeProdDB/home.html')
def signup(request):
if request.method == 'POST':
uname = request.POST.get('username')
pword = request.POST.get('password')
confirm_pword = request.POST.get('confirm_password')
fname = request.POST.get('first_name')
lname = request.POST.get('last_name')
bday = request.POST.get('birthday')
sex = request.POST.get('sex')
if pword==confirm_pword:
if User.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.save()
messages.success(request, 'User account created.')
return redirect('loginpage')
else:
messages.info(request, 'Password does not match. Please try again.')
return redirect('signup')
else:
return render(request, 'EmployeeProdDB/signup.html')
def loginpage(request):
if(request.method == "POST"):
uname = request.POST.get('username')
pword = request.POST.get('password')
accountList = User.objects.filter(username = uname)
if(len(accountList) > 0):
findUser = User.objects.get(username= uname)
if(findUser.getPassword() == pword):
global loggedInUser
loggedInUser = findUser
messages.success(request, 'SUCCESSFULLY LOGGED IN!')
return redirect('home')
else:
messages.info(request, 'Invalid Username or Password')
return render(request, 'EmployeeProdDB/loginpage.html')
else:
messages.info(request, 'User Account Not Found')
return render(request, 'EmployeeProdDB/loginpage.html')
else:
return render(request, 'EmployeeProdDB/loginpage.html')
def upload_csv(request):
if request.method == 'POST':
csv_file = request.FILES['csv_file']
if not csv_file.name.endswith('.csv'):
messages.error(request, 'This is not a CSV file')
else:
# read the data from the uploaded file
csv_data = csv.reader(
(line.decode('utf-8') for line in csv_file),
delimiter=',',
quotechar='"'
)
encountered_empty_row = False
# Loop through data rows
for i, row in enumerate(csv_data):
# Check if this row is the start of a new report
if row[0] == 'PRODUCTIVITY REPORT':
# Reset variables for the new report
report_no = row[1]
employee = None
prod_date = None
workinghours = None
remarks = None
prod_score = None
joborder_no = None
process = None
status = None
# Skip 8 rows
count = 0
while count < 8:
next(csv_data)
count += 1
# Reset the flag for encountered empty row
encountered_empty_row = False
# Read headers from 9th row
headers = next(csv_data)
jo_no_index = headers.index('JO NO')
status_index = headers.index('Status')
process_index = headers.index('Process')
duration_index = headers.index('Duration')
remarks_index = headers.index('Remarks')
elif all(cell == '' for cell in row):
# Check if an empty row has been encountered before
if encountered_empty_row:
# Stop processing data as we have encountered two consecutive empty rows
break
else:
# Set the flag to indicate that an empty row has been encountered
encountered_empty_row = True
else:
# Read data from the row
joborder_no = row[jo_no_index]
status = row[status_index]
process = row[process_index]
workinghours = row[duration_index]
remarks = row[remarks_index]
# Convert working hours to a Duration object
if workinghours:
hours, minutes = map(int, workinghours.split(':'))
workinghours = timedelta(hours=hours, minutes=minutes)
# Create a new productivity object
Productivity.objects.create(
#report_no=report_no,
#employee=employee,
#prod_date=prod_date,
workinghours=workinghours,
remarks=remarks,
#prod_score=prod_score,
joborder_no=joborder_no,
process=process,
status=status
)
return render(request, 'EmployeeProdDB/upload_csv.html', {'message': 'Data imported successfully!'})
return render(request, 'EmployeeProdDB/upload_csv.html')
# # def chart_view(request):
# # Define the data pool
# data_pool = DataPool(
# series=[{
# 'options': {
# 'source': SummaryPR.objects.all()
# },
# 'terms': [
# 'my_field_1',
# 'my_field_2',
# ]
# }]
# )
# # Define the chart
# chart = Chart(
# datasource=data_pool,
# series_options=[{
# 'options': {
# 'type': 'pie',
# 'stacking': False
# },
# 'terms': {
# 'my_field_1': 'my_field_2'
# }
# }]
# )
# # Render the chart template
# return render(request, 'chart_template.html', {
# 'chart': chart,
# })
def show_csv_data(request):
csv_data = Productivity.objects.all()
return render(request, 'EmployeeProdDB/show_csv_data.html', {'csv_data': csv_data})
def show_csv_data2(request):
csv_data = SummaryReport.objects.all()
return render(request, 'EmployeeProdDB/show_csv_data2.html', {'csv_data': csv_data})
# Create your views here.
File added
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'IPS.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
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