style: padroniza layout do formulário de criação de empresas com o de vagas
This commit is contained in:
parent
a754b4eba8
commit
007a708ffe
1 changed files with 217 additions and 162 deletions
|
|
@ -6,11 +6,11 @@ import { Button } from "@/components/ui/button"
|
||||||
import { Input } from "@/components/ui/input"
|
import { Input } from "@/components/ui/input"
|
||||||
import { Textarea } from "@/components/ui/textarea"
|
import { Textarea } from "@/components/ui/textarea"
|
||||||
import { Label } from "@/components/ui/label"
|
import { Label } from "@/components/ui/label"
|
||||||
import { Loader2, Eye, EyeOff, ArrowLeft } from "lucide-react"
|
import { Loader2, Eye, EyeOff, ArrowLeft, Building2 } from "lucide-react"
|
||||||
import { adminCompaniesApi } from "@/lib/api"
|
import { adminCompaniesApi } from "@/lib/api"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { useTranslation } from "@/lib/i18n"
|
import { useTranslation } from "@/lib/i18n"
|
||||||
import { Card, CardContent } from "@/components/ui/card"
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
|
|
||||||
const formatCNPJ = (value: string) => {
|
const formatCNPJ = (value: string) => {
|
||||||
|
|
@ -85,22 +85,39 @@ export default function NewCompanyPage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8 max-w-3xl mx-auto">
|
<div className="container max-w-4xl py-10">
|
||||||
<div className="flex items-center gap-4">
|
<div className="mb-8">
|
||||||
<Button variant="ghost" size="icon" asChild>
|
<Button variant="ghost" size="sm" asChild className="mb-4">
|
||||||
<Link href="/dashboard/companies">
|
<Link href="/dashboard/companies" className="flex items-center gap-2">
|
||||||
<ArrowLeft className="h-5 w-5" />
|
<ArrowLeft className="h-4 w-4" />
|
||||||
|
{t('admin.companies.create.backToList', { defaultValue: 'Voltar para lista' })}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
<div>
|
|
||||||
<h1 className="text-3xl font-bold text-foreground">{t('admin.companies.create.title')}</h1>
|
|
||||||
<p className="text-muted-foreground mt-1">{t('admin.companies.create.subtitle')}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card>
|
<Card className="border-0 shadow-lg">
|
||||||
<CardContent className="pt-6">
|
<CardHeader className="bg-muted/50 pb-8 pt-8">
|
||||||
<div className="grid gap-6">
|
<div className="flex items-center gap-4">
|
||||||
|
<div className="bg-primary/10 p-3 rounded-xl">
|
||||||
|
<Building2 className="h-8 w-8 text-primary" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<CardTitle className="text-2xl font-bold">{t('admin.companies.create.title')}</CardTitle>
|
||||||
|
<CardDescription className="text-base mt-1">
|
||||||
|
{t('admin.companies.create.subtitle')}
|
||||||
|
</CardDescription>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="pt-8">
|
||||||
|
<div className="grid gap-8">
|
||||||
|
{/* Seção: Informações Básicas */}
|
||||||
|
<div className="grid gap-4">
|
||||||
|
<h3 className="text-lg font-semibold border-b pb-2 flex items-center gap-2">
|
||||||
|
<span className="bg-primary w-1 h-5 rounded-full"></span>
|
||||||
|
{t('admin.companies.sections.basicInfo', { defaultValue: 'Informações Básicas' })}
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">{t('admin.companies.create.name')}</Label>
|
<Label htmlFor="name">{t('admin.companies.create.name')}</Label>
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -125,6 +142,8 @@ export default function NewCompanyPage() {
|
||||||
placeholder={t('admin.companies.create.slugPlaceholder')}
|
placeholder={t('admin.companies.create.slugPlaceholder')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="document">{t('admin.companies.fields.document')}</Label>
|
<Label htmlFor="document">{t('admin.companies.fields.document')}</Label>
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -145,6 +164,15 @@ export default function NewCompanyPage() {
|
||||||
placeholder={t('admin.companies.create.emailPlaceholder')}
|
placeholder={t('admin.companies.create.emailPlaceholder')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Seção: Segurança */}
|
||||||
|
<div className="grid gap-4">
|
||||||
|
<h3 className="text-lg font-semibold border-b pb-2 flex items-center gap-2">
|
||||||
|
<span className="bg-primary w-1 h-5 rounded-full"></span>
|
||||||
|
{t('admin.companies.sections.security', { defaultValue: 'Segurança' })}
|
||||||
|
</h3>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="password">{t('admin.companies.fields.password')}</Label>
|
<Label htmlFor="password">{t('admin.companies.fields.password')}</Label>
|
||||||
|
|
@ -200,6 +228,15 @@ export default function NewCompanyPage() {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Seção: Contato e Localização */}
|
||||||
|
<div className="grid gap-4">
|
||||||
|
<h3 className="text-lg font-semibold border-b pb-2 flex items-center gap-2">
|
||||||
|
<span className="bg-primary w-1 h-5 rounded-full"></span>
|
||||||
|
{t('admin.companies.sections.contact', { defaultValue: 'Contato e Localização' })}
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="phone">{t('admin.companies.fields.phone')}</Label>
|
<Label htmlFor="phone">{t('admin.companies.fields.phone')}</Label>
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -207,7 +244,7 @@ export default function NewCompanyPage() {
|
||||||
maxLength={15}
|
maxLength={15}
|
||||||
value={formData.phone}
|
value={formData.phone}
|
||||||
onChange={(e) => setFormData({ ...formData, phone: formatPhone(e.target.value) })}
|
onChange={(e) => setFormData({ ...formData, phone: formatPhone(e.target.value) })}
|
||||||
placeholder="+55 11 99999-9999"
|
placeholder="(99) 99999-9999"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
|
|
@ -216,28 +253,38 @@ export default function NewCompanyPage() {
|
||||||
id="website"
|
id="website"
|
||||||
value={formData.website}
|
value={formData.website}
|
||||||
onChange={(e) => setFormData({ ...formData, website: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, website: e.target.value })}
|
||||||
placeholder="https://..."
|
placeholder="https://example.com"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="address">{t('admin.companies.fields.address')}</Label>
|
<Label htmlFor="address">{t('admin.companies.fields.address')}</Label>
|
||||||
<Input
|
<Input
|
||||||
id="address"
|
id="address"
|
||||||
value={formData.address}
|
value={formData.address}
|
||||||
onChange={(e) => setFormData({ ...formData, address: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, address: e.target.value })}
|
||||||
placeholder="Address..."
|
placeholder="Endereço completo"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Seção: Detalhes da Empresa */}
|
||||||
|
<div className="grid gap-4">
|
||||||
|
<h3 className="text-lg font-semibold border-b pb-2 flex items-center gap-2">
|
||||||
|
<span className="bg-primary w-1 h-5 rounded-full"></span>
|
||||||
|
{t('admin.companies.sections.details', { defaultValue: 'Detalhes Adicionais' })}
|
||||||
|
</h3>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="description">{t('admin.companies.fields.description')}</Label>
|
<Label htmlFor="description">{t('admin.companies.fields.description')}</Label>
|
||||||
<Textarea
|
<Textarea
|
||||||
id="description"
|
id="description"
|
||||||
value={formData.description}
|
value={formData.description}
|
||||||
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
|
||||||
placeholder="Company description..."
|
placeholder="Conte um pouco sobre a empresa..."
|
||||||
className="min-h-[120px]"
|
className="min-h-[120px] resize-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="logoUrl">Logo URL</Label>
|
<Label htmlFor="logoUrl">Logo URL</Label>
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -251,19 +298,27 @@ export default function NewCompanyPage() {
|
||||||
<Label htmlFor="yearsInMarket">Anos no mercado</Label>
|
<Label htmlFor="yearsInMarket">Anos no mercado</Label>
|
||||||
<Input
|
<Input
|
||||||
id="yearsInMarket"
|
id="yearsInMarket"
|
||||||
|
type="number"
|
||||||
value={formData.yearsInMarket}
|
value={formData.yearsInMarket}
|
||||||
onChange={(e) => setFormData({ ...formData, yearsInMarket: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, yearsInMarket: e.target.value })}
|
||||||
placeholder="Ex: 10"
|
placeholder="Ex: 10"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end gap-4 pt-4 border-t">
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-end gap-4 pt-6 mt-4 border-t">
|
||||||
<Button variant="outline" asChild>
|
<Button variant="outline" asChild>
|
||||||
<Link href="/dashboard/companies">
|
<Link href="/dashboard/companies">
|
||||||
{t('admin.companies.create.cancel')}
|
{t('admin.companies.create.cancel')}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleCreate} disabled={creating}>
|
<Button onClick={handleCreate} disabled={creating} className="min-w-[140px]">
|
||||||
{creating && <Loader2 className="h-4 w-4 mr-2 animate-spin" />}
|
{creating ? (
|
||||||
|
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||||
|
) : (
|
||||||
|
<Building2 className="h-4 w-4 mr-2" />
|
||||||
|
)}
|
||||||
{t('admin.companies.create.submit')}
|
{t('admin.companies.create.submit')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue