Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
debaraja-394 committed Sep 1, 2024
2 parents aa5e321 + 4ada27b commit 1f3a50d
Show file tree
Hide file tree
Showing 3 changed files with 247 additions and 6 deletions.
7 changes: 6 additions & 1 deletion Government of NCT of Delhi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,16 @@ def admin():
data = hospital_data_collection.find_one({'hospital_name': hospital_name})
if data:
g_beds = data['number_of_general_beds']
vacent_general = g_beds-data['occupied_general']
icu_beds= data['number_of_icu_beds']
vacent_icu = icu_beds-data['occupied_icu']
v_beds = data['number_of_ventilators']
vacent_ventilator = v_beds-data['occupied_ventilator']
total_patient = patients_collection.count_documents({'hospital_name': hospital_name})
total_doc= doctors_collection.count_documents({"hospital_name":hospital_name})
return render_template('admin_dashboard.html',count=total_appointment,general_total=g_beds,icu_total= icu_beds,vantilator_total =v_beds,patient = total_patient,doc=total_doc)

return render_template('admin_dashboard.html',count=total_appointment,general_total=g_beds,icu_total= icu_beds,vantilator_total =v_beds,patient = total_patient,doc=total_doc,
vacent_general=vacent_general,vacent_icu=vacent_icu,vacent_ventilator=vacent_ventilator)
else:
return redirect('/admin/add_detail')

Expand Down
11 changes: 6 additions & 5 deletions Government of NCT of Delhi/templates/admin_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ <h3 class="text-light">Government of NCT of Delhi</h3>
<!-- <a href="../templates/admin/opd/index.html">Opd</a> -->
<!-- <a href="../templates/admin/opd/Emergency.html">Bed Availability</a> -->
<a href="/admin/contact-us">Feed Back</a>
<a href="/admin/discharge">Discharge</a>
<a href="/admin_logout">Logout</a>
</div>

Expand All @@ -186,22 +187,22 @@ <h3>Total patient</h3>
</div>
<div class="card">
<h3>General bed</h3>
<p>{{general_total}}</p>
<p>{{vacent_general}}/{{general_total}}</p>
</div>
<div class="card">
<h3>ICU Bed </h3>
<p>{{icu_total}}</p>
<p>{{vacent_icu}}/{{icu_total}}</p>
</div>
<div class="card">
<h3>Ventilator</h3>
<p>{{vantilator_total}}</p>
<p>{{vacent_ventilator}}/{{vantilator_total}}</p>
</div>
</div>

<div class="card">
<!-- <div class="card">
<h3>Patient Admission Overview</h3>
<p>Graph or table of recent admissions will be displayed here.</p>
</div>
</div> -->

<div class="card">
<h3>Inventory Status</h3>
Expand Down
235 changes: 235 additions & 0 deletions Government of NCT of Delhi/templates/super admin dash.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Super Admin Dashboard</title>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../static/css/style.css">
<style>
body {
font-family: Arial, sans-serif;
background-color: #FFF3C7;
margin: 0;
padding: 0;
}

.navbar {
background-color: #00637f !important;
padding: 10px;
color: white;
}

.sidebar {
width: 250px;
background-color: #343a40;
position: fixed;
height: 100%;
color: #fff;
padding-top: 20px;
overflow-y: auto;
}

.sidebar a {
padding: 15px;
text-decoration: none;
color: #fff;
display: block;
transition: 0.3s;
}

.sidebar a:hover {
background-color: #575757;
}

.main-content {
margin-left: 250px;
padding: 20px;
}

.card {
background-color: #FFF8E3;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 20px;
text-align: center;
}

.card h3 {
margin-top: 0;
color: #2c3e50;
}

.card p {
font-size: 18px;
color: #333;
}

.footer {
background-color: #00637f;
color: #fff;
text-align: center;
padding: 10px;
position: fixed;
bottom: 0;
width: 100%;
}

@media (max-width: 768px) {
.sidebar {
width: 100%;
height: auto;
position: relative;
}

.main-content {
margin-left: 0;
}
}
</style>
</head>

<body>

<div class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="#">
<img src="../static/images/delhi.png" alt="Delhi Logo" class="rounded-circle" width="40" height="40">
</a>
<h3 class="text-light">Government of NCT of Delhi</h3>
</div>

<div class="sidebar">
<a href="#">Dashboard</a>
<a href="#" id="add-hospital-link">Add Hospital</a>
<a href="#" id="check-hospital-status-link">Check Hospital Status</a>
<a href="#" id="order-medicine-link">Order Medicine</a>
<a href="/admin/manage_appointment" id="appointment-link">Appointments</a>
<a href="#" id="feedback-link">Feedback</a>
<a href="#" id="blood-bank-status-link">Blood Bank Status</a>
<a href="/">Logout</a>
</div>

<div class="main-content">
<h2>Super Admin Dashboard</h2>

<!-- Add Hospital Section -->

<div id="add-hospital-section" class="card">
<h3>Add Hospital</h3>
<form method="POST" action="/superadmin/addHospital">
<label for="hospitalName">Hospital Name:</label>
<input type="text" id="hospitalName" name="hospitalName" required><br>
<label for="hospitalmail">Hospital email ID:</label>
<input type="text" id="hospitalmail" name="hospitalmail" required><br>
<label for="hospitalpass">Password:</label>
<input type="text" id="hospitalpass" name="hospitalpass" required><br>
<button type="submit">Add Hospital</button>
</form>

<p id="hospital-message"></p>
</div>

<!-- Check Hospital Status Section -->
<div id="check-hospital-status-section" class="card" style="display: none;">
<h3>Check Hospital Status</h3><br>
<form method="POST" action="/superadmin/checkHospitalStatus">
<label for="hname">Hospital Name:</label>
<input type="text" name="hname" id="hname">
<button type="submit" id="check-hospital-status">View Status</button>
<div id="hospital-status" class="status"></div>
</form>
</div>


<!-- Order Medicine Section -->
<div id="order-medicine-section" class="card" style="display: none;">
<h3>Order Medicine</h3>
<form id="order-medicine-form">
<label for="medicineName">Medicine Name:</label>
<input type="text" id="medicineName" name="medicineName" required>
<label for="quantity">Quantity:</label>
<input type="number" id="quantity" name="quantity" required>
<button type="submit">Place Order</button>
</form>
<p id="order-message"></p>
</div>


<div id="appointment-section" class="card" style="display: none;">
<h3>Appointment</h3>
<button id="view-appointment">View Appointment</button>
<div id="appointment-list"></div>
</div>
<!-- Feedback Section -->
<div id="feedback-section" class="card" style="display: none;">
<h3>Feedback</h3>
<button id="view-feedback">View Feedback</button>
<div id="feedback-list"></div>
</div>

<!-- Blood Bank Status Section -->
<div id="blood-bank-status-section" class="card" style="display: none;">
<h3>Blood Bank Status</h3>
<button id="view-blood-bank-status">View Blood Bank Status</button>
<div id="blood-bank-status"></div>
</div>
</div>

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Toggle visibility of sections
function showSection(sectionId) {
const sections = ['add-hospital-section', 'check-hospital-status-section', 'order-medicine-section', 'feedback-section', 'blood-bank-status-section'];
sections.forEach(id => {
document.getElementById(id).style.display = id === sectionId ? 'block' : 'none';
});
}


// Order Medicine Form Submission
document.getElementById('order-medicine-form').addEventListener('submit', async (event) => {
event.preventDefault();
const medicineName = document.getElementById('medicineName').value;
const quantity = document.getElementById('quantity').value;
const response = await fetch('/order-medicine', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ medicineName, quantity })
});
const message = await response.text();
document.getElementById('order-message').textContent = message;
});

// View Feedback Button
document.getElementById('view-feedback').addEventListener('click', async () => {
const response = await fetch('/get-feedback');
const feedback = await response.json();
const feedbackList = document.getElementById('feedback-list');
feedbackList.innerHTML = feedback.map(fb => `<p>${fb}</p>`).join('');
});

// View Blood Bank Status Button
document.getElementById('view-blood-bank-status').addEventListener('click', async () => {
const response = await fetch('/get-blood-bank-status');
const status = await response.json();
document.getElementById('blood-bank-status').innerHTML = JSON.stringify(status, null, 2);
});

// Sidebar Links
document.getElementById('add-hospital-link').addEventListener('click', () => showSection('add-hospital-section'));
document.getElementById('check-hospital-status-link').addEventListener('click', () => showSection('check-hospital-status-section'));
document.getElementById('order-medicine-link').addEventListener('click', () => showSection('order-medicine-section'));
document.getElementById('feedback-link').addEventListener('click', () => showSection('feedback-section'));
document.getElementById('blood-bank-status-link').addEventListener('click', () => showSection('blood-bank-status-section'));

// Default section to show
showSection('add-hospital-section');
</script>
</body>

</html>

0 comments on commit 1f3a50d

Please sign in to comment.