260915_01_ENH: 다운로드 결과값 포함 및 컨택 이력 정렬 옵션 추가
This commit is contained in:
@@ -4,13 +4,20 @@ import { useState } from 'react'
|
||||
import { Download } from 'lucide-react'
|
||||
import { KriDialog } from '@/components/common/KriDialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
import ApplyFilterOption, { validateApplyFilterTarget } from './ListDialogOption/ApplyFilterOption'
|
||||
import KriDateRangePicker from '@/components/common/KriDateRangePicker'
|
||||
import type { ContactHistoryDownloadType, ListDownloadMode, ListDownloadPayload, ListFilterTarget } from '@/types/list'
|
||||
import {
|
||||
type ContactHistoryDownloadType,
|
||||
ListEventHistoryOrder,
|
||||
type ListDownloadMode,
|
||||
type ListDownloadPayload,
|
||||
type ListFilterTarget,
|
||||
} from '@/types/list'
|
||||
|
||||
export type ListDownloadDialogProps = {
|
||||
dialogId?: DialogId
|
||||
@@ -43,6 +50,8 @@ const ListDownloadDialog = ({
|
||||
const [contactHistoryDateFrom, setContactHistoryDateFrom] = useState('')
|
||||
const [contactHistoryDateTo, setContactHistoryDateTo] = useState('')
|
||||
const [contactHistoryType, setContactHistoryType] = useState<ContactHistoryDownloadType>('all')
|
||||
const [historyOrder, setHistoryOrder] = useState<ListEventHistoryOrder>(ListEventHistoryOrder.DESC)
|
||||
const [includeResult, setIncludeResult] = useState(true)
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId)
|
||||
@@ -78,9 +87,11 @@ const ListDownloadDialog = ({
|
||||
mode,
|
||||
target,
|
||||
onlyFiltered: target === 'filtered',
|
||||
includeResult,
|
||||
contactHistoryDateFrom: mode === 'contact-history' ? contactHistoryDateFrom || undefined : undefined,
|
||||
contactHistoryDateTo: mode === 'contact-history' ? contactHistoryDateTo || undefined : undefined,
|
||||
contactHistoryType: mode === 'contact-history' ? contactHistoryType : undefined,
|
||||
historyOrder: mode === 'contact-history' ? historyOrder : undefined,
|
||||
})
|
||||
handleOpenChange(false)
|
||||
} finally {
|
||||
@@ -130,6 +141,16 @@ const ListDownloadDialog = ({
|
||||
filterSummary={filterSummary}
|
||||
/>
|
||||
</div>
|
||||
{mode === 'list' || mode === 'contact-history' ? (
|
||||
<div className="flex items-center gap-2 rounded-md border p-4">
|
||||
<Checkbox
|
||||
id="download-include-result"
|
||||
checked={includeResult}
|
||||
onCheckedChange={(checked) => setIncludeResult(checked === true)}
|
||||
/>
|
||||
<Label className="text-base" htmlFor="download-include-result">결과값 포함</Label>
|
||||
</div>
|
||||
) : null}
|
||||
{mode === 'contact-history' ? (
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="text-lg font-semibold">이력 기준</p>
|
||||
@@ -149,6 +170,25 @@ const ListDownloadDialog = ({
|
||||
</RadioGroup>
|
||||
</div>
|
||||
) : null}
|
||||
{mode === 'contact-history' && contactHistoryType === 'all' ? (
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="text-lg font-semibold">이력 순서</p>
|
||||
<RadioGroup
|
||||
value={historyOrder}
|
||||
onValueChange={(value) => setHistoryOrder(value as ListEventHistoryOrder)}
|
||||
className="flex items-center gap-6 flex-wrap"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value={ListEventHistoryOrder.DESC} id="download-history-order-desc" />
|
||||
<Label className="text-base" htmlFor="download-history-order-desc">최근 이력이 왼쪽부터</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value={ListEventHistoryOrder.ASC} id="download-history-order-asc" />
|
||||
<Label className="text-base" htmlFor="download-history-order-asc">오래된 이력이 왼쪽부터</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
) : null}
|
||||
</KriDialog>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user