Skip to content

Commit 4d85e4e

Browse files
Merge pull request #2998 from rintumerin-aot/feature/FWF-5465-fix-checkbox-and-search-integration
Feature/fwf 5465 fix checkbox and search integration
2 parents 07c96da + 0cd815e commit 4d85e4e

File tree

6 files changed

+44
-21
lines changed

6 files changed

+44
-21
lines changed

forms-flow-web/src/routes/Design/Forms/FormEdit.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,6 @@ const saveFormWithWorkflow = async () => {
12511251
};
12521252

12531253
const handleFormHistory = () => {
1254-
// setShowHistoryModal(true);
12551254
dispatch(setFormHistories({ formHistory: [], totalCount: 0 }));
12561255
if (processListData?.parentFormId) {
12571256
fetchFormHistory(processListData?.parentFormId, 1, paginationModel.pageSize);

forms-flow-web/src/routes/Design/Forms/List.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ const List = React.memo((props) => {
393393
searchLoading={searchFormLoading}
394394
title={t("Search Form Name and Description")}
395395
dataTestId="form-search-input"
396+
width="22rem"
396397
/>
397398
</div>
398399
</div>

forms-flow-web/src/routes/Design/Forms/SettingsTab.js

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
CustomTextArea,
1010
DropdownMultiSelect,
1111
CustomUrl,
12-
// CustomCheckbox,
12+
CustomCheckbox,
1313
} from "@formsflow/components";
1414
import {
1515
removeTenantKeywithSlash,
@@ -113,7 +113,7 @@ const SettingsTab = (
113113
/* ---------------------- handling form details change ---------------------- */
114114
const handleFormDetailsChange = (e) => {
115115
const { name, value, type } = e.target;
116-
const sanitizedValue = value.replace(/[#+]/g, "");
116+
const sanitizedValue = value?.replace(/[#+]/g, "");
117117
setErrors((prev) => ({ ...prev, [name]: "" }));
118118
blurStatus.current[name] = false;
119119
let updatedValue = name === "path" ? _camelCase(sanitizedValue).toLowerCase() : sanitizedValue;
@@ -124,7 +124,7 @@ const SettingsTab = (
124124
}
125125

126126
if (type === "checkbox") {
127-
setFormDetails((prev) => ({ ...prev, [name]: e.target.checked ? "wizard" : "form" }));
127+
setFormDetails((prev) => ({ ...prev, [name]: e.target.value ? "wizard" : "form" }));
128128
return;
129129
}
130130

@@ -290,19 +290,22 @@ const SettingsTab = (
290290
dataTestId="form-description"
291291
/>
292292
</div>
293-
{/* need to use custom checkbox when component is ready */}
294-
{/* <CustomCheckbox
295-
onChange={handleFormDetailsChange}
296-
aria-label={t("Allow multiple pages in this form")}
297-
id="allow-adding-multiple-pages"
298-
label={t("Allow multiple pages in this form")}
299-
items={allowMultiplePagesOption}
300-
selectedValues={formDetails.display === "wizard" ? ["wizard"] : []}
301-
name="display"
302-
inline={true}
303-
variant="secondary"
304-
/> */}
305-
<label
293+
294+
<div className="ms-4">
295+
<CustomCheckbox
296+
onChange={(e) => handleFormDetailsChange({ target: { name: "display", value: e[0], type: "checkbox" } })}
297+
aria-label={t("Allow multiple pages in this form")}
298+
id="allow-adding-multiple-pages"
299+
items={[{ label: "Allow adding multiple pages in this form", value: "wizard" }]}
300+
selectedValues={formDetails.display === "wizard" ? ["wizard"] : []}
301+
name="display"
302+
inline={true}
303+
variant="secondary"
304+
size="small"
305+
dataTestId="form-edit-wizard-display"
306+
/>
307+
</div>
308+
{/* <label
306309
htmlFor="allow-adding-multiple-pages"
307310
className="input-checkbox"
308311
>
@@ -315,7 +318,7 @@ const SettingsTab = (
315318
name="display"
316319
/>
317320
<span>Allow adding multiple pages in this form</span>
318-
</label>
321+
</label> */}
319322
</div>
320323
</div>
321324
<div className="grid-section">
@@ -379,7 +382,7 @@ const SettingsTab = (
379382
variant="secondary"
380383
/>
381384

382-
<label htmlFor="anonymouse-checkbox" className="input-checkbox">
385+
{/* <label htmlFor="anonymouse-checkbox" className="input-checkbox">
383386
<input
384387
id="anonymouse-checkbox"
385388
type="checkbox"
@@ -392,7 +395,23 @@ const SettingsTab = (
392395
<span>
393396
{t("Also allow anonymous users to create submissions")}
394397
</span>
395-
</label>
398+
</label> */}
399+
<div className="ms-4">
400+
<CustomCheckbox
401+
onChange={() => {
402+
setIsAnonymous(!isAnonymous);
403+
}}
404+
aria-label={t("Also allow anonymous users to create submissions")}
405+
id="anonymous-checkbox"
406+
items={[{ label: "Also allow anonymous users to create submissions", value: "isAnonymous" }]}
407+
selectedValues={isAnonymous ? ["isAnonymous"] : []}
408+
name="anonymous"
409+
inline={true}
410+
variant="secondary"
411+
size="small"
412+
dataTestId="form-edit-allow-anonymous"
413+
/>
414+
</div>
396415
</div>
397416

398417
<DropdownMultiSelect

forms-flow-web/src/routes/Design/Process/ProcessTable.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ const ProcessTable = React.memo(() => {
355355
searchLoading={searchLoading}
356356
title={t(`Search ${ProcessContents.processType} Name`)}
357357
dataTestId={`${ProcessContents.processType}-search-input`}
358+
width="22rem"
358359
/>
359360
</div>
360361
</div>

forms-flow-web/src/routes/Submit/Forms/DraftAndSubmissions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const SearchBar = ({ search, setSearch, handleSearch, handleClearSearch, searchL
3030
searchLoading={searchLoading}
3131
title={t("Search Form Name and Description")}
3232
dataTestId="form-search-input"
33+
width="22rem"
3334
/>
3435
</div>
3536
);
@@ -148,6 +149,7 @@ const DraftsAndSubmissions = () => {
148149
searchLoading={searchFormLoading}
149150
title={t("Search")}
150151
dataTestId="form-search-input"
152+
width="22rem"
151153
/>
152154
</div>
153155
</div>

forms-flow-web/src/routes/Submit/Forms/SubmitList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import PropTypes from "prop-types";
2121
const SearchBar = ({ search, setSearch, handleSearch, handleClearSearch, searchLoading }) => {
2222
const { t } = useTranslation();
2323
return (
24-
2524
<CustomSearch
2625
search={search}
2726
setSearch={setSearch}
@@ -31,6 +30,7 @@ const SearchBar = ({ search, setSearch, handleSearch, handleClearSearch, searchL
3130
searchLoading={searchLoading}
3231
title={t("Search Form Name and Description")}
3332
dataTestId="form-search-input"
33+
width="22rem"
3434
/>
3535
);
3636
};
@@ -128,6 +128,7 @@ const SubmitList = React.memo(({ getFormsInit }) => {
128128
searchLoading={searchFormLoading}
129129
title={t("Search")}
130130
dataTestId="form-search-input"
131+
width="22rem"
131132
/>
132133
</div>
133134
</div>

0 commit comments

Comments
 (0)