Skip to content

Commit 10793d0

Browse files
Merge pull request #58 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 09b2dcf + 6ca6d5e commit 10793d0

File tree

42 files changed

+3162
-799
lines changed

Some content is hidden

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

42 files changed

+3162
-799
lines changed

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.1"
3+
}

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)