2025-01-12 00:34:37 +03:00

44 lines
938 B
TypeScript

import React from 'react';
import { Badge, Link, Stack, Td, Tr } from '@chakra-ui/react';
import MasterActionsMenu from '../MasterActionsMenu';
import { getTimeSlot } from '../../lib';
export interface Schedule {
id: string;
startWashTime: string;
endWashTime: string;
}
export type MasterProps = {
id: string;
name: string;
phone: string;
schedule: Schedule[];
};
const MasterItem = ({ name, phone, id, schedule }) => {
return (
<Tr>
<Td>{name}</Td>
<Td>
<Stack direction='row'>
{schedule.map(({ startWashTime, endWashTime }, index) => (
<Badge colorScheme={'green'} key={index}>
{getTimeSlot(startWashTime, endWashTime)}
</Badge>
))}
</Stack>
</Td>
<Td>
<Link href='tel:'>{phone}</Link>
</Td>
<Td>
<MasterActionsMenu id={id} />
</Td>
</Tr>
);
};
export default MasterItem;