feat(sales): replace import page with dialog UI and support template download
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 50s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-02-09 17:16:00 +08:00
parent 613eb555ba
commit 7cf640b2f4
6 changed files with 193 additions and 99 deletions

View File

@@ -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">