mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
add dropdown logic for revenue report, defaults to USD for unknown currency code
This commit is contained in:
parent
214396f4b6
commit
be50e8a575
8 changed files with 155 additions and 12 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { useMessages } from 'components/hooks';
|
||||
import useRevenueValues from 'components/hooks/queries/useRevenueValues';
|
||||
import { useContext } from 'react';
|
||||
import { Dropdown, Form, FormButtons, FormInput, FormRow, Item, SubmitButton } from 'react-basics';
|
||||
import BaseParameters from '../[reportId]/BaseParameters';
|
||||
|
|
@ -10,6 +11,7 @@ export function RevenueParameters() {
|
|||
const { id, parameters } = report || {};
|
||||
const { websiteId, dateRange } = parameters || {};
|
||||
const queryEnabled = websiteId && dateRange;
|
||||
const { data: values = [] } = useRevenueValues(websiteId, dateRange.startDate, dateRange.endDate);
|
||||
|
||||
const handleSubmit = (data: any, e: any) => {
|
||||
e.stopPropagation();
|
||||
|
|
@ -23,7 +25,7 @@ export function RevenueParameters() {
|
|||
<BaseParameters showDateSelect={true} allowWebsiteSelect={!id} />
|
||||
<FormRow label={formatMessage(labels.currency)}>
|
||||
<FormInput name="currency" rules={{ required: formatMessage(labels.required) }}>
|
||||
<Dropdown items={['USD', 'EUR', 'MXN']}>
|
||||
<Dropdown items={values.map(item => item.currency)}>
|
||||
{item => <Item key={item}>{item}</Item>}
|
||||
</Dropdown>
|
||||
</FormInput>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue