ERP-node/frontend/lib/registry/components/tax-invoice-list/TaxInvoiceListConfigPanel.tsx

133 lines
5.0 KiB
TypeScript

"use client";
/**
* 세금계산서 목록 설정 패널
*/
import React from "react";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { TaxInvoiceListConfig, defaultTaxInvoiceListConfig } from "./types";
interface TaxInvoiceListConfigPanelProps {
config: TaxInvoiceListConfig;
onChange: (config: TaxInvoiceListConfig) => void;
}
export function TaxInvoiceListConfigPanel({ config, onChange }: TaxInvoiceListConfigPanelProps) {
const currentConfig = { ...defaultTaxInvoiceListConfig, ...config };
const handleChange = (key: keyof TaxInvoiceListConfig, value: any) => {
onChange({ ...currentConfig, [key]: value });
};
return (
<div className="space-y-4">
{/* 기본 설정 */}
<div className="space-y-3">
<h4 className="text-sm font-medium"> </h4>
<div>
<Label className="text-xs"></Label>
<Input
value={currentConfig.title || ""}
onChange={(e) => handleChange("title", e.target.value)}
placeholder="세금계산서 관리"
className="h-8 text-xs"
/>
</div>
<div className="flex items-center justify-between">
<Label className="text-xs"> </Label>
<Switch
checked={currentConfig.showHeader}
onCheckedChange={(checked) => handleChange("showHeader", checked)}
/>
</div>
</div>
{/* 기본 필터 */}
<div className="space-y-3">
<h4 className="text-sm font-medium"> </h4>
<div>
<Label className="text-xs"> </Label>
<Select value={currentConfig.defaultInvoiceType} onValueChange={(v) => handleChange("defaultInvoiceType", v)}>
<SelectTrigger className="h-8 text-xs">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="all"></SelectItem>
<SelectItem value="sales"></SelectItem>
<SelectItem value="purchase"></SelectItem>
</SelectContent>
</Select>
</div>
<div>
<Label className="text-xs"> </Label>
<Select value={currentConfig.defaultStatus} onValueChange={(v) => handleChange("defaultStatus", v)}>
<SelectTrigger className="h-8 text-xs">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="all"></SelectItem>
<SelectItem value="draft"></SelectItem>
<SelectItem value="issued"></SelectItem>
<SelectItem value="sent"></SelectItem>
<SelectItem value="cancelled"></SelectItem>
</SelectContent>
</Select>
</div>
<div>
<Label className="text-xs"> </Label>
<Select value={String(currentConfig.pageSize)} onValueChange={(v) => handleChange("pageSize", parseInt(v))}>
<SelectTrigger className="h-8 text-xs">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="10">10</SelectItem>
<SelectItem value="20">20</SelectItem>
<SelectItem value="50">50</SelectItem>
<SelectItem value="100">100</SelectItem>
</SelectContent>
</Select>
</div>
</div>
{/* 권한 설정 */}
<div className="space-y-3">
<h4 className="text-sm font-medium"> </h4>
<div className="flex items-center justify-between">
<Label className="text-xs"> </Label>
<Switch checked={currentConfig.canCreate} onCheckedChange={(checked) => handleChange("canCreate", checked)} />
</div>
<div className="flex items-center justify-between">
<Label className="text-xs"> </Label>
<Switch checked={currentConfig.canEdit} onCheckedChange={(checked) => handleChange("canEdit", checked)} />
</div>
<div className="flex items-center justify-between">
<Label className="text-xs"> </Label>
<Switch checked={currentConfig.canDelete} onCheckedChange={(checked) => handleChange("canDelete", checked)} />
</div>
<div className="flex items-center justify-between">
<Label className="text-xs"> </Label>
<Switch checked={currentConfig.canIssue} onCheckedChange={(checked) => handleChange("canIssue", checked)} />
</div>
<div className="flex items-center justify-between">
<Label className="text-xs"> </Label>
<Switch checked={currentConfig.canCancel} onCheckedChange={(checked) => handleChange("canCancel", checked)} />
</div>
</div>
</div>
);
}