Commit 1b2a8ffc authored by Withana R.D.K's avatar Withana R.D.K

Merge branch 'Employee_StatusUpdate' into 'master'

Employee status update

See merge request !4
parents 83466dd2 b2bbfb5e
StaffID,Availability
1,Yes
2,No
2,Yes
3,Yes
4,Yes
5,Yes
......@@ -11,6 +11,7 @@ urlpatterns = [
path('AdminLogin/', responseapp_views.AdminLogin),
path('AdminHome/', responseapp_views.AdminHome),
path('Employee_Data/', responseapp_views.Employee_Data),
path('EmployeeStatus_Update/', responseapp_views.EmployeeStatus_Update),
path('PurchaseHistory/', responseapp_views.PurchaseHistory),
path('Forecasting/', responseapp_views.Forecasting),
path('Result/', responseapp_views.Forecasting),
......
......@@ -34,7 +34,7 @@ def Homepage(request):
# Employee_Efficency
def Employee_Data(request):
data1 = pd.read_csv('Data/WorkHistory.csv')
data2 = pd.read_csv('Data/EmployeeStatus.csv')
......@@ -47,6 +47,26 @@ def Employee_Data(request):
context = {'d': arr}
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});
# Demand Forecasting
def PurchaseHistory(request):
data = pd.read_csv('Data/Purchasefile.csv')
......
{% 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 %}
......@@ -71,8 +71,6 @@
</div></div>
<script language="javascript">
function printdiv(printpage) {
var headstr = "<html><head><title></title></head><body>";
......@@ -88,7 +86,6 @@
</script>
<div class="card-body">
<input name="b_print" type="button" class="btn btn-primary btn-print" onClick="printdiv('div_print');" value=" Print ">
......
......@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> SMART SERVICE STATION </title>
<title> SERVPORT | Your Service Station Partner </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
......@@ -12,10 +12,6 @@
<style>
.row{
padding: 5px;
}
......@@ -181,23 +177,16 @@ body{
<li><a style="text-decoration:none;" href="/Admin/AdminHome/"><i class="fas fa-desktop"></i>Home</a></li>
<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="#"><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><a style="text-decoration:none;" href="/Admin/Forecasting/"><i class="fas fa-bullseye "></i> Demand Forecasting </a>
<li><a style="text-decoration:none;" href="/Admin/PurchaseHistory/"><i class="fas fa-cubes"></i> Purchase History </a>
</ul>
</div>
......
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