prepare onClick ReloadButton
This commit is contained in:
parent
8b570e3a80
commit
77ea1d5019
@ -4,13 +4,15 @@ import { observer } from 'mobx-react-lite';
|
||||
import { Button } from 'ui/antd';
|
||||
import { ReloadOutlined } from 'ui/elements/icons';
|
||||
|
||||
export const ReloadButton = observer(({ storeSelector }: { storeSelector: StoreSelector }) => {
|
||||
const { $tables } = useStore();
|
||||
const { validation } = storeSelector($tables.elt);
|
||||
export const ReloadButton = observer(
|
||||
({ storeSelector, onClick }: { onClick: () => void; storeSelector: StoreSelector }) => {
|
||||
const { $tables } = useStore();
|
||||
const { validation } = storeSelector($tables.elt);
|
||||
|
||||
const hasErrors = validation.hasErrors;
|
||||
const hasErrors = validation.hasErrors;
|
||||
|
||||
return (
|
||||
<Button onClick={() => {}} disabled={hasErrors} shape="circle" icon={<ReloadOutlined />} />
|
||||
);
|
||||
});
|
||||
return (
|
||||
<Button onClick={onClick} disabled={hasErrors} shape="circle" icon={<ReloadOutlined />} />
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@ -4,17 +4,18 @@ import type { StoreSelector } from './types';
|
||||
import { clone } from 'tools';
|
||||
import { Flex } from 'ui/grid';
|
||||
|
||||
const getter: StoreSelector = ({ osago }) => osago;
|
||||
const storeSelector: StoreSelector = ({ kasko }) => kasko;
|
||||
|
||||
const kaskoColumns = clone(columns);
|
||||
kaskoColumns[0].title = 'Страховая компания КАСКО';
|
||||
kaskoColumns[3].title = <ReloadButton storeSelector={getter} />;
|
||||
function handleOnClick() {}
|
||||
|
||||
export function Kasko() {
|
||||
const kaskoColumns = clone(columns);
|
||||
kaskoColumns[0].title = 'Страховая компания КАСКО';
|
||||
kaskoColumns[3].title = <ReloadButton storeSelector={storeSelector} onClick={handleOnClick} />;
|
||||
return (
|
||||
<Flex flexDirection="column">
|
||||
<Validation storeSelector={getter} />
|
||||
<PolicyTable storeSelector={getter} columns={kaskoColumns} />
|
||||
<Validation storeSelector={storeSelector} />
|
||||
<PolicyTable storeSelector={storeSelector} columns={kaskoColumns} />
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,11 +6,13 @@ import { Flex } from 'ui/grid';
|
||||
|
||||
const storeSelector: StoreSelector = ({ osago }) => osago;
|
||||
|
||||
const osagoColumns = clone(columns);
|
||||
osagoColumns[0].title = 'Страховая компания ОСАГО';
|
||||
osagoColumns[3].title = <ReloadButton storeSelector={storeSelector} />;
|
||||
function handleOnClick() {}
|
||||
|
||||
export function Osago() {
|
||||
const osagoColumns = clone(columns);
|
||||
osagoColumns[0].title = 'Страховая компания ОСАГО';
|
||||
osagoColumns[3].title = <ReloadButton storeSelector={storeSelector} onClick={handleOnClick} />;
|
||||
|
||||
return (
|
||||
<Flex flexDirection="column">
|
||||
<Validation storeSelector={storeSelector} />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user