diff --git a/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts b/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts index e9e3f41c9..dd18dcd77 100644 --- a/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts +++ b/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts @@ -1,6 +1,6 @@ import {IDropdownConfigVocabulary, IAuthoringFieldV2, ISubject, IVocabularyItem} from 'superdesk-api'; import {superdeskApi} from '../../../superdeskApi'; -import {IFieldDefinition} from '../profile'; +import {IFieldDefinition} from '../field-definitions/interfaces'; import {getPlanningProfileFields} from '../profile-fields'; export const getCustomVocabularyFields = () => { diff --git a/client/components/planning-editor-standalone/field-definitions/index.ts b/client/components/planning-editor-standalone/field-definitions/index.ts index 9249ebc71..38c5d6734 100644 --- a/client/components/planning-editor-standalone/field-definitions/index.ts +++ b/client/components/planning-editor-standalone/field-definitions/index.ts @@ -13,6 +13,7 @@ import {getTextFieldConfig} from './text-field-config'; import {getPlaceField} from './place-field'; import {getCategoriesField} from './category-field'; import {getAgendasField} from './agendas-field'; +import {getPriorityField} from './priority-field'; export function getFieldDefinitions(): IFieldDefinitions { const {gettext} = superdeskApi.localization; @@ -68,6 +69,7 @@ export function getFieldDefinitions(): IFieldDefinitions { getPlaceField(), getAgendasField(), getCategoriesField(), + getPriorityField(), { fieldId: 'coverages', getField: ({id, required}) => { diff --git a/client/components/planning-editor-standalone/field-definitions/priority-field.ts b/client/components/planning-editor-standalone/field-definitions/priority-field.ts new file mode 100644 index 000000000..8c943ab3e --- /dev/null +++ b/client/components/planning-editor-standalone/field-definitions/priority-field.ts @@ -0,0 +1,35 @@ +import {IAuthoringFieldV2, IDropdownConfigManualSource} from 'superdesk-api'; +import {IFieldDefinition} from './interfaces'; +import {planningApi, superdeskApi} from '../../../superdeskApi'; + +export const getPriorityField = (): IFieldDefinition => { + const {gettext} = superdeskApi.localization; + + return { + fieldId: 'priority', + getField: ({id, required}) => { + const options = planningApi.redux.store.getState().vocabularies.priority.map((x) => ({ + id: x.qcode, + label: x.name, + })); + + const fieldConfig: IDropdownConfigManualSource = { + source: 'manual-entry', + options: options, + roundCorners: true, + type: 'text', + multiple: false, + required: required, + }; + + const field: IAuthoringFieldV2 = { + id: id, + name: gettext('Priority'), + fieldType: 'dropdown', + fieldConfig: fieldConfig, + }; + + return field; + }, + }; +};