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"
|
inputMode="numeric"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="status">Durum</Label>
|
<Label htmlFor="status">Durum</Label>
|
||||||
<Select name="status" defaultValue={customer?.status ?? "active"}>
|
<Select name="status" defaultValue={customer?.status ?? "active"}>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ export type CustomerRow = {
|
|||||||
email: string;
|
email: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
taxId: string;
|
taxId: string;
|
||||||
|
taxOffice: string;
|
||||||
|
website: string;
|
||||||
address: string;
|
address: string;
|
||||||
notes: string;
|
notes: string;
|
||||||
status: "active" | "passive";
|
status: "active" | "passive";
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ export default async function CustomersPage() {
|
|||||||
email: c.email ?? "",
|
email: c.email ?? "",
|
||||||
phone: c.phone ?? "",
|
phone: c.phone ?? "",
|
||||||
taxId: c.taxId ?? "",
|
taxId: c.taxId ?? "",
|
||||||
|
taxOffice: c.taxOffice ?? "",
|
||||||
|
website: c.website ?? "",
|
||||||
address: c.address ?? "",
|
address: c.address ?? "",
|
||||||
notes: c.notes ?? "",
|
notes: c.notes ?? "",
|
||||||
status: (c.status ?? "active") as "active" | "passive",
|
status: (c.status ?? "active") as "active" | "passive",
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ function pickFormFields(formData: FormData) {
|
|||||||
email: String(formData.get("email") ?? "").trim(),
|
email: String(formData.get("email") ?? "").trim(),
|
||||||
phone: String(formData.get("phone") ?? "").trim(),
|
phone: String(formData.get("phone") ?? "").trim(),
|
||||||
taxId: String(formData.get("taxId") ?? "").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(),
|
address: String(formData.get("address") ?? "").trim(),
|
||||||
notes: String(formData.get("notes") ?? "").trim(),
|
notes: String(formData.get("notes") ?? "").trim(),
|
||||||
status: (formData.get("status") as "active" | "passive" | null) ?? "active",
|
status: (formData.get("status") as "active" | "passive" | null) ?? "active",
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ export interface Customer extends Row {
|
|||||||
email?: string;
|
email?: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
taxId?: string;
|
taxId?: string;
|
||||||
|
taxOffice?: string;
|
||||||
|
website?: string;
|
||||||
address?: string;
|
address?: string;
|
||||||
notes?: string;
|
notes?: string;
|
||||||
status?: CustomerStatus;
|
status?: CustomerStatus;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ export const customerSchema = z.object({
|
|||||||
.transform((v) => (v ? v : undefined)),
|
.transform((v) => (v ? v : undefined)),
|
||||||
phone: z.string().trim().max(30).optional().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)),
|
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)),
|
address: z.string().trim().max(500).optional().transform((v) => (v ? v : undefined)),
|
||||||
notes: z.string().trim().max(2000).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"),
|
status: z.enum(["active", "passive"]).optional().default("active"),
|
||||||
|
|||||||
Reference in New Issue
Block a user