- Progress check

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-09 10:59:04 -05:00
parent 351e46ad6b
commit 3fbd1b2ee0
2 changed files with 218 additions and 214 deletions

View File

@@ -150,7 +150,7 @@ export function ReportCenterModalComponent({reportCenterModal}) {
<Typography.Title level={4}> <Typography.Title level={4}>
{t(`reportcenter.labels.groups.${key}`)} {t(`reportcenter.labels.groups.${key}`)}
</Typography.Title> </Typography.Title>
<ul style={{columns: "2 auto"}}> <ul style={{ listStyleType: 'none', columns: "2 auto"}}>
{grouped[key].map((item) => ( {grouped[key].map((item) => (
<li key={item.key}> <li key={item.key}>
<Radio key={item.key} value={item.key}> <Radio key={item.key} value={item.key}>

View File

@@ -1,27 +1,27 @@
import { Button, Col, Form, Input, Row, Select } from "antd"; import {Button, Col, Form, Input, Row, Select} from "antd";
import React, { useEffect, useState } from "react"; import React, {useEffect, useState} from "react";
import { fetchFilterData } from "../../utils/RenderTemplate"; import {fetchFilterData} from "../../utils/RenderTemplate";
import { DeleteFilled } from "@ant-design/icons"; import {DeleteFilled} from "@ant-design/icons";
import { useTranslation } from "react-i18next"; import {useTranslation} from "react-i18next";
export default function Test({ form }) { export default function Test({form}) {
return ( return (
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}> <Form.Item style={{margin: 0, padding: 0}} dependencies={["key"]}>
{() => { {() => {
const key = form.getFieldValue("key"); const key = form.getFieldValue("key");
return <RenderFilters templateId={key} />; return <RenderFilters templateId={key}/>;
}} }}
</Form.Item> </Form.Item>
); );
} }
function RenderFilters({ templateId }) { function RenderFilters({templateId}) {
const [state, setState] = useState(null); const [state, setState] = useState(null);
console.log("state", state); console.log("state", state);
const { t } = useTranslation(); const {t} = useTranslation();
useEffect(() => { useEffect(() => {
const fetch = async () => { const fetch = async () => {
const data = await fetchFilterData({ name: templateId }); const data = await fetchFilterData({name: templateId});
console.log("🚀 ~ fetch ~ data:", data); console.log("🚀 ~ fetch ~ data:", data);
setState(data.data); setState(data.data);
}; };
@@ -36,7 +36,7 @@ function RenderFilters({ templateId }) {
return ( return (
<div> <div>
<Form.List name={["filters"]}> <Form.List name={["filters"]}>
{(fields, { add, remove, move }) => { {(fields, {add, remove, move}) => {
return ( return (
<div> <div>
Filters Filters
@@ -58,10 +58,14 @@ function RenderFilters({ templateId }) {
<Select <Select
options={ options={
state.filters state.filters
? state.filters.map((f) => ({ ? state.filters.map((f) => {
console.log('filter added');
console.dir(f);
return {
value: f.name, value: f.name,
label: t(f.translation), label: f?.translation ? t(f.translation) : f.label,
})) }
})
: [] : []
} }
/> />
@@ -81,16 +85,16 @@ function RenderFilters({ templateId }) {
> >
<Select <Select
options={[ options={[
{ value: "_eq", label: "Equals" }, {value: "_eq", label: "Equals"},
{ value: "_ne", label: "Not Equals" }, {value: "_ne", label: "Not Equals"},
{ value: "_gt", label: "Greater Than" }, {value: "_gt", label: "Greater Than"},
{ value: "_lt", label: "Less Than" }, {value: "_lt", label: "Less Than"},
{ value: "_gte", label: "Greater Than or Equal To" }, {value: "_gte", label: "Greater Than or Equal To"},
{ value: "_lte", label: "Less Than or Equal To" }, {value: "_lte", label: "Less Than or Equal To"},
{ value: "_in", label: "In" }, {value: "_in", label: "In"},
{ value: "_nin", label: "Not In" }, {value: "_nin", label: "Not In"},
{ value: "_contains", label: "Contains" }, {value: "_contains", label: "Contains"},
{ value: "_ncontains", label: "Does Not Contain" }, {value: "_ncontains", label: "Does Not Contain"},
]} ]}
/> />
</Form.Item> </Form.Item>
@@ -107,12 +111,12 @@ function RenderFilters({ templateId }) {
}, },
]} ]}
> >
<Input /> <Input/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={2}> <Col span={2}>
<DeleteFilled <DeleteFilled
style={{ margin: "1rem" }} style={{margin: "1rem"}}
onClick={() => { onClick={() => {
remove(field.name); remove(field.name);
}} }}
@@ -127,7 +131,7 @@ function RenderFilters({ templateId }) {
onClick={() => { onClick={() => {
add(); add();
}} }}
style={{ width: "100%" }} style={{width: "100%"}}
> >
{t("general.actions.add")} {t("general.actions.add")}
</Button> </Button>
@@ -137,7 +141,7 @@ function RenderFilters({ templateId }) {
}} }}
</Form.List> </Form.List>
<Form.List name={["sorters"]}> <Form.List name={["sorters"]}>
{(fields, { add, remove, move }) => { {(fields, {add, remove, move}) => {
return ( return (
<div> <div>
Sorters Sorters
@@ -161,7 +165,7 @@ function RenderFilters({ templateId }) {
state.sorters state.sorters
? state.sorters.map((f) => ({ ? state.sorters.map((f) => ({
value: f.name, value: f.name,
label: t(f.name), label: t(f.translation),
})) }))
: [] : []
} }
@@ -182,8 +186,8 @@ function RenderFilters({ templateId }) {
> >
<Select <Select
options={[ options={[
{ value: "desc", label: "Descending" }, {value: "desc", label: "Descending"},
{ value: "asc", label: "Ascending" }, {value: "asc", label: "Ascending"},
]} ]}
/> />
</Form.Item> </Form.Item>
@@ -191,7 +195,7 @@ function RenderFilters({ templateId }) {
<Col span={2}> <Col span={2}>
<DeleteFilled <DeleteFilled
style={{ margin: "1rem" }} style={{margin: "1rem"}}
onClick={() => { onClick={() => {
remove(field.name); remove(field.name);
}} }}
@@ -206,7 +210,7 @@ function RenderFilters({ templateId }) {
onClick={() => { onClick={() => {
add(); add();
}} }}
style={{ width: "100%" }} style={{width: "100%"}}
> >
{t("general.actions.add")} {t("general.actions.add")}
</Button> </Button>