mirror of
https://github.com/umami-software/umami.git
synced 2026-02-15 18:15:35 +01:00
Add revenue.
This commit is contained in:
parent
3f477c5d50
commit
f3efe0c9c3
17 changed files with 488 additions and 4 deletions
51
src/app/(main)/reports/revenue/RevenueParameters.tsx
Normal file
51
src/app/(main)/reports/revenue/RevenueParameters.tsx
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { useMessages } from 'components/hooks';
|
||||
import { useContext } from 'react';
|
||||
import { Form, FormButtons, FormInput, FormRow, SubmitButton, TextField } from 'react-basics';
|
||||
import BaseParameters from '../[reportId]/BaseParameters';
|
||||
import { ReportContext } from '../[reportId]/Report';
|
||||
|
||||
export function RevenueParameters() {
|
||||
const { report, runReport, isRunning } = useContext(ReportContext);
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
||||
const { id, parameters } = report || {};
|
||||
const { websiteId, dateRange } = parameters || {};
|
||||
const queryDisabled = !websiteId || !dateRange;
|
||||
|
||||
const handleSubmit = (data: any, e: any) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (!queryDisabled) {
|
||||
runReport(data);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Form values={parameters} onSubmit={handleSubmit} preventSubmit={true}>
|
||||
<BaseParameters showDateSelect={true} allowWebsiteSelect={!id} />
|
||||
<FormRow label={formatMessage(labels.event)}>
|
||||
<FormInput name="eventName" rules={{ required: formatMessage(labels.required) }}>
|
||||
<TextField autoComplete="off" />
|
||||
</FormInput>
|
||||
</FormRow>
|
||||
<FormRow label={formatMessage(labels.revenueProperty)}>
|
||||
<FormInput name="revenueProperty" rules={{ required: formatMessage(labels.required) }}>
|
||||
<TextField autoComplete="off" />
|
||||
</FormInput>
|
||||
</FormRow>
|
||||
<FormRow label={formatMessage(labels.userProperty)}>
|
||||
<FormInput name="userProperty">
|
||||
<TextField autoComplete="off" />
|
||||
</FormInput>
|
||||
</FormRow>
|
||||
<FormButtons>
|
||||
<SubmitButton variant="primary" disabled={queryDisabled} isLoading={isRunning}>
|
||||
{formatMessage(labels.runQuery)}
|
||||
</SubmitButton>
|
||||
</FormButtons>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
export default RevenueParameters;
|
||||
Loading…
Add table
Add a link
Reference in a new issue