68 lines
2.8 KiB
TypeScript
68 lines
2.8 KiB
TypeScript
import { Head, useForm, Link } from '@inertiajs/react';
|
|
import React from 'react';
|
|
import { Button } from '@/components/ui/button';
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
import { Input } from '@/components/ui/input';
|
|
import { Label } from '@/components/ui/label';
|
|
import { Separator } from '@/components/ui/separator';
|
|
import AppLayout from '@/layouts/app-layout';
|
|
|
|
export default function Create() {
|
|
const { data, setData, post, processing, errors } = useForm({
|
|
name: '',
|
|
});
|
|
|
|
const submit = (e: React.FormEvent) => {
|
|
e.preventDefault();
|
|
post('/admin/positions');
|
|
};
|
|
|
|
return (
|
|
<AppLayout>
|
|
<Head title="Tambah Jabatan" />
|
|
|
|
<div className="p-4 md:p-8 w-full">
|
|
<div className="flex items-center justify-between mb-6">
|
|
<div>
|
|
<h2 className="text-2xl font-bold tracking-tight">Tambah Jabatan</h2>
|
|
<p className="text-muted-foreground">Buat posisi atau level baru.</p>
|
|
</div>
|
|
<Button variant="outline" asChild>
|
|
<Link href="/admin/positions">Kembali</Link>
|
|
</Button>
|
|
</div>
|
|
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Form Jabatan</CardTitle>
|
|
</CardHeader>
|
|
<Separator />
|
|
<CardContent className="pt-6">
|
|
<form onSubmit={submit} className="space-y-6">
|
|
|
|
<div className="max-w-xl space-y-2">
|
|
<Label>Nama Jabatan <span className="text-red-500">*</span></Label>
|
|
<Input
|
|
placeholder="Contoh: Senior Backend Developer"
|
|
value={data.name}
|
|
onChange={e => setData('name', e.target.value)}
|
|
/>
|
|
{errors.name && <div className="text-red-500 text-xs">{errors.name}</div>}
|
|
</div>
|
|
|
|
<div className="flex justify-start gap-4 pt-4">
|
|
<Button type="submit" disabled={processing}>
|
|
Simpan Jabatan
|
|
</Button>
|
|
<Button type="button" variant="ghost" asChild>
|
|
<Link href="/admin/positions">Batal</Link>
|
|
</Button>
|
|
</div>
|
|
|
|
</form>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</AppLayout>
|
|
);
|
|
} |