@omniumretail/component-library 1.1.66 → 1.1.67
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.
package/package.json
CHANGED
|
@@ -97,7 +97,8 @@ Primary.args = {
|
|
|
97
97
|
"Grade": "0",
|
|
98
98
|
"Note": "Lorem ipsum dolor sit amet, consectetur adipiscing elit Lorem ipsum dolor sit amet, consectetur adipiscing elit",
|
|
99
99
|
"Answer": null,
|
|
100
|
-
"ActionNames": ["Ação12345662323", "A"]
|
|
100
|
+
"ActionNames": ["Ação12345662323", "A"],
|
|
101
|
+
"IsOpenAnswer": true
|
|
101
102
|
},
|
|
102
103
|
{
|
|
103
104
|
"Id": "85562A64-A24B-425A-A345-560238CA2468",
|
|
@@ -251,7 +251,7 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
|
|
|
251
251
|
}, [currentKey, localData.CategoryAnswers, props]);
|
|
252
252
|
|
|
253
253
|
const questionWrapper = classNames({
|
|
254
|
-
[styles.questionWrapperOpenAnswer]: selectedCategory.Data.OpenAnswer,
|
|
254
|
+
[styles.questionWrapperOpenAnswer]: (selectedCategory.Data.OpenAnswer),
|
|
255
255
|
}, [styles.questionWrapper]);
|
|
256
256
|
|
|
257
257
|
// This gets the scale we use for each select from the database using a key based variable,if
|
|
@@ -282,91 +282,98 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
|
|
|
282
282
|
{selectedCategory?.Data?.Description}
|
|
283
283
|
</div>
|
|
284
284
|
</div>
|
|
285
|
-
{selectedCategory?.Data?.Questions.map((question: any, index: number) =>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
285
|
+
{selectedCategory?.Data?.Questions.map((question: any, index: number) => {
|
|
286
|
+
const isOpenAnswer = selectedCategory.Data.OpenAnswer || question.IsOpenAnswer;
|
|
287
|
+
const questionWrapper = classNames({
|
|
288
|
+
[styles.questionWrapperOpenAnswer]: isOpenAnswer,
|
|
289
|
+
}, [styles.questionWrapper]);
|
|
290
|
+
|
|
291
|
+
return (
|
|
292
|
+
<div className={questionWrapper} key={index}>
|
|
293
|
+
<div className={styles.question}>
|
|
294
|
+
<div className={styles.subject}>
|
|
295
|
+
{question.Subject}
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div className={styles.description}>
|
|
299
|
+
{question.Description}
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
{props.addButtons &&
|
|
303
|
+
<>
|
|
304
|
+
{(form.getFieldValue(`Questions`)?.[index].Note || isNoteVisible) &&
|
|
305
|
+
<div className={styles.noteContainer}>
|
|
306
|
+
<span className={styles.note}>{t('components.categoryResponse.note')}: </span>
|
|
307
|
+
{isNoteVisible?.categoryIndex === currentKey && isNoteVisible?.questionIndex === index ? (
|
|
308
|
+
<Form.Item name={["Questions", index, "Note"]} className={styles.form}>
|
|
309
|
+
<TextArea onBlur={() => setIsNoteVisible(null)} />
|
|
310
|
+
</Form.Item>
|
|
311
|
+
) : (
|
|
312
|
+
<div className={styles.noteText}>{form.getFieldValue(`Questions`)?.[index].Note}</div>
|
|
313
|
+
)}
|
|
314
|
+
</div>
|
|
295
315
|
|
|
296
|
-
|
|
297
|
-
<>
|
|
298
|
-
{(form.getFieldValue(`Questions`)?.[index].Note || isNoteVisible) &&
|
|
299
|
-
<div className={styles.noteContainer}>
|
|
300
|
-
<span className={styles.note}>{t('components.categoryResponse.note')}: </span>
|
|
301
|
-
{isNoteVisible?.categoryIndex === currentKey && isNoteVisible?.questionIndex === index ? (
|
|
302
|
-
<Form.Item name={["Questions", index, "Note"]} className={styles.form}>
|
|
303
|
-
<TextArea onBlur={() => setIsNoteVisible(null)} />
|
|
304
|
-
</Form.Item>
|
|
305
|
-
) : (
|
|
306
|
-
<div className={styles.noteText}>{form.getFieldValue(`Questions`)?.[index].Note}</div>
|
|
307
|
-
)}
|
|
308
|
-
</div>
|
|
309
|
-
|
|
310
|
-
}
|
|
316
|
+
}
|
|
311
317
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
318
|
+
{question?.ActionNames &&
|
|
319
|
+
<div className={styles.actionContainer}>
|
|
320
|
+
<span className={styles.note}>{t('components.categoryResponse.actions')}: </span>
|
|
321
|
+
|
|
322
|
+
{question?.ActionNames?.map((action: any, index: number) => (
|
|
323
|
+
<span key={index} className={index > 0 ? styles.action : ''}>
|
|
324
|
+
{action}
|
|
325
|
+
<br />
|
|
326
|
+
</span>
|
|
327
|
+
))}
|
|
328
|
+
</div>
|
|
329
|
+
}
|
|
315
330
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
331
|
+
<div className={styles.actionsButtonsContainer}>
|
|
332
|
+
<Upload
|
|
333
|
+
listType={"text"}
|
|
334
|
+
fileList={fileLists[`${selectedCategory.Data.CategoryId}_${question.QuestionId}`] || []}
|
|
335
|
+
beforeUpload={() => false} // Prevent automatic upload
|
|
336
|
+
onChange={({ fileList }) => handleFileChange(fileList, selectedCategory.Data.CategoryId, question.QuestionId)}
|
|
337
|
+
onPreview={onPreview}
|
|
338
|
+
>
|
|
339
|
+
<Button customClass={styles.loadFile}>{t('components.upload.loadFile')}</Button>
|
|
340
|
+
</Upload>
|
|
341
|
+
|
|
342
|
+
<Button customClass={styles.actionsButtons} onClick={() => setIsNoteVisible({ categoryIndex: currentKey, questionIndex: index })}>
|
|
343
|
+
{form.getFieldValue(`Questions`)?.[index].Note ? t('components.categoryResponse.editNote') : t('components.categoryResponse.addNote')}
|
|
344
|
+
</Button>
|
|
345
|
+
|
|
346
|
+
<Button customClass={styles.actionsButtons} onClick={props.addAction}>{t('components.categoryResponse.createAction')}</Button>
|
|
322
347
|
</div>
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
>
|
|
350
|
-
<TextArea />
|
|
351
|
-
</Form.Item>
|
|
352
|
-
|
|
353
|
-
: <Form.Item
|
|
354
|
-
name={["Questions", index, "Answer"]}
|
|
355
|
-
>
|
|
356
|
-
<Select
|
|
357
|
-
options={selectedCategory.Data.IsYesOrNo
|
|
358
|
-
? props.selectYesNoOption
|
|
359
|
-
: question?.Options?.length > 0
|
|
360
|
-
? question?.Options?.map((option: any) => ({ label: option.Value, value: option.Value }))
|
|
361
|
-
: evaluationOptions[selectedEvaluationOption]
|
|
362
|
-
}
|
|
363
|
-
style={{ minWidth: '100%' }}
|
|
364
|
-
/>
|
|
365
|
-
</Form.Item>
|
|
366
|
-
}
|
|
348
|
+
</>
|
|
349
|
+
}
|
|
350
|
+
</div>
|
|
351
|
+
<div className={styles.answer}>
|
|
352
|
+
{isOpenAnswer
|
|
353
|
+
? <Form.Item
|
|
354
|
+
name={["Questions", index, "Answer"]}
|
|
355
|
+
>
|
|
356
|
+
<TextArea />
|
|
357
|
+
</Form.Item>
|
|
358
|
+
|
|
359
|
+
: <Form.Item
|
|
360
|
+
name={["Questions", index, "Answer"]}
|
|
361
|
+
>
|
|
362
|
+
<Select
|
|
363
|
+
options={selectedCategory.Data.IsYesOrNo
|
|
364
|
+
? props.selectYesNoOption
|
|
365
|
+
: question?.Options?.length > 0
|
|
366
|
+
? question?.Options?.map((option: any) => ({ label: option.Value, value: option.Value }))
|
|
367
|
+
: evaluationOptions[selectedEvaluationOption]
|
|
368
|
+
}
|
|
369
|
+
style={{ minWidth: '100%' }}
|
|
370
|
+
/>
|
|
371
|
+
</Form.Item>
|
|
372
|
+
}
|
|
373
|
+
</div>
|
|
367
374
|
</div>
|
|
368
|
-
|
|
369
|
-
)
|
|
375
|
+
);
|
|
376
|
+
})}
|
|
370
377
|
</Form>
|
|
371
378
|
</div >
|
|
372
379
|
</div >
|