feat(sales): replace import page with dialog UI and support template download
This commit is contained in:
@@ -28,6 +28,7 @@ import Pagination from "@/Components/shared/Pagination";
|
||||
import { SearchableSelect } from "@/Components/ui/searchable-select";
|
||||
import { router } from "@inertiajs/react";
|
||||
import { usePermission } from "@/hooks/usePermission";
|
||||
import SalesImportDialog from "@/Components/Sales/SalesImportDialog";
|
||||
|
||||
interface ImportBatch {
|
||||
id: number;
|
||||
@@ -54,6 +55,7 @@ interface Props {
|
||||
export default function SalesImportIndex({ batches, filters = {} }: Props) {
|
||||
const { can } = usePermission();
|
||||
const [perPage, setPerPage] = useState(filters?.per_page?.toString() || "10");
|
||||
const [isImportDialogOpen, setIsImportDialogOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (filters?.per_page) {
|
||||
@@ -91,15 +93,21 @@ export default function SalesImportIndex({ batches, filters = {} }: Props) {
|
||||
</p>
|
||||
</div>
|
||||
{can('sales_imports.create') && (
|
||||
<Link href={route('sales-imports.create')}>
|
||||
<Button className="button-filled-primary gap-2">
|
||||
<Plus className="h-4 w-4" />
|
||||
新增匯入
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
className="button-filled-primary gap-2"
|
||||
onClick={() => setIsImportDialogOpen(true)}
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
新增匯入
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<SalesImportDialog
|
||||
open={isImportDialogOpen}
|
||||
onOpenChange={setIsImportDialogOpen}
|
||||
/>
|
||||
|
||||
<div className="bg-white rounded-lg border shadow-sm overflow-hidden">
|
||||
<Table>
|
||||
<TableHeader className="bg-gray-50">
|
||||
|
||||
Reference in New Issue
Block a user