Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #1517

Merged
merged 6 commits into from
Dec 19, 2024
Merged

Develop #1517

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/DraggableTree/DraggableTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ const DraggableTable = ({ data, setData, fallbackStatus, setFallbackStatus, tran
deleteData(newData);
return newData;
};

const columns = calendarContentLanguage.map((language) => ({
title: capitalizeFirstLetter(language),
title: t(`common.tab${capitalizeFirstLetter(language)}`),
dataIndex: contentLanguageKeyMap[language],
key: contentLanguageKeyMap[language],
editable: true,
Expand Down
5 changes: 4 additions & 1 deletion src/components/TreeSelectOption/SortableTreeSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SortableTag from '../Tags/SortableTag/SortableTag';
import Tags from '../Tags/Common/Tags';
import './treeSelectOption.css';

function SortableTreeSelect({ form, fieldName, draggable = false, dataCy, ...props }) {
function SortableTreeSelect({ form, fieldName, draggable = false, dataCy, setShowDialog, ...props }) {
const [selectedValues, setSelectedValues] = useState(props.value || []);
const TITLE = 'title';
const LABEL = 'label';
Expand All @@ -24,13 +24,15 @@ function SortableTreeSelect({ form, fieldName, draggable = false, dataCy, ...pro

form.setFieldValue(fieldName, reorderedValues);
}
setShowDialog(true);
};

const handleChange = (values) => {
const uniqueValues = [...new Set(values)];
setSelectedValues(uniqueValues);

form.setFieldValue(fieldName, uniqueValues);
setShowDialog(true);
};

const tagRender = (props) => {
Expand All @@ -51,6 +53,7 @@ function SortableTreeSelect({ form, fieldName, draggable = false, dataCy, ...pro
selectedValues.filter((v) => v !== value),
);
handleChange(selectedValues.filter((v) => v !== value));
setShowDialog(true);
}}
/>
);
Expand Down
2 changes: 2 additions & 0 deletions src/constants/formFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,11 @@ export const formFieldValue = [
mappedField,
name,
form,
setShowDialog,
}) => {
return (
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-${mappedField}`}
form={form}
draggable
Expand Down
6 changes: 6 additions & 0 deletions src/pages/Dashboard/AddEvent/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,7 @@ function AddEvent() {
data-cy="form-item-event-type-label">
<SortableTreeSelect
form={form}
setShowDialog={setShowDialog}
dataCy={`tag-event-type`}
draggable
fieldName="eventType"
Expand Down Expand Up @@ -2421,6 +2422,7 @@ function AddEvent() {
]}
data-cy="form-item-audience-label">
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-audience`}
form={form}
draggable
Expand Down Expand Up @@ -2456,6 +2458,7 @@ function AddEvent() {
]}
data-cy="form-item-event-discipline-label">
<SortableTreeSelect
setShowDialog={setShowDialog}
form={form}
draggable
dataCy={`tag-event-discipline`}
Expand Down Expand Up @@ -2510,6 +2513,7 @@ function AddEvent() {
},
]}>
<SortableTreeSelect
setShowDialog={setShowDialog}
form={form}
draggable
dataCy={`tag-${taxonomy?.id}`}
Expand Down Expand Up @@ -4288,6 +4292,7 @@ function AddEvent() {
}
data-cy="form-item-eventlanguage-label">
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-event-language`}
form={form}
draggable
Expand Down Expand Up @@ -4388,6 +4393,7 @@ function AddEvent() {
}
data-cy="form-item-event-accessibility-label">
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-event-accessibility`}
form={form}
draggable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,7 @@ function CreateNewOrganization() {
taxonomy?.isAdminOnly ? (adminCheckHandler({ calendar, user }) ? false : true) : false
}>
<SortableTreeSelect
setShowDialog={setShowDialog}
form={form}
draggable
dataCy={`tag-organization-dynamic-field`}
Expand Down
1 change: 1 addition & 0 deletions src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ function CreateNewPerson() {
taxonomy?.isAdminOnly ? (adminCheckHandler({ calendar, user }) ? false : true) : false
}>
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-person-dynamic-field`}
form={form}
draggable
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,7 @@ function CreateNewPlace() {
) && 'none',
}}>
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-place-type`}
form={form}
draggable
Expand Down Expand Up @@ -1812,6 +1813,7 @@ function CreateNewPlace() {
]}
hidden={taxonomy?.isAdminOnly ? (adminCheckHandler({ calendar, user }) ? false : true) : false}>
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-place-dynamic-field`}
form={form}
draggable
Expand Down Expand Up @@ -2156,6 +2158,7 @@ function CreateNewPlace() {
},
]}>
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-place`}
form={form}
draggable
Expand Down Expand Up @@ -2705,6 +2708,7 @@ function CreateNewPlace() {
},
]}>
<SortableTreeSelect
setShowDialog={setShowDialog}
dataCy={`tag-venue-accessibility`}
form={form}
draggable
Expand Down
Loading