import usePurchases from '../hooks/usePurchases';
import PurchasePanel from '../components/PurchasePanel';

export default function PurchaseTab() {
    const pur = usePurchases();

    return (
        <PurchasePanel
            records={pur.purchases}
            stats={pur.purchaseStats}
            loading={pur.purchaseLoading}
            formOpen={pur.purchaseFormOpen}
            form={pur.purchaseForm}
            formSaving={pur.purchaseFormSaving}
            formError={pur.purchaseFormError}
            editId={pur.purchaseEditId}
            onFormOpen={pur.handlePurchaseFormOpen}
            onFormClose={pur.handlePurchaseFormClose}
            onFormChange={pur.handlePurchaseFormChange}
            onFormSubmit={pur.handlePurchaseFormSubmit}
            onEditStart={pur.handlePurchaseEditStart}
            onDelete={pur.handlePurchaseDelete}
        />
    );
}
