feat: add format date(#40)
Some checks failed
it-academy/dry-wash-pl/pipeline/pr-main There was a failure building this commit

This commit is contained in:
2024-11-24 12:08:45 +03:00
parent 920f4440e9
commit acd39b1e32
8 changed files with 61 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Badge, Link, Stack, Td, Tr } from '@chakra-ui/react';
import MasterActionsMenu from '../MasterActionsMenu';
import { getTimeSlot } from '../../lib/date-helpers';
const MasterItem = ({ name, schedule, phone }) => {
return (
@@ -9,9 +9,9 @@ const MasterItem = ({ name, schedule, phone }) => {
<Td>{name}</Td>
<Td>
<Stack direction='row'>
{schedule.map((time, index) => (
{schedule.map(({ startWashTime, endWashTime }, index) => (
<Badge colorScheme={'green'} key={index}>
{time}
{getTimeSlot(startWashTime, endWashTime)}
</Badge>
))}
</Stack>

View File

@@ -1,6 +1,8 @@
import React, { useState } from 'react';
import { Td, Tr, Link, Select } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import dayjs from 'dayjs';
import { getTimeSlot } from '../../lib/date-helpers';
const statuses = [
'pending' as const,
@@ -15,7 +17,8 @@ type GetArrItemType<ArrType> =
export type OrderProps = {
carNumber?: string;
washTime?: string;
startWashTime?: string;
endWashTime?: string;
orderDate?: string;
status?: GetArrItemType<typeof statuses>;
phone?: string;
@@ -24,7 +27,8 @@ export type OrderProps = {
const OrderItem = ({
carNumber,
washTime,
startWashTime,
endWashTime,
orderDate,
status,
phone,
@@ -39,8 +43,8 @@ const OrderItem = ({
return (
<Tr>
<Td>{carNumber}</Td>
<Td>{washTime}</Td>
<Td>{orderDate}</Td>
<Td>{getTimeSlot(startWashTime, endWashTime)}</Td>
<Td>{dayjs(orderDate).format('DD.MM.YYYY')}</Td>
<Td>
<Select
value={statusSelect}