add test to checkout
This commit is contained in:
@@ -287,7 +287,7 @@ function List({ items, search }) {
|
||||
{currency.format(
|
||||
filtered
|
||||
?.filter((x) => 'course' in x)
|
||||
.reduce((acc, { unit_price }) => acc + unit_price, 0)
|
||||
?.reduce((acc, { unit_price }) => acc + unit_price, 0)
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRequest, useToggle } from 'ahooks'
|
||||
import { CheckIcon, UserIcon, XIcon } from 'lucide-react'
|
||||
import { CheckIcon, UserIcon, XIcon, AlertTriangleIcon } from 'lucide-react'
|
||||
import { formatCPF } from '@brazilian-utils/brazilian-utils'
|
||||
|
||||
import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar'
|
||||
@@ -109,6 +109,7 @@ export function AsyncCombobox({
|
||||
key={id}
|
||||
value={id}
|
||||
className="cursor-pointer"
|
||||
disabled={!cpf}
|
||||
onSelect={() => {
|
||||
onChange?.({ id, name, email, cpf })
|
||||
set(false)
|
||||
@@ -128,10 +129,16 @@ export function AsyncCombobox({
|
||||
<li className="text-muted-foreground text-sm">
|
||||
<Abbr>{email}</Abbr>
|
||||
</li>
|
||||
{cpf && (
|
||||
|
||||
{cpf ? (
|
||||
<li className="text-muted-foreground text-sm">
|
||||
{formatCPF(cpf)}
|
||||
</li>
|
||||
) : (
|
||||
<li className="flex gap-1 items-center text-red-400">
|
||||
<AlertTriangleIcon className="text-red-400" />
|
||||
Inelegível
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -96,8 +96,8 @@ export async function action({ params, request, context }: Route.ActionArgs) {
|
||||
context
|
||||
})
|
||||
|
||||
const result = (await r.json()) as { sk: string }
|
||||
return redirect(`/${params.orgid}/enrollments/${result.sk}/submitted`)
|
||||
const data = (await r.json()) as { sk: string }
|
||||
return redirect(`/${params.orgid}/enrollments/${data.sk}/submitted`)
|
||||
}
|
||||
|
||||
const emptyRow = {
|
||||
|
||||
@@ -226,7 +226,7 @@ function Timeline({
|
||||
<EmptyMedia variant="icon">
|
||||
<ClockIcon />
|
||||
</EmptyMedia>
|
||||
<EmptyTitle>Nenhum agendamento aqui</EmptyTitle>
|
||||
<EmptyTitle>Nenhum agendamento encontrado</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
Ainda não há agendamentos. Quando houver, eles aparecerão aqui.
|
||||
</EmptyDescription>
|
||||
|
||||
@@ -79,11 +79,11 @@ export default function Route({}: Route.ComponentProps) {
|
||||
switch (fetcher.data?.error?.type) {
|
||||
case 'RateLimitExceededError':
|
||||
toast.error('Seu limite diário de atualizações foi atingido.')
|
||||
return
|
||||
case 'CPFConflictError':
|
||||
setError('cpf', { message: 'CPF já está em uso' })
|
||||
return
|
||||
}
|
||||
|
||||
console.log(fetcher.data?.error)
|
||||
}, [fetcher.data, setError])
|
||||
|
||||
return (
|
||||
|
||||
@@ -41,10 +41,10 @@ export async function loader({ params, context, request }: Route.ActionArgs) {
|
||||
}
|
||||
|
||||
const { items = [] } = (await r.json()) as { items: { sk: string }[] }
|
||||
const orgs = items.map(({ sk, ...props }) => ({
|
||||
...props,
|
||||
id: sk?.split('#')[1] ?? null
|
||||
}))
|
||||
const orgs = items.map(({ sk, ...props }) => {
|
||||
const [, id] = sk?.split('#')
|
||||
return { ...props, id }
|
||||
})
|
||||
const exists = orgs.some(({ id }) => id === params.orgid)
|
||||
|
||||
if (exists) {
|
||||
|
||||
Reference in New Issue
Block a user