Integrate committee ballots with Voting

This commit is contained in:
2026-08-01 20:57:25 +02:00
parent 758b59ca03
commit 133e55987e
12 changed files with 565 additions and 104 deletions
@@ -8,6 +8,7 @@ import {
} from "@govoplan/core-webui";
import {
finalizeProviderBallot,
finalizeVotingBallot,
type CommitteeRecord
} from "../../api/committee";
@@ -43,11 +44,13 @@ export default function CommitteeBallotDialog({
setBusy(true);
setError("");
try {
const saved = await finalizeProviderBallot(settings, record, {
providerBallotRef,
approvalId,
changeReason
});
const saved = votingBallotId
? await finalizeVotingBallot(settings, record, { approvalId, changeReason })
: await finalizeProviderBallot(settings, record, {
providerBallotRef,
approvalId,
changeReason
});
onSaved(saved);
onClose();
} catch (reason) {
@@ -58,10 +61,11 @@ export default function CommitteeBallotDialog({
}
const providerId = String(record.attributes.provider_id ?? "");
const votingBallotId = String(record.attributes.voting_ballot_id ?? "").trim();
return (
<Dialog
open={open}
title="Finalize provider ballot"
title={votingBallotId ? "Finalize Voting ballot" : "Finalize provider ballot"}
onClose={onClose}
closeDisabled={busy}
portal
@@ -71,7 +75,7 @@ export default function CommitteeBallotDialog({
<Button disabled={busy} onClick={onClose}>Cancel</Button>
<Button
variant="primary"
disabled={busy || !providerBallotRef.trim() || !approvalId.trim() || !changeReason.trim()}
disabled={busy || (!votingBallotId && !providerBallotRef.trim()) || !approvalId.trim() || !changeReason.trim()}
onClick={() => void finalize()}
>
{busy ? "Importing" : "Finalize"}
@@ -82,12 +86,13 @@ export default function CommitteeBallotDialog({
<div className="committee-record-form">
{error ? <DismissibleAlert tone="danger" resetKey={error}>{error}</DismissibleAlert> : null}
<p className="committee-dialog-note">
Provider <strong>{providerId}</strong> returns only the verified aggregate result,
receipt hash and evidence. Individual secret ballots are not stored in GovOPlaN.
{votingBallotId
? <>Voting ballot <strong>{votingBallotId}</strong> will be closed and its aggregate result recorded in the Committee minutes.</>
: <>Provider <strong>{providerId}</strong> returns only the verified aggregate result, receipt hash and evidence.</>}
</p>
<FormField label="Provider ballot reference">
{!votingBallotId ? <FormField label="Provider ballot reference">
<input value={providerBallotRef} disabled={busy} onChange={(event) => setProviderBallotRef(event.target.value)} />
</FormField>
</FormField> : null}
<FormField label="Approval ID">
<input value={approvalId} disabled={busy} onChange={(event) => setApprovalId(event.target.value)} />
</FormField>