165 lines
6.8 KiB
HTML
165 lines
6.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Curio Pharmacy | Inventory & Billing</title>
|
|
<link rel="stylesheet" href="globals.css">
|
|
<link rel="stylesheet" href="index.css">
|
|
<link rel="stylesheet" href="dashboard.css">
|
|
<link rel="stylesheet" href="pharmacy.css">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
|
|
<script src="globals.js"></script>
|
|
</head>
|
|
<body class="dashboard-body">
|
|
<aside class="sidebar">
|
|
<div class="logo">
|
|
<div class="logo-icon">C</div>
|
|
<span class="logo-text">Curio</span>
|
|
</div>
|
|
<nav class="side-nav">
|
|
<a href="dashboard.html"><span>🏠</span> Overview</a>
|
|
<a href="dashboard.html" onclick="showSection('queue')"><span>👥</span> Queue</a>
|
|
<a href="dashboard.html" onclick="showSection('patients')"><span>📂</span> Patients</a>
|
|
<a href="pharmacy.html" class="active"><span>💊</span> Pharmacy</a>
|
|
<a href="lab.html"><span>🔬</span> Lab</a>
|
|
<a href="billing.html"><span>💳</span> Billing & Accounts</a>
|
|
<a href="staff.html"><span>👔</span> Staff & Payroll</a>
|
|
<a href="settings.html"><span>⚙️</span> Settings</a>
|
|
</nav>
|
|
<div class="user-profile">
|
|
<div class="avatar">PH</div>
|
|
<div class="info">
|
|
<strong>Pharmacy Head</strong>
|
|
<span>Staff</span>
|
|
<a href="login.html" class="logout-btn"><span>🚪</span> Logout</a>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
<main class="dashboard-main">
|
|
<header class="dash-header">
|
|
<div class="header-title">
|
|
<h1>Pharmacy Management</h1>
|
|
<p>Manage prescriptions and inventory with real-time stock alerts.</p>
|
|
</div>
|
|
<div class="header-actions">
|
|
<button class="btn btn-primary" onclick="handleComingSoon('+ Add New Stock')">+ Add New Stock</button>
|
|
</div>
|
|
</header>
|
|
|
|
<section class="stats-row">
|
|
<div class="stat-card">
|
|
<span>Pending Rx</span>
|
|
<h3>8 Orders</h3>
|
|
<small class="text-accent">↑ 2 from Dr. Sharma</small>
|
|
</div>
|
|
<div class="stat-card">
|
|
<span>Low Stock</span>
|
|
<h3 class="text-urgent">4 Medicines</h3>
|
|
<small>Alert: Cough Syrup < 5 units</small>
|
|
</div>
|
|
<div class="stat-card">
|
|
<span>Revenue Today</span>
|
|
<h3>₹12,450</h3>
|
|
<small class="text-accent">↑ 15% vs Yesterday</small>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="queue-section">
|
|
<div class="section-card">
|
|
<div class="card-header">
|
|
<h2>Pending Prescriptions</h2>
|
|
</div>
|
|
<table class="queue-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Order ID</th>
|
|
<th>Patient Name</th>
|
|
<th>Medicines</th>
|
|
<th>Doctor</th>
|
|
<th>Status</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="pending-queue">
|
|
<tr><td colspan="6" style="text-align: center;">Loading prescriptions...</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="side-panel">
|
|
<div class="section-card inventory-card">
|
|
<h3>📦 Fast Moving Stock</h3>
|
|
<div class="inventory-item">
|
|
<span>Paracetamol 500mg</span>
|
|
<small>120 units</small>
|
|
<div class="bar"><div class="fill" style="width: 80%;"></div></div>
|
|
</div>
|
|
<div class="inventory-item">
|
|
<span>Amoxicillin</span>
|
|
<small>45 units</small>
|
|
<div class="bar"><div class="fill" style="width: 40%; background: #F59E0B;"></div></div>
|
|
</div>
|
|
<div class="inventory-item">
|
|
<span>Cough Syrup</span>
|
|
<small>4 units</small>
|
|
<div class="bar"><div class="fill" style="width: 5%; background: #EF4444;"></div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
<script>
|
|
async function fetchPending() {
|
|
try {
|
|
const res = await apiCall('/api/prescriptions/pending');
|
|
if (res && res.success) {
|
|
const tbody = document.getElementById('pending-queue');
|
|
if (res.prescriptions.length === 0) {
|
|
tbody.innerHTML = '<tr><td colspan="6" style="text-align: center;">No pending prescriptions</td></tr>';
|
|
return;
|
|
}
|
|
|
|
tbody.innerHTML = '';
|
|
res.prescriptions.forEach(p => {
|
|
const tr = document.createElement('tr');
|
|
tr.innerHTML = `
|
|
<td>${p.id}</td>
|
|
<td><strong>${p.patient_name}</strong></td>
|
|
<td>${(p.medicines || []).map(m => m.name).join(', ')}</td>
|
|
<td>${p.doctor_name || 'Dr. Sharma'}</td>
|
|
<td><span class="badge badge-warning">${p.status}</span></td>
|
|
<td>
|
|
<button class="btn btn-sm btn-primary" onclick="updateStatus('${p.id}', 'dispensed')">Dispense</button>
|
|
</td>
|
|
`;
|
|
tbody.appendChild(tr);
|
|
});
|
|
}
|
|
} catch (err) {
|
|
console.error("Failed to fetch pending prescriptions", err);
|
|
}
|
|
}
|
|
|
|
async function updateStatus(id, status) {
|
|
try {
|
|
const res = await apiCall(\`/api/prescriptions/\${id}/status\`, 'POST', { status });
|
|
if (res.success) {
|
|
fetchPending();
|
|
}
|
|
} catch (err) {
|
|
console.error("Failed to update status", err);
|
|
}
|
|
}
|
|
|
|
// Poll every 5 seconds
|
|
setInterval(fetchPending, 5000);
|
|
fetchPending();
|
|
</script>
|
|
</body>
|
|
</html>
|