@omniumretail/component-library 1.0.36 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/bundle.js +27 -27
  2. package/dist/main.css +14 -8
  3. package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -0
  4. package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -0
  5. package/dist/types/components/AnalyticsBar/index.d.ts +3 -0
  6. package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -0
  7. package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -0
  8. package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -0
  9. package/dist/types/components/CategoryResponse/index.d.ts +9 -0
  10. package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +5 -0
  11. package/dist/types/components/DatePickerTag/index.d.ts +6 -0
  12. package/dist/types/components/Menu/Menu.stories.d.ts +5 -0
  13. package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -0
  14. package/dist/types/components/Menu/index.d.ts +3 -0
  15. package/dist/types/components/index.d.ts +1 -1
  16. package/dist/types/constants/translationHelper.d.ts +2 -0
  17. package/package.json +1 -1
  18. package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +180 -0
  19. package/src/components/AnalyticsBar/helpers/codeMutation.tsx +19 -0
  20. package/src/components/AnalyticsBar/index.tsx +76 -0
  21. package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +13 -0
  22. package/src/components/AnalyticsBar/styles.module.scss +108 -0
  23. package/src/components/Category/Category.stories.tsx +64 -37
  24. package/src/components/Category/CategoryContent/index.tsx +9 -9
  25. package/src/components/CategoryResponse/CategoryResponse.stories.tsx +261 -0
  26. package/src/components/CategoryResponse/evaluationOptions.tsx +81 -0
  27. package/src/components/CategoryResponse/index.tsx +280 -0
  28. package/src/components/CategoryResponse/styles.module.scss +135 -0
  29. package/src/components/{RangePickerTag/RangePickerTag.stories.tsx → DatePickerTag/DatePickerTag.stories.tsx} +4 -4
  30. package/src/components/{RangePickerTag → DatePickerTag}/index.tsx +9 -10
  31. package/src/components/{RangePickerTag → DatePickerTag}/styles.module.scss +5 -0
  32. package/src/components/Menu/Menu.stories.tsx +178 -0
  33. package/src/components/Menu/helpers/codeMutation.tsx +19 -0
  34. package/src/components/Menu/index.tsx +23 -0
  35. package/src/components/Menu/styles.module.scss +0 -0
  36. package/src/components/index.tsx +1 -1
  37. package/src/constants/translationHelper.ts +7 -0
  38. package/src/locales/en.json +3 -0
  39. package/src/locales/es.json +3 -0
  40. package/src/locales/pt.json +3 -0
@@ -0,0 +1,280 @@
1
+ import styles from './styles.module.scss';
2
+ import { useEffect, useImperativeHandle, useState } from 'react';
3
+ import { Form } from 'antd';
4
+ import { useForm } from 'antd/es/form/Form';
5
+ import { InputField } from 'components/Input';
6
+ import { Button } from 'components/Button';
7
+ import classNames from 'classnames';
8
+ import TextArea from 'antd/es/input/TextArea';
9
+ import { Select } from 'components/Select';
10
+ import { EvaluationOptions, evaluationOptions } from './evaluationOptions';
11
+ import React from 'react';
12
+
13
+ interface CategoryResponse {
14
+ data: any;
15
+ serverReadyData: any;
16
+ onNextCategoryAvailabilityChange: (hasNext: boolean) => void;
17
+ onPreviousCategoryAvailabilityChange: (hasPrevious: boolean) => void;
18
+ };
19
+
20
+ type Category = {
21
+ title: string;
22
+ key: string;
23
+ data: any;
24
+ children?: Category[];
25
+ };
26
+
27
+ const updateCategoryAnswers = (categoryAnswers: any[], categoryToUpdate: any, updatedQuestions: any) => {
28
+ categoryAnswers.forEach((category: any) => {
29
+ if (category.data.category_id === categoryToUpdate.category_id) {
30
+ category.data.questions = category.data.questions.map((question: any, index: any) => {
31
+ return {
32
+ ...question,
33
+ answer: updatedQuestions[index].answer
34
+ };
35
+ });
36
+ }
37
+ else if (category.children && category.children.length > 0) {
38
+ updateCategoryAnswers(category.children, categoryToUpdate, updatedQuestions);
39
+ }
40
+ });
41
+ return categoryAnswers;
42
+ };
43
+
44
+ const findCategoryWithQuestions = (currentKey: string, categories: Category[], direction: 'next' | 'prev'): Category | null => {
45
+ let foundCurrent = false;
46
+
47
+ const searchCategories = (categoryList: Category[], direction: 'next' | 'prev'): Category | null => {
48
+ const iterable = direction === 'next' ? categoryList : [...categoryList].reverse();
49
+
50
+ for (const category of iterable) {
51
+ if (foundCurrent) {
52
+ if (category.data.questions.length > 0) {
53
+ return category;
54
+ }
55
+ } else if (category.key === currentKey) {
56
+ foundCurrent = true;
57
+ }
58
+
59
+ if (category.children) {
60
+ const result = searchCategories(category.children, direction);
61
+ if (result) {
62
+ return result;
63
+ }
64
+ }
65
+ }
66
+ return null;
67
+ };
68
+
69
+ return searchCategories(categories, direction);
70
+ };
71
+
72
+ const getCategoryObject = (currentKey: string, categories: Category[], direction: 'next' | 'prev'): any => {
73
+ const category = findCategoryWithQuestions(currentKey, categories, direction);
74
+ return category ? category.data : null;
75
+ };
76
+
77
+ const hasCategory = (currentKey: string, categories: Category[], direction: 'next' | 'prev'): boolean => {
78
+ const category = findCategoryWithQuestions(currentKey, categories, direction);
79
+ return !!category;
80
+ };
81
+
82
+ const getTitleWithQuestionCount = (category: any): string => {
83
+ const questionCount = category?.data?.questions?.length;
84
+ const answeredQuestions = category?.data?.questions?.filter((question: any) => question.answer !== null && question.answer !== undefined && question.answer !== '').length;
85
+
86
+ return questionCount
87
+ ? `${category.title} - ${answeredQuestions} / ${questionCount}`
88
+ : category.title ;
89
+ };
90
+
91
+ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref) => {
92
+ const { data } = props;
93
+
94
+ const [currentKey, setCurrentKey] = useState(data.categoryAnswers[0].key);
95
+ const [localData, setLocalData] = useState<any>(data);
96
+ // Setting first set of questions as default open
97
+ const [selectedCategory, setSelectedCategory] = useState<any>(data.categoryAnswers[0]);
98
+ const [initialValues, setInitialValues] = useState<any>(data.categoryAnswers[0].data);
99
+ const [form] = useForm();
100
+
101
+
102
+ const updateInitialValues = (data: any) => {
103
+ const {
104
+ questions,
105
+ openAnswer
106
+ } = data;
107
+
108
+ const initial = {
109
+ questions: questions.map((question: any) => ({
110
+ subject: question.subject,
111
+ description: question.description,
112
+ answer: question.answer || ""
113
+ })),
114
+ openAnswer: openAnswer
115
+ };
116
+
117
+ setInitialValues(initial);
118
+ form.setFieldsValue(initial);
119
+ };
120
+
121
+ const handleLabelClick = (category: any, index: number) => {
122
+ setSelectedCategory(category);
123
+ updateInitialValues(category.data);
124
+ setCurrentKey(index);
125
+ };
126
+
127
+ const onFinish = (values: any) => {
128
+ const updatedQuestions = initialValues.questions.map((question: any, index: number) => {
129
+ return {
130
+ ...question,
131
+ answer: values.questions[index].answer
132
+ };
133
+ });
134
+
135
+ const updatedCategory = updateCategoryAnswers(localData.categoryAnswers, selectedCategory.data, updatedQuestions);
136
+
137
+ const updatedLocalData = { ...localData, categoryAnswers: updatedCategory };
138
+
139
+ setLocalData(updatedLocalData);
140
+ };
141
+
142
+ const renderCategories = (categories: any) => {
143
+ return categories.map((category: any, index: number) => {
144
+ const labelClasses = classNames({
145
+ [styles.cursorPointer]: category.data.questions.length > 0
146
+ }, [styles.label]);
147
+
148
+ const indexCheck = category.data.questions.length > 0 && category.key;
149
+
150
+ return (
151
+ <div
152
+ className={`${styles.labelWrapper} ${category.data.category_id === selectedCategory.data.category_id ? styles.active : ""}`}
153
+ key={index}
154
+ >
155
+ <div
156
+ className={labelClasses}
157
+ data-index={indexCheck}
158
+ onClick={() => category.data.questions.length > 0 && handleLabelClick(category, indexCheck)}
159
+ >
160
+ {getTitleWithQuestionCount(category)}
161
+ </div>
162
+ {category.children && (
163
+ <div className={styles.subCategory}>
164
+ {renderCategories(category.children)}
165
+ </div>
166
+ )}
167
+ </div>
168
+ )
169
+ });
170
+ };
171
+
172
+ const handleNextClick = () => {
173
+ const nextCategory = findCategoryWithQuestions(currentKey, localData.categoryAnswers, 'next');
174
+ if (nextCategory) {
175
+ setCurrentKey(nextCategory.key);
176
+ setSelectedCategory(nextCategory);
177
+ }
178
+
179
+ const nextCategoryData = getCategoryObject(currentKey, localData.categoryAnswers, 'next');
180
+ setSelectedCategory(nextCategoryData ? { ...nextCategory, data: nextCategoryData } : null);
181
+ updateInitialValues(nextCategoryData);
182
+ };
183
+
184
+ const handlePreviousClick = () => {
185
+ const prevCategory = findCategoryWithQuestions(currentKey, localData.categoryAnswers, 'prev');
186
+ if (prevCategory) {
187
+ setCurrentKey(prevCategory.key);
188
+ setSelectedCategory(prevCategory);
189
+ }
190
+
191
+ const prevCategoryData = getCategoryObject(currentKey, localData.categoryAnswers, 'prev');
192
+ setSelectedCategory(prevCategoryData ? { ...prevCategory, data: prevCategoryData } : null);
193
+ updateInitialValues(prevCategoryData);
194
+ };
195
+
196
+ useImperativeHandle(ref, () => ({
197
+ handleNextClick,
198
+ handlePreviousClick,
199
+ }));
200
+
201
+ useEffect(() => {
202
+ props.serverReadyData(localData);
203
+ }, [localData]);
204
+
205
+ useEffect(() => {
206
+ const hasNext = hasCategory(currentKey, localData.categoryAnswers, 'next');
207
+ props.onNextCategoryAvailabilityChange(hasNext);
208
+
209
+ const hasPrevious = hasCategory(currentKey, localData.categoryAnswers, 'prev');
210
+ props.onPreviousCategoryAvailabilityChange(hasPrevious);
211
+ }, [currentKey, localData.categoryAnswers, props]);
212
+
213
+ const questionWrapper = classNames({
214
+ [styles.questionWrapperOpenAnswer]: selectedCategory.data.openAnswer,
215
+ }, [styles.questionWrapper]);
216
+
217
+ // This gets the scale we use for each select from the database using a key based variable,if
218
+ // any new generalEvaluationLevel is added to the backend we need to update our own without
219
+ // deleting any of the previous so we dont mess up the project history.
220
+ const selectedEvaluationOption = `scale_${selectedCategory?.data?.generalEvaluationLevel}` as keyof typeof evaluationOptions;
221
+
222
+ return (
223
+ <div className={styles.categoryResponse}>
224
+ <div className={styles.sidebarWrapper}>
225
+ <div className={styles.title}>Categorias</div>
226
+ {renderCategories(localData.categoryAnswers)}
227
+ </div>
228
+ <div className={styles.contentWrapper}>
229
+ <Form
230
+ initialValues={initialValues}
231
+ name="dynamic_form_nest_item"
232
+ onFinish={onFinish}
233
+ autoComplete="off"
234
+ form={form}
235
+ >
236
+ <div className={styles.details}>
237
+ <div className={styles.categoryName}>
238
+ {selectedCategory?.data?.categoryName}
239
+ </div>
240
+ <div className={styles.categoryDescription}>
241
+ {selectedCategory?.data?.description}
242
+ </div>
243
+ </div>
244
+ {selectedCategory?.data?.questions.map((question: any, index: number) => (
245
+ <div className={questionWrapper} key={index}>
246
+ <div className={styles.question}>
247
+ <div className={styles.subject}>
248
+ {question.subject}
249
+ </div>
250
+ <div className={styles.description}>
251
+ {question.description}
252
+ </div>
253
+ </div>
254
+ <div className={styles.answer}>
255
+ {selectedCategory.data.openAnswer
256
+ ? <Form.Item
257
+ name={["questions", index, "answer"]}
258
+ >
259
+ <TextArea />
260
+ </Form.Item>
261
+ : <Form.Item
262
+ name={["questions", index, "answer"]}
263
+ >
264
+ <Select options={evaluationOptions[selectedEvaluationOption]}
265
+ style={{ minWidth: '100%' }}
266
+ />
267
+ </Form.Item>
268
+ }
269
+ </div>
270
+ </div>
271
+ ))}
272
+
273
+ {selectedCategory?.data?.questions.length > 0 && (
274
+ <Button onClick={() => form.submit()}>Answer</Button>
275
+ )}
276
+ </Form>
277
+ </div>
278
+ </div>
279
+ );
280
+ });
@@ -0,0 +1,135 @@
1
+ .categoryResponse {
2
+ display: grid;
3
+ grid-template-columns: 300px auto;
4
+ gap: 16px;
5
+ height: 100%;
6
+ }
7
+
8
+ .sidebarWrapper {
9
+ background: #EBECED;
10
+ }
11
+
12
+ .contentWrapper {
13
+ background: var(--color-white);
14
+ }
15
+
16
+ .sidebarWrapper,
17
+ .contentWrapper {
18
+ padding: 20px;
19
+ }
20
+
21
+ .title {
22
+ font-size: var(--font-size-body-4);
23
+ color: var(--color-blue);
24
+ margin-bottom: 36px;
25
+ font-weight: var(--font-weight-semibold);
26
+ text-transform: uppercase;
27
+
28
+ }
29
+
30
+ .label {
31
+ padding-bottom: 15px;
32
+ font-weight: var(--font-weight-bold);
33
+ font-size: var(--font-size-body-4);
34
+ }
35
+
36
+ .cursorPointer {
37
+ cursor: pointer;
38
+ }
39
+
40
+ .subCategory {
41
+ padding-left: 16px;
42
+
43
+ .label {
44
+ font-weight: var(--font-weight-medium);
45
+ }
46
+
47
+ .labelWrapper {
48
+ .subCategory {
49
+ .label {
50
+ font-weight: var(--font-weight-light);
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ .labelWrapper {
57
+ display: block;
58
+ }
59
+
60
+ .active {
61
+ color: var(--color-orange);
62
+ }
63
+
64
+ .details {
65
+ margin-bottom: 24px;
66
+ }
67
+
68
+ .categoryName {
69
+ font-size: var(--font-size-body-4);
70
+ color: var(--color-blue);
71
+ font-weight: var(--font-weight-semibold);
72
+ margin-bottom: 8px;
73
+ }
74
+
75
+ .categoryDescription {
76
+ font-size: var(--font-size-body-3);
77
+ font-weight: var(--font-weight-light);
78
+ color: var(--color-black);
79
+ }
80
+
81
+ // Questions
82
+ .questionWrapper {
83
+ display: flex;
84
+ flex-direction: row;
85
+ gap: 12px;
86
+ margin-bottom: 36px;
87
+ }
88
+
89
+ .questionWrapperOpenAnswer {
90
+ flex-direction: column;
91
+ border-bottom: 1px solid rgba(var(--color-blue-rgb), .2);
92
+ margin-bottom: 24px;
93
+
94
+ .question {
95
+ width: 100%;
96
+ border-bottom: none;
97
+ }
98
+
99
+ .answer {
100
+ width: 100%;
101
+ height: auto;
102
+
103
+ :global {
104
+ .ant-input {
105
+ min-height: 140px;
106
+ }
107
+
108
+ .ant-form-item {
109
+ margin-bottom: 16px;
110
+ }
111
+ }
112
+ }
113
+ }
114
+
115
+ .question {
116
+ width: calc(100% - 112px);
117
+ border-bottom: 1px solid rgba(var(--color-blue-rgb), .2);
118
+ }
119
+
120
+ .answer {
121
+ width: 100px;
122
+ height: 50px;
123
+ align-self: flex-end;
124
+ }
125
+
126
+ .subject {
127
+ font-size: var(--font-size-body-3);
128
+ font-weight: var(--font-weight-medium);
129
+ margin-bottom: 8px;
130
+ }
131
+
132
+ .description {
133
+ font-weight: var(--font-weight-light);
134
+ margin-bottom: 4px;
135
+ }
@@ -1,17 +1,17 @@
1
1
  import { Meta, Story } from "@storybook/react";
2
- import { RangePickerTag } from '.';
2
+ import { DatePickerTag } from '.';
3
3
  import { TagProps } from 'antd';
4
4
  import { useState } from "react";
5
5
 
6
6
  export default {
7
- title: 'RangePickerTag',
8
- component: RangePickerTag,
7
+ title: 'DatePickerTag',
8
+ component: DatePickerTag,
9
9
  } as Meta;
10
10
 
11
11
  const Template: Story<TagProps> = (args) => {
12
12
  const [tagsInfo, setTagsInfo] = useState<any>({});
13
13
 
14
- return <RangePickerTag {...args} tagsInfo={setTagsInfo}></RangePickerTag>;
14
+ return <DatePickerTag {...args} tagsInfo={setTagsInfo}></DatePickerTag>;
15
15
  }
16
16
 
17
17
  export const Primary = Template.bind({});
@@ -9,24 +9,23 @@ export interface RangePickerTagProps extends TagProps {
9
9
  tagsInfo?: any;
10
10
  }
11
11
 
12
- const { RangePicker } = DatePicker;
13
- type RangeValue = [Dayjs | null, Dayjs | null] | null;
12
+ type DateValue = Dayjs | null;
14
13
 
15
- export const RangePickerTag = (props: RangePickerTagProps) => {
14
+ export const DatePickerTag = (props: RangePickerTagProps) => {
16
15
  const { customTags = [] } = props;
17
16
 
18
17
  const [tags, setTags] = useState<any>(customTags);
19
- const [rangeValue, setRangeValue] = useState<RangeValue>(null);
18
+ const [dateValue, setDateValue] = useState<DateValue>(null);
20
19
 
21
20
  const handleClose = (removedTag: any) => {
22
21
  const newTags = tags.filter((tag: any) => tag !== removedTag);
23
22
  setTags(newTags);
24
23
  };
25
24
 
26
- const handleChange = (dates: RangeValue, dateStrings: [string, string]) => {
27
- const rangeString = `${dates?.[0]?.format('DD/MM/YYYY')} - ${dates?.[1]?.format('DD/MM/YYYY')}`;
28
- setTags([...tags, rangeString]);
29
- setRangeValue(null);
25
+ const handleChange = (date: DateValue, dateString: string) => {
26
+ const formattedDate = date?.format('DD/MM/YYYY');
27
+ setTags([...tags, formattedDate]);
28
+ setDateValue(null);
30
29
  };
31
30
 
32
31
  useEffect(() => {
@@ -56,8 +55,8 @@ export const RangePickerTag = (props: RangePickerTagProps) => {
56
55
 
57
56
  return (
58
57
  <div className={styles.tagfield}>
59
- <RangePicker
60
- value={rangeValue}
58
+ <DatePicker
59
+ value={dateValue}
61
60
  onChange={handleChange}
62
61
  className={styles.picker}
63
62
  />
@@ -3,6 +3,11 @@
3
3
 
4
4
  .picker {
5
5
  height: 50px;
6
+ width: 300px;
7
+
8
+ @media(min-width: 1024px) {
9
+ width: 450px;
10
+ }
6
11
  }
7
12
 
8
13
  .new {
@@ -0,0 +1,178 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ import { Menu } from '.';
3
+ import { MenuProps } from 'antd';
4
+ import { getItem } from './helpers/codeMutation';
5
+
6
+ export default {
7
+ title: 'Menu',
8
+ component: Menu,
9
+ } as Meta;
10
+
11
+ const Template: Story<MenuProps> = (args) => {
12
+ const data = [
13
+ {
14
+ "Year": 2023,
15
+ "EvaluationCycles": [
16
+ {
17
+ "Id": "D5A77A3B-1163-4590-9C98-2E6D62442F62",
18
+ "Type": "Permanent",
19
+ "Name": "EV1",
20
+ "Year": 2023,
21
+ "StartDate": "2023-03-01T00:00:00Z",
22
+ "EndDate": "2023-05-31T23:00:00Z",
23
+ "Users": [
24
+ {
25
+ "UserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
26
+ "UserAnswer": null,
27
+ "UserScore": null,
28
+ "SupervisorId": null,
29
+ "SupervisorAnswer": null,
30
+ "SupervisorScore": null
31
+ },
32
+ {
33
+ "UserId": "9D361E92-A748-4E4A-BC5E-0134CE62328E",
34
+ "UserAnswer": "982FF376-56AD-4E3F-B0D0-5BD4282A7F78",
35
+ "UserScore": 3.333,
36
+ "SupervisorId": null,
37
+ "SupervisorAnswer": null,
38
+ "SupervisorScore": null
39
+ },
40
+ {
41
+ "UserId": "594A4DD5-12B1-4ED0-B00C-EDF729B85C57",
42
+ "UserAnswer": null,
43
+ "UserScore": null,
44
+ "SupervisorId": null,
45
+ "SupervisorAnswer": null,
46
+ "SupervisorScore": null
47
+ }
48
+ ],
49
+ "QuestionnaireId": "4C15A0A0-7DDF-4952-810C-B46105807CB7",
50
+ "State": "Started",
51
+ "Notifications": [],
52
+ "NotificationAgenda": null,
53
+ "Status": "A",
54
+ "IsOnlyForUsers": false,
55
+ "CreateDate": "2023-02-27T10:50:41.737Z",
56
+ "UpdateDate": "2023-02-27T10:52:50.661Z",
57
+ "CreateUserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
58
+ "UpdateUserId": null,
59
+ "InitiatDate": "2023-02-27T10:51:00Z",
60
+ "CancelDate": "0001-01-01T00:00:00Z"
61
+ },
62
+ {
63
+ "Id": "42A6EFDD-6D74-4905-94AE-5B5588967BE6",
64
+ "Type": "Permanent",
65
+ "Name": "EV1",
66
+ "Year": 2023,
67
+ "StartDate": "2023-03-01T00:00:00Z",
68
+ "EndDate": "2023-05-31T23:00:00Z",
69
+ "Users": [],
70
+ "QuestionnaireId": "4C15A0A0-7DDF-4952-810C-B46105807CB7",
71
+ "State": "Draft",
72
+ "Notifications": [],
73
+ "NotificationAgenda": null,
74
+ "Status": "A",
75
+ "IsOnlyForUsers": false,
76
+ "CreateDate": "2023-02-27T14:52:16.523Z",
77
+ "UpdateDate": "2023-02-27T14:53:04.987Z",
78
+ "CreateUserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
79
+ "UpdateUserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
80
+ "InitiatDate": "0001-01-01T00:00:00Z",
81
+ "CancelDate": "0001-01-01T00:00:00Z"
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "Year": 2024,
87
+ "EvaluationCycles": [
88
+ {
89
+ "Id": "D5A77A3B-1163-4590-9C98-2E6D62442F62",
90
+ "Type": "Permanent",
91
+ "Name": "EV2",
92
+ "Year": 2024,
93
+ "StartDate": "2023-03-01T00:00:00Z",
94
+ "EndDate": "2023-05-31T23:00:00Z",
95
+ "Users": [
96
+ {
97
+ "UserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
98
+ "UserAnswer": null,
99
+ "UserScore": null,
100
+ "SupervisorId": null,
101
+ "SupervisorAnswer": null,
102
+ "SupervisorScore": null
103
+ },
104
+ {
105
+ "UserId": "9D361E92-A748-4E4A-BC5E-0134CE62328E",
106
+ "UserAnswer": "982FF376-56AD-4E3F-B0D0-5BD4282A7F78",
107
+ "UserScore": 3.333,
108
+ "SupervisorId": null,
109
+ "SupervisorAnswer": null,
110
+ "SupervisorScore": null
111
+ },
112
+ {
113
+ "UserId": "594A4DD5-12B1-4ED0-B00C-EDF729B85C57",
114
+ "UserAnswer": null,
115
+ "UserScore": null,
116
+ "SupervisorId": null,
117
+ "SupervisorAnswer": null,
118
+ "SupervisorScore": null
119
+ }
120
+ ],
121
+ "QuestionnaireId": "4C15A0A0-7DDF-4952-810C-B46105807CB7",
122
+ "State": "Started",
123
+ "Notifications": [],
124
+ "NotificationAgenda": null,
125
+ "Status": "A",
126
+ "IsOnlyForUsers": false,
127
+ "CreateDate": "2023-02-27T10:50:41.737Z",
128
+ "UpdateDate": "2023-02-27T10:52:50.661Z",
129
+ "CreateUserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
130
+ "UpdateUserId": null,
131
+ "InitiatDate": "2023-02-27T10:51:00Z",
132
+ "CancelDate": "0001-01-01T00:00:00Z"
133
+ },
134
+ {
135
+ "Id": "42A6EFDD-6D74-4905-94AE-5B5588967BE6",
136
+ "Type": "Permanent",
137
+ "Name": "EV2",
138
+ "Year": 2024,
139
+ "StartDate": "2023-03-01T00:00:00Z",
140
+ "EndDate": "2023-05-31T23:00:00Z",
141
+ "Users": [],
142
+ "QuestionnaireId": "4C15A0A0-7DDF-4952-810C-B46105807CB7",
143
+ "State": "Draft",
144
+ "Notifications": [],
145
+ "NotificationAgenda": null,
146
+ "Status": "A",
147
+ "IsOnlyForUsers": false,
148
+ "CreateDate": "2023-02-27T14:52:16.523Z",
149
+ "UpdateDate": "2023-02-27T14:53:04.987Z",
150
+ "CreateUserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
151
+ "UpdateUserId": "A200F4C5-8E41-41D4-A90C-B15EEC448517",
152
+ "InitiatDate": "0001-01-01T00:00:00Z",
153
+ "CancelDate": "0001-01-01T00:00:00Z"
154
+ }
155
+ ]
156
+ }
157
+ ];
158
+
159
+ const items = data.map((el: any, index: any) => {
160
+ return (
161
+ getItem(
162
+ el.Year,
163
+ index,
164
+ <></>,
165
+ el.EvaluationCycles?.map((evCycle: any, subIndex: any) => {
166
+ return getItem(evCycle.Name, `${index}-${subIndex}`);
167
+ })
168
+ )
169
+ )
170
+ });
171
+
172
+
173
+ return <Menu {...args} items={items}></Menu>;
174
+ }
175
+
176
+ export const Primary = Template.bind({});
177
+ Primary.args = {
178
+ };
@@ -0,0 +1,19 @@
1
+ import type { MenuProps } from 'antd';
2
+
3
+ export type MenuItem = Required<MenuProps>['items'][number];
4
+
5
+ export function getItem(
6
+ label: React.ReactNode,
7
+ key: React.Key,
8
+ icon?: React.ReactNode,
9
+ children?: MenuItem[],
10
+ type?: 'group',
11
+ ): MenuItem {
12
+ return {
13
+ key,
14
+ icon,
15
+ children,
16
+ label,
17
+ type,
18
+ } as MenuItem;
19
+ }