mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
2c723410a4
UI - Dashboard BillApprovalsCard: render approver name chips (color-coded by vote status) per pending bill instead of leaving the approver identity invisible. - BillDetailPage: collapse the duplicate "Requested Approvers" card into the existing "Approvers" table. Approve/deny handler now stamps approved_by = auth.uid() for audit trail. - MasterBoardDashboardPage: the "pending approvals for me" count was filtering on a non-existent bill_approvals.approver_user_id column. Replaced with a board_members.member_name -> bill_approvals.approver_name join (matches the RLS policy). - BillApprovalRequestDialog + AIInvoiceParserPage: bill_approvals inserts now set created_by. Database - Rename public.bill_approvals.vendor_name -> approver_name. RLS policies auto-rewritten by ALTER TABLE RENAME COLUMN; the column was misnamed (it stores the approver's board-member name, never a vendor). - Restore the bill_approval_email_tokens table + lookup_/record_ bill_approval_by_token RPCs. The original 20260520153409 migration was never applied successfully; rewrote it to use approver_name and to populate approved_by/created_by from board_members.user_id on token-driven votes. Added the v2 migration that matches the live DB state. - accounting trigger: void on accounting.bills cascades to public.bills.status='cancelled' (existing forward sync then drops the accounting row per accounting.bill_should_mirror). Edge function - send-transactional-email: add bill-approval-request and bill-approval-vote-invite templates (caller paths in BillApprovalsPage + send-bill-approval-invites referenced templates that weren't in the registry, so every email 404'd). Restored the local copies of election-invite, board-vote-invite, and the missing registry.ts so the repo matches what's deployed. Deployed to send-transactional-email v35. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
52 lines
2.8 KiB
TypeScript
52 lines
2.8 KiB
TypeScript
import * as React from 'npm:react@18.3.1'
|
|
import { Body, Container, Head, Heading, Html, Preview, Text, Button } from 'npm:@react-email/components@0.0.22'
|
|
import type { TemplateEntry } from './registry.ts'
|
|
|
|
const SITE_NAME = 'Avria Community Management'
|
|
|
|
interface Props {
|
|
ownerName?: string
|
|
electionTitle?: string
|
|
associationName?: string
|
|
deadline?: string
|
|
votingUrl?: string
|
|
}
|
|
|
|
const ElectionInviteEmail = ({ ownerName, electionTitle, associationName, deadline, votingUrl }: Props) => (
|
|
<Html lang="en" dir="ltr">
|
|
<Head />
|
|
<Preview>Cast your vote — {electionTitle || 'Election'}</Preview>
|
|
<Body style={main}>
|
|
<Container style={container}>
|
|
<Heading style={h1}>Election Ballot — {electionTitle || 'Election'}</Heading>
|
|
<Text style={text}>Dear {ownerName || 'Owner'},</Text>
|
|
<Text style={text}>
|
|
You are eligible to vote in the <strong>{electionTitle || 'election'}</strong>
|
|
{associationName ? ` for ${associationName}` : ''}.
|
|
</Text>
|
|
{deadline && <Text style={text}>⏰ <strong>Deadline:</strong> {deadline}</Text>}
|
|
<Button href={votingUrl || '#'} style={button}>Cast Your Vote</Button>
|
|
<Text style={smallText}>This is a secure, tokenized link tied to your unit. Your vote is anonymous — we record that you voted but not how you voted.</Text>
|
|
<Text style={smallText}>You may change your vote until the deadline by clicking the link again.</Text>
|
|
<Text style={footer}>If you did not expect this email, please contact your association manager. — {SITE_NAME}</Text>
|
|
</Container>
|
|
</Body>
|
|
</Html>
|
|
)
|
|
|
|
export const template = {
|
|
component: ElectionInviteEmail,
|
|
subject: (d: Record<string, any>) =>
|
|
`Vote Now: ${d.electionTitle || 'Election'}${d.associationName ? ` — ${d.associationName}` : ''}`,
|
|
displayName: 'Election invite',
|
|
previewData: { ownerName: 'Jane Owner', electionTitle: '2026 Board Election', associationName: 'Sample HOA', deadline: 'January 15, 2026 5:00 PM', votingUrl: 'https://avria.cloud/vote/xxx?token=yyy' },
|
|
} satisfies TemplateEntry
|
|
|
|
const main = { backgroundColor: '#ffffff', fontFamily: 'Inter, Arial, sans-serif' }
|
|
const container = { maxWidth: '600px', margin: '0 auto', padding: '28px 24px' }
|
|
const h1 = { color: '#111827', fontSize: '22px', lineHeight: '30px', margin: '0 0 14px', fontWeight: '700' }
|
|
const text = { color: '#374151', fontSize: '15px', lineHeight: '24px', margin: '0 0 14px' }
|
|
const smallText = { color: '#6b7280', fontSize: '13px', lineHeight: '20px', margin: '0 0 10px' }
|
|
const button = { backgroundColor: '#2941a4', color: '#ffffff', borderRadius: '6px', fontSize: '14px', fontWeight: '600', textDecoration: 'none', padding: '12px 18px', margin: '12px 0 18px' }
|
|
const footer = { color: '#6b7280', fontSize: '12px', lineHeight: '18px', margin: '28px 0 0' }
|