Skip to content

Commit 6146818

Browse files
authored
Merge pull request #20 from KelvinTegelaar/main
[pull] main from KelvinTegelaar:main
2 parents d6850f5 + 64facf7 commit 6146818

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4465
-836
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ app.log
3131

3232
# AI rules
3333
.*/rules
34+
AGENTS.md

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
"react-leaflet": "5.0.0",
9090
"react-leaflet-markercluster": "^5.0.0-rc.0",
9191
"react-markdown": "10.1.0",
92+
"rehype-raw": "^7.0.0",
93+
"remark-gfm": "^3.0.1",
9294
"react-media-hook": "^0.5.0",
9395
"react-papaparse": "^4.4.0",
9496
"react-quill": "^2.0.0",
@@ -112,4 +114,4 @@
112114
"eslint": "9.35.0",
113115
"eslint-config-next": "15.5.2"
114116
}
115-
}
117+
}

public/version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "8.5.2"
3-
}
2+
"version": "8.6.0"
3+
}

src/api/ApiCall.jsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export function ApiGetCall(props) {
2121
refetchOnReconnect = true,
2222
keepPreviousData = false,
2323
refetchInterval = false,
24+
responseType = "json",
25+
convertToDataUrl = false,
2426
} = props;
2527
const queryClient = useQueryClient();
2628
const dispatch = useDispatch();
@@ -107,9 +109,22 @@ export function ApiGetCall(props) {
107109
headers: {
108110
"Content-Type": "application/json",
109111
},
112+
responseType: responseType,
110113
});
114+
115+
let responseData = response.data;
116+
117+
// Convert blob to data URL if requested
118+
if (convertToDataUrl && responseType === "blob" && response.data) {
119+
responseData = await new Promise((resolve) => {
120+
const reader = new FileReader();
121+
reader.onloadend = () => resolve(reader.result);
122+
reader.readAsDataURL(response.data);
123+
});
124+
}
125+
111126
if (onResult) {
112-
onResult(response.data); // Emit each result as it arrives
127+
onResult(responseData); // Emit each result as it arrives
113128
}
114129
if (relatedQueryKeys) {
115130
const clearKeys = Array.isArray(relatedQueryKeys) ? relatedQueryKeys : [relatedQueryKeys];
@@ -137,7 +152,7 @@ export function ApiGetCall(props) {
137152
});
138153
}, 1000);
139154
}
140-
return response.data;
155+
return responseData;
141156
}
142157
},
143158
staleTime: staleTime,

src/components/CippComponents/CippAddEditTenantGroups.jsx

Lines changed: 88 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,96 @@
11
import CippFormComponent from "/src/components/CippComponents/CippFormComponent";
2-
import { Stack, Typography } from "@mui/material";
3-
import CippFormSection from "/src/components/CippFormPages/CippFormSection";
2+
import { Typography } from "@mui/material";
3+
import { Grid } from "@mui/system";
44
import { CippFormTenantSelector } from "./CippFormTenantSelector";
5+
import { CippFormCondition } from "./CippFormCondition";
6+
import CippTenantGroupRuleBuilder from "./CippTenantGroupRuleBuilder";
57

6-
const CippAddEditTenantGroups = ({ formControl, initialValues, title, backButtonTitle }) => {
8+
const CippAddEditTenantGroups = ({ formControl, initialValues, title, backButtonTitle, hideSubmitButton = false }) => {
79
return (
8-
<CippFormSection
9-
formControl={formControl}
10-
title={title}
11-
backButtonTitle={backButtonTitle}
12-
postUrl="/api/ExecTenantGroup"
13-
relatedQueryKeys={["TenantGroupListPage"]}
14-
resetForm={false}
15-
customDataformatter={(values) => {
16-
return {
17-
...values,
18-
Action: "AddEdit",
19-
};
20-
}}
21-
initialValues={initialValues}
22-
>
10+
<>
2311
<Typography variant="h6">Properties</Typography>
24-
<Stack spacing={1} sx={{ mt: 2 }}>
25-
<CippFormComponent
26-
type="textField"
27-
name="groupName"
28-
label="Group Name"
29-
placeholder="Enter the name for this group."
30-
formControl={formControl}
31-
required
32-
/>
33-
<CippFormComponent
34-
type="textField"
35-
name="groupDescription"
36-
label="Group Description"
37-
placeholder="Enter a description for this group."
38-
formControl={formControl}
39-
/>
40-
<CippFormTenantSelector
41-
formControl={formControl}
42-
multiple={true}
43-
required={false}
44-
disableClearable={false}
45-
name="members"
46-
valueField="customerId"
47-
placeholder="Select members to add to this group."
48-
/>
49-
</Stack>
50-
</CippFormSection>
12+
<Grid container spacing={2} sx={{ mt: 1 }}>
13+
<Grid size={{ xs: 12 }}>
14+
<CippFormComponent
15+
type="textField"
16+
name="groupName"
17+
label="Group Name"
18+
placeholder="Enter the name for this group."
19+
formControl={formControl}
20+
required
21+
fullWidth
22+
validators={{
23+
required: "Group name is required",
24+
minLength: {
25+
value: 2,
26+
message: "Group name must be at least 2 characters long"
27+
}
28+
}}
29+
/>
30+
</Grid>
31+
<Grid size={{ xs: 12 }}>
32+
<CippFormComponent
33+
type="textField"
34+
name="groupDescription"
35+
label="Group Description"
36+
placeholder="Enter a description for this group."
37+
formControl={formControl}
38+
fullWidth
39+
/>
40+
</Grid>
41+
42+
{/* Group Type Selection */}
43+
<Grid size={{ xs: 12 }}>
44+
<CippFormComponent
45+
type="radio"
46+
name="groupType"
47+
label="Group Type"
48+
options={[
49+
{ label: "Static", value: "static" },
50+
{ label: "Dynamic", value: "dynamic" }
51+
]}
52+
formControl={formControl}
53+
required
54+
defaultValue="static"
55+
/>
56+
</Grid>
57+
58+
{/* Static Group Members - Show only when Static is selected */}
59+
<Grid size={{ xs: 12 }}>
60+
<CippFormCondition
61+
formControl={formControl}
62+
field="groupType"
63+
compareType="is"
64+
compareValue="static"
65+
>
66+
<CippFormTenantSelector
67+
formControl={formControl}
68+
multiple={true}
69+
required={false}
70+
disableClearable={false}
71+
name="members"
72+
valueField="customerId"
73+
placeholder="Select members to add to this group."
74+
/>
75+
</CippFormCondition>
76+
</Grid>
77+
78+
{/* Dynamic Group Rules - Show only when Dynamic is selected */}
79+
<Grid size={{ xs: 12 }}>
80+
<CippFormCondition
81+
formControl={formControl}
82+
field="groupType"
83+
compareType="is"
84+
compareValue="dynamic"
85+
>
86+
<CippTenantGroupRuleBuilder
87+
formControl={formControl}
88+
name="dynamicRules"
89+
/>
90+
</CippFormCondition>
91+
</Grid>
92+
</Grid>
93+
</>
5194
);
5295
};
5396

0 commit comments

Comments
 (0)