Add submit buttons to examination step
This commit is contained in:
71
server.js
71
server.js
@@ -513,33 +513,31 @@ async function dashboardPage(session) {
|
|||||||
)
|
)
|
||||||
.join("")}
|
.join("")}
|
||||||
</section>
|
</section>
|
||||||
<section class="detail-grid">
|
<section class="panel">
|
||||||
<div class="panel">
|
${panelHeader("Recent orders", "", '<a class="btn btn-secondary" href="/orders">View all</a>')}
|
||||||
${panelHeader("Recent orders", "", '<a class="btn btn-secondary" href="/orders">View all</a>')}
|
<div class="table-wrap">
|
||||||
<div class="table-wrap">
|
<table>
|
||||||
<table>
|
<thead>
|
||||||
<thead>
|
<tr><th>Patient</th><th>Order</th><th>Status</th><th>Updated</th></tr>
|
||||||
<tr><th>Patient</th><th>Order</th><th>Status</th><th>Updated</th></tr>
|
</thead>
|
||||||
</thead>
|
<tbody>
|
||||||
<tbody>
|
${(orders.items || []).length
|
||||||
${(orders.items || []).length
|
? orders.items
|
||||||
? orders.items
|
.slice(0, 5)
|
||||||
.slice(0, 5)
|
.map(
|
||||||
.map(
|
(order) => `
|
||||||
(order) => `
|
<tr>
|
||||||
<tr>
|
<td><strong>${escapeHtml(order.patient || "Unknown patient")}</strong><br /><span class="muted">${escapeHtml(order.mode || "-")}</span></td>
|
||||||
<td><strong>${escapeHtml(order.patient || "Unknown patient")}</strong><br /><span class="muted">${escapeHtml(order.mode || "-")}</span></td>
|
<td><a href="/orders/${order.id}">${escapeHtml(order.id)}</a><br /><span class="muted">${escapeHtml(order.diagnosis || "-")}</span></td>
|
||||||
<td><a href="/orders/${order.id}">${escapeHtml(order.id)}</a><br /><span class="muted">${escapeHtml(order.diagnosis || "-")}</span></td>
|
<td>${statusBadge(order.status || "Unconfirmed")}</td>
|
||||||
<td>${statusBadge(order.status)}</td>
|
<td>${escapeHtml(order.updated || "-")}</td>
|
||||||
<td>${escapeHtml(order.updated || "-")}</td>
|
</tr>
|
||||||
</tr>
|
`,
|
||||||
`,
|
)
|
||||||
)
|
.join("")
|
||||||
.join("")
|
: `<tr><td colspan="4">${emptyState("No orders returned", "The desktop order endpoint did not return any rows for this page.")}</td></tr>`}
|
||||||
: `<tr><td colspan="4">${emptyState("No orders returned", "The desktop order endpoint did not return any rows for this page.")}</td></tr>`}
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -833,10 +831,7 @@ function renderOrderForm(step, stepKey = "demografi", fppTests = [], mouId = "")
|
|||||||
demografi: `
|
demografi: `
|
||||||
<div class="stack">
|
<div class="stack">
|
||||||
<div class="panel" style="padding:0; box-shadow:none; background:transparent; border:0">
|
<div class="panel" style="padding:0; box-shadow:none; background:transparent; border:0">
|
||||||
${panelHeader("Mandatory", "These fields are required before save.")}
|
${panelHeader("Mandatory", "These fields are required before save.", '<button class="btn btn-primary" type="button" hx-get="/fragments/modals/patient-search" hx-target="#modal-root" hx-swap="innerHTML">Search patient</button>')}
|
||||||
<div class="topbar-actions" style="justify-content:flex-start; margin-bottom:12px">
|
|
||||||
<button class="btn btn-secondary" type="button" hx-get="/fragments/modals/patient-search" hx-target="#modal-root" hx-swap="innerHTML">Search patient</button>
|
|
||||||
</div>
|
|
||||||
<div class="grid grid-2">
|
<div class="grid grid-2">
|
||||||
<label class="field"><span>Patient name</span><input name="patient_name" required /></label>
|
<label class="field"><span>Patient name</span><input name="patient_name" required /></label>
|
||||||
</div>
|
</div>
|
||||||
@@ -876,6 +871,9 @@ function renderOrderForm(step, stepKey = "demografi", fppTests = [], mouId = "")
|
|||||||
<strong>Selected tests</strong>
|
<strong>Selected tests</strong>
|
||||||
<p id="order-selected-count">0 selected</p>
|
<p id="order-selected-count">0 selected</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="topbar-actions" style="justify-content:flex-start; margin: 0 0 14px;">
|
||||||
|
<button class="btn btn-primary" type="submit">Submit order</button>
|
||||||
|
</div>
|
||||||
${
|
${
|
||||||
packedGroups.length
|
packedGroups.length
|
||||||
? `<div class="fpp-select-board">${packedGroups
|
? `<div class="fpp-select-board">${packedGroups
|
||||||
@@ -934,6 +932,9 @@ function renderOrderForm(step, stepKey = "demografi", fppTests = [], mouId = "")
|
|||||||
.join("")}</div>`
|
.join("")}</div>`
|
||||||
: `<div class="note-box">FPP catalog not available yet.</div>`
|
: `<div class="note-box">FPP catalog not available yet.</div>`
|
||||||
}
|
}
|
||||||
|
<div class="topbar-actions" style="justify-content:flex-start; margin-top:14px">
|
||||||
|
<button class="btn btn-primary" type="submit">Submit order</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
@@ -965,11 +966,7 @@ function renderOrderForm(step, stepKey = "demografi", fppTests = [], mouId = "")
|
|||||||
<a class="btn btn-secondary" href="/orders/new/${prev ? prev[0] : "demografi"}">Back</a>
|
<a class="btn btn-secondary" href="/orders/new/${prev ? prev[0] : "demografi"}">Back</a>
|
||||||
<div class="pill-row">
|
<div class="pill-row">
|
||||||
<a class="btn btn-ghost" href="/orders">Save draft</a>
|
<a class="btn btn-ghost" href="/orders">Save draft</a>
|
||||||
${
|
${next ? `<a class="btn btn-primary" href="/orders/new/${next[0]}" hx-get="/fragments/forms/order-step/${next[0]}" hx-target="#order-step-fragment" hx-push-url="true">Continue</a>` : ""}
|
||||||
next
|
|
||||||
? `<a class="btn btn-primary" href="/orders/new/${next[0]}" hx-get="/fragments/forms/order-step/${next[0]}" hx-target="#order-step-fragment" hx-push-url="true">Continue</a>`
|
|
||||||
: `<button class="btn btn-primary" type="submit">Submit order</button>`
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1690,7 +1687,7 @@ function normalizeDesktopOrder(raw, index = 0) {
|
|||||||
orderDob: raw?.order_dob || "",
|
orderDob: raw?.order_dob || "",
|
||||||
diagnosis: raw?.order_diagnosa || raw?.diagnosis || "",
|
diagnosis: raw?.order_diagnosa || raw?.diagnosis || "",
|
||||||
message: raw?.order_note || raw?.note || "",
|
message: raw?.order_note || raw?.note || "",
|
||||||
status: String(raw?.is_confirm || raw?.status || "").toUpperCase() === "Y" ? "Confirmed" : "",
|
status: String(raw?.is_confirm || raw?.status || "").toUpperCase() === "Y" ? "Confirmed" : "Unconfirmed",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user