import { NavLink, useLocation } from "react-router-dom"; import { useState, useEffect } from 'react'; import { observer } from "mobx-react"; import { toJS } from "mobx"; import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, Modal, App, Select } from 'antd'; import dayjs from "dayjs"; import { useStore } from '@/stores/StoreContext.js'; import { isEmpty, objectMapper } from "@/utils/commons"; import { useTranslation } from 'react-i18next'; import usePresets from '@/hooks/usePresets'; import useAuthStore from '@/stores/Auth' import useReservationStore from '@/stores/Reservation' import SearchForm from '@/components/SearchForm'; const { Title } = Typography; function Newest() { const { t } = useTranslation(); const presets = usePresets(); const reservationListColumns = [ { title: t('group:RefNo'), dataIndex: 'referenceNumber', key: 'Reference number', render: (text, record) => { const after3Dayjs = dayjs().add(3, 'day'); const lastDayjs = dayjs().subtract(1, 'day'); const arrivalDatejs = dayjs(record.arrivalDate); const requiredHighlight = (arrivalDatejs.isAfter(lastDayjs) && arrivalDatejs.isBefore(after3Dayjs, 'day')) && isEmpty(record.guide); const linkClassName = requiredHighlight ? 'reservation-highlight' : ''; return ( {text} ) }, }, { title: t('group:ArrivalDate'), dataIndex: 'arrivalDate', key: 'Arrival date', render: (text, record) => (isEmpty(text) ? '' : dayjs(text).format('YYYY-MM-DD')), }, { title: t('group:Pax'), key: 'Pax', dataIndex: 'pax' }, { title: t('group:Status'), key: 'Status', dataIndex: 'status' }, { title: t('group:ResSendingDate'), key: 'Reservation date', dataIndex: 'reservationDate', render: (text, record) => (isEmpty(text) ? '' : dayjs(text).format('YYYY-MM-DD')), }, { title: t('group:Guide'), key: 'Guide', dataIndex: 'guide', render: guideRender }, ]; function guideRender(text, reservation) { if (reservation.guide === '') { return ( ); } else { return ( {reservation.guide} ); } } function cityGuideRender(text, city) { return (