Commit c606ffdf authored by dexsap's avatar dexsap

final product + dashboard

parent 5e66ff07
...@@ -38,7 +38,10 @@ INSTALLED_APPS = [ ...@@ -38,7 +38,10 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'IPSapp' 'IPSapp',
'graphapp',
'django_plotly_dash',
'plotly'
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -49,6 +52,7 @@ MIDDLEWARE = [ ...@@ -49,6 +52,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_plotly_dash.middleware.BaseMiddleware'
] ]
ROOT_URLCONF = 'IPS.urls' ROOT_URLCONF = 'IPS.urls'
......
body { body {
font-family: Helvetica ; font-family: Helvetica;
} }
.employee-info-cont { .employee-info-cont {
margin: 30px 50px 0px; margin: 30px 50px 0px;
background-color: #00802D; background-color: #00802d;
color: white; color: white;
width: 91.5%; width: 91.5%;
height: 100px; height: 100px;
margin-right: 50px; margin-right: 50px;
border-radius: 4px; border-radius: 4px;
padding: 5px 10px; padding: 5px 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.employee-info-contact{ .employee-info-contact {
display: flex; display: flex;
margin-right: 50px; margin-right: 50px;
} }
.employee-nameID { .employee-nameID {
display: flex; display: flex;
height: 100%; height: 100%;
margin-left: 30px; margin-left: 30px;
flex-direction: column; flex-direction: column;
width: 30%; width: 30%;
justify-content: center; justify-content: center;
}
}
#ID { #ID {
background-color: white; background-color: white;
color: #00802D; color: #00802d;
border-radius: 4px; border-radius: 4px;
padding: 3px; padding: 3px;
font-weight: bold; font-weight: bold;
} }
/* .employee-info-contact { /* .employee-info-contact {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} */ } */
/* kebab styling */
.kebab {
cursor: pointer;
position: relative;
display: inline-block;
box-sizing: border-box;
padding: 0 16px;
}
.kebab figure {
width: 6px;
height: 6px;
border-radius: 5px;
background: white;
margin: 3px 0;
}
.middle {
transition: all 0.25s cubic-bezier(0.72, 1.2, 0.71, 0.72);
transform: scale(1);
position: relative;
box-shadow: 0 0.1px 0.1px 0 rgba(0, 0, 0, 0.16),
0 0.1px 0.3px 0 rgba(0, 0, 0, 0.12);
-webkit-filter: blur(0.1px);
filter: blur(0.1px);
}
.middle.active {
transform: scale(4.5);
transition: all 0.25s cubic-bezier(0.32, 2.04, 0.85, 0.54);
box-shadow: 0 0.1px 0.1px 0 rgba(0, 0, 0, 0.16),
0 0.1px 0.3px 0 rgba(0, 0, 0, 0.12);
}
.cross {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0);
margin-top: -1px;
color: white;
transition: all 0.2s cubic-bezier(0.72, 1.2, 0.71, 0.72);
font-size: 22px;
user-select: none;
}
.cross.active {
transform: translate(-50%, -50%) scale(1);
transition: all 0.15s cubic-bezier(0.32, 2.04, 0.85, 0.54);
color: black;
}
h1 {
font-size: 26px;
background: white;
color: white;
padding: 40px 0 40px 20%;
margin-bottom: 50px;
}
a,
li {
color: darken(grey, 20%);
text-decoration: none;
}
.dropdown {
position: absolute;
right: 0;
top: 3em;
transition: all 0.25s ease-out;
transform: scale(0);
transform-origin: 100% 0;
/* box-shadow: $shadow; */
}
.dropdown ul:hover {
transform: scale(1);
}
.dropdown li {
display: block;
width: 100%;
}
.dropdown li:hover {
background-color: #ddd;
}
.dropdown a {
width: 100%;
padding: 1em 18px;
display: inline-block;
white-space: pre;
box-sizing: border-box;
color: black;
}
.dropdown a:hover {
background: darken(grey, 30%);
text-decoration: none;
}
.dropdown.active {
transform: scale(1);
transition: all 0.25s cubic-bezier(0.5, 1.8, 0.9, 0.8);
box-shadow: 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 8px 0 rgba(0, 0, 0, 0.12);
background-color: white;
padding: 0px;
}
.SBP { .SBP {
display: flex; display: flex;
height: 100%; height: 100%;
margin-left: 30px; margin-left: 30px;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.SBP h6 { .SBP h6 {
font-size: 16px; font-size: 16px;
margin: 0px; margin: 0px;
} }
.bold { .bold {
font-weight: bold; font-weight: bold;
} }
.dashboard-options { .dashboard-options {
margin: 15px 50px 0px; margin: 15px 50px 0px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.print-out button { .print-out button {
border-radius: 4px; border-radius: 4px;
border: 1px solid black; border: 1px solid black;
padding: 5px 10px; padding: 5px 10px;
background-color: white; background-color: white;
width: max-content; width: max-content;
} }
.print-out button:hover { .print-out button:hover {
background-color: #ddd; background-color: #ddd;
} }
.select-range { .select-range {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.range-selected { .range-selected {
border-radius: 4px; border-radius: 4px;
border: 1px solid black; border: 1px solid black;
margin: 0px 5px; margin: 0px 5px;
padding: 5px 10px; padding: 5px 10px;
font-weight: bold; font-weight: bold;
background-color: white; background-color: white;
} }
.range-selected:hover, .range-selected:focus { .range-selected:hover,
.range-selected:focus {
background-color: #00802B; background-color: #00802b;
color: white; color: white;
} }
.vert-line { .vert-line {
border: 0.5px solid grey; border: 0.5px solid grey;
height: 80%; height: 80%;
width: 0.3px; width: 0.3px;
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
opacity: 50%; opacity: 50%;
} }
.seperator { .seperator {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.hori-line { .hori-line {
border: 0.5px solid grey; border: 0.5px solid grey;
width: 91.5%; width: 91.5%;
height: 0.3px; height: 0.3px;
margin-top: 15px; margin-top: 15px;
} }
.main { .main {
margin-left: 85px; margin-left: 85px;
} }
\ No newline at end of file
...@@ -119,11 +119,11 @@ ...@@ -119,11 +119,11 @@
</div> </div>
</div> </div>
<div class="bottom-cont"> <div class="form-group">
<div class="col-md-8"></div> <div class="col-md-8"></div>
<div class="profile-options"> <div class="profile-options">
<div class="button-cancel"> <div class="button-cancel">
<button name="Save" type="submit">Cancel</button> <button name="Cancel" ><a href="{% url 'home' %}" style="color: black">Cancel</a></button>
</div> </div>
<div class="button-save"> <div class="button-save">
<button name="Save" type="submit">Save Changes</button> <button name="Save" type="submit">Save Changes</button>
......
...@@ -33,11 +33,7 @@ ...@@ -33,11 +33,7 @@
<br /> <br />
<div class="profile-options"> <div class="profile-options">
<div class="button-save"> <div class="button-save">
<button name="Save" type="submit"> <button name="Save" type="submit">Save Change</button>
<a href="{% url 'positionlist'%}" style="color: white"
>Save Changes</a
>
</button>
</div> </div>
<div class="button-cancel"> <div class="button-cancel">
<button name="Save" type="submit"> <button name="Save" type="submit">
......
...@@ -32,14 +32,18 @@ ...@@ -32,14 +32,18 @@
type="text" type="text"
style="width: 660px" style="width: 660px"
name="full-name" name="full-name"
required value="{{ employee.employee_name|default:'' }}"
/> />
</div> </div>
</div> </div>
<div class="text-input-grouping"> <div class="text-input-grouping">
<label for="phonenum" class="">Phone Number:</label> <label for="phonenum" class="">Phone Number:</label>
<div class="input-row"> <div class="input-row">
<input type="tel" name="phone-number" required /> <input
type="tel"
name="phone-number"
value="{{ employee.employee_num|default:'' }}"
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -48,21 +52,33 @@ ...@@ -48,21 +52,33 @@
<div class="text-input-grouping"> <div class="text-input-grouping">
<label for="bday">Birthday:</label> <label for="bday">Birthday:</label>
<div class=""> <div class="">
<input type="date" name="birthday" /> <input
type="date"
name="birthday"
value="{{ employee.employee_bday|default:'' }}"
/>
</div> </div>
</div> </div>
<div class="text-input-grouping"> <div class="text-input-grouping">
<label for="email" class="">Email:</label> <label for="email" class="">Email:</label>
<div class=""> <div class="">
<input type="email" name="email" required /> <input
type="email"
name="email"
value="{{ employee.employee_email|default:'' }}"
/>
</div> </div>
</div> </div>
<div class="text-input-grouping"> <div class="text-input-grouping">
<label for="emerg_num">Emergency Contact:</label> <label for="emerg_num">Emergency Contact:</label>
<div class="tex"> <div class="tex">
<input type="tel" name="emerg-number" required /> <input
type="tel"
name="emerg-number"
value="{{ employee.employee_emergnum|default:'' }}"
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -77,7 +93,6 @@ ...@@ -77,7 +93,6 @@
id="male" id="male"
name="gender" name="gender"
value="male" value="male"
required
/> />
<label for="male">Male</label> <label for="male">Male</label>
<input <input
...@@ -85,7 +100,6 @@ ...@@ -85,7 +100,6 @@
id="female" id="female"
name="gender" name="gender"
value="female" value="female"
required
/> />
<label for="female">Female</label> <label for="female">Female</label>
</div> </div>
...@@ -94,20 +108,26 @@ ...@@ -94,20 +108,26 @@
<div class="text-input-grouping"> <div class="text-input-grouping">
<label for="id-num" class="">ID Number:</label> <label for="id-num" class="">ID Number:</label>
<div class=""> <div class="">
<input type="text" name="id-num" required /> <input
type="text"
name="id-num"
value="{{ employee.employee_id|default:'' }}"
/>
</div> </div>
</div> </div>
<div class="text-input-grouping"> <div class="text-input-grouping">
<label for="position" class="">Position:</label> <label for="position" class="">Position:</label>
<div class=""> <div class="">
<select name="position"> <select name="position_name">
<option value="" disabled selected> <option value="" disabled selected>
Select a position Select a position
</option> </option>
<option value="packager">Packager</option> {% for position in positions %}
<option value="handler">Handler</option> <option value="{{ position.position_name }}">
<option value="cutter">Cutter</option> {{ position.position_name }}
</option>
{% endfor %}
</select> </select>
</div> </div>
</div> </div>
...@@ -125,15 +145,25 @@ ...@@ -125,15 +145,25 @@
<div class="col-md-8"></div> <div class="col-md-8"></div>
<div class="profile-options"> <div class="profile-options">
<div class="button-cancel"> <div class="button-cancel">
<button name="Save" type="submit">Cancel</button> <button name="Cancel">
<a
href="{% url 'emp_record' employee.employee_id %}"
style="color: black"
>Cancel</a
>
</button>
</div> </div>
<div class="button-delete"> <div class="button-delete">
<button name="Delete" type="submit"> <button name="Delete" type="submit">Delete Profile</button>
Delete Profile
</button>
</div> </div>
<div class="button-save"> <div class="button-save">
<button name="Save" type="submit">Save Changes</button> <button name="Save" type="submit">
<a
href="{% url 'emp_record' employee.employee_id %}"
style="color: white"
>Save Changes</a
>
</button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -53,6 +53,27 @@ ...@@ -53,6 +53,27 @@
<span class="bold"> {{ employee.employee_emergnum }} </span> <span class="bold"> {{ employee.employee_emergnum }} </span>
</h6> </h6>
</div> </div>
<div class="SBP">
<div class="kebab">
<figure></figure>
<figure class="middle"></figure>
<p class="cross">x</p>
<figure></figure>
<ul class="dropdown">
<li>
<a href="{% url 'view_all_productivity' employee.employee_id %}"
>View all Productivity Reports</a
>
</li>
<li>
<a
href="{% url 'edit_emp_profile' employee_id=employee.employee_id %}"
>Edit User Profile</a
>
</li>
</ul>
</div>
</div>
</div> </div>
</div> </div>
...@@ -87,6 +108,19 @@ ...@@ -87,6 +108,19 @@
</div> </div>
<!-- EXTEND CHART JS AND REMARKS PAGE HEREHERE HERE HERE HERE --> <!-- EXTEND CHART JS AND REMARKS PAGE HEREHERE HERE HERE HERE -->
<iframe src="" width="100%" height="500px" frameborder="0"></iframe>
<!-- DUNNO HOW TO EXTEND ANOTHER HTML HERE --> <!-- DUNNO HOW TO EXTEND ANOTHER HTML HERE -->
<script>
const kebab = document.querySelector(".kebab");
const middle = document.querySelector(".middle");
const cross = document.querySelector(".cross");
const dropdown = document.querySelector(".dropdown");
kebab.addEventListener("click", () => {
middle.classList.toggle("active");
cross.classList.toggle("active");
dropdown.classList.toggle("active");
});
</script>
</body> </body>
{% endblock %} {% endblock %}
...@@ -18,41 +18,39 @@ ...@@ -18,41 +18,39 @@
<body> <body>
<div class="employee-info-cont"> <div class="employee-info-cont">
<div class="employee-nameID"> <div class="employee-nameID">
<h4 class="bold">March Leighton Chua</h4> <h4 class="bold">{{ employee.employee_name }}</h4>
<div> <div>
<span id="ID">ID# 1</span> <span id="ID">ID# {{ employee.employee_id }}</span>
<span>Dataset: 44 Reports</span> <span>Dataset: Reports</span>
</div> </div>
</div> </div>
<div class="employee-info-contact"> <div class="employee-info-contact">
<div class="SBP"> <div class="SBP">
<h6> <h6>
Sex: Sex:
<span class="bold"> Male<!-- IMPORT INFO HERE --> </span> <span class="bold"> {{ employee.employee_sex }} </span>
</h6> </h6>
<h6> <h6>
Birthday: Birthday:
<span class="bold"> 4/3/2023<!-- IMPORT INFO HERE --> </span> <span class="bold"> {{ employee.employee_bday }} </span>
</h6> </h6>
<h6> <h6>
Position: <span class="bold"> Leader<!-- IMPORT INFO HERE --> </span> Position: <span class="bold"> {{ employee.position_id }} </span>
</h6> </h6>
</div> </div>
<div class="SBP"> <div class="SBP">
<h6> <h6>
Phone Number: Phone Number:
<span class="bold"> 098765143223<!-- IMPORT INFO HERE --> </span> <span class="bold"> {{ employee.employee_num }} </span>
</h6> </h6>
<h6> <h6>
Email: Email:
<span class="bold"> <span class="bold"> {{ employee.employee_email }} </span>
march.chua@obf.ateneo.edu<!-- IMPORT INFO HERE -->
</span>
</h6> </h6>
<h6> <h6>
Emergency Contact: Emergency Contact:
<span class="bold"> 0912344567<!-- IMPORT INFO HERE --> </span> <span class="bold"> {{ employee.employee_emergnum }} </span>
</h6> </h6>
</div> </div>
<div class="SBP"> <div class="SBP">
...@@ -63,7 +61,11 @@ ...@@ -63,7 +61,11 @@
<figure></figure> <figure></figure>
<ul class="dropdown"> <ul class="dropdown">
<li><a href="#">View all Productivity Reports</a></li> <li><a href="#">View all Productivity Reports</a></li>
<li><a href="#">Edit User Profile</a></li> <li>
<a href="{% url 'edit_emp_profile' employee.employee_id %}"
>Edit User Profile</a
>
</li>
</ul> </ul>
</div> </div>
</div> </div>
...@@ -75,7 +77,9 @@ ...@@ -75,7 +77,9 @@
<input placeholder="Search Name" /> <input placeholder="Search Name" />
</div> </div>
<div class="add-button"> <div class="add-button">
<button type="submit" class="add-profile-button">Import File</button> <button type="submit" class="add-profile-button">
<a href="{% url 'upload_csv'%}" style="color: white">Import File</a>
</button>
</div> </div>
</div> </div>
...@@ -84,7 +88,7 @@ ...@@ -84,7 +88,7 @@
</div> </div>
<div class="productivity-table-cont"> <div class="productivity-table-cont">
<h2>variable.name</h2> <h2>Productivities for {{ employee.employee_name }}</h2>
<table class="productivity-table"> <table class="productivity-table">
<tr> <tr>
<th>Report Number</th> <th>Report Number</th>
...@@ -92,39 +96,20 @@ ...@@ -92,39 +96,20 @@
<th>Duration</th> <th>Duration</th>
<th>Process</th> <th>Process</th>
<th>Status</th> <th>Status</th>
<th>Productivity Score</th> <th>Productivity Score for that day</th>
</tr> </tr>
<tr> {% for productivity in productivities %}
<td>1</td> {% for summaryreport in summaryreports %}
<td>Juan Dela Cruz</td> <tr>
<td>Jan 12, 2022</td> <td>{{ productivity.report_no }}</td>
<td>Packager</td> <td>{{ summaryreport.prod_date }}</td>
<td>Juan Dela Paz</td> <td>{{ productivity.duration }}</td>
<td>69.9%</td> <td>{{ productivity.process }}</td>
</tr> <td>{{ productivity.status }}</td>
<tr> <td>{{ summaryreport.prod_score }}</td>
<td>1</td> </tr>
<td>Juan Dela Cruz</td> {% endfor %}
<td>Jan 12, 2022</td> {% endfor %}
<td>Packager</td>
<td>Juan Dela Paz</td>
<td>69.9%</td>
</tr>
<tr>
<td>1</td>
<td>Juan Dela Cruz</td>
<td>Jan 12, 2022</td>
<td>Packager</td>
<td>Juan Dela Paz</td>
<td>69.9%</td>
</tr>
<tr>
<td>1</td>
<td>Juan Dela Cruz</td>
<td>Jan 12, 2022</td>
<td>Packager</td>
<td>Juan Dela Paz</td>
<td>69.9%</td>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -132,16 +117,16 @@ ...@@ -132,16 +117,16 @@
<!-- EXTEND CHART JS AND REMARKS PAGE HEREHERE HERE HERE HERE --> <!-- EXTEND CHART JS AND REMARKS PAGE HEREHERE HERE HERE HERE -->
<!-- DUNNO HOW TO EXTEND ANOTHER HTML HERE --> <!-- DUNNO HOW TO EXTEND ANOTHER HTML HERE -->
<script> <script>
const kebab = document.querySelector('.kebab'); const kebab = document.querySelector(".kebab");
const middle = document.querySelector('.middle'); const middle = document.querySelector(".middle");
const cross = document.querySelector('.cross'); const cross = document.querySelector(".cross");
const dropdown = document.querySelector('.dropdown'); const dropdown = document.querySelector(".dropdown");
kebab.addEventListener('click', () => { kebab.addEventListener("click", () => {
middle.classList.toggle('active'); middle.classList.toggle("active");
cross.classList.toggle('active'); cross.classList.toggle("active");
dropdown.classList.toggle('active'); dropdown.classList.toggle("active");
}) });
</script> </script>
</body> </body>
{% endblock %} {% endblock %}
...@@ -2,6 +2,7 @@ from django.contrib import admin ...@@ -2,6 +2,7 @@ from django.contrib import admin
from django.urls import path from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', views.signin, name='signin'), path('', views.signin, name='signin'),
...@@ -12,12 +13,12 @@ urlpatterns = [ ...@@ -12,12 +13,12 @@ urlpatterns = [
path('signup/', views.signup, name='signup'), path('signup/', views.signup, name='signup'),
path('emp_record/<int:employee_id>/', views.emp_record, name='emp_record'), path('emp_record/<int:employee_id>/', views.emp_record, name='emp_record'),
path('create_profile/' ,views.create_emp_profile, name='create_emp_profile'), path('create_profile/' ,views.create_emp_profile, name='create_emp_profile'),
path('edit_profile/', views.edit_emp_profile, name='edit_emp_profile'), path('edit_profile/<int:employee_id>', views.edit_emp_profile, name='edit_emp_profile'),
path('positionlist/', views.positionlist, name='positionlist'), path('positionlist/', views.positionlist, name='positionlist'),
path('create_position/', views.create_position, name='create_position'), path('create_position/', views.create_position, name='create_position'),
path('edit_position/<int:position_id>/', views.edit_position, name='edit_position'), path('edit_position/<int:position_id>/', views.edit_position, name='edit_position'),
path('view_all_productivity/', views.view_all_productivity, name='view_all_productivity'), path('view_all_productivity/<int:employee_id>/', views.view_all_productivity, name='view_all_productivity'),
path('search/', views.search_employees, name='search_employees'), path('search/', views.search_employees, name='search_employees'),
]
]
\ No newline at end of file
...@@ -173,6 +173,10 @@ def upload_csv(request): ...@@ -173,6 +173,10 @@ def upload_csv(request):
def create_emp_profile(request): def create_emp_profile(request):
positions = Position.objects.all() positions = Position.objects.all()
if request.method == 'POST': if request.method == 'POST':
if 'cancel' in request.POST:
# Redirect to home page if cancel button is pressed
return redirect('home')
employee_name = request.POST.get('full-name') employee_name = request.POST.get('full-name')
employee_sex = request.POST.get('gender') employee_sex = request.POST.get('gender')
employee_bday = request.POST.get('birthday') employee_bday = request.POST.get('birthday')
...@@ -194,13 +198,10 @@ def create_emp_profile(request): ...@@ -194,13 +198,10 @@ def create_emp_profile(request):
employee.save() employee.save()
# Redirect to a success page or do something else # Redirect to a success page or do something else
return redirect('create_emp_profile') return redirect('home')
return render(request, 'EmployeeProdDB/create_emp_profile.html',{'positions': positions}) return render(request, 'EmployeeProdDB/create_emp_profile.html',{'positions': positions})
def edit_emp_profile(request):
return render(request, 'EmployeeProdDB/edit_emp_profile.html')
def chart_template(request): def chart_template(request):
data = SummaryReport.objects.all() data = SummaryReport.objects.all()
...@@ -276,5 +277,32 @@ def edit_position(request, position_id): ...@@ -276,5 +277,32 @@ def edit_position(request, position_id):
return redirect('positionlist') return redirect('positionlist')
return render(request, 'EmployeeProdDB/edit_position.html', {'position': position}) return render(request, 'EmployeeProdDB/edit_position.html', {'position': position})
def view_all_productivity(request): def view_all_productivity(request, employee_id):
return render(request, 'EmployeeProdDB/view_all_productivity.html') employee = Employee.objects.get(pk=employee_id)
productivities = Productivity.objects.filter(employee_id=employee)
summaryreports = SummaryReport.objects.filter(employee_id=employee)
return render(request, 'EmployeeProdDB/view_all_productivity.html', {'employee': employee, 'productivities': productivities, 'summaryreports': summaryreports})
def edit_emp_profile(request, employee_id):
positions = Position.objects.all()
employee = get_object_or_404(Employee, pk=employee_id)
# position = get_object_or_404(Employee, pk=position_id)
context = {'employee': employee, 'positions':positions}
if request.method == 'POST':
employee.employee_name = request.POST.get('employee_name')
employee.employee_sex = request.POST.get('gender')
employee.employee_bday = request.POST.get('birthday')
employee.employee_email = request.POST.get('email')
employee.employee_num = request.POST.get('phone-number')
employee.employee_emergnum = request.POST.get('emerg-number')
position = request.POST.get('position_name')
employee.position_id=position
employee.full_clean() # validate the model fields
employee.save() # persist the changes to the database
return redirect('emp_record')
return render(request, 'EmployeeProdDB/edit_emp_profile.html', context)
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(children='Productivity Graph'),
dcc.Graph(
id='productivity-graph',
figure={
'data': [
go.Scatter(
x=[1, 2, 3, 4, 5],
y=[80, 60, 70, 50, 90],
mode='lines+markers',
name='Productivity',
),
],
'layout': go.Layout(
xaxis={'title': 'Weeks/Months/Quarters/Years'},
yaxis={'title': 'Productivity %'},
)
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
from django.urls import path
from graphapp import views
urlpatterns = [
path('graph/', views.productivity_graph, name='productivity_graph'),
]
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
# Create your views here. # Create your views here.
from django_plotly_dash import DjangoDash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
app = DjangoDash('ProductivityGraph')
app.layout = html.Div(children=[
html.H1(children='Productivity Graph'),
dcc.Graph(
id='productivity-graph',
figure={
'data': [
go.Scatter(
x=[1, 2, 3, 4, 5],
y=[80, 60, 70, 50, 90],
mode='lines+markers',
name='Productivity',
),
],
'layout': go.Layout(
xaxis={'title': 'Weeks/Months/Quarters/Years'},
yaxis={'title': 'Productivity %'},
)
}
)
])
def productivity_graph(request):
return app.run_server(mode='inline')
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