@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
37 lines (36 loc) • 4.25 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import Input from '../../../components/Input';
import { Box, Flex } from '../../../components/Flex';
import { SingleSelect } from '../../../components/NewSelect';
import { Card } from '../../../components/Card';
import { Tag } from '../../../components/Tag';
export const ScheduledReportSettings = (props) => {
const handleNameChange = (event) => {
props.onChange({
...props.reportSchedule,
Name: event.target.value,
});
};
const formatOptions = props.allFormats.map((reportFormat) => ({
label: reportFormat,
value: reportFormat,
}));
const destinationOptions = props.allDestinations.map((destination) => ({
label: destination,
value: destination,
}));
const reportOptions = (props.allReportNames ?? []).map((reportName) => ({
label: reportName,
value: reportName,
}));
return (_jsxs(Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-3", "data-name": "scheduled-report-settings", children: [props.fixedReportName ? (_jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Report" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "The report that will be exported on this schedule" })] }), _jsx(Card.Body, { children: _jsx(Tag, { children: props.fixedReportName }) })] })) : null, props.allReportNames ? (_jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Report" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Choose which report to export on this schedule" })] }), _jsx(Card.Body, { className: "twa:p-1", children: _jsx(SingleSelect, { className: "twa:max-w-[300px]", "data-name": "select-report", items: reportOptions, value: props.reportSchedule?.ReportName || undefined, placeholder: "Select Report", onValueChange: (value) => props.onChange({
...props.reportSchedule,
ReportName: value,
}) }) })] })) : null, _jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Name" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Provide a unique name for this scheduled export" })] }), _jsx(Card.Body, { className: "twa:p-1", children: _jsx(Input, { "data-name": "schedule-name", className: "twa:max-w-[300px] twa:w-full", onChange: handleNameChange, placeholder: "Enter Schedule Name", type: "string", value: props.reportSchedule?.Name ?? '' }) })] }), _jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Format" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Choose the export file format" })] }), _jsx(Card.Body, { className: "twa:p-1", children: _jsx(SingleSelect, { className: "twa:max-w-[300px]", "data-name": "select-format", items: formatOptions, value: props.reportSchedule?.ReportFormat, placeholder: "Select Format", onValueChange: (value) => props.onChange({
...props.reportSchedule,
ReportFormat: value,
}) }) })] }), _jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Destination" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Choose where the exported report is sent" })] }), _jsx(Card.Body, { className: "twa:p-1", children: _jsx(SingleSelect, { className: "twa:max-w-[300px]", "data-name": "select-destination", items: destinationOptions, value: props.reportSchedule?.ExportDestination, placeholder: "Select Destination", onValueChange: (value) => props.onChange({
...props.reportSchedule,
ExportDestination: value,
}) }) })] })] }));
};