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, Radio, Modal, App, Select } from 'antd'; import dayjs from "dayjs"; import { useStore } from '@/stores/StoreContext.js'; import { formatDate, isEmpty } from "@/utils/commons"; import { DATE_PRESETS } from "@/config"; import { formatDate, isNotEmpty } from "@/utils/commons"; const { Title } = Typography; function Newest() { const reservationListColumns = [ { title: 'Reference number', dataIndex: 'referenceNumber', key: 'Reference number', render: (text, record) => { const requiredHighlight = dayjs(record.arrivalDate).add(2, 'day').isBefore(dayjs(), 'day') && isEmpty(record.guide); const linkClassName = requiredHighlight ? 'reservation-highlight' : ''; return ( {text} ) }, }, { title: 'Arrival date', dataIndex: 'arrivalDate', key: 'Arrival date', render: (text, record) => (isEmpty(text) ? '' : dayjs(text).format('YYYY-MM-DD')), }, { title: 'Pax', key: 'Pax', dataIndex: 'pax' }, { title: 'Status', key: 'Status', dataIndex: 'status' }, { title: 'Res. sending date', key: 'Reservation date', dataIndex: 'reservationDate', render: (text, record) => (isEmpty(text) ? '' : dayjs(text).format('YYYY-MM-DD')), }, { title: 'Guide', key: 'Guide', dataIndex: 'guide', render: guideRender }, ]; function guideRender(text, reservation) { if (reservation.guide === '') { return ( ); } else { return ( {reservation.guide} ); } } function cityGuideRender(text, city) { return ( { reservationStore.updatePropertyValue('referenceNo', e.target.value)} } /> Arrival Date { reservationStore.updatePropertyValue('arrivalDateRange', dateRange == null ? [] : dateRange) }} /> 'Reservations without the tour guide information will be highlighted in red if the arrival date is within 3 days.'} bordered loading={dataLoading} pagination={{ position: ['bottomCenter'], current: reservationPage.current, pageSize: reservationPage.size, total: reservationPage.total, simple: true }} onChange={(pagination, filters, sorter, extra) => {onSearchClick(pagination.current);}} columns={reservationListColumns} dataSource={reservationList} /> ); } export default observer(Newest);