-
+
+
+
+
-
-
- {truncateNameAtWordBoundary(tile.name, 28)}
-
- {secondary ? (
-
{secondary}
- ) : null}
- {!tile.exclusive ? (
-
- Não exclusivo
-
- ) : null}
-
-
-
-
- {noteText}
-
-
+
+
+ {truncateNameAtWordBoundary(tile.name, 28)}
+
+ {secondary ? (
+
{secondary}
+ ) : null}
+ {!tile.exclusive ? (
+
+ Não exclusivo
+
+ ) : null}
+
+
+
+
+ {noteText}
+
+
+
+
)
}
diff --git a/src/lib/wizardLeadershipContract.ts b/src/lib/wizardLeadershipContract.ts
index e3caa971..e1958a62 100644
--- a/src/lib/wizardLeadershipContract.ts
+++ b/src/lib/wizardLeadershipContract.ts
@@ -4,7 +4,6 @@ import type { SupportStatus } from '@/lib/schemas/leadership'
/** Client-safe tile payload for the B70 leadership wizard grid. */
export type WizardLeadershipTileViewModel = {
id: number
- contactID: number
name: string
phone: string | null
email: string | null
diff --git a/src/utilities/leadership/leadershipData.ts b/src/utilities/leadership/leadershipData.ts
index 8bb973b1..f3aa5c95 100644
--- a/src/utilities/leadership/leadershipData.ts
+++ b/src/utilities/leadership/leadershipData.ts
@@ -54,6 +54,38 @@ const contactSummary = (
return { id: Number(contact), name: 'Contato', phone: null, email: null }
}
+const findMunicipalityLeadershipDocs = async (
+ payload: Payload,
+ user: CampaignUser,
+ municipalityID: number,
+ sort = 'createdAt',
+): Promise
=> {
+ const result = await payload.find({
+ collection: 'leadership',
+ where: { municipalities: { in: [municipalityID] } },
+ depth: 1,
+ limit: 0,
+ pagination: false,
+ sort,
+ user,
+ overrideAccess: false,
+ })
+ return result.docs as Leadership[]
+}
+
+const toWizardLeadershipTile = (doc: Leadership): WizardLeadershipTileViewModel => {
+ const contact = contactSummary(doc.contact)
+ return {
+ id: doc.id,
+ name: contact.name,
+ phone: contact.phone,
+ email: contact.email,
+ supportStatus: isSupportStatus(doc.supportStatus) ? doc.supportStatus : null,
+ exclusive: doc.exclusive ?? true,
+ notes: doc.notes ?? null,
+ }
+}
+
const organizationNamesForIds = (payload: Payload, ids: number[]): Promise