Commit c7eab748 authored by Withana R.D.K's avatar Withana R.D.K

Employee Status

parent 8ff30e7d
...@@ -11,5 +11,6 @@ urlpatterns = [ ...@@ -11,5 +11,6 @@ urlpatterns = [
path('AdminLogin/', responseapp_views.AdminLogin), path('AdminLogin/', responseapp_views.AdminLogin),
path('AdminHome/', responseapp_views.AdminHome), path('AdminHome/', responseapp_views.AdminHome),
path('Employee_Data/', responseapp_views.Employee_Data), path('Employee_Data/', responseapp_views.Employee_Data),
path('EmployeeStatus_Update/', responseapp_views.EmployeeStatus_Update),
path('', admin.site.urls), path('', admin.site.urls),
] ]
\ No newline at end of file
...@@ -43,6 +43,27 @@ def Employee_Data(request): ...@@ -43,6 +43,27 @@ def Employee_Data(request):
return render(request, 'Admin/Employee_Data.html',context); return render(request, 'Admin/Employee_Data.html',context);
def EmployeeStatus_Update(request):
if request.method == 'POST':
myForm = MyForm3(request.POST)
if myForm.is_valid():
StaffID = myForm.cleaned_data['StaffID']
Availability = myForm.cleaned_data['Availability']
DateSet = pd.read_csv("Data/EmployeeStatus.csv")
StaffID = (int(StaffID) - 1)
DateSet.at[StaffID,'Availability']= Availability
DateSet.to_csv("Data/EmployeeStatus.csv", index=False)
messages.success(request, 'Employee status successfully! Updated.')
return HttpResponseRedirect(request.path_info)
else:
form = MyForm3()
return render(request, 'Admin/EmployeeStatus_Update.html', {'form':form});
else:
form = MyForm3()
return render(request, 'Admin/EmployeeStatus_Update.html', {'form':form});
def AdminLogin(request): def AdminLogin(request):
if request.method == 'POST': if request.method == 'POST':
myForm = MyForm2(request.POST) myForm = MyForm2(request.POST)
......
{% extends 'Admin/Sidebar2.html' %}
{% block content %}
{% load widget_tweaks %}
{%load static%}
<head>
<!-- Font special for pages-->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i" rel="stylesheet">
<!-- Main CSS-->
<link href="{% static "css/main.css" %}"rel="stylesheet" media="all">
</head>
<div class=" >
<div class="wrapper wrapper 0">
<div style="margin-left: 0px;" class="card card-5">
<br/><br/>
{% if messages %}
<div class="alert alert-danger" role="alert">
{% for message in messages %}
{% if message.tags %} {% endif %} {{ message }}
{% endfor %}
</div>
{% endif %}
<div class="card-heading">
<h2 class="title"> ASSIGN EMPLOYEE </h2>
</div>
<div class="card-body">
<form action="/Admin/EmployeeStatus_Update/" method="post">
{% csrf_token %}
<table class="table table-light">
{{form.as_table}}
</table>
<input type="submit" value="Assign" class="btn btn--radius-2 btn-primary"/>
<div role="alert">
<center><h3> {{ Price_prediction }} </h3></center>
</div>
</form>
<br>
<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>
</div>
</div>
</div><div class="alert alert-primary" role="alert" > © SMART SERVICE STATION 2022 </div>
</div>
{% endblock content %}
...@@ -186,7 +186,7 @@ body{ ...@@ -186,7 +186,7 @@ body{
<li><a style="text-decoration:none;" href="#"><i class="fas fa-barcode"></i> Employee Efficiency </a> <li><a style="text-decoration:none;" href="#"><i class="fas fa-barcode"></i> Employee Efficiency </a>
<li><a style="text-decoration:none;" href="/Admin/Employee_Data/"><i class="fas fa-paper-plane "></i> Employee Data </a> <li><a style="text-decoration:none;" href="/Admin/Employee_Data/"><i class="fas fa-paper-plane "></i> Employee Data </a>
<li><a style="text-decoration:none;" href="#"><i class="fas fa-upload"></i> Assign Employee </a> <li><a style="text-decoration:none;" href="/Admin/EmployeeStatus_Update/"><i class="fas fa-upload"></i> Assign Employee </a>
</li> </li>
......
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