diff --git a/.env.development b/.env.development
index dbc6490..03b6bab 100644
--- a/.env.development
+++ b/.env.development
@@ -2,4 +2,7 @@ JAMIE_UI_BASE_URL=http://localhost:3000
JAMIE_KEYCLOAK_BASE_URL=http://localhost:8080
-JAMIE_API_BASE_URL=https://api.jamie.g6tech.com.br
\ No newline at end of file
+JAMIE_API_BASE_URL=https://api.jamie.g6tech.com.br
+
+# The conditions feature requires FeatWS to be installed and configured.
+# JAMIE_FEATURE_CONDITIONS=true
\ No newline at end of file
diff --git a/src/api/services/MenuService.ts b/src/api/services/MenuService.ts
index e046f21..68d6691 100644
--- a/src/api/services/MenuService.ts
+++ b/src/api/services/MenuService.ts
@@ -4,6 +4,8 @@ export const ALL_MENU_PROPERTIES = `
id
name
mustDeferChanges
+hasConditions
+parameters
createdAt
updatedAt
version
@@ -64,6 +66,7 @@ items {
createdAt
updatedAt
version
+ rules
}
`;
diff --git a/src/components/Menu/Form/Form.tsx b/src/components/Menu/Form/Form.tsx
index deef871..4f2a5e7 100644
--- a/src/components/Menu/Form/Form.tsx
+++ b/src/components/Menu/Form/Form.tsx
@@ -26,7 +26,7 @@ import { useTranslation } from 'react-i18next';
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
import { DateTime } from 'luxon';
-import { MENU_VALIDATION } from '../../../constants';
+import { JAMIE_FEATURE_CONDITIONS, MENU_VALIDATION } from '../../../constants';
import { EnumInputAction, FormAction, IMenuMetaWithErrors, MenuMetaType } from '../../../types';
import './styles.css';
@@ -59,6 +59,10 @@ interface Props {
setMustDeferChanges: (mustDeferChanges: boolean) => void;
meta: IMenuMetaWithErrors[];
setMeta: (meta: IMenuMetaWithErrors[]) => void;
+ hasConditions: boolean;
+ setHasConditions: (hasConditions: boolean) => void;
+ parameters: string;
+ setParameters: (parameters: string) => void;
loadingSubmit: boolean;
onSubmit: () => void;
onBack: () => void;
@@ -74,6 +78,10 @@ export const MenuForm = ({
setMustDeferChanges,
meta,
setMeta,
+ hasConditions,
+ setHasConditions,
+ parameters,
+ setParameters,
loadingSubmit,
onSubmit,
onBack,
@@ -425,6 +433,52 @@ export const MenuForm = ({
)}
));
+
+ const renderHasConditionCheckbox = () => {
+ if (!JAMIE_FEATURE_CONDITIONS) return null;
+ return (
+
+ ) => {
+ const { checked } = e.target;
+ setHasConditions(checked);
+ }}
+ color="primary"
+ />
+ }
+ label={`${t('menu.fields.hasConditions')}?`}
+ />
+
+ );
+ };
+
+ const renderParameters = () => {
+ if (!hasConditions) return null;
+ return (
+ ) => {
+ const { value } = e.target;
+ setParameters(value);
+ }}
+ InputLabelProps={{
+ shrink: true,
+ }}
+ sx={{ width: '16rem' }}
+ className="bg-white"
+ />
+ );
+ };
+
return (