mario-education 2.4.21-beta → 2.4.23-beta

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.
@@ -13,5 +13,6 @@ declare const useSwitchAssistant: () => {
13
13
  removeData: (teacherUserId: string, studentId: number) => Promise<void>;
14
14
  resetData: () => void;
15
15
  choiceUser: (userChoiced: IStudentAssistantItem) => void;
16
+ onDeleteAssistant: (studentId: number) => Promise<void>;
16
17
  };
17
18
  export default useSwitchAssistant;
@@ -4,3 +4,4 @@ export declare const getStudentAssistant: (data: IStudentWidthAssistant) => Prom
4
4
  export declare const getAssistant: () => Promise<import("axios").AxiosResponse<any>>;
5
5
  export declare const getAssistantByStudentId: (studentId: number) => Promise<import("axios").AxiosResponse<any>>;
6
6
  export declare const changeAssistantOfStudent: (id: number, assistantUserId: string) => Promise<import("axios").AxiosResponse<any>>;
7
+ export declare const removeAssistantForStudent: (studentId: number) => Promise<import("axios").AxiosResponse<any>>;
package/dist/index.js CHANGED
@@ -8413,6 +8413,13 @@ var changeAssistantOfStudent = function changeAssistantOfStudent(id, assistantUs
8413
8413
  assistantUserId: assistantUserId
8414
8414
  });
8415
8415
  };
8416
+ var removeAssistantForStudent = function removeAssistantForStudent(studentId) {
8417
+ return marioCore.api["delete"](USER_URL$2 + "/remove-assistant", {
8418
+ params: {
8419
+ studentId: studentId
8420
+ }
8421
+ });
8422
+ };
8416
8423
 
8417
8424
  var INITIAL_USER_CHOICE = {
8418
8425
  id: 0,
@@ -8460,7 +8467,6 @@ var useSwitchAssistant = function useSwitchAssistant() {
8460
8467
  };
8461
8468
 
8462
8469
  dispatch(marioCore.setLoading(true));
8463
- console.log(filters);
8464
8470
 
8465
8471
  var _temp4 = _catch(function () {
8466
8472
  return Promise.resolve(getStudentAssistant(filters)).then(function (res) {
@@ -8577,6 +8583,45 @@ var useSwitchAssistant = function useSwitchAssistant() {
8577
8583
  }
8578
8584
  };
8579
8585
 
8586
+ var onDeleteAssistant = function onDeleteAssistant(studentId) {
8587
+ try {
8588
+ dispatch(marioCore.setLoading(true));
8589
+ dispatch(marioCore.setModal({
8590
+ isOpen: true,
8591
+ type: "warning",
8592
+ message: "Do you want to remove this Assistant?",
8593
+ onConfirm: function () {
8594
+ try {
8595
+ var _temp12 = _catch(function () {
8596
+ return Promise.resolve(removeAssistantForStudent(studentId)).then(function () {
8597
+ getStudentAssistantData();
8598
+ dispatch(marioCore.setAlert({
8599
+ type: "success",
8600
+ message: "Remove assistant successfully"
8601
+ }));
8602
+ });
8603
+ }, function (err) {
8604
+ var _err$response4, _err$response4$data;
8605
+
8606
+ dispatch(marioCore.setAlert({
8607
+ type: "danger",
8608
+ message: ((_err$response4 = err.response) === null || _err$response4 === void 0 ? void 0 : (_err$response4$data = _err$response4.data) === null || _err$response4$data === void 0 ? void 0 : _err$response4$data.title) || err.message
8609
+ }));
8610
+ });
8611
+
8612
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
8613
+ } catch (e) {
8614
+ return Promise.reject(e);
8615
+ }
8616
+ }
8617
+ }));
8618
+ dispatch(marioCore.setLoading(false));
8619
+ return Promise.resolve();
8620
+ } catch (e) {
8621
+ return Promise.reject(e);
8622
+ }
8623
+ };
8624
+
8580
8625
  React.useEffect(function () {
8581
8626
  document.title = TITLE$d;
8582
8627
  }, []);
@@ -8598,7 +8643,8 @@ var useSwitchAssistant = function useSwitchAssistant() {
8598
8643
  assistantChangeId: assistantChangeId,
8599
8644
  removeData: removeData,
8600
8645
  resetData: resetData,
8601
- choiceUser: choiceUser
8646
+ choiceUser: choiceUser,
8647
+ onDeleteAssistant: onDeleteAssistant
8602
8648
  };
8603
8649
  };
8604
8650
 
@@ -8661,7 +8707,8 @@ var SwitchAssistantList = function SwitchAssistantList() {
8661
8707
  assistantChangeId = _useSwitchTeacher.assistantChangeId,
8662
8708
  removeData = _useSwitchTeacher.removeData,
8663
8709
  resetData = _useSwitchTeacher.resetData,
8664
- choiceUser = _useSwitchTeacher.choiceUser;
8710
+ choiceUser = _useSwitchTeacher.choiceUser,
8711
+ onDeleteAssistant = _useSwitchTeacher.onDeleteAssistant;
8665
8712
 
8666
8713
  return React__default.createElement("div", {
8667
8714
  className: "fadeIn animated"
@@ -8700,7 +8747,9 @@ var SwitchAssistantList = function SwitchAssistantList() {
8700
8747
  className: "align-top"
8701
8748
  }, "Current Assistant Name"), React__default.createElement("th", {
8702
8749
  className: "align-top"
8703
- }, "Current Assistant Email"))), React__default.createElement("tbody", null, !!userList && userList.length > 0 && userList.map(function (record) {
8750
+ }, "Current Assistant Email"), React__default.createElement("th", {
8751
+ className: "align-top"
8752
+ }, "Remove Assistant"))), React__default.createElement("tbody", null, !!userList && userList.length > 0 && userList.map(function (record) {
8704
8753
  return React__default.createElement("tr", {
8705
8754
  key: record.id
8706
8755
  }, React__default.createElement("td", {
@@ -8716,7 +8765,13 @@ var SwitchAssistantList = function SwitchAssistantList() {
8716
8765
  className: "align-middle"
8717
8766
  }, record.assistantName), React__default.createElement("td", {
8718
8767
  className: "align-middle"
8719
- }, record.emailAssistant));
8768
+ }, record.emailAssistant), React__default.createElement("td", {
8769
+ className: "text-center align-middle"
8770
+ }, React__default.createElement(marioCore.DeleteButtonIcon, {
8771
+ onClick: function onClick() {
8772
+ return onDeleteAssistant(record.id);
8773
+ }
8774
+ })));
8720
8775
  })))) : React__default.createElement(marioCore.EmptyDataAlert, {
8721
8776
  label: "user"
8722
8777
  })), React__default.createElement(reactstrap.Col, {