Add submit buttons to examination step

This commit is contained in:
sas.fajri
2026-04-13 20:53:55 +07:00
parent 50921294de
commit a1fb9b1230

View File

@@ -513,33 +513,31 @@ async function dashboardPage(session) {
)
.join("")}
</section>
<section class="detail-grid">
<div class="panel">
${panelHeader("Recent orders", "", '<a class="btn btn-secondary" href="/orders">View all</a>')}
<div class="table-wrap">
<table>
<thead>
<tr><th>Patient</th><th>Order</th><th>Status</th><th>Updated</th></tr>
</thead>
<tbody>
${(orders.items || []).length
? orders.items
.slice(0, 5)
.map(
(order) => `
<tr>
<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>${statusBadge(order.status)}</td>
<td>${escapeHtml(order.updated || "-")}</td>
</tr>
`,
)
.join("")
: `<tr><td colspan="4">${emptyState("No orders returned", "The desktop order endpoint did not return any rows for this page.")}</td></tr>`}
</tbody>
</table>
</div>
<section class="panel">
${panelHeader("Recent orders", "", '<a class="btn btn-secondary" href="/orders">View all</a>')}
<div class="table-wrap">
<table>
<thead>
<tr><th>Patient</th><th>Order</th><th>Status</th><th>Updated</th></tr>
</thead>
<tbody>
${(orders.items || []).length
? orders.items
.slice(0, 5)
.map(
(order) => `
<tr>
<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>${statusBadge(order.status || "Unconfirmed")}</td>
<td>${escapeHtml(order.updated || "-")}</td>
</tr>
`,
)
.join("")
: `<tr><td colspan="4">${emptyState("No orders returned", "The desktop order endpoint did not return any rows for this page.")}</td></tr>`}
</tbody>
</table>
</div>
</section>
</div>
@@ -833,10 +831,7 @@ function renderOrderForm(step, stepKey = "demografi", fppTests = [], mouId = "")
demografi: `
<div class="stack">
<div class="panel" style="padding:0; box-shadow:none; background:transparent; border:0">
${panelHeader("Mandatory", "These fields are required before save.")}
<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>
${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="grid grid-2">
<label class="field"><span>Patient name</span><input name="patient_name" required /></label>
</div>
@@ -876,6 +871,9 @@ function renderOrderForm(step, stepKey = "demografi", fppTests = [], mouId = "")
<strong>Selected tests</strong>
<p id="order-selected-count">0 selected</p>
</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
? `<div class="fpp-select-board">${packedGroups
@@ -934,6 +932,9 @@ function renderOrderForm(step, stepKey = "demografi", fppTests = [], mouId = "")
.join("")}</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>
`,
@@ -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>
<div class="pill-row">
<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>`
: `<button class="btn btn-primary" type="submit">Submit order</button>`
}
${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>` : ""}
</div>
</div>
</div>
@@ -1690,7 +1687,7 @@ function normalizeDesktopOrder(raw, index = 0) {
orderDob: raw?.order_dob || "",
diagnosis: raw?.order_diagnosa || raw?.diagnosis || "",
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",
};
}