@elice/material-assignment 1.231227.0 → 1.240112.0-cloud.0
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/cjs/components/material-assignment/MaterialAssignment.js +13 -19
- package/cjs/components/material-assignment/MaterialAssignmentContent.js +99 -130
- package/cjs/components/material-assignment/MaterialAssignmentUploadModal.js +96 -129
- package/cjs/components/material-assignment/locales.js +2 -4
- package/cjs/components/material-assignment-admin/MaterialAssignmentAdmin.js +21 -26
- package/cjs/components/material-assignment-admin/MaterialAssignmentAdmin.styled.js +9 -21
- package/cjs/components/material-assignment-admin/MaterialAssignmentAdminContent.js +320 -447
- package/cjs/components/material-assignment-admin/MaterialAssignmentAdminContentTa.js +152 -211
- package/cjs/components/shared/MaterialAssignmentContainer.js +10 -14
- package/cjs/index.js +2 -4
- package/es/components/material-assignment/MaterialAssignment.js +8 -8
- package/es/components/material-assignment/MaterialAssignmentContent.js +65 -92
- package/es/components/material-assignment/MaterialAssignmentUploadModal.js +83 -111
- package/es/components/material-assignment/locales.js +2 -2
- package/es/components/material-assignment-admin/MaterialAssignmentAdmin.js +13 -13
- package/es/components/material-assignment-admin/MaterialAssignmentAdmin.styled.js +9 -15
- package/es/components/material-assignment-admin/MaterialAssignmentAdminContent.js +231 -353
- package/es/components/material-assignment-admin/MaterialAssignmentAdminContentTa.js +94 -148
- package/es/components/shared/MaterialAssignmentContainer.js +7 -6
- package/package.json +7 -7
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -388
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -377
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React, { forwardRef } from 'react';
|
|
3
2
|
import { useForm, Controller } from 'react-hook-form';
|
|
4
3
|
import { FormattedDate } from 'react-intl';
|
|
5
4
|
import { config, getOrgUserGet, getOrgMaterialAssignmentGet, getOrgMaterialAssignmentSubmissionList, getOrgMaterialAssignmentGradeResultGet, getOrgMaterialAssignmentGradeList, postOrgMaterialAssignmentGradeEdit, postOrgMaterialAssignmentGradeResultManualScoreEdit, postOrgMaterialAssignmentGradeDelete } from '@elice/api-client';
|
|
6
|
-
import { Flex, Vspace, ProfileImage, Hspace, Text, Tooltip, Icon, InfoTable, Button, TableNext, IconButton, Pagination, Modal, Label, Input, Textarea, Alert
|
|
5
|
+
import { Notification, Flex, Vspace, ProfileImage, Hspace, Text, Tooltip, Icon, InfoTable, Button, TableNext, IconButton, Pagination, Modal, Label, Input, Textarea, Alert } from '@elice/blocks';
|
|
7
6
|
import { base } from '@elice/design-tokens';
|
|
8
7
|
import { eilStatusInfo, eilChat, eilDelete, eilArrowRightwardsBasic } from '@elice/icons';
|
|
9
8
|
import { useMaterialConfigApiClientUpdate } from '@elice/material-shared-utils';
|
|
@@ -11,173 +10,121 @@ import dayjs from 'dayjs';
|
|
|
11
10
|
import MaterialAssignmentContainer from '../shared/MaterialAssignmentContainer.js';
|
|
12
11
|
import { StyledMaterialAssignmentAdminHeader, StyledMaterialAssignmentAdminHeaderCell, StyledMaterialAssignmentAdminGradeWrapper, StyledMaterialAssignmentAdminTextareaWrapper, StyledMaterialAssignmentAdminManualScoreEditButtonWrapper, StyledMaterialAssignmentAdminManualScoreEditButton } from './MaterialAssignmentAdmin.styled.js';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const FETCH_GRADE_LIST_COUNT = 5;
|
|
14
|
+
const MaterialAssignmentAdminContent = forwardRef(({
|
|
15
|
+
materialAssignmentId,
|
|
16
|
+
userId,
|
|
17
|
+
adminUserId,
|
|
18
|
+
updateMaterialUserBrowserResponse
|
|
19
|
+
}, ref) => {
|
|
20
20
|
var _a;
|
|
21
21
|
// Form
|
|
22
|
-
|
|
22
|
+
const gradeEditFormMethods = useForm({
|
|
23
23
|
defaultValues: {
|
|
24
24
|
score: 0,
|
|
25
25
|
comment: ''
|
|
26
26
|
},
|
|
27
27
|
mode: 'onChange'
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
const manualScoreEditFormMethods = useForm({
|
|
30
30
|
defaultValues: {
|
|
31
31
|
manualScore: 0
|
|
32
32
|
},
|
|
33
33
|
mode: 'onChange'
|
|
34
34
|
});
|
|
35
35
|
// API Status
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
submissionListGetStatus = _React$useState2[0],
|
|
40
|
-
setSubmissionListGetStatus = _React$useState2[1];
|
|
41
|
-
var _React$useState3 = React.useState('idle'),
|
|
42
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
43
|
-
gradeDeleteStatus = _React$useState4[0],
|
|
44
|
-
setGradeDeleteStatus = _React$useState4[1];
|
|
36
|
+
const isReady = useMaterialConfigApiClientUpdate(config.init);
|
|
37
|
+
const [submissionListGetStatus, setSubmissionListGetStatus] = React.useState('idle');
|
|
38
|
+
const [gradeDeleteStatus, setGradeDeleteStatus] = React.useState('idle');
|
|
45
39
|
// State related with component
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var _React$useState7 = React.useState(false),
|
|
51
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
52
|
-
showManualScoreEditModal = _React$useState8[0],
|
|
53
|
-
setShowManualScoreEditModal = _React$useState8[1];
|
|
54
|
-
var _React$useState9 = React.useState(null),
|
|
55
|
-
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
56
|
-
selectedGradeForShow = _React$useState10[0],
|
|
57
|
-
setSelectedGradeForShow = _React$useState10[1];
|
|
58
|
-
var _React$useState11 = React.useState(null),
|
|
59
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
60
|
-
selectedGradeForDelete = _React$useState12[0],
|
|
61
|
-
setSelectedGradeForDelete = _React$useState12[1];
|
|
40
|
+
const [showGradeEditModal, setShowGradeEditModal] = React.useState(false);
|
|
41
|
+
const [showManualScoreEditModal, setShowManualScoreEditModal] = React.useState(false);
|
|
42
|
+
const [selectedGradeForShow, setSelectedGradeForShow] = React.useState(null);
|
|
43
|
+
const [selectedGradeForDelete, setSelectedGradeForDelete] = React.useState(null);
|
|
62
44
|
// State related with api
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
77
|
-
myGrade = _React$useState20[0],
|
|
78
|
-
setMyGrade = _React$useState20[1];
|
|
79
|
-
var _React$useState21 = React.useState(null),
|
|
80
|
-
_React$useState22 = _slicedToArray(_React$useState21, 2),
|
|
81
|
-
gradeResult = _React$useState22[0],
|
|
82
|
-
setGradeResult = _React$useState22[1];
|
|
83
|
-
var _React$useState23 = React.useState([]),
|
|
84
|
-
_React$useState24 = _slicedToArray(_React$useState23, 2),
|
|
85
|
-
gradeList = _React$useState24[0],
|
|
86
|
-
setGradeList = _React$useState24[1];
|
|
87
|
-
var _React$useState25 = React.useState(0),
|
|
88
|
-
_React$useState26 = _slicedToArray(_React$useState25, 2),
|
|
89
|
-
gradeListCount = _React$useState26[0],
|
|
90
|
-
setGradeListCount = _React$useState26[1];
|
|
91
|
-
var _React$useState27 = React.useState(1),
|
|
92
|
-
_React$useState28 = _slicedToArray(_React$useState27, 2),
|
|
93
|
-
gradeListPage = _React$useState28[0],
|
|
94
|
-
setGradeListPage = _React$useState28[1];
|
|
95
|
-
var gradeListOffset = (gradeListPage - 1) * FETCH_GRADE_LIST_COUNT;
|
|
96
|
-
var isAssignmentClosed = dayjs().isAfter(dayjs(materialAssignment === null || materialAssignment === void 0 ? void 0 : materialAssignment.closeDatetime));
|
|
97
|
-
var isScoreFinalized = Boolean(materialAssignment === null || materialAssignment === void 0 ? void 0 : materialAssignment.scoreFinalizedDatetime);
|
|
98
|
-
var isUserSubmitted = Boolean(userSubmission);
|
|
99
|
-
var fetchUserGet = React.useCallback(function () {
|
|
45
|
+
const [user, setUser] = React.useState(null);
|
|
46
|
+
const [materialAssignment, setMaterialAssignment] = React.useState(null);
|
|
47
|
+
const [userSubmission, setUserSubmission] = React.useState(null);
|
|
48
|
+
const [myGrade, setMyGrade] = React.useState(null);
|
|
49
|
+
const [gradeResult, setGradeResult] = React.useState(null);
|
|
50
|
+
const [gradeList, setGradeList] = React.useState([]);
|
|
51
|
+
const [gradeListCount, setGradeListCount] = React.useState(0);
|
|
52
|
+
const [gradeListPage, setGradeListPage] = React.useState(1);
|
|
53
|
+
const gradeListOffset = (gradeListPage - 1) * FETCH_GRADE_LIST_COUNT;
|
|
54
|
+
const isAssignmentClosed = dayjs().isAfter(dayjs(materialAssignment === null || materialAssignment === void 0 ? void 0 : materialAssignment.closeDatetime));
|
|
55
|
+
const isScoreFinalized = Boolean(materialAssignment === null || materialAssignment === void 0 ? void 0 : materialAssignment.scoreFinalizedDatetime);
|
|
56
|
+
const isUserSubmitted = Boolean(userSubmission);
|
|
57
|
+
const fetchUserGet = React.useCallback(() => {
|
|
100
58
|
void getOrgUserGet({
|
|
101
|
-
userId
|
|
102
|
-
}).then(
|
|
103
|
-
return res.user;
|
|
104
|
-
}).then(setUser);
|
|
59
|
+
userId
|
|
60
|
+
}).then(res => res.user).then(setUser);
|
|
105
61
|
}, [userId]);
|
|
106
|
-
|
|
62
|
+
const fetchMaterialAssignmentGet = React.useCallback(() => {
|
|
107
63
|
void getOrgMaterialAssignmentGet({
|
|
108
|
-
materialAssignmentId
|
|
109
|
-
}).then(
|
|
110
|
-
return res.materialAssignment;
|
|
111
|
-
}).then(setMaterialAssignment);
|
|
64
|
+
materialAssignmentId
|
|
65
|
+
}).then(res => res.materialAssignment).then(setMaterialAssignment);
|
|
112
66
|
}, [materialAssignmentId]);
|
|
113
|
-
|
|
67
|
+
const fetchSubmissionList = React.useCallback(() => {
|
|
114
68
|
setSubmissionListGetStatus('pending');
|
|
115
69
|
void getOrgMaterialAssignmentSubmissionList({
|
|
116
|
-
materialAssignmentId
|
|
70
|
+
materialAssignmentId,
|
|
117
71
|
offset: 0,
|
|
118
72
|
count: 1,
|
|
119
73
|
filterConditions: {
|
|
120
74
|
isLast: true,
|
|
121
75
|
userIds: [userId]
|
|
122
76
|
}
|
|
123
|
-
}).then(
|
|
124
|
-
return res.materialAssignmentSubmissions[0];
|
|
125
|
-
}).then(function (submission) {
|
|
77
|
+
}).then(res => res.materialAssignmentSubmissions[0]).then(submission => {
|
|
126
78
|
setUserSubmission(submission !== null && submission !== void 0 ? submission : null);
|
|
127
79
|
setSubmissionListGetStatus('resolved');
|
|
128
|
-
}).catch(
|
|
80
|
+
}).catch(err => {
|
|
129
81
|
console.error(err);
|
|
130
82
|
setSubmissionListGetStatus('rejected');
|
|
131
83
|
});
|
|
132
84
|
}, [materialAssignmentId, userId]);
|
|
133
|
-
|
|
85
|
+
const fetchGradeResult = React.useCallback(() => {
|
|
134
86
|
void getOrgMaterialAssignmentGradeResultGet({
|
|
135
|
-
materialAssignmentId
|
|
136
|
-
userId
|
|
137
|
-
}).then(
|
|
138
|
-
return res.materialAssignmentGradeResult;
|
|
139
|
-
}).then(setGradeResult).catch(function () {
|
|
87
|
+
materialAssignmentId,
|
|
88
|
+
userId
|
|
89
|
+
}).then(res => res.materialAssignmentGradeResult).then(setGradeResult).catch(() => {
|
|
140
90
|
setGradeResult(null);
|
|
141
91
|
});
|
|
142
92
|
}, [materialAssignmentId, userId]);
|
|
143
|
-
|
|
93
|
+
const fetchGradeList = React.useCallback(() => {
|
|
144
94
|
void getOrgMaterialAssignmentGradeList({
|
|
145
|
-
materialAssignmentId
|
|
95
|
+
materialAssignmentId,
|
|
146
96
|
offset: gradeListOffset,
|
|
147
97
|
count: FETCH_GRADE_LIST_COUNT,
|
|
148
98
|
filterConditions: {
|
|
149
|
-
userId
|
|
99
|
+
userId
|
|
150
100
|
}
|
|
151
|
-
}).then(
|
|
152
|
-
|
|
153
|
-
|
|
101
|
+
}).then(({
|
|
102
|
+
materialAssignmentGrades,
|
|
103
|
+
materialAssignmentGradeCount
|
|
104
|
+
}) => {
|
|
154
105
|
setGradeList(materialAssignmentGrades);
|
|
155
106
|
setGradeListCount(materialAssignmentGradeCount);
|
|
156
107
|
});
|
|
157
108
|
}, [gradeListOffset, materialAssignmentId, userId]);
|
|
158
|
-
|
|
109
|
+
const fetchMyGrade = React.useCallback(() => {
|
|
159
110
|
void getOrgMaterialAssignmentGradeList({
|
|
160
|
-
materialAssignmentId
|
|
111
|
+
materialAssignmentId,
|
|
161
112
|
offset: 0,
|
|
162
113
|
count: 1,
|
|
163
114
|
filterConditions: {
|
|
164
|
-
userId
|
|
115
|
+
userId,
|
|
165
116
|
gradeUserId: adminUserId
|
|
166
117
|
}
|
|
167
|
-
}).then(
|
|
168
|
-
return res.materialAssignmentGrades[0];
|
|
169
|
-
}).then(function (grade) {
|
|
170
|
-
return setMyGrade(grade !== null && grade !== void 0 ? grade : null);
|
|
171
|
-
});
|
|
118
|
+
}).then(res => res.materialAssignmentGrades[0]).then(grade => setMyGrade(grade !== null && grade !== void 0 ? grade : null));
|
|
172
119
|
}, [adminUserId, materialAssignmentId, userId]);
|
|
173
|
-
|
|
120
|
+
const handleManualScoreEditClick = () => {
|
|
174
121
|
var _a, _b;
|
|
175
122
|
setShowManualScoreEditModal(true);
|
|
176
123
|
manualScoreEditFormMethods.reset({
|
|
177
124
|
manualScore: (_b = (_a = gradeResult === null || gradeResult === void 0 ? void 0 : gradeResult.manualScore) !== null && _a !== void 0 ? _a : gradeResult === null || gradeResult === void 0 ? void 0 : gradeResult.avgCalcScore) !== null && _b !== void 0 ? _b : 0
|
|
178
125
|
});
|
|
179
126
|
};
|
|
180
|
-
|
|
127
|
+
const handleGradeEditClick = () => {
|
|
181
128
|
var _a, _b;
|
|
182
129
|
setShowGradeEditModal(true);
|
|
183
130
|
gradeEditFormMethods.reset({
|
|
@@ -185,144 +132,82 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
185
132
|
comment: (_b = myGrade === null || myGrade === void 0 ? void 0 : myGrade.comment) !== null && _b !== void 0 ? _b : ''
|
|
186
133
|
});
|
|
187
134
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
case 14:
|
|
265
|
-
_context2.prev = 14;
|
|
266
|
-
_context2.t0 = _context2["catch"](2);
|
|
267
|
-
console.error(_context2.t0);
|
|
268
|
-
setGradeDeleteStatus('rejected');
|
|
269
|
-
Notification.error('오류가 발생했습니다.');
|
|
270
|
-
case 19:
|
|
271
|
-
_context2.prev = 19;
|
|
272
|
-
setSelectedGradeForDelete(null);
|
|
273
|
-
return _context2.finish(19);
|
|
274
|
-
case 22:
|
|
275
|
-
case "end":
|
|
276
|
-
return _context2.stop();
|
|
277
|
-
}
|
|
278
|
-
}, _callee2, null, [[2, 14, 19, 22]]);
|
|
279
|
-
}));
|
|
280
|
-
return function handleGradeDeleteSubmit() {
|
|
281
|
-
return _ref5.apply(this, arguments);
|
|
282
|
-
};
|
|
283
|
-
}();
|
|
284
|
-
var handleManualScoreEditSubmit = manualScoreEditFormMethods.handleSubmit( /*#__PURE__*/function () {
|
|
285
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref6) {
|
|
286
|
-
var manualScore;
|
|
287
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
288
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
289
|
-
case 0:
|
|
290
|
-
manualScore = _ref6.manualScore;
|
|
291
|
-
_context3.prev = 1;
|
|
292
|
-
_context3.next = 4;
|
|
293
|
-
return postOrgMaterialAssignmentGradeResultManualScoreEdit({
|
|
294
|
-
userId: userId,
|
|
295
|
-
manualScore: manualScore,
|
|
296
|
-
materialAssignmentId: materialAssignmentId
|
|
297
|
-
});
|
|
298
|
-
case 4:
|
|
299
|
-
fetchGradeResult();
|
|
300
|
-
if (typeof updateMaterialUserBrowserResponse === 'function') {
|
|
301
|
-
updateMaterialUserBrowserResponse(userId);
|
|
302
|
-
}
|
|
303
|
-
Notification.success('저장되었습니다');
|
|
304
|
-
_context3.next = 13;
|
|
305
|
-
break;
|
|
306
|
-
case 9:
|
|
307
|
-
_context3.prev = 9;
|
|
308
|
-
_context3.t0 = _context3["catch"](1);
|
|
309
|
-
console.error(_context3.t0);
|
|
310
|
-
Notification.error('오류가 발생했습니다.');
|
|
311
|
-
case 13:
|
|
312
|
-
_context3.prev = 13;
|
|
313
|
-
setShowManualScoreEditModal(false);
|
|
314
|
-
return _context3.finish(13);
|
|
315
|
-
case 16:
|
|
316
|
-
case "end":
|
|
317
|
-
return _context3.stop();
|
|
318
|
-
}
|
|
319
|
-
}, _callee3, null, [[1, 9, 13, 16]]);
|
|
320
|
-
}));
|
|
321
|
-
return function (_x2) {
|
|
322
|
-
return _ref7.apply(this, arguments);
|
|
323
|
-
};
|
|
324
|
-
}());
|
|
325
|
-
React.useEffect(function () {
|
|
135
|
+
const handleGradeEditSubmit = gradeEditFormMethods.handleSubmit(async ({
|
|
136
|
+
score,
|
|
137
|
+
comment
|
|
138
|
+
}) => {
|
|
139
|
+
try {
|
|
140
|
+
await postOrgMaterialAssignmentGradeEdit({
|
|
141
|
+
materialAssignmentGradeId: myGrade === null || myGrade === void 0 ? void 0 : myGrade.id,
|
|
142
|
+
materialAssignmentId,
|
|
143
|
+
userId,
|
|
144
|
+
score,
|
|
145
|
+
comment
|
|
146
|
+
});
|
|
147
|
+
fetchMyGrade();
|
|
148
|
+
fetchGradeResult();
|
|
149
|
+
fetchGradeList();
|
|
150
|
+
if (typeof updateMaterialUserBrowserResponse === 'function') {
|
|
151
|
+
updateMaterialUserBrowserResponse(userId);
|
|
152
|
+
}
|
|
153
|
+
Notification.success('저장되었습니다');
|
|
154
|
+
} catch (err) {
|
|
155
|
+
console.error(err);
|
|
156
|
+
Notification.error('오류가 발생했습니다.');
|
|
157
|
+
} finally {
|
|
158
|
+
setShowGradeEditModal(false);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
const handleGradeDeleteSubmit = async () => {
|
|
162
|
+
if (!selectedGradeForDelete) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
setGradeDeleteStatus('pending');
|
|
167
|
+
await postOrgMaterialAssignmentGradeDelete({
|
|
168
|
+
materialAssignmentGradeId: selectedGradeForDelete.id
|
|
169
|
+
});
|
|
170
|
+
// If delete my grade, re-fetch my grade data.
|
|
171
|
+
if (adminUserId === selectedGradeForDelete.gradeUser.id) {
|
|
172
|
+
fetchMyGrade();
|
|
173
|
+
}
|
|
174
|
+
fetchGradeList();
|
|
175
|
+
fetchGradeResult();
|
|
176
|
+
setGradeDeleteStatus('resolved');
|
|
177
|
+
if (typeof updateMaterialUserBrowserResponse === 'function') {
|
|
178
|
+
updateMaterialUserBrowserResponse(userId);
|
|
179
|
+
}
|
|
180
|
+
Notification.success('저장되었습니다');
|
|
181
|
+
} catch (err) {
|
|
182
|
+
console.error(err);
|
|
183
|
+
setGradeDeleteStatus('rejected');
|
|
184
|
+
Notification.error('오류가 발생했습니다.');
|
|
185
|
+
} finally {
|
|
186
|
+
setSelectedGradeForDelete(null);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const handleManualScoreEditSubmit = manualScoreEditFormMethods.handleSubmit(async ({
|
|
190
|
+
manualScore
|
|
191
|
+
}) => {
|
|
192
|
+
try {
|
|
193
|
+
await postOrgMaterialAssignmentGradeResultManualScoreEdit({
|
|
194
|
+
userId,
|
|
195
|
+
manualScore,
|
|
196
|
+
materialAssignmentId
|
|
197
|
+
});
|
|
198
|
+
fetchGradeResult();
|
|
199
|
+
if (typeof updateMaterialUserBrowserResponse === 'function') {
|
|
200
|
+
updateMaterialUserBrowserResponse(userId);
|
|
201
|
+
}
|
|
202
|
+
Notification.success('저장되었습니다');
|
|
203
|
+
} catch (err) {
|
|
204
|
+
console.error(err);
|
|
205
|
+
Notification.error('오류가 발생했습니다.');
|
|
206
|
+
} finally {
|
|
207
|
+
setShowManualScoreEditModal(false);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
React.useEffect(() => {
|
|
326
211
|
if (!isReady) {
|
|
327
212
|
return;
|
|
328
213
|
}
|
|
@@ -333,14 +218,12 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
333
218
|
fetchSubmissionList();
|
|
334
219
|
fetchMaterialAssignmentGet();
|
|
335
220
|
}, [isReady, fetchUserGet, fetchMyGrade, fetchGradeList, fetchGradeResult, fetchSubmissionList, fetchMaterialAssignmentGet]);
|
|
336
|
-
React.useImperativeHandle(ref,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}, [fetchMaterialAssignmentGet]);
|
|
343
|
-
var renderHeader = function renderHeader() {
|
|
221
|
+
React.useImperativeHandle(ref, () => ({
|
|
222
|
+
refreshMaterialAssignment: () => {
|
|
223
|
+
fetchMaterialAssignmentGet();
|
|
224
|
+
}
|
|
225
|
+
}), [fetchMaterialAssignmentGet]);
|
|
226
|
+
const renderHeader = () => {
|
|
344
227
|
var _a, _b, _c;
|
|
345
228
|
return React.createElement(StyledMaterialAssignmentAdminHeader, {
|
|
346
229
|
align: "center",
|
|
@@ -364,7 +247,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
364
247
|
}, "\uC810\uC218"), React.createElement(Text, {
|
|
365
248
|
size: "small",
|
|
366
249
|
role: "white"
|
|
367
|
-
}, gradeResult ?
|
|
250
|
+
}, gradeResult ? `${(_c = (_b = gradeResult.manualScore) !== null && _b !== void 0 ? _b : gradeResult.avgCalcScore) !== null && _c !== void 0 ? _c : 0}${isScoreFinalized ? '(공개됨)' : '(비공개)'}` : '--')), React.createElement(StyledMaterialAssignmentAdminHeaderCell, null, React.createElement(Text, {
|
|
368
251
|
size: "tiny",
|
|
369
252
|
role: "gray4"
|
|
370
253
|
}, "\uC81C\uCD9C \uC77C\uC2DC"), React.createElement(Text, {
|
|
@@ -376,7 +259,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
376
259
|
timeStyle: "short"
|
|
377
260
|
}) : '--')));
|
|
378
261
|
};
|
|
379
|
-
|
|
262
|
+
const renderManualScoreEditButton = () => {
|
|
380
263
|
return React.createElement(Tooltip, {
|
|
381
264
|
placement: "top",
|
|
382
265
|
title: isUserSubmitted ? '제출 기한이 지난 이후 조정할 수 있습니다.' : '미제출인 경우 조정할 수 없습니다.',
|
|
@@ -391,7 +274,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
391
274
|
onClick: handleManualScoreEditClick
|
|
392
275
|
}, "\uC810\uC218 \uC870\uC815\uD558\uAE30")));
|
|
393
276
|
};
|
|
394
|
-
|
|
277
|
+
const renderGradeResult = () => {
|
|
395
278
|
var _a, _b;
|
|
396
279
|
return React.createElement(StyledMaterialAssignmentAdminGradeWrapper, {
|
|
397
280
|
wrap: true,
|
|
@@ -404,7 +287,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
404
287
|
role: "navy1",
|
|
405
288
|
size: "small",
|
|
406
289
|
lineHeight: "1.375rem"
|
|
407
|
-
}, user ?
|
|
290
|
+
}, user ? `${user.fullname} 님의 점수` : null), React.createElement(Hspace, {
|
|
408
291
|
width: 0.25
|
|
409
292
|
}), React.createElement(Tooltip, {
|
|
410
293
|
useMaxWidth: true,
|
|
@@ -418,10 +301,10 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
418
301
|
}), React.createElement(Text, {
|
|
419
302
|
bold: true,
|
|
420
303
|
role: "white"
|
|
421
|
-
}, gradeResult ?
|
|
304
|
+
}, gradeResult ? `${(_b = (_a = gradeResult.manualScore) !== null && _a !== void 0 ? _a : gradeResult.avgCalcScore) !== null && _b !== void 0 ? _b : 0}${isScoreFinalized ? '(공개됨)' : '(비공개)'}` : '--')), renderManualScoreEditButton());
|
|
422
305
|
};
|
|
423
|
-
|
|
424
|
-
|
|
306
|
+
const renderSubmissionInfo = () => {
|
|
307
|
+
const statusText = (() => {
|
|
425
308
|
if (submissionListGetStatus === 'pending') {
|
|
426
309
|
return null;
|
|
427
310
|
}
|
|
@@ -451,13 +334,13 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
451
334
|
size: "small"
|
|
452
335
|
}, "\uBBF8\uC81C\uCD9C");
|
|
453
336
|
}
|
|
454
|
-
}();
|
|
455
|
-
|
|
337
|
+
})();
|
|
338
|
+
const submissionAttachment = (() => {
|
|
456
339
|
if (!userSubmission) {
|
|
457
340
|
return '--';
|
|
458
341
|
}
|
|
459
342
|
if (userSubmission.assignmentFileUrl) {
|
|
460
|
-
|
|
343
|
+
const assignmentFilename = decodeURIComponent(userSubmission.assignmentFileUrl && new URL(userSubmission.assignmentFileUrl).pathname.split('/').pop() || '');
|
|
461
344
|
return React.createElement("a", {
|
|
462
345
|
href: userSubmission.assignmentFileUrl,
|
|
463
346
|
download: assignmentFilename,
|
|
@@ -482,7 +365,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
482
365
|
size: "small"
|
|
483
366
|
}, userSubmission.assignmentUrl));
|
|
484
367
|
}
|
|
485
|
-
}();
|
|
368
|
+
})();
|
|
486
369
|
return React.createElement(InfoTable, {
|
|
487
370
|
dark: true
|
|
488
371
|
}, React.createElement("tbody", null, React.createElement("tr", null, React.createElement("td", null, "\uC0C1\uD0DC"), React.createElement("td", null, statusText)), React.createElement("tr", null, React.createElement("td", null, "\uACFC\uC81C \uC81C\uCD9C \uAE30\uD55C"), React.createElement("td", null, React.createElement(FormattedDate, {
|
|
@@ -495,7 +378,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
495
378
|
timeStyle: "short"
|
|
496
379
|
}) : '--')), React.createElement("tr", null, React.createElement("td", null, "\uC5C5\uB85C\uB4DC\uB41C \uACFC\uC81C"), React.createElement("td", null, submissionAttachment))));
|
|
497
380
|
};
|
|
498
|
-
|
|
381
|
+
const renderGradeList = () => {
|
|
499
382
|
return React.createElement(Flex, {
|
|
500
383
|
column: true,
|
|
501
384
|
align: "center"
|
|
@@ -540,48 +423,46 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
540
423
|
accessor: 'created',
|
|
541
424
|
textAlign: 'left'
|
|
542
425
|
}],
|
|
543
|
-
data: gradeList.map(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
};
|
|
584
|
-
})
|
|
426
|
+
data: gradeList.map(grade => ({
|
|
427
|
+
fullname: React.createElement(Flex, null, React.createElement(Text, {
|
|
428
|
+
noWrap: true,
|
|
429
|
+
role: "navy0",
|
|
430
|
+
size: "small"
|
|
431
|
+
}, `${grade.gradeUser.fullname}${grade.gradeUser.id === adminUserId ? '(나)' : ''}`), React.createElement(Hspace, {
|
|
432
|
+
width: 0.25
|
|
433
|
+
}), React.createElement(Text, {
|
|
434
|
+
ellipsis: true,
|
|
435
|
+
role: "navy3",
|
|
436
|
+
size: "small"
|
|
437
|
+
}, grade.gradeUser.email)),
|
|
438
|
+
grade: grade.score,
|
|
439
|
+
created: React.createElement(Flex, {
|
|
440
|
+
align: "center",
|
|
441
|
+
justify: "space-between"
|
|
442
|
+
}, React.createElement(FormattedDate, {
|
|
443
|
+
value: grade.createdDatetime,
|
|
444
|
+
dateStyle: "medium",
|
|
445
|
+
timeStyle: "short"
|
|
446
|
+
}), React.createElement(Flex, {
|
|
447
|
+
align: "center"
|
|
448
|
+
}, React.createElement(IconButton, {
|
|
449
|
+
icon: eilChat,
|
|
450
|
+
size: "tiny",
|
|
451
|
+
role: "navy3",
|
|
452
|
+
onClick: () => {
|
|
453
|
+
setSelectedGradeForShow(grade);
|
|
454
|
+
}
|
|
455
|
+
}), React.createElement(Hspace, {
|
|
456
|
+
width: 0.5
|
|
457
|
+
}), React.createElement(IconButton, {
|
|
458
|
+
icon: eilDelete,
|
|
459
|
+
size: "tiny",
|
|
460
|
+
role: "navy3",
|
|
461
|
+
onClick: () => {
|
|
462
|
+
setSelectedGradeForDelete(grade);
|
|
463
|
+
}
|
|
464
|
+
})))
|
|
465
|
+
}))
|
|
585
466
|
}), React.createElement(Vspace, {
|
|
586
467
|
height: 0.5
|
|
587
468
|
}), React.createElement(Pagination, {
|
|
@@ -591,15 +472,15 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
591
472
|
total: gradeListCount,
|
|
592
473
|
isNext: gradeListOffset + FETCH_GRADE_LIST_COUNT < gradeListCount,
|
|
593
474
|
isPrev: gradeListOffset > 0,
|
|
594
|
-
onClickNext:
|
|
475
|
+
onClickNext: () => {
|
|
595
476
|
setGradeListPage(gradeListPage + 1);
|
|
596
477
|
},
|
|
597
|
-
onClickPrev:
|
|
478
|
+
onClickPrev: () => {
|
|
598
479
|
setGradeListPage(gradeListPage - 1);
|
|
599
480
|
}
|
|
600
481
|
}));
|
|
601
482
|
};
|
|
602
|
-
|
|
483
|
+
const renderGradeEditModal = () => {
|
|
603
484
|
if (!showGradeEditModal) {
|
|
604
485
|
return null;
|
|
605
486
|
}
|
|
@@ -616,11 +497,11 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
616
497
|
label: '취소',
|
|
617
498
|
size: 'small',
|
|
618
499
|
role: 'gray1',
|
|
619
|
-
onClick:
|
|
500
|
+
onClick: () => {
|
|
620
501
|
setShowGradeEditModal(false);
|
|
621
502
|
}
|
|
622
503
|
}],
|
|
623
|
-
onHide:
|
|
504
|
+
onHide: () => {
|
|
624
505
|
setShowGradeEditModal(false);
|
|
625
506
|
}
|
|
626
507
|
}, React.createElement(Label, {
|
|
@@ -639,16 +520,15 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
639
520
|
min: 0,
|
|
640
521
|
max: 100
|
|
641
522
|
},
|
|
642
|
-
render:
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
523
|
+
render: ({
|
|
524
|
+
field,
|
|
525
|
+
fieldState
|
|
526
|
+
}) => React.createElement(Input, Object.assign({}, field, {
|
|
527
|
+
invalid: fieldState.invalid,
|
|
528
|
+
size: "small",
|
|
529
|
+
width: "xsmall",
|
|
530
|
+
type: "number"
|
|
531
|
+
}))
|
|
652
532
|
}), React.createElement(Hspace, {
|
|
653
533
|
width: 0.5
|
|
654
534
|
}), React.createElement(Text, {
|
|
@@ -671,18 +551,17 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
671
551
|
rules: {
|
|
672
552
|
maxLength: 1000
|
|
673
553
|
},
|
|
674
|
-
render:
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
554
|
+
render: ({
|
|
555
|
+
field
|
|
556
|
+
}) => React.createElement(Textarea, {
|
|
557
|
+
value: field.value,
|
|
558
|
+
wordLimit: 1000,
|
|
559
|
+
rows: 8,
|
|
560
|
+
onChange: field.onChange
|
|
561
|
+
})
|
|
683
562
|
}));
|
|
684
563
|
};
|
|
685
|
-
|
|
564
|
+
const renderGradeShowModal = () => {
|
|
686
565
|
if (!selectedGradeForShow) {
|
|
687
566
|
return null;
|
|
688
567
|
}
|
|
@@ -692,11 +571,11 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
692
571
|
label: '확인',
|
|
693
572
|
size: 'small',
|
|
694
573
|
role: 'primary',
|
|
695
|
-
onClick:
|
|
574
|
+
onClick: () => {
|
|
696
575
|
setSelectedGradeForShow(null);
|
|
697
576
|
}
|
|
698
577
|
}],
|
|
699
|
-
onHide:
|
|
578
|
+
onHide: () => {
|
|
700
579
|
setSelectedGradeForShow(null);
|
|
701
580
|
}
|
|
702
581
|
}, React.createElement(Label, {
|
|
@@ -736,7 +615,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
736
615
|
rows: 8
|
|
737
616
|
})));
|
|
738
617
|
};
|
|
739
|
-
|
|
618
|
+
const renderGradeDeleteModal = () => {
|
|
740
619
|
if (!selectedGradeForDelete) {
|
|
741
620
|
return null;
|
|
742
621
|
}
|
|
@@ -754,11 +633,11 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
754
633
|
label: '취소',
|
|
755
634
|
size: 'small',
|
|
756
635
|
role: 'gray1',
|
|
757
|
-
onClick:
|
|
636
|
+
onClick: () => {
|
|
758
637
|
setSelectedGradeForDelete(null);
|
|
759
638
|
}
|
|
760
639
|
}],
|
|
761
|
-
onHide:
|
|
640
|
+
onHide: () => {
|
|
762
641
|
setSelectedGradeForDelete(null);
|
|
763
642
|
}
|
|
764
643
|
}, React.createElement(Text, {
|
|
@@ -789,7 +668,7 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
789
668
|
}]
|
|
790
669
|
}));
|
|
791
670
|
};
|
|
792
|
-
|
|
671
|
+
const renderManualScoreEditModal = () => {
|
|
793
672
|
var _a, _b;
|
|
794
673
|
if (!showManualScoreEditModal) {
|
|
795
674
|
return null;
|
|
@@ -808,11 +687,11 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
808
687
|
label: '취소',
|
|
809
688
|
size: 'small',
|
|
810
689
|
role: 'gray1',
|
|
811
|
-
onClick:
|
|
690
|
+
onClick: () => {
|
|
812
691
|
setShowManualScoreEditModal(false);
|
|
813
692
|
}
|
|
814
693
|
}],
|
|
815
|
-
onHide:
|
|
694
|
+
onHide: () => {
|
|
816
695
|
setShowManualScoreEditModal(false);
|
|
817
696
|
}
|
|
818
697
|
}, React.createElement(Alert, {
|
|
@@ -842,17 +721,16 @@ var MaterialAssignmentAdminContent = forwardRef(function (_ref, ref) {
|
|
|
842
721
|
min: 0,
|
|
843
722
|
max: 100
|
|
844
723
|
},
|
|
845
|
-
render:
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
}
|
|
724
|
+
render: ({
|
|
725
|
+
field,
|
|
726
|
+
fieldState
|
|
727
|
+
}) => React.createElement(Input, Object.assign({}, field, {
|
|
728
|
+
invalid: fieldState.invalid,
|
|
729
|
+
size: "small",
|
|
730
|
+
width: "xsmall",
|
|
731
|
+
type: "number",
|
|
732
|
+
label: "\uC870\uC815 \uC810\uC218"
|
|
733
|
+
}))
|
|
856
734
|
}), React.createElement(Hspace, {
|
|
857
735
|
width: 0.75
|
|
858
736
|
}), React.createElement(Text, {
|