import React, { ReactElement } from 'react';
import LayoutAuthenticated from '../../layouts/Authenticated';
import { fetch } from '../../stores/ledger_entries/ledger_entriesSlice';
import EntityRecordViewPage from '../../components/EntityPage/EntityRecordViewPage';

const LedgerEntriesView = () => (
  <EntityRecordViewPage
    singularLabel="Ledger Entry"
    pluralLabel="Ledger Entries"
    stateKey="ledger_entries"
    recordKey="ledger_entries"
    fetchRecord={fetch}
    listHref="/ledger_entries/ledger_entries-list"
    editHref={(id) => `/ledger_entries/ledger_entries-edit/?id=${id ?? ''}`}
  />
);

LedgerEntriesView.getLayout = function getLayout(page: ReactElement) {
  return <LayoutAuthenticated permission={'READ_LEDGER_ENTRIES'}>{page}</LayoutAuthenticated>;
};

export default LedgerEntriesView;
