WIP
This commit is contained in:
@@ -1,27 +1,21 @@
|
||||
import {
|
||||
use,
|
||||
useState,
|
||||
useMemo,
|
||||
forwardRef,
|
||||
type InputHTMLAttributes
|
||||
} from 'react'
|
||||
import { useToggle } from 'ahooks'
|
||||
import Fuse from 'fuse.js'
|
||||
import {
|
||||
ChevronsUpDownIcon,
|
||||
CheckIcon,
|
||||
BookIcon,
|
||||
ArrowDownAZIcon,
|
||||
ArrowUpAZIcon
|
||||
ArrowUpAZIcon,
|
||||
BookIcon,
|
||||
CheckIcon,
|
||||
ChevronsUpDownIcon
|
||||
} from 'lucide-react'
|
||||
|
||||
import { cn } from '@repo/ui/lib/utils'
|
||||
import { Button } from '@repo/ui/components/ui/button'
|
||||
import {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupInput
|
||||
} from '@repo/ui/components/ui/input-group'
|
||||
forwardRef,
|
||||
use,
|
||||
useMemo,
|
||||
useState,
|
||||
type InputHTMLAttributes
|
||||
} from 'react'
|
||||
|
||||
import { Button } from '@repo/ui/components/ui/button'
|
||||
import {
|
||||
Command,
|
||||
CommandEmpty,
|
||||
@@ -30,11 +24,17 @@ import {
|
||||
CommandItem,
|
||||
CommandList
|
||||
} from '@repo/ui/components/ui/command'
|
||||
import {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupInput
|
||||
} from '@repo/ui/components/ui/input-group'
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger
|
||||
} from '@repo/ui/components/ui/popover'
|
||||
import { cn } from '@repo/ui/lib/utils'
|
||||
|
||||
import { type Course } from './data'
|
||||
|
||||
@@ -114,7 +114,7 @@ export const CoursePicker = forwardRef<HTMLInputElement, CoursePickerProps>(
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<CommandInput
|
||||
placeholder="Curso"
|
||||
placeholder="Digite para pesquisar"
|
||||
autoComplete="off"
|
||||
onValueChange={setSearch}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from 'zod'
|
||||
import { format } from 'date-fns'
|
||||
import { z } from 'zod'
|
||||
|
||||
export const MAX_ITEMS = 50
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
PlusIcon,
|
||||
Trash2Icon
|
||||
} from 'lucide-react'
|
||||
import { pick } from 'ramda'
|
||||
import { Fragment, use, useEffect, type ReactNode } from 'react'
|
||||
import { Controller, useFieldArray, useForm } from 'react-hook-form'
|
||||
import { Link, redirect, useFetcher, useParams } from 'react-router'
|
||||
@@ -115,13 +114,14 @@ export async function loader({ params, context, request }: Route.LoaderArgs) {
|
||||
|
||||
export async function action({ params, request, context }: Route.ActionArgs) {
|
||||
const { orgid: org_id } = params
|
||||
const { subscription } = context.get(workspaceContext)
|
||||
const body = (await request.json()) as object
|
||||
|
||||
const r = await req({
|
||||
url: `enrollments`,
|
||||
headers: new Headers({ 'Content-Type': 'application/json' }),
|
||||
method: HttpMethod.POST,
|
||||
body: JSON.stringify({ org_id, ...body }),
|
||||
body: JSON.stringify({ org_id, subscription, ...body }),
|
||||
request,
|
||||
context
|
||||
})
|
||||
@@ -181,7 +181,10 @@ export default function Route({
|
||||
'enrollments',
|
||||
enrolled
|
||||
.filter(({ status }) => status === 'fail')
|
||||
.map(({ input_record }) => pick(['course', 'user'], input_record))
|
||||
.map(({ input_record: { course, user } }) => ({
|
||||
user,
|
||||
course: { ...course, unit_price: 0 }
|
||||
}))
|
||||
)
|
||||
}, [enrolled, setValue])
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import type { ControllerFieldState } from 'react-hook-form'
|
||||
import { XIcon, CheckIcon, AlertTriangleIcon, UserIcon } from 'lucide-react'
|
||||
import { formatCPF } from '@brazilian-utils/brazilian-utils'
|
||||
import { AlertTriangleIcon, CheckIcon, UserIcon, XIcon } from 'lucide-react'
|
||||
import type { ControllerFieldState } from 'react-hook-form'
|
||||
|
||||
import { cn, initials } from '@repo/ui/lib/utils'
|
||||
import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar'
|
||||
import { Abbr } from '@repo/ui/components/abbr'
|
||||
import { Spinner } from '@repo/ui/components/ui/spinner'
|
||||
import { SearchFilter } from '@repo/ui/components/search-filter'
|
||||
import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar'
|
||||
import { CommandItem } from '@repo/ui/components/ui/command'
|
||||
import {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupButton,
|
||||
InputGroupInput
|
||||
} from '@repo/ui/components/ui/input-group'
|
||||
import { CommandItem } from '@repo/ui/components/ui/command'
|
||||
import { SearchFilter } from '@repo/ui/components/search-filter'
|
||||
import { Spinner } from '@repo/ui/components/ui/spinner'
|
||||
import { cn, initials } from '@repo/ui/lib/utils'
|
||||
|
||||
import type { User } from './data'
|
||||
|
||||
@@ -35,6 +35,7 @@ export function UserPicker({
|
||||
align="start"
|
||||
onChange={onChange}
|
||||
onSearch={onSearch}
|
||||
placeholder="Digite para pesquisar"
|
||||
render={({ id, name, email, cpf, onSelect, onClose }) => (
|
||||
<CommandItem
|
||||
key={id}
|
||||
|
||||
Reference in New Issue
Block a user