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

Add DutyOfCare Procedure #212

Merged
merged 15 commits into from
May 9, 2024
Merged
21 changes: 21 additions & 0 deletions src/plugins/recordTypes/dutyofcare/advancedSearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default (configContext) => {
const {
OP_CONTAIN,
} = configContext.searchOperators;

const {
defaultAdvancedSearchBooleanOp,
extensions,
} = configContext.config;

return {
op: defaultAdvancedSearchBooleanOp,
value: [
{
op: OP_CONTAIN,
path: 'ns2:dutyofcares_common/dutyOfCareNumber',
},
...extensions.core.advancedSearch,
],
};
};
17 changes: 17 additions & 0 deletions src/plugins/recordTypes/dutyofcare/columns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineMessages } from 'react-intl';

export default () => ({
default: {
dutyOfCareNumber: {
messages: defineMessages({
label: {
id: 'column.dutyofcares_common.default.dutyOfCareNumber',
defaultMessage: 'Duty of care id',
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
},
}),
order: 10,
sortBy: 'dutyofcares_common:referenceNumber',
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
width: 200,
},
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
},
});
337 changes: 337 additions & 0 deletions src/plugins/recordTypes/dutyofcare/fields.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,337 @@
import { defineMessages } from 'react-intl';

export default (configContext) => {
const {
AutocompleteInput,
CompoundInput,
DateInput,
IDGeneratorInput,
TextInput,
TermPickerInput,
} = configContext.inputComponents;

const {
configKey: config,
} = configContext.configHelpers;

const {
DATA_TYPE_DATE,
} = configContext.dataTypes;

const {
extensions,
} = configContext.config;

const {
validateNotInUse,
} = configContext.validationHelpers;

return {
document: {
[config]: {
view: {
type: CompoundInput,
props: {
defaultChildSubpath: 'ns2:dutyofcares_common',
},
},
},
...extensions.core.fields,
'ns2:dutyofcares_common': {
[config]: {
service: {
ns: 'http://collectionspace.org/services/dutyofcare',
},
},
dutyOfCareNumber: {
[config]: {
cloneable: false,
messages: defineMessages({
inUse: {
id: 'field.dutyofcares_common.dutyOfCareNumber.inUse',
defaultMessage: 'The identification number {value} is in use by another record.',
},
name: {
id: 'field.dutyofcares_common.dutyOfCareNumber.name',
defaultMessage: 'Duty of care id',
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
},
}),
required: true,
searchView: {
type: TextInput,
},
validate: (validationContext) => validateNotInUse({
configContext,
validationContext,
fieldName: 'dutyofcares_common:dutyOfCareNumber',
}),
view: {
type: IDGeneratorInput,
props: {
source: 'dutyofcare',
},
},
},
},
originationDate: {
[config]: {
dataType: DATA_TYPE_DATE,
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.originationDate.name',
defaultMessage: 'Origination date',
},
}),
view: {
type: DateInput,
},
},
},
dutyOfCareTitle: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.dutyOfCareTitle.fullName',
defaultMessage: 'Duty of care title',
},
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
name: {
id: 'field.dutyofcares_common.dutyOfCareTitle.name',
defaultMessage: 'Title',
},
}),
view: {
type: TextInput,
},
},
},
dutyOfCareNotes: {
[config]: {
view: {
type: CompoundInput,
},
},
dutyOfCareNote: {
[config]: {
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.dutyOfCareNote.name',
defaultMessage: 'Note',
},
}),
repeating: true,
view: {
type: TextInput,
props: {
multiline: true,
},
},
},
},
},
dutyOfCareDetailsGroupList: {
[config]: {
view: {
type: CompoundInput,
},
},
dutyOfCareDetailsGroup: {
[config]: {
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.dutyOfCareDetailsGroup.name',
defaultMessage: 'Duty of care details',
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
},
}),
repeating: true,
view: {
type: CompoundInput,
},
},
detailType: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailType.fullName',
defaultMessage: 'Duty of care details type',
},
name: {
id: 'field.dutyofcares_common.detailType.name',
defaultMessage: 'Type',
},
}),
view: {
type: TermPickerInput,
props: {
source: 'nagpratype',
},
},
},
},
detailLevel: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailLevel.fullName',
defaultMessage: 'Duty of care details level',
},
name: {
id: 'field.dutyofcares_common.detailLevel.name',
defaultMessage: 'Level',
},
}),
view: {
type: TermPickerInput,
props: {
source: 'nagpralevel',
},
},
},
},
detailDeterminedBy: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailDeterminedBy.fullName',
defaultMessage: 'Duty of care details determined by',
},
name: {
id: 'field.dutyofcares_common.detailDeterminedBy.name',
defaultMessage: 'Determined by',
},
}),
view: {
type: AutocompleteInput,
props: {
source: 'person/local,organization/local',
},
},
},
},
detailDeterminationDate: {
[config]: {
dataType: DATA_TYPE_DATE,
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailDeterminationDate.fullName',
defaultMessage: 'Duty of care details determination date',
},
name: {
id: 'field.dutyofcares_common.detailDeterminationDate.name',
defaultMessage: 'Determination date',
},
}),
view: {
type: DateInput,
},
},
},
detailNote: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailNote.fullName',
defaultMessage: 'Duty of care detail note',
},
name: {
id: 'field.dutyofcares_common.detailNote.name',
defaultMessage: 'Note',
},
}),
view: {
type: TextInput,
props: {
multiline: true,
},
},
},
},
},
},
partiesInvolvedGroupList: {
[config]: {
view: {
type: CompoundInput,
},
},
partiesInvolvedGroup: {
[config]: {
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.partiesInvolvedGroup.name',
defaultMessage: 'Parties involved',
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
},
}),
repeating: true,
view: {
type: CompoundInput,
props: {
tabular: true,
},
},
},
involvedParty: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.involvedParty.fullName',
defaultMessage: 'Parties involved',
},
name: {
id: 'field.dutyofcares_common.involvedParty.name',
defaultMessage: 'Party',
mikejritter marked this conversation as resolved.
Show resolved Hide resolved
},
}),
view: {
type: AutocompleteInput,
props: {
source: 'person/local',
},
},
},
},
involvedOnBehalfOf: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.involvedOnBehalfOf.fullName',
defaultMessage: 'Parties involved on behalf of',
},
name: {
id: 'field.dutyofcares_common.involvedOnBehalfOf.name',
defaultMessage: 'On behalf of',
},
}),
view: {
type: AutocompleteInput,
props: {
source: 'organization/local',
},
},
},
},
involvedRole: {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.involvedRole.fullName',
defaultMessage: 'Parties involved roles',
},
name: {
id: 'field.dutyofcares_common.involvedRole.name',
defaultMessage: 'Role',
},
}),
view: {
type: TermPickerInput,
props: {
source: 'nagprainvolvedrole',
},
},
},
},
},
},
},
},
};
};
Loading