integrated pharmacy dashboard with aiinvoice
This commit is contained in:
@@ -263,7 +263,13 @@
|
||||
<div class="switch-auth">
|
||||
<p>Don't have an account? <a href="{{ url_for('signup') }}" class="btn-link">Create Account</a></p>
|
||||
<p><a href="{{ url_for('forgot_password') }}" class="btn-link">Forgot Password?</a></p>
|
||||
<p class="security-note"><i class="fas fa-lock"></i> Secured with SSL Encryption</p>
|
||||
<div style="margin-top: 14px; padding-top: 14px; border-top: 1px solid #e5e7eb;">
|
||||
<p style="margin-bottom: 4px; font-size: 0.9rem; color: #4b5563;">Hospital Pharmacy Staff?</p>
|
||||
<a href="{{ url_for('pharmacy_login') }}" style="color: #0284c7; font-weight: 600; text-decoration: none; font-size: 0.95rem;">
|
||||
Sign In via Dedicated Pharmacy Portal →
|
||||
</a>
|
||||
</div>
|
||||
<p class="security-note" style="margin-top: 14px;"><i class="fas fa-lock"></i> Secured with SSL Encryption</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Local GRN Records — Test Dashboard</title>
|
||||
<style>
|
||||
:root {
|
||||
--primary: #0284c7;
|
||||
--success: #059669;
|
||||
--danger: #dc2626;
|
||||
--warning: #d97706;
|
||||
--bg: #f8fafc;
|
||||
--surface: #ffffff;
|
||||
--border: #e2e8f0;
|
||||
--text: #0f172a;
|
||||
--muted: #64748b;
|
||||
--radius: 8px;
|
||||
}
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
|
||||
.topbar {
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 14px 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
|
||||
.local-pill {
|
||||
background: #fef9c3;
|
||||
border: 1px solid #fde68a;
|
||||
color: #92400e;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
padding: 3px 10px;
|
||||
border-radius: 999px;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.back-link { color: var(--primary); text-decoration: none; font-size: 13px; }
|
||||
.back-link:hover { text-decoration: underline; }
|
||||
.container { max-width: 1400px; margin: 0 auto; padding: 32px 24px; }
|
||||
.page-header { margin-bottom: 24px; }
|
||||
.page-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
|
||||
.page-header p { color: var(--muted); font-size: 13px; }
|
||||
|
||||
/* Stat Cards */
|
||||
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
|
||||
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
|
||||
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 8px; }
|
||||
.stat-value { font-size: 28px; font-weight: 700; }
|
||||
.stat-value.success { color: var(--success); }
|
||||
.stat-value.danger { color: var(--danger); }
|
||||
.stat-value.primary { color: var(--primary); }
|
||||
|
||||
/* Endpoint Info */
|
||||
.endpoint-box {
|
||||
background: #0f172a;
|
||||
color: #e2e8f0;
|
||||
border-radius: var(--radius);
|
||||
padding: 18px 24px;
|
||||
margin-bottom: 28px;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
.endpoint-box .label { color: #94a3b8; margin-bottom: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-family: sans-serif; }
|
||||
.endpoint-box .url { color: #34d399; font-weight: 600; }
|
||||
.endpoint-box .key { color: #fbbf24; }
|
||||
.endpoint-box .sep { color: #475569; margin: 0 8px; }
|
||||
|
||||
/* Table */
|
||||
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
|
||||
.table-toolbar { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||
.table-toolbar h2 { font-size: 14px; font-weight: 600; }
|
||||
.search-box { padding: 7px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; width: 240px; outline: none; }
|
||||
.search-box:focus { border-color: var(--primary); }
|
||||
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
thead th { background: #f1f5f9; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
|
||||
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; cursor: pointer; }
|
||||
tbody tr:last-child { border-bottom: none; }
|
||||
tbody tr:hover { background: #f8fafc; }
|
||||
tbody td { padding: 10px 14px; font-size: 13px; vertical-align: middle; }
|
||||
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
|
||||
.badge.success { background: #d1fae5; color: #065f46; }
|
||||
.badge.local { background: #dbeafe; color: #1e40af; }
|
||||
.badge.pending { background: #fef3c7; color: #92400e; }
|
||||
|
||||
/* Modal */
|
||||
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; }
|
||||
.modal-overlay.open { display: flex; }
|
||||
.modal { background: var(--surface); border-radius: var(--radius); width: 90%; max-width: 760px; max-height: 85vh; display: flex; flex-direction: column; }
|
||||
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
|
||||
.modal-header h3 { font-size: 15px; font-weight: 700; }
|
||||
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
|
||||
.modal-body { padding: 20px 24px; overflow-y: auto; }
|
||||
pre { background: #0f172a; color: #e2e8f0; border-radius: 6px; padding: 16px; font-size: 12px; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
|
||||
|
||||
/* Refresh badge */
|
||||
.refresh-btn { padding: 7px 14px; background: var(--primary); color: white; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; }
|
||||
.refresh-btn:hover { background: #0369a1; }
|
||||
|
||||
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
|
||||
.empty p { font-size: 15px; margin-bottom: 6px; }
|
||||
.empty small { font-size: 12px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<div class="topbar-title">
|
||||
GRN Records
|
||||
<span class="local-pill">Local Test</span>
|
||||
</div>
|
||||
<a href="/dashboard" class="back-link">Back to Dashboard</a>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h1>Local GRN Test Records</h1>
|
||||
<p>All GRNs received from your local n8n workflow. These are stored in the <strong>invoice</strong> database, table <strong>grn_records</strong>.</p>
|
||||
</div>
|
||||
|
||||
<!-- Endpoint Info Box -->
|
||||
<div class="endpoint-box">
|
||||
<div class="label">n8n HTTP Node — Point these to your local server</div>
|
||||
<div>
|
||||
<span style="color:#94a3b8">OCR Endpoint :</span>
|
||||
<span class="url">http://localhost:8080/process-invoice</span>
|
||||
<span class="sep">|</span>
|
||||
<span style="color:#94a3b8">Header :</span>
|
||||
<span class="key">x-api-key: 971dcea6c47445f6f7405fa2d14e116b1d81dae6c10330571e8d4220c013b523</span>
|
||||
</div>
|
||||
<div style="margin-top:8px">
|
||||
<span style="color:#94a3b8">GRN Endpoint :</span>
|
||||
<span class="url">http://localhost:8080/dmhApiRef/grn/createGRN.php</span>
|
||||
<span class="sep">|</span>
|
||||
<span style="color:#94a3b8">Header :</span>
|
||||
<span class="key">x-api-key: nirajAi26@DMH</span>
|
||||
</div>
|
||||
<div style="margin-top:8px">
|
||||
<span style="color:#94a3b8">JSON API :</span>
|
||||
<span class="url">GET http://localhost:8080/api/grn/records</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats -->
|
||||
{% set total = records | length %}
|
||||
{% set success_count = records | selectattr('status', 'equalto', 'created') | list | length %}
|
||||
<div class="stats">
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">Total GRNs</div>
|
||||
<div class="stat-value primary">{{ total }}</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">Created</div>
|
||||
<div class="stat-value success">{{ success_count }}</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">Total Items</div>
|
||||
<div class="stat-value primary">{{ records | sum(attribute='items_inserted') }}</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">Unique Sellers</div>
|
||||
<div class="stat-value primary">{{ records | map(attribute='seller_name') | unique | list | length }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<div class="table-wrap">
|
||||
<div class="table-toolbar">
|
||||
<h2>GRN Records (last 200)</h2>
|
||||
<div style="display:flex;gap:10px;align-items:center">
|
||||
<input type="text" class="search-box" id="searchBox" placeholder="Search GRN, invoice, seller..." oninput="filterTable()">
|
||||
<button class="refresh-btn" onclick="location.reload()">Refresh</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if records %}
|
||||
<div style="overflow-x:auto">
|
||||
<table id="grnTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>GRN No</th>
|
||||
<th>Invoice Number</th>
|
||||
<th>Invoice ID</th>
|
||||
<th>Seller Name</th>
|
||||
<th>PO Number</th>
|
||||
<th>Amount (₹)</th>
|
||||
<th>Items</th>
|
||||
<th>Source</th>
|
||||
<th>Received At</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in records %}
|
||||
<tr onclick="showDetail({{ r.id }})">
|
||||
<td><strong>{{ r.grn_no }}</strong></td>
|
||||
<td>{{ r.invoice_number or '—' }}</td>
|
||||
<td style="color:var(--muted);font-size:12px">{{ r.invoice_id or '—' }}</td>
|
||||
<td>{{ r.seller_name or '—' }}</td>
|
||||
<td style="font-size:12px">{{ r.po_number or '—' }}</td>
|
||||
<td style="text-align:right"><strong>{{ "%.2f"|format(r.invoice_amount|float) if r.invoice_amount else '0.00' }}</strong></td>
|
||||
<td style="text-align:center">{{ r.items_inserted }}</td>
|
||||
<td><span class="badge local">{{ r.source or 'n8n' }}</span></td>
|
||||
<td style="color:var(--muted);font-size:12px">{{ r.received_at }}</td>
|
||||
<td><span class="badge success">{{ r.status }}</span></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty">
|
||||
<p>No GRN records yet.</p>
|
||||
<small>Run your n8n workflow with the local endpoint to see records appear here.</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Detail Modal -->
|
||||
<div class="modal-overlay" id="detailModal">
|
||||
<div class="modal">
|
||||
<div class="modal-header">
|
||||
<h3 id="modalTitle">GRN Detail</h3>
|
||||
<button class="modal-close" onclick="closeModal()">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre id="modalContent">Loading...</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function showDetail(id) {
|
||||
document.getElementById('modalTitle').textContent = 'Loading...';
|
||||
document.getElementById('modalContent').textContent = 'Loading...';
|
||||
document.getElementById('detailModal').classList.add('open');
|
||||
|
||||
fetch('/grn/records/' + id)
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
document.getElementById('modalTitle').textContent = 'GRN: ' + (data.grn_no || 'N/A');
|
||||
document.getElementById('modalContent').textContent = JSON.stringify(data, null, 2);
|
||||
})
|
||||
.catch(e => {
|
||||
document.getElementById('modalContent').textContent = 'Error: ' + e;
|
||||
});
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('detailModal').classList.remove('open');
|
||||
}
|
||||
|
||||
document.getElementById('detailModal').addEventListener('click', function(e) {
|
||||
if (e.target === this) closeModal();
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') closeModal();
|
||||
});
|
||||
|
||||
function filterTable() {
|
||||
const q = document.getElementById('searchBox').value.toLowerCase();
|
||||
const rows = document.querySelectorAll('#grnTable tbody tr');
|
||||
rows.forEach(row => {
|
||||
row.style.display = row.textContent.toLowerCase().includes(q) ? '' : 'none';
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,239 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Pharmacy Staff Login</title>
|
||||
<style>
|
||||
:root {
|
||||
--primary: #0284c7;
|
||||
--primary-hover: #0369a1;
|
||||
--primary-light: #f0f9ff;
|
||||
--primary-border: #bae6fd;
|
||||
--background: #f8fafc;
|
||||
--surface: #ffffff;
|
||||
--border: #e2e8f0;
|
||||
--border-hover: #cbd5e1;
|
||||
--text-primary: #0f172a;
|
||||
--text-secondary: #475569;
|
||||
--text-muted: #94a3b8;
|
||||
--danger: #dc2626;
|
||||
--danger-bg: #fef2f2;
|
||||
--danger-border: #fecaca;
|
||||
--radius-sm: 4px;
|
||||
--radius: 6px;
|
||||
--radius-lg: 8px;
|
||||
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
background-color: var(--background);
|
||||
color: var(--text-primary);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 24px 16px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
background-color: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow);
|
||||
width: 100%;
|
||||
max-width: 440px;
|
||||
padding: 36px 32px;
|
||||
}
|
||||
|
||||
.header-section {
|
||||
text-align: center;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.logo-slot {
|
||||
height: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.logo-slot img {
|
||||
max-height: 58px;
|
||||
width: auto;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.portal-badge {
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.6px;
|
||||
text-transform: uppercase;
|
||||
padding: 4px 10px;
|
||||
background-color: var(--primary-light);
|
||||
color: var(--primary);
|
||||
border: 1px solid var(--primary-border);
|
||||
border-radius: 9999px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.portal-title {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.2px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.portal-subtitle {
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
color: var(--text-primary);
|
||||
background-color: #ffffff;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
outline: none;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
|
||||
}
|
||||
|
||||
.btn-submit {
|
||||
width: 100%;
|
||||
padding: 11px 16px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
color: #ffffff;
|
||||
background-color: var(--primary);
|
||||
border: 1px solid var(--primary);
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.btn-submit:hover {
|
||||
background-color: var(--primary-hover);
|
||||
border-color: var(--primary-hover);
|
||||
}
|
||||
|
||||
.btn-submit:active {
|
||||
transform: translateY(1px);
|
||||
}
|
||||
|
||||
.alert-error {
|
||||
background-color: var(--danger-bg);
|
||||
border: 1px solid var(--danger-border);
|
||||
color: var(--danger);
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--radius);
|
||||
font-size: 13px;
|
||||
margin-bottom: 20px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.footer-note {
|
||||
margin-top: 24px;
|
||||
padding-top: 18px;
|
||||
border-top: 1px solid var(--border);
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.footer-note strong {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.back-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-card">
|
||||
<div class="header-section">
|
||||
<div class="logo-slot">
|
||||
<img src="/static/logo.png" alt="Hospital Logo" onerror="this.src='/static/logos/logo.png';">
|
||||
</div>
|
||||
<span class="portal-badge">Pharmacy Department</span>
|
||||
<h1 class="portal-title">Item-Code Approval Portal</h1>
|
||||
<p class="portal-subtitle">Dedicated authentication for pharmacy personnel to review and verify invoice drug item codes.</p>
|
||||
</div>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert-error">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form action="/pharmacy/login" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="username" class="form-label">Staff Username</label>
|
||||
<input type="text" id="username" name="username" class="form-input" placeholder="e.g. pharmacy" required autocomplete="username" autofocus>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" id="password" name="password" class="form-input" placeholder="••••••••" required autocomplete="current-password">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-submit">Sign In to Pharmacy Portal</button>
|
||||
</form>
|
||||
|
||||
<div class="footer-note">
|
||||
<strong>Restricted Access</strong><br>
|
||||
This portal is restricted to authorized pharmacy staff with approval privileges. Invoice extraction and billing users must use the standard portal.
|
||||
<a href="/login" class="back-link">Go to Standard Billing Login</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user