2026-03-29 21:11:03 +00:00
|
|
|
module Web.View.InteractionReportingContracts.Index where
|
|
|
|
|
|
|
|
|
|
import Web.Types
|
|
|
|
|
import Generated.Types
|
|
|
|
|
import IHP.Prelude
|
|
|
|
|
import IHP.ViewPrelude
|
2026-04-04 09:55:12 +00:00
|
|
|
import Web.Routes ()
|
2026-03-29 21:11:03 +00:00
|
|
|
import Application.Helper.View (adapterStatusBadge)
|
|
|
|
|
|
|
|
|
|
data IndexView = IndexView
|
|
|
|
|
{ contracts :: ![InteractionReportingContract]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
instance View IndexView where
|
|
|
|
|
html IndexView { .. } = [hsx|
|
|
|
|
|
<div class="flex items-center justify-between mb-6">
|
|
|
|
|
<div>
|
|
|
|
|
<h1 class="text-2xl font-semibold">Interaction Reporting Contracts</h1>
|
|
|
|
|
<p class="text-sm text-gray-500 mt-1">
|
|
|
|
|
Defines the REST endpoint and payload schema for external adapter event submission.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<a href={EnvelopeEmissionContractsAction}
|
|
|
|
|
class="text-sm text-gray-500 hover:text-gray-800">
|
|
|
|
|
← Envelope Contracts
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-04-04 09:55:12 +00:00
|
|
|
{if null contracts then noContractsMsg else renderTable contracts}
|
2026-03-29 21:11:03 +00:00
|
|
|
|]
|
|
|
|
|
|
2026-04-04 09:55:12 +00:00
|
|
|
noContractsMsg :: Html
|
|
|
|
|
noContractsMsg = [hsx|<p class="text-sm text-gray-400">No contracts found.</p>|]
|
|
|
|
|
|
2026-03-29 21:11:03 +00:00
|
|
|
renderTable :: [InteractionReportingContract] -> Html
|
|
|
|
|
renderTable contracts = [hsx|
|
|
|
|
|
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden">
|
|
|
|
|
<table class="w-full text-sm">
|
|
|
|
|
<thead class="bg-gray-50 border-b border-gray-200">
|
|
|
|
|
<tr>
|
|
|
|
|
<th class="text-left px-4 py-3 font-medium text-gray-600">Version</th>
|
|
|
|
|
<th class="text-left px-4 py-3 font-medium text-gray-600">Endpoint</th>
|
|
|
|
|
<th class="text-left px-4 py-3 font-medium text-gray-600">Auth</th>
|
|
|
|
|
<th class="text-left px-4 py-3 font-medium text-gray-600">Status</th>
|
|
|
|
|
<th class="text-left px-4 py-3 font-medium text-gray-600">Created</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody class="divide-y divide-gray-100">
|
|
|
|
|
{forEach contracts renderRow}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
|]
|
|
|
|
|
|
|
|
|
|
renderRow :: InteractionReportingContract -> Html
|
|
|
|
|
renderRow c = [hsx|
|
|
|
|
|
<tr class="hover:bg-gray-50">
|
|
|
|
|
<td class="px-4 py-3">
|
2026-04-04 09:55:12 +00:00
|
|
|
<a href={ShowInteractionReportingContractAction (c.id)}
|
2026-03-29 21:11:03 +00:00
|
|
|
class="font-mono text-indigo-600 hover:underline">v{c.contractVersion}</a>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="px-4 py-3 font-mono text-xs text-gray-700">{c.endpointPath}</td>
|
|
|
|
|
<td class="px-4 py-3 text-xs text-gray-500">{c.authScheme}</td>
|
|
|
|
|
<td class="px-4 py-3">
|
|
|
|
|
<span class={adapterStatusBadge c.status <> " text-xs px-2 py-0.5 rounded font-medium"}>
|
|
|
|
|
{c.status}
|
|
|
|
|
</span>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="px-4 py-3 text-gray-400 text-xs">{show c.createdAt}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|]
|