feat: add taxOffice and website fields to customers (db: customers)
This commit is contained in:
@@ -122,6 +122,28 @@ export function CustomerFormSheet({ open, onOpenChange, customer }: Props) {
|
||||
inputMode="numeric"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="taxOffice">Vergi dairesi</Label>
|
||||
<Input
|
||||
id="taxOffice"
|
||||
name="taxOffice"
|
||||
defaultValue={customer?.taxOffice ?? ""}
|
||||
placeholder="Kadıköy VD"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="website">Web sitesi</Label>
|
||||
<Input
|
||||
id="website"
|
||||
name="website"
|
||||
type="url"
|
||||
defaultValue={customer?.website ?? ""}
|
||||
placeholder="https://firma.com"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="status">Durum</Label>
|
||||
<Select name="status" defaultValue={customer?.status ?? "active"}>
|
||||
|
||||
@@ -4,6 +4,8 @@ export type CustomerRow = {
|
||||
email: string;
|
||||
phone: string;
|
||||
taxId: string;
|
||||
taxOffice: string;
|
||||
website: string;
|
||||
address: string;
|
||||
notes: string;
|
||||
status: "active" | "passive";
|
||||
|
||||
@@ -43,6 +43,8 @@ export default async function CustomersPage() {
|
||||
email: c.email ?? "",
|
||||
phone: c.phone ?? "",
|
||||
taxId: c.taxId ?? "",
|
||||
taxOffice: c.taxOffice ?? "",
|
||||
website: c.website ?? "",
|
||||
address: c.address ?? "",
|
||||
notes: c.notes ?? "",
|
||||
status: (c.status ?? "active") as "active" | "passive",
|
||||
|
||||
@@ -29,6 +29,8 @@ function pickFormFields(formData: FormData) {
|
||||
email: String(formData.get("email") ?? "").trim(),
|
||||
phone: String(formData.get("phone") ?? "").trim(),
|
||||
taxId: String(formData.get("taxId") ?? "").trim(),
|
||||
taxOffice: String(formData.get("taxOffice") ?? "").trim(),
|
||||
website: String(formData.get("website") ?? "").trim(),
|
||||
address: String(formData.get("address") ?? "").trim(),
|
||||
notes: String(formData.get("notes") ?? "").trim(),
|
||||
status: (formData.get("status") as "active" | "passive" | null) ?? "active",
|
||||
|
||||
@@ -73,6 +73,8 @@ export interface Customer extends Row {
|
||||
email?: string;
|
||||
phone?: string;
|
||||
taxId?: string;
|
||||
taxOffice?: string;
|
||||
website?: string;
|
||||
address?: string;
|
||||
notes?: string;
|
||||
status?: CustomerStatus;
|
||||
|
||||
@@ -8,6 +8,8 @@ export const customerSchema = z.object({
|
||||
.transform((v) => (v ? v : undefined)),
|
||||
phone: z.string().trim().max(30).optional().transform((v) => (v ? v : undefined)),
|
||||
taxId: z.string().trim().max(50).optional().transform((v) => (v ? v : undefined)),
|
||||
taxOffice: z.string().trim().max(100).optional().transform((v) => (v ? v : undefined)),
|
||||
website: z.string().trim().max(255).optional().transform((v) => (v ? v : undefined)),
|
||||
address: z.string().trim().max(500).optional().transform((v) => (v ? v : undefined)),
|
||||
notes: z.string().trim().max(2000).optional().transform((v) => (v ? v : undefined)),
|
||||
status: z.enum(["active", "passive"]).optional().default("active"),
|
||||
|
||||
Reference in New Issue
Block a user