import { Anchor, Button, Group, Modal, SegmentedControl, Select, Stack, Table, Text, Textarea } from '@mantine/core'; import { useState } from 'react'; import { Link, useSearchParams } from 'react-router-dom'; import { useLeftOnPod, useLeftOnPodActions, usePods, type LeftDoc } from '../../api/hooks'; import { Can, ErrorAlert, fmtTs, PageHeader } from '../../components/common'; import { DataTable } from '../../components/states'; import { shortWhen } from '../../domain/runName'; import './admin.css'; /** The kinds of test document a run can leave on a pod (coworker/platform/left_on_pod.py KINDS), in words. */ export const LEFT_KINDS: Record = { ap_invoice: 'Payables invoice', po_requisition: 'Purchase requisition', po_order: 'Purchase order', po_receipt: 'Receipt of an order', gl_journal: 'Journal', ar_transaction: 'Receivables transaction', ar_receipt: 'Receivables receipt', }; const STATUS_FILTERS = [{ value: 'open', label: 'Open' }, { value: 'done', label: 'Done' }, { value: 'dismissed', label: 'Dismissed' }, { value: 'all', label: 'All' }]; const CHECK: Record = { still_on_pod: { tone: 'amber', words: 'Still on the pod' }, looks_resolved: { tone: 'green', words: 'Looks resolved' }, unknown: { tone: 'neutral', words: 'Could not tell' }, }; function DecideSheet({ doc, decision, onClose }: { doc: LeftDoc | null; decision: 'done' | 'dismiss'; onClose: () => void }) { const { decide } = useLeftOnPodActions(); const [note, setNote] = useState(''); const done = decision === 'done'; return ( {doc ? `${LEFT_KINDS[doc.kind] ?? doc.kind} ${doc.reference}` : ''} {done ? 'Say that it has been dealt with on the pod, or that nothing is needed.' : 'Say that it does not need to be dealt with.'} It leaves the open list; the name and the time are kept in the audit log.