Skip to content

Commit

Permalink
WIP - Location field
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Dec 3, 2024
1 parent f691141 commit 12623c6
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions client/components/planning-editor-standalone/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,41 @@ function getTextFieldConfig(options: {id: string; label: string, required: boole
return field;
}

// function getVocabularyRemoteSourceConfig(options: {id: string; label: string, required: boolean}): IAuthoringFieldV2 {
// const config: IDropdownConfig = {
// source: 'remote-source',
// getId: (item: ILocation) => item._id,
// getLabel: (item: ILocation) => item.name,
// multiple: false,
// searchOptions: (
// searchTerm,
// language,
// callback,
// ) => {
// return planningApi.locations.searchExternal(searchTerm, language).then((x) => {
// const tree: ITreeWithLookup<Partial<ILocation>> = {
// nodes: x.map((location) => ({value: location})),
// lookup: {},
// };

// callback(tree);
// });
// },
// };

// const field: IAuthoringFieldV2 = {
// id: options.id,
// name: options.label,
// fieldType: 'dropdown',
// fieldConfig: {
// ...config,
// required: options.required,
// },
// };

// return field;
// }

function getDateTimeField(options: {id: string; label: string, required: boolean}): IAuthoringFieldV2 {
const config: IDateTimeFieldConfig = {
allowSeconds: false,
Expand Down Expand Up @@ -127,6 +162,18 @@ export function getProfile() {
);
}

// TODO: Do only events have location as a field that can be configured?
// else if (fieldId === 'location') {
// profileV2.content = profileV2.content.set(
// fieldId,
// getVocabularyRemoteSourceConfig({
// id: 'location',
// label: gettext('Location'),
// required: required,
// }),
// );
// }

// else if (fieldId === 'language') {
// const languageFieldConfig: IDropdownConfigVocabulary = {
// source: 'vocabulary',
Expand Down

0 comments on commit 12623c6

Please sign in to comment.