diff --git a/apps/admin/.env.example b/apps/admin/.env.example index 8946981b..0451108b 100644 --- a/apps/admin/.env.example +++ b/apps/admin/.env.example @@ -18,6 +18,11 @@ NEXT_PUBLIC_FIREBASE_PROJECT_ID=demo-widoo # and production. NEXT_PUBLIC_FIREBASE_AUTH_EMULATOR_URL=http://127.0.0.1:9099 +# Origin of the public site (https://host, without path): where the pages of the B2B partners and +# the link of the stores live, written in the links and QR codes of A-10. Locally, +# http://localhost:3000 if the site runs there. Empty: A-10 says it is not set, and gives no link. +NEXT_PUBLIC_SITE_URL= + # Dashboards the admin links to from its home page (A-05), https: the exact page of the Widoo # project. Empty: the home page of PostHog Cloud EU and of RevenueCat. NEXT_PUBLIC_POSTHOG_URL= diff --git a/apps/admin/src/app/(shell)/partenaires/page.tsx b/apps/admin/src/app/(shell)/partenaires/page.tsx new file mode 100644 index 00000000..1943b94c --- /dev/null +++ b/apps/admin/src/app/(shell)/partenaires/page.tsx @@ -0,0 +1,11 @@ +import { PartnersContainer } from '@/containers/PartnersContainer'; +import { Suspense } from 'react'; + +/** A-10, the B2B partners. The open partner is read from the address, in the browser. */ +export default function PartnersPage() { + return ( + + + + ); +} diff --git a/apps/admin/src/components/b2b/PartnerActions.tsx b/apps/admin/src/components/b2b/PartnerActions.tsx new file mode 100644 index 00000000..1c998ff4 --- /dev/null +++ b/apps/admin/src/components/b2b/PartnerActions.tsx @@ -0,0 +1,21 @@ +import { messages } from '@/messages/fr'; +import { Button } from '@widoo/ui'; + +const texts = messages.b2b.panel; + +type PartnerActionsProps = { + onEdit: () => void; + onChooseRoutes: () => void; +}; + +/** The actions of the card of a partner (A-10): change it, choose the routes of its page. */ +export function PartnerActions({ onEdit, onChooseRoutes }: PartnerActionsProps) { + return ( + <> + + + + ); +} diff --git a/apps/admin/src/components/b2b/PartnerFormDialog.tsx b/apps/admin/src/components/b2b/PartnerFormDialog.tsx new file mode 100644 index 00000000..8b8f7677 --- /dev/null +++ b/apps/admin/src/components/b2b/PartnerFormDialog.tsx @@ -0,0 +1,162 @@ +import { monthlyPricePattern, type PartnerFormValues } from '@/lib/partner-form'; +import { messages } from '@/messages/fr'; +import { b2bClientStatuses, b2bClientTypes } from '@widoo/shared'; +import { ConfirmDialog, Field, Input, Select, Textarea } from '@widoo/ui'; + +const texts = messages.b2b.form; + +type PartnerFormDialogProps = { + isOpen: boolean; + /** True when it changes a partner; false when it registers one. */ + isEdit: boolean; + values: PartnerFormValues; + onChange: (key: Key, value: PartnerFormValues[Key]) => void; + onCancel: () => void; + onConfirm: () => void; + isBusy: boolean; +}; + +/** « Ajouter un partenaire » or « Modifier le partenaire »: its contact, contract and notes. */ +export function PartnerFormDialog({ + isOpen, + isEdit, + values, + onChange, + onCancel, + onConfirm, + isBusy, +}: PartnerFormDialogProps) { + return ( + + + onChange('name', event.target.value)} + /> + + + onChange('slug', event.target.value)} + /> + + + + + + + + + onChange('contactName', event.target.value)} + /> + + + onChange('contactEmail', event.target.value)} + /> + + + onChange('contactPhone', event.target.value)} + /> + + + onChange('address', event.target.value)} + /> + + + onChange('monthlyPrice', event.target.value)} + /> + + + onChange('startedAt', event.target.value)} + /> + + +