Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
JARVIS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacob Dylan D. Vitug
JARVIS
Commits
53a8ac75
Commit
53a8ac75
authored
Apr 03, 2023
by
Dexter Sapugay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
966a3a04
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
76 additions
and
91 deletions
+76
-91
admin.cpython-38.pyc
IPSystemTOPC/EmployeeProdDB/__pycache__/admin.cpython-38.pyc
+0
-0
models.cpython-38.pyc
...stemTOPC/EmployeeProdDB/__pycache__/models.cpython-38.pyc
+0
-0
views.cpython-38.pyc
IPSystemTOPC/EmployeeProdDB/__pycache__/views.cpython-38.pyc
+0
-0
admin.py
IPSystemTOPC/EmployeeProdDB/admin.py
+1
-2
0001_initial.py
IPSystemTOPC/EmployeeProdDB/migrations/0001_initial.py
+23
-28
0002_remove_productivity_employee_and_more.py
.../migrations/0002_remove_productivity_employee_and_more.py
+0
-27
0001_initial.cpython-38.pyc
...ProdDB/migrations/__pycache__/0001_initial.cpython-38.pyc
+0
-0
models.py
IPSystemTOPC/EmployeeProdDB/models.py
+4
-9
chart_template.html
...ployeeProdDB/templates/EmployeeProdDB/chart_template.html
+7
-0
views.py
IPSystemTOPC/EmployeeProdDB/views.py
+37
-24
settings.py
IPSystemTOPC/IPSystemTOPC/settings.py
+4
-1
db.sqlite3
IPSystemTOPC/db.sqlite3
+0
-0
No files found.
IPSystemTOPC/EmployeeProdDB/__pycache__/admin.cpython-38.pyc
View file @
53a8ac75
No preview for this file type
IPSystemTOPC/EmployeeProdDB/__pycache__/models.cpython-38.pyc
View file @
53a8ac75
No preview for this file type
IPSystemTOPC/EmployeeProdDB/__pycache__/views.cpython-38.pyc
View file @
53a8ac75
No preview for this file type
IPSystemTOPC/EmployeeProdDB/admin.py
View file @
53a8ac75
from
django.contrib
import
admin
from
.models
import
Employee
,
Productivity
,
Position
,
History
,
Dashboard
,
User
from
.models
import
Employee
,
Productivity
,
Position
,
History
,
User
admin
.
site
.
register
(
User
)
admin
.
site
.
register
(
Employee
)
admin
.
site
.
register
(
Productivity
)
admin
.
site
.
register
(
Position
)
admin
.
site
.
register
(
History
)
admin
.
site
.
register
(
Dashboard
)
IPSystemTOPC/EmployeeProdDB/migrations/0001_initial.py
View file @
53a8ac75
# Generated by Django 4.0.4 on 2023-04-0
2 13:16
# Generated by Django 4.0.4 on 2023-04-0
3 13:53
from
django.db
import
migrations
,
models
import
django.db.models.deletion
...
...
@@ -34,6 +34,28 @@ class Migration(migrations.Migration):
(
'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
=
'SummaryPR'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'productivity_score'
,
models
.
IntegerField
(
max_length
=
3
)),
(
'date'
,
models
.
DateField
()),
(
'totalworkhrs'
,
models
.
DurationField
()),
],
),
migrations
.
CreateModel
(
name
=
'User'
,
fields
=
[
...
...
@@ -46,20 +68,6 @@ class Migration(migrations.Migration):
(
'sex'
,
models
.
CharField
(
max_length
=
50
)),
],
),
migrations
.
CreateModel
(
name
=
'Productivity'
,
fields
=
[
(
'report_no'
,
models
.
CharField
(
max_length
=
10
,
primary_key
=
True
,
serialize
=
False
)),
(
'prod_date'
,
models
.
DateField
()),
(
'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
)),
(
'employee'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'EmployeeProdDB.employee'
)),
],
),
migrations
.
CreateModel
(
name
=
'History'
,
fields
=
[
...
...
@@ -74,17 +82,4 @@ class Migration(migrations.Migration):
(
'position'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'EmployeeProdDB.position'
)),
],
),
migrations
.
CreateModel
(
name
=
'Dashboard'
,
fields
=
[
(
'dashboard_id'
,
models
.
CharField
(
max_length
=
10
,
primary_key
=
True
,
serialize
=
False
)),
(
'report_no'
,
models
.
CharField
(
max_length
=
255
)),
(
'timespan'
,
models
.
DurationField
()),
(
'displaytype'
,
models
.
CharField
(
max_length
=
255
)),
(
'total_workinghours'
,
models
.
DurationField
()),
(
'contribution'
,
models
.
CharField
(
max_length
=
10
)),
(
'avgprodscore'
,
models
.
FloatField
()),
(
'employee'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'EmployeeProdDB.employee'
)),
],
),
]
IPSystemTOPC/EmployeeProdDB/migrations/0002_remove_productivity_employee_and_more.py
deleted
100644 → 0
View file @
966a3a04
# Generated by Django 4.0.4 on 2023-04-02 14:00
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'EmployeeProdDB'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'productivity'
,
name
=
'employee'
,
),
migrations
.
AlterField
(
model_name
=
'productivity'
,
name
=
'prod_date'
,
field
=
models
.
DateField
(
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'productivity'
,
name
=
'report_no'
,
field
=
models
.
AutoField
(
max_length
=
10
,
primary_key
=
True
,
serialize
=
False
),
),
]
IPSystemTOPC/EmployeeProdDB/migrations/__pycache__/0001_initial.cpython-38.pyc
View file @
53a8ac75
No preview for this file type
IPSystemTOPC/EmployeeProdDB/models.py
View file @
53a8ac75
...
...
@@ -87,15 +87,10 @@ class History(models.Model):
# )
# ]
class
Dashboard
(
models
.
Model
):
dashboard_id
=
models
.
CharField
(
max_length
=
10
,
primary_key
=
True
)
employee
=
models
.
ForeignKey
(
'Employee'
,
on_delete
=
models
.
CASCADE
)
report_no
=
models
.
CharField
(
max_length
=
255
)
timespan
=
models
.
DurationField
()
displaytype
=
models
.
CharField
(
max_length
=
255
)
total_workinghours
=
models
.
DurationField
()
contribution
=
models
.
CharField
(
max_length
=
10
)
avgprodscore
=
models
.
FloatField
()
class
SummaryPR
(
models
.
Model
):
productivity_score
=
models
.
IntegerField
(
max_length
=
3
)
date
=
models
.
DateField
()
totalworkhrs
=
models
.
DurationField
()
# class Meta:
# constraints = [
...
...
IPSystemTOPC/EmployeeProdDB/templates/EmployeeProdDB/chart_template.html
0 → 100644
View file @
53a8ac75
{% extends 'base.html' %}
{% block content %}
<div
id=
"chart-container"
>
{{ chart|safe }}
</div>
{% endblock %}
\ No newline at end of file
IPSystemTOPC/EmployeeProdDB/views.py
View file @
53a8ac75
...
...
@@ -2,10 +2,14 @@ import io
import
csv
from
datetime
import
datetime
,
timedelta
from
django.shortcuts
import
render
,
redirect
from
.models
import
Productivity
,
User
from
.models
import
Productivity
,
User
,
SummaryPR
from
django.contrib
import
messages
from
django.utils.dateparse
import
parse_date
,
parse_duration
from
dateutil.parser
import
parse
as
parse_date
from
django.shortcuts
import
render
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'
)
...
...
@@ -145,32 +149,41 @@ def upload_csv(request):
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 handle_file_upload(request):
# if request.method == 'POST':
# file = request.FILES.get('file-input')
# You can now process the file as needed
# ...
# return render(request, 'uploadpage.html')
#def login_page(request):
# return render(request, 'loginpage.html')
#def upload_file(request):
# if request.method == 'POST':
# form = Upload(request.POST.get('file'), request.FILES.get('file'))
# if form.is_valid():
# form.save()
# return redirect('success_url')
# else:
# form = Upload()
# return render(request, 'uploadpage.html', {'form': form})
#def index(request):
# return render(request, 'index.html')
IPSystemTOPC/IPSystemTOPC/settings.py
View file @
53a8ac75
...
...
@@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/4.0/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
...
...
@@ -38,7 +39,9 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'EmployeeProdDB'
'EmployeeProdDB'
,
'chartjs'
]
MIDDLEWARE
=
[
...
...
IPSystemTOPC/db.sqlite3
View file @
53a8ac75
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment