mario-teacher-student-client 9000.0.14 → 9000.0.15

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.
@@ -19,6 +19,6 @@ declare const useListDetailActivity: () => {
19
19
  setFile: import("react").Dispatch<any>;
20
20
  confirmData: (values: any, cb: any) => Promise<void>;
21
21
  getData: () => Promise<void>;
22
- deleteActivity: (studentId: number, activityId: number) => Promise<void>;
22
+ deleteActivity: (studentId: number, activityId: number, cb?: any) => Promise<void>;
23
23
  };
24
24
  export default useListDetailActivity;
package/dist/index.js CHANGED
@@ -29610,7 +29610,6 @@ var FriendCircleLearning = function FriendCircleLearning() {
29610
29610
  var styles$q = {"block-friend":"_2Wi6k","block-view":"_npp6I","button-view":"_248rc","block-item-friend-1":"_1DLhQ","block-item-friend-2":"_2bHBT","block-item-friend-3":"_2rdAc","block-item-friend-4":"_32V3N","list-item-note":"_bEQOL","item-note-1":"_2LDWj","item-note-2":"_232v0","item-note-3":"_3Rm0X","item-note-4":"_2o4NX","dialog-box":"_3Xq0t","simple-dialog-title":"_2nK-E","dialog-box-input":"_1bCme","dialog-box-title":"_1cbOw","dialog-box-button":"_XdCJL","dialog-button-add":"_1AFOo","dialog-button-cancel":"_3Jepk","button-edit":"_kb6Ui","gr-action":"_RdA3i","btn-request":"_N2AkR","filter-type":"_1Mg3a","search-input":"_1LH-q","search-input-icon":"_NY-nw","inputInput":"_3-ciL","table-border":"_EK-2y","table-row":"_25sma","row_name":"_13KPp","avatar_user":"_EjXlz","row_grade":"_tel45","row_type":"_r0src","duration":"_fXyit","request":"_3c49N","content-modal":"_MZRHg","form-upload":"_fbKnI","avatarimage":"_xrtuk","icon-upload":"_24zk-"};
29611
29611
 
29612
29612
  var ACTIVITY_CIRCLE = marioCore.BASE_URL + "/api/Student";
29613
- var SYSTEM_PROFILE$2 = marioCore.BASE_URL + "/api/file/system/profile";
29614
29613
  var getTotalActivityCount = function getTotalActivityCount() {
29615
29614
  return marioCore.api.get(ACTIVITY_CIRCLE + "/activityCircleAllStudent");
29616
29615
  };
@@ -29631,9 +29630,6 @@ var update$1 = function update(studentId, activityId, data) {
29631
29630
  var remove = function remove(studentId, activityId) {
29632
29631
  return marioCore.api["delete"](ACTIVITY_CIRCLE + "/" + studentId + "/studentActivities/" + activityId);
29633
29632
  };
29634
- var systemProfileUpload$2 = function systemProfileUpload(formData) {
29635
- return marioCore.api.post(SYSTEM_PROFILE$2, formData);
29636
- };
29637
29633
 
29638
29634
  var useTotalActivity = function useTotalActivity() {
29639
29635
  var dispatch = reactRedux.useDispatch();
@@ -33854,36 +33850,18 @@ var useListDetailActivity = function useListDetailActivity() {
33854
33850
 
33855
33851
  var confirmData = React.useCallback(function (values, cb) {
33856
33852
  try {
33857
- var _temp9 = function _temp9() {
33853
+ var _temp7 = function _temp7() {
33858
33854
  dispatch(marioCore.setLoading(false));
33859
33855
  };
33860
33856
 
33861
33857
  dispatch(marioCore.setLoading(true));
33862
33858
 
33863
- var _temp10 = _catch(function () {
33864
- function _temp6() {
33865
- var createOrUpdate = !!acticityId ? update$1(parseInt(studentId || "0"), acticityId, values) : create$1(parseInt(studentId || "0"), values);
33866
- return Promise.resolve(createOrUpdate).then(function () {
33867
- !!cb && cb();
33868
- !!acticityId && setActivityId(0);
33869
- });
33870
- }
33871
-
33872
- var _temp5 = function () {
33873
- if (!!file) {
33874
- var formData = new FormData();
33875
- var name = file.name;
33876
- formData.append("file", file, name);
33877
- return Promise.resolve(systemProfileUpload$2(formData)).then(function (res) {
33878
- var _res$data;
33879
-
33880
- var imageUrl = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.key;
33881
- values.imageUrl = imageUrl;
33882
- });
33883
- }
33884
- }();
33885
-
33886
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
33859
+ var _temp8 = _catch(function () {
33860
+ var createOrUpdate = !!acticityId ? update$1(parseInt(studentId || "0"), acticityId, values) : create$1(parseInt(studentId || "0"), values);
33861
+ return Promise.resolve(createOrUpdate).then(function () {
33862
+ !!cb && cb();
33863
+ !!acticityId && setActivityId(0);
33864
+ });
33887
33865
  }, function (e) {
33888
33866
  var _e$response2, _e$response2$data;
33889
33867
 
@@ -33893,26 +33871,27 @@ var useListDetailActivity = function useListDetailActivity() {
33893
33871
  }));
33894
33872
  });
33895
33873
 
33896
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
33874
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8));
33897
33875
  } catch (e) {
33898
33876
  return Promise.reject(e);
33899
33877
  }
33900
33878
  }, [acticityId, myGoalCircle]);
33901
33879
 
33902
- var deleteActivity = function deleteActivity(studentId, activityId) {
33880
+ var deleteActivity = function deleteActivity(studentId, activityId, cb) {
33903
33881
  try {
33904
- var _temp13 = function _temp13() {
33882
+ var _temp11 = function _temp11() {
33905
33883
  dispatch(marioCore.setLoading(false));
33906
33884
  };
33907
33885
 
33908
33886
  dispatch(marioCore.setLoading(true));
33909
33887
 
33910
- var _temp14 = _catch(function () {
33888
+ var _temp12 = _catch(function () {
33911
33889
  return Promise.resolve(remove(studentId, activityId)).then(function () {
33912
33890
  dispatch(marioCore.setAlert({
33913
33891
  type: "success",
33914
33892
  message: "Delete successfully"
33915
33893
  }));
33894
+ !!cb && cb();
33916
33895
  });
33917
33896
  }, function (e) {
33918
33897
  var _e$response3, _e$response3$data;
@@ -33923,7 +33902,7 @@ var useListDetailActivity = function useListDetailActivity() {
33923
33902
  }));
33924
33903
  });
33925
33904
 
33926
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp13) : _temp13(_temp14));
33905
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(_temp11) : _temp11(_temp12));
33927
33906
  } catch (e) {
33928
33907
  return Promise.reject(e);
33929
33908
  }
@@ -34011,6 +33990,8 @@ var useListActivity = function useListActivity() {
34011
33990
  };
34012
33991
  };
34013
33992
 
33993
+ var DEFAULT_USER_AVATAR$l = "/images/image-default.png";
33994
+
34014
33995
  var ModalGoalActivity = function ModalGoalActivity(props, ref) {
34015
33996
  var header = props.header,
34016
33997
  confirmText = props.confirmText,
@@ -34020,7 +34001,8 @@ var ModalGoalActivity = function ModalGoalActivity(props, ref) {
34020
34001
  isCreate = props.isCreate,
34021
34002
  setFile = props.setFile,
34022
34003
  deleteActivity = props.deleteActivity,
34023
- acticityId = props.acticityId;
34004
+ acticityId = props.acticityId,
34005
+ getActivityListData = props.getActivityListData;
34024
34006
  var dispatch = reactRedux.useDispatch();
34025
34007
  var targetImage = React.useRef();
34026
34008
 
@@ -34061,6 +34043,9 @@ var ModalGoalActivity = function ModalGoalActivity(props, ref) {
34061
34043
  handleClose: handleClose
34062
34044
  };
34063
34045
  });
34046
+ React.useEffect(function () {
34047
+ setImagePreviewUrl("");
34048
+ }, [isOpen]);
34064
34049
  var MAX_SIZE = 20097152;
34065
34050
 
34066
34051
  var _useState2 = React.useState(""),
@@ -34089,10 +34074,27 @@ var ModalGoalActivity = function ModalGoalActivity(props, ref) {
34089
34074
  }
34090
34075
  };
34091
34076
 
34092
- var imageSrc = imagePreviewUrl || marioCore.getFileUrl(myGoalCircle === null || myGoalCircle === void 0 ? void 0 : myGoalCircle.imageUrl);
34077
+ var imageSrc = React.useMemo(function () {
34078
+ if (imagePreviewUrl != '') {
34079
+ return imagePreviewUrl;
34080
+ }
34081
+
34082
+ if ((myGoalCircle === null || myGoalCircle === void 0 ? void 0 : myGoalCircle.imageUrl) != '') {
34083
+ return myGoalCircle === null || myGoalCircle === void 0 ? void 0 : myGoalCircle.imageUrl;
34084
+ } else {
34085
+ if (!!acticityId && (myGoalCircle === null || myGoalCircle === void 0 ? void 0 : myGoalCircle.imageUrl) == '') {
34086
+ return DEFAULT_USER_AVATAR$l;
34087
+ }
34088
+
34089
+ return '';
34090
+ }
34091
+ }, [myGoalCircle, imagePreviewUrl, acticityId]);
34093
34092
 
34094
34093
  var removeAcitivity = function removeAcitivity() {
34095
- deleteActivity(studentId, acticityId);
34094
+ deleteActivity(studentId, acticityId, function () {
34095
+ setIsOpen(false);
34096
+ getActivityListData();
34097
+ });
34096
34098
  };
34097
34099
 
34098
34100
  return React__default.createElement(formik.Formik, {
@@ -34101,8 +34103,10 @@ var ModalGoalActivity = function ModalGoalActivity(props, ref) {
34101
34103
  validationSchema: schema,
34102
34104
  onSubmit: function onSubmit(values, actions) {
34103
34105
  values.studentId = parseInt(studentId);
34106
+ values.imageUrl = imagePreviewUrl;
34104
34107
  onConfirm(values);
34105
34108
  actions.resetForm();
34109
+ setImagePreviewUrl("");
34106
34110
  }
34107
34111
  }, function (formikProps) {
34108
34112
  var values = formikProps.values,
@@ -34202,7 +34206,7 @@ var ModalGoalActivity = function ModalGoalActivity(props, ref) {
34202
34206
 
34203
34207
  var ModalGoalActivity$1 = React.forwardRef(ModalGoalActivity);
34204
34208
 
34205
- var DEFAULT_USER_AVATAR$l = "/images/image-default.png";
34209
+ var DEFAULT_USER_AVATAR$m = "/images/image-default.png";
34206
34210
 
34207
34211
  var ListActivityLearning = function ListActivityLearning() {
34208
34212
  var _useListDetailActivit = useListDetailActivity(),
@@ -34286,7 +34290,8 @@ var ListActivityLearning = function ListActivityLearning() {
34286
34290
  isCreate: isCreate,
34287
34291
  setFile: setFile,
34288
34292
  deleteActivity: deleteActivity,
34289
- acticityId: acticityId
34293
+ acticityId: acticityId,
34294
+ getActivityListData: getActivityListData
34290
34295
  }), React__default.createElement(HeaderLearningPlan, {
34291
34296
  text: "Activity List",
34292
34297
  isShowButtonBackGround: true,
@@ -34375,7 +34380,7 @@ var ListActivityLearning = function ListActivityLearning() {
34375
34380
  height: 80,
34376
34381
  className: "" + styles$q["row_name"]
34377
34382
  }, React__default.createElement("img", {
34378
- src: !!row.imageUrl ? row.imageUrl : DEFAULT_USER_AVATAR$l,
34383
+ src: !!row.imageUrl ? row.imageUrl : DEFAULT_USER_AVATAR$m,
34379
34384
  alt: "",
34380
34385
  className: "" + styles$q["avatar_user"]
34381
34386
  }), row.name), React__default.createElement(core.TableCell, {
@@ -37657,7 +37662,7 @@ var useClassReflectionList$1 = function useClassReflectionList() {
37657
37662
 
37658
37663
  var styles$B = {"table-border":"_3DZEC","table-row":"_26P31","row_type":"_1AL56","duration":"_3LIe0","request":"_3xPaL","impact_score":"_3LCKu","row_name":"_-43QB","avatar_user":"_3QuLn","row_grade":"_2qavH","row_time":"_1Jt3s","time":"_1CQc9","row_class_type":"_1Ok_-","box-filter":"_2Im9q","box-filter-item":"_3nSSt","gr-action":"_34QFV","btn-request":"_2m8fl","search-input":"_3j3Pk","search-input-icon":"_h3gqE","inputInput":"_2gDJN","row_state_done":"_3ibCi","row_state_missed":"_2Ssf_","row_state_notsent":"_221OL","row_state_default":"_Px9sV","box-todo-content-gr":"_2vc2E","box-student-mobile":"_2MyQa","box-student-top":"_1XC2j","box-student-top-box":"_1Owjo","box-student-top-name":"_21rcr","box-student-top-class":"_3PDvN","box-student-content":"_2rnGC","class-reflection-box":"_2Wey9","reflection-avatar-content":"_3Tm0l","reflection-avatar":"_hGRgn","reflection-name":"_OXSEg","reflection-content":"_1HBcc","class-reflection-science-class":"_2DStO","reflection-info":"_3wSMy","reflection-info-gr":"_3v_VO","header-box":"_yw424","header-box-title":"_1aJh-","row-send-date":"_1JhNh","table-cell":"_2racV","table-body":"_27Gto","table-class-type":"_1NNAh","table-class-date":"_2XwAn","date":"_2Dt0k","student-detail":"_XWeBE","send-date":"_2Ixp9","send-time":"_3sSJt","table-desktop":"_2Smul","table-mobile":"_3QMOg","arrow-icon":"_B5tAK"};
37659
37664
 
37660
- var DEFAULT_USER_AVATAR$m = "/images/image-default.png";
37665
+ var DEFAULT_USER_AVATAR$n = "/images/image-default.png";
37661
37666
 
37662
37667
  var MyClassReflection = function MyClassReflection() {
37663
37668
  var _classReflectionData$, _classReflectionData$2;
@@ -37996,7 +38001,7 @@ var MyClassReflection = function MyClassReflection() {
37996
38001
  className: "" + styles$B["student-detail"]
37997
38002
  }, React__default.createElement("img", {
37998
38003
  className: styles$B["reflection-avatar"] + " " + styles$B["avatar_user"],
37999
- src: !!(row !== null && row !== void 0 && row.studentAvatar) ? row === null || row === void 0 ? void 0 : row.studentAvatar : DEFAULT_USER_AVATAR$m
38004
+ src: !!(row !== null && row !== void 0 && row.studentAvatar) ? row === null || row === void 0 ? void 0 : row.studentAvatar : DEFAULT_USER_AVATAR$n
38000
38005
  }), row.studentName)), React__default.createElement(core.TableCell, {
38001
38006
  align: "left",
38002
38007
  style: {
@@ -38067,7 +38072,7 @@ var MyClassReflection = function MyClassReflection() {
38067
38072
  marginRight: "10px"
38068
38073
  },
38069
38074
  className: styles$B["reflection-avatar"] + " " + styles$B["avatar_user"],
38070
- src: !!(row !== null && row !== void 0 && row.teacherAvatar) ? row === null || row === void 0 ? void 0 : row.teacherAvatar : DEFAULT_USER_AVATAR$m
38075
+ src: !!(row !== null && row !== void 0 && row.teacherAvatar) ? row === null || row === void 0 ? void 0 : row.teacherAvatar : DEFAULT_USER_AVATAR$n
38071
38076
  }), React__default.createElement(core.Typography, {
38072
38077
  className: "" + styles$B["reflection-name"]
38073
38078
  }, row.teacherName)), React__default.createElement(core.Grid, {