Commit b8913db9 authored by Shivanthi Fernando's avatar Shivanthi Fernando

Add customer dataset and display customer dataset

parent 74a81db5
This diff is collapsed.
......@@ -15,5 +15,6 @@ urlpatterns = [
path('PurchaseHistory/', responseapp_views.PurchaseHistory),
path('Forecasting/', responseapp_views.Forecasting),
path('Result/', responseapp_views.Forecasting),
path('Customer_Data/', responseapp_views.Customer_Data),
path('', admin.site.urls),
]
\ No newline at end of file
......@@ -210,6 +210,16 @@ def AdminLogin(request):
form = MyForm2()
return render(request, 'Admin/AdminLogin.html', {'form':form});
# Customer Data
def Customer_Data(request):
data = pd.read_csv('Data/CustomerDataset.csv')
finalpt = data.head(500)
json_records = finalpt.reset_index().to_json(orient='records')
arr = []
arr = json.loads(json_records)
context = {'d': arr}
return render(request, 'Admin/Customer_Data.html',context);
def AdminHome(request):
return render(request,'Admin/AdminHome.html')
......
No preview for this file type
{% 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">
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li {% if message.tags %} class=" {{ message.tags }} " {% endif %}> {{ message }} </li>
{% endfor %}
</ul>
{% endif %}
<div class="card-heading">
<h2 class="title mt-3" style="color: #02111f;"> CUSTOMER DATA </h2>
</div>
<div id="myDiv">
<div id="div_print">
<div class="card card-body printableArea">
<div class="container" style="overflow-x:auto;">
<table class="table table-striped">
<thead>
<tr>
<th> Customer ID </th>
<th> Customer Name </th>
<th> Mobile Number</th>
<th> NIC </th>
<th> Vehicle No</th>
<th> Vehicle Type</th>
<th> Service ID </th>
<th> Service Price </th>
<th> Invoice No</th>
<th> Invoice Date </th>
</tr>
</thead>
<tbody>
{% if d %}
{% for i in d %}
<tr>
<td>{{i.CustomerID}}</td>
<td>{{i.CustomerName}}</td>
<td>{{i.MobileNumber}}</td>
<td>{{i.NIC}}</td>
<td>{{i.VehicleNo}}</td>
<td>{{i.VehicleType}}</td>
<td>{{i.ServiceID}}</td>
<td>{{i.ServicePrice}}</td>
<td>{{i.InvoiceNo}}</td>
<td>{{i.InvoiceDate}}</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
</div>
</div></div>
<script language="javascript">
function printdiv(printpage) {
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr + newstr + footstr;
window.print();
document.body.innerHTML = oldstr;
location.reload();
return false;
}
</script>
<div class="card-body">
<input name="b_print" type="button" class="btn btn-print" onClick="printdiv('div_print');" value=" Print " style="background: #02111f;">
</div>
<div class="alert alert-primary fixed-bottom mb-0 text-center" style="background: #747578; border: none; color: white;" role="alert" > © SERVPORT 2022 </div>
</div>
</div>
</div>
</div>
{% endblock content %}
......@@ -186,7 +186,7 @@ body{
<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="#"><i class="fas fa-eye"></i> Highest Demand </a>
<li><a style="text-decoration:none;" href="/Admin/PurchaseHistory/"><i class="fas fa-cubes"></i> Purchase History </a>
<li><a style="text-decoration:none;" href="/Admin/Customer_Data/"><i class="fas fa-user"></i> Customer Data </a>
</ul>
......
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