Skip to content

Commit 9714e61

Browse files
committed
feat(api): dynamic render list of requirement
1 parent 6844bad commit 9714e61

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

admin/app/components/quests/requirements/form.gjs

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@ export default class RequirementForm extends Component {
2424
@tracked formFields = null;
2525

2626
get requirementTypeOptions() {
27-
return [
28-
{ value: 'organization', label: 'Organization' },
29-
{ value: 'organizationLearner', label: 'Organization Learner' },
30-
{ value: 'campaignParticipations', label: 'Participation' },
31-
{ value: 'cappedTubes', label: 'Tubes cappés' },
32-
];
27+
console.log(Object.values(objectConfigurations));
28+
return Object.values(objectConfigurations).map(({ name, label }) => ({ value: name, label }));
3329
}
3430

3531
get configurationForSelectedRequirement() {

admin/app/components/quests/requirements/object/object-configuration.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class ObjectConfiguration {
2-
constructor({ name, refersToAnArray, fieldConfigurations, mergeFields = false }) {
2+
constructor({ name, label, refersToAnArray, fieldConfigurations, mergeFields = false }) {
33
this.name = name;
4+
this.label = label;
45
this.refersToAnArray = refersToAnArray;
56
this.fieldConfigurations = fieldConfigurations;
67
this.mergeFields = mergeFields;
@@ -111,6 +112,7 @@ const organizationConfigField_type = new FieldConfiguration({
111112
});
112113
const organizationConfiguration = new ObjectConfiguration({
113114
name: 'organization',
115+
label: 'Organisation',
114116
refersToAnArray: false,
115117
fieldConfigurations: [
116118
organizationConfigField_isManagingStudents,
@@ -128,6 +130,7 @@ const organizationLearnerConfigField_MEFCode = new FieldConfiguration({
128130
});
129131
const organizationLearnerConfiguration = new ObjectConfiguration({
130132
name: 'organizationLearner',
133+
label: 'Organization learner',
131134
refersToAnArray: false,
132135
fieldConfigurations: [organizationLearnerConfigField_MEFCode],
133136
});
@@ -152,6 +155,7 @@ const campaignParticipationsConfigField_status = new FieldConfiguration({
152155

153156
const campaignParticipationsConfiguration = new ObjectConfiguration({
154157
name: 'campaignParticipations',
158+
label: 'Participations',
155159
refersToAnArray: true,
156160
fieldConfigurations: [
157161
campaignParticipationsConfigField_targetProfileId,
@@ -177,6 +181,7 @@ const cappedTubeConfiguration_threshold = new FieldConfiguration({
177181

178182
const cappedTubeConfiguration = new ObjectConfiguration({
179183
name: 'cappedTubes',
184+
label: 'Tubes cappés',
180185
refersToAnArray: true,
181186
mergeFields: true,
182187
fieldConfigurations: [cappedTubeConfiguration_cappedTubes, cappedTubeConfiguration_threshold],

0 commit comments

Comments
 (0)