touchstudy-core 0.1.158 → 0.1.160

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.
@@ -106,6 +106,7 @@ export declare type TextbookDetailResponse = {
106
106
  type: number;
107
107
  createdBy?: any;
108
108
  isCreatedByAdmin?: boolean;
109
+ totalUses: number;
109
110
  };
110
111
  export declare type Academy = {
111
112
  id: number;
@@ -11,7 +11,7 @@ declare const useTextbookManagement: ({ textbookId, role, onNavigateList }: Prop
11
11
  isAdminSite: boolean;
12
12
  disabledTextbookOwners: boolean;
13
13
  isReadonly: boolean;
14
- isEditable: any;
14
+ isEditable: boolean;
15
15
  isAdmin: any;
16
16
  theme: import("@mui/material").Theme;
17
17
  history: History;
@@ -1,8 +1,8 @@
1
1
  import { TextbookRequest, TextbookSearchQuery, TextbookShareRequest, TextbookUpdateRequest } from "../configs/types";
2
- export declare const getTextbookListApi: (query: TextbookSearchQuery, isSuperAdmin: any) => Promise<import("axios").AxiosResponse<any, any>>;
2
+ export declare const getTextbookListApi: (query: TextbookSearchQuery, isSuperAdmin?: boolean | undefined, isPersonal?: boolean | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
3
3
  export declare const getTextbookByIdApi: (textbookId: number, isSuperAdmin: any) => Promise<import("axios").AxiosResponse<any, any>>;
4
4
  export declare const createTextbookApi: (data: TextbookRequest) => Promise<import("axios").AxiosResponse<any, any>>;
5
5
  export declare const updateTextbookApi: (textbookId: number, data: TextbookUpdateRequest) => Promise<import("axios").AxiosResponse<any, any>>;
6
- export declare const deleteTextbookApi: (textbookId: number) => Promise<import("axios").AxiosResponse<any, any>>;
6
+ export declare const deleteTextbookApi: (textbookId: number, onAcademy: boolean) => Promise<import("axios").AxiosResponse<any, any>>;
7
7
  export declare const shareTextbookApi: (textbookId: number, data: TextbookShareRequest) => Promise<import("axios").AxiosResponse<any, any>>;
8
8
  export declare const updateSharedTextbookApi: (textbookId: number, data: TextbookShareRequest) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -8,7 +8,7 @@ export declare const DEFAULT_TEXTBOOK_SHARE_FILTER: {
8
8
  sortColumnName: TextbookSortBy;
9
9
  };
10
10
  export declare const DefaultTeacherQuery: TeacherQuery;
11
- export declare const TEXTBOOK_HEADERS: TextbookHeaderTable[];
11
+ export declare const TEXTBOOK_HEADERS: (isAdmin: boolean, isAdminSite: boolean, onAcademy: boolean) => TextbookHeaderTable[];
12
12
  export declare const SHARE_TEXTBOOK_HEADERS: TextbookHeaderTable[];
13
13
  export declare const TEACHER_ACADEMY_HEADERS: TeacherAcademyHeaderTable[];
14
14
  export declare const DEFAULT_ANSWER_COUNT = 5;
@@ -23,7 +23,9 @@ export declare type TextbookResponse = {
23
23
  name: string;
24
24
  subject: SubjectResponse;
25
25
  totalChapters: number;
26
+ totalUses: number;
26
27
  createdAt: string;
28
+ coverImage: string;
27
29
  isCreatedByAdmin: boolean;
28
30
  sharedUsers: string[];
29
31
  createdBy: CreatedBy;
@@ -32,5 +32,6 @@ declare const useTextbookShare: (props: TextbookShareProps) => {
32
32
  currentModel: TextbookResponse | undefined;
33
33
  isAdmin: any;
34
34
  isAdminSite: boolean;
35
+ onAcademy: boolean;
35
36
  };
36
37
  export default useTextbookShare;
@@ -6,6 +6,7 @@ export interface TextbookListProps {
6
6
  onNavigateCreate?: () => void;
7
7
  onNavigateDetail: (data: TextbookResponse, readOnly?: boolean, replace?: boolean) => void;
8
8
  isSuperAdmin: any;
9
+ personal?: boolean;
9
10
  createable?: boolean;
10
11
  }
11
12
  declare const TextbookList: FC<TextbookListProps>;
package/dist/index.js CHANGED
@@ -387,7 +387,7 @@ var do_you_want_to_complete_the_exam = "시험을 완료처리 하시겠습니
387
387
  var do_you_want_to_cancel_the_exam = "시험을 취소하시겠습니까? (학생의 결과는 모두 삭제됩니다)";
388
388
  var are_you_sure_you_want_to_delete_the_exam = "시험을 삭제하시겠습니까?";
389
389
  var are_you_sure_you_want_to_cancel_the_exam = "시험을 취소하시겠습니까?";
390
- var are_you_sure_you_want_to_delete_the_textbook = "교과서를 삭제하시겠습니까?";
390
+ var are_you_sure_you_want_to_delete_the_textbook = "교과서를 삭제하시겠습니까? (모든 학생 교과서 결과가 삭제됩니다)";
391
391
  var are_you_sure_you_want_to_delete_the_user = "사용자 {{user}}을(를) 삭제하시겠습니까?";
392
392
  var are_you_sure_you_want_to_delete_the_article = "정말로 기사를 삭제하시겠습니까: {{article}}?";
393
393
  var yes = "예";
@@ -2649,7 +2649,7 @@ var do_you_want_to_complete_the_exam$1 = "Do you want to complete the exam?";
2649
2649
  var do_you_want_to_cancel_the_exam$1 = "Do you want to cancel the exam? (All student results will be deleted)";
2650
2650
  var are_you_sure_you_want_to_delete_the_exam$1 = "Are you sure you want to delete the exam?";
2651
2651
  var are_you_sure_you_want_to_cancel_the_exam$1 = "Are you sure you want to cancel the exam?";
2652
- var are_you_sure_you_want_to_delete_the_textbook$1 = "Are you sure you want to delete the textbook?";
2652
+ var are_you_sure_you_want_to_delete_the_textbook$1 = "Are you sure you want to delete the textbook? (All student textbook results will be deleted)";
2653
2653
  var are_you_sure_you_want_to_delete_the_user$1 = "Are you sure you want to delete the user: {{user}}?";
2654
2654
  var are_you_sure_you_want_to_delete_the_article$1 = "Are you sure you want to delete the article: {{article}}?";
2655
2655
  var yes$1 = "Yes";
@@ -30117,9 +30117,12 @@ var _ChapterBox = function ChapterBox(_ref) {
30117
30117
 
30118
30118
  var TEXTBOOK_URL$1 = BASE_URL + "/api/textbooks";
30119
30119
  var SUPER_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook/personal-textbooks";
30120
- var getTextbookListApi$2 = function getTextbookListApi(query, isSuperAdmin) {
30121
- return api.get("" + (isSuperAdmin ? SUPER_TEXTBOOK_URL : TEXTBOOK_URL$1), {
30122
- params: query
30120
+ var SUPER_ADMIN_PREPARED_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook/prepared-textbooks";
30121
+ var getTextbookListApi$2 = function getTextbookListApi(query, isSuperAdmin, isPersonal) {
30122
+ return api.get("" + (isSuperAdmin ? isPersonal ? SUPER_TEXTBOOK_URL : SUPER_ADMIN_PREPARED_TEXTBOOK_URL : TEXTBOOK_URL$1), {
30123
+ params: _extends({}, query, {
30124
+ isPrepared: true
30125
+ })
30123
30126
  });
30124
30127
  };
30125
30128
  var getTextbookByIdApi$1 = function getTextbookByIdApi(textbookId, isSuperAdmin) {
@@ -30131,8 +30134,8 @@ var createTextbookApi = function createTextbookApi(data) {
30131
30134
  var updateTextbookApi = function updateTextbookApi(textbookId, data) {
30132
30135
  return api.put(TEXTBOOK_URL$1 + "/" + textbookId, data);
30133
30136
  };
30134
- var deleteTextbookApi$1 = function deleteTextbookApi(textbookId) {
30135
- return api["delete"](TEXTBOOK_URL$1 + "/" + textbookId);
30137
+ var deleteTextbookApi$1 = function deleteTextbookApi(textbookId, onAcademy) {
30138
+ return api["delete"]((onAcademy ? TEXTBOOK_URL$1 : SUPER_ADMIN_PREPARED_TEXTBOOK_URL) + "/" + textbookId);
30136
30139
  };
30137
30140
  var shareTextbookApi = function shareTextbookApi(textbookId, data) {
30138
30141
  return api.post(TEXTBOOK_URL$1 + "/" + textbookId + "/shared-textbook", data);
@@ -30173,24 +30176,44 @@ var DefaultTeacherQuery = {
30173
30176
  sortColumnDirection: exports.OrderType.DESC,
30174
30177
  sortColumnName: TeacherSortBy$1.Name
30175
30178
  };
30176
- var TEXTBOOK_HEADERS = [{
30177
- title: "#"
30178
- }, {
30179
- title: "textbook_title",
30180
- sortKey: TextbookSortBy$1.Title
30181
- }, {
30182
- title: "textbook_subject",
30183
- sortKey: TextbookSortBy$1.SubjectName
30184
- }, {
30185
- title: "created_at",
30186
- sortKey: TextbookSortBy$1.CreatedAt
30187
- }, {
30188
- title: "total_chapters"
30189
- }, {
30190
- title: "authority"
30191
- }, {
30192
- title: ["edit_action", "view_action", "share_action", "update_shared_action", "delete_action"]
30193
- }];
30179
+ var TEXTBOOK_HEADERS = function TEXTBOOK_HEADERS(isAdmin, isAdminSite, onAcademy) {
30180
+ var headers = [{
30181
+ title: "#"
30182
+ }, {
30183
+ title: "image"
30184
+ }, {
30185
+ title: "textbook_title",
30186
+ sortKey: TextbookSortBy$1.Title
30187
+ }, {
30188
+ title: "textbook_subject",
30189
+ sortKey: TextbookSortBy$1.SubjectName
30190
+ }, {
30191
+ title: "created_at",
30192
+ sortKey: TextbookSortBy$1.CreatedAt
30193
+ }, {
30194
+ title: "total_chapters"
30195
+ }, {
30196
+ title: "total_uses"
30197
+ }];
30198
+ if (onAcademy && !isAdmin && !isAdminSite) {
30199
+ headers.push({
30200
+ title: "teacher_personal_textbook"
30201
+ });
30202
+ }
30203
+ if (onAcademy) {
30204
+ headers.push({
30205
+ title: "authority"
30206
+ });
30207
+ headers.push({
30208
+ title: ["edit_action", "view_action", "share_action", "update_shared_action", "delete_action"]
30209
+ });
30210
+ } else {
30211
+ headers.push({
30212
+ title: ["edit_action", "view_action", "delete_action"]
30213
+ });
30214
+ }
30215
+ return headers;
30216
+ };
30194
30217
  var TEACHER_ACADEMY_HEADERS = [{
30195
30218
  title: ""
30196
30219
  }, {
@@ -31644,9 +31667,10 @@ var useTextbookList = function useTextbookList(props) {
31644
31667
  var onNavigateCreate = props.onNavigateCreate,
31645
31668
  onNavigateDetail = props.onNavigateDetail,
31646
31669
  isSuperAdmin = props.isSuperAdmin,
31670
+ personal = props.personal,
31647
31671
  role = props.role;
31648
31672
  var _useList = useList(function (search) {
31649
- return getTextbookListApi$2(search, isSuperAdmin);
31673
+ return getTextbookListApi$2(search, isSuperAdmin, personal);
31650
31674
  }, TextbookDefaultQuery),
31651
31675
  filter = _useList.filter,
31652
31676
  textSearchRef = _useList.textSearchRef,
@@ -31666,6 +31690,7 @@ var useTextbookList = function useTextbookList(props) {
31666
31690
  var isTeacherSite = role === exports.Role.Teacher;
31667
31691
  var isAdmin = !!user && ((_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(exports.Role.Admin));
31668
31692
  var isTeacher = !!user && ((_user$roles2 = user.roles) === null || _user$roles2 === void 0 ? void 0 : _user$roles2.includes(exports.Role.Teacher)) && !isAdmin;
31693
+ var onAcademy = user && !!user.academyDomain;
31669
31694
  var _useTranslation = reactI18next.useTranslation(),
31670
31695
  t = _useTranslation.t;
31671
31696
  var dispatch = reactRedux.useDispatch();
@@ -31692,9 +31717,10 @@ var useTextbookList = function useTextbookList(props) {
31692
31717
  if (!(selectedTextbook !== null && selectedTextbook !== void 0 && selectedTextbook.id)) return Promise.resolve();
31693
31718
  dispatch(setLoading(true));
31694
31719
  var _temp = _catch(function () {
31695
- return Promise.resolve(deleteTextbookApi$1(selectedTextbook.id)).then(function () {
31720
+ return Promise.resolve(deleteTextbookApi$1(selectedTextbook.id, onAcademy)).then(function () {
31696
31721
  return Promise.resolve(getData(false)).then(function () {
31697
31722
  toggleConfirmDialog();
31723
+ reactToastify.toast.success(t("delete_data_successfully"));
31698
31724
  });
31699
31725
  });
31700
31726
  }, function (error) {
@@ -31950,6 +31976,7 @@ var useTextbookShare = function useTextbookShare(props) {
31950
31976
  });
31951
31977
  var isAdmin = infoUser && (infoUser === null || infoUser === void 0 ? void 0 : (_infoUser$roles = infoUser.roles) === null || _infoUser$roles === void 0 ? void 0 : _infoUser$roles.includes(exports.Role.Admin));
31952
31978
  var isAdminSite = role === exports.Role.Admin;
31979
+ var onAcademy = infoUser && !!infoUser.academyDomain;
31953
31980
  React.useEffect(function () {
31954
31981
  if (!isUpdate) {
31955
31982
  filterTeacherNotShared(currentModel);
@@ -32117,12 +32144,13 @@ var useTextbookShare = function useTextbookShare(props) {
32117
32144
  handleUpdateSharedTextbook: handleUpdateSharedTextbook,
32118
32145
  currentModel: currentModel,
32119
32146
  isAdmin: isAdmin,
32120
- isAdminSite: isAdminSite
32147
+ isAdminSite: isAdminSite,
32148
+ onAcademy: onAcademy
32121
32149
  };
32122
32150
  };
32123
32151
 
32124
32152
  var TextbookRow = function TextbookRow(_ref) {
32125
- var _infoUser$roles, _infoUser$roles2, _data$createdBy, _data$textbookOwners, _data$createdBy2, _data$createdBy3;
32153
+ var _infoUser$roles, _infoUser$roles2, _data$createdBy, _data$textbookOwners, _data$createdBy2, _data$createdBy3, _data$sharedUsers;
32126
32154
  var index = _ref.index,
32127
32155
  data = _ref.data,
32128
32156
  role = _ref.role,
@@ -32149,11 +32177,11 @@ var TextbookRow = function TextbookRow(_ref) {
32149
32177
  });
32150
32178
  var _useTranslation = reactI18next.useTranslation(),
32151
32179
  t = _useTranslation.t;
32152
- var isEditable = !onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && data.isShared && (((_data$createdBy = data.createdBy) === null || _data$createdBy === void 0 ? void 0 : _data$createdBy.id) === (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id) || ((_data$textbookOwners = data.textbookOwners) === null || _data$textbookOwners === void 0 ? void 0 : _data$textbookOwners.some(function (i) {
32180
+ var isEditable = (!onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && data.isShared && (((_data$createdBy = data.createdBy) === null || _data$createdBy === void 0 ? void 0 : _data$createdBy.id) === (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id) || ((_data$textbookOwners = data.textbookOwners) === null || _data$textbookOwners === void 0 ? void 0 : _data$textbookOwners.some(function (i) {
32153
32181
  var _infoUser$email, _infoUser$email$trim;
32154
32182
  return (i === null || i === void 0 ? void 0 : i.email.trim().toUpperCase()) === (infoUser === null || infoUser === void 0 ? void 0 : (_infoUser$email = infoUser.email) === null || _infoUser$email === void 0 ? void 0 : (_infoUser$email$trim = _infoUser$email.trim()) === null || _infoUser$email$trim === void 0 ? void 0 : _infoUser$email$trim.toUpperCase()) && (i === null || i === void 0 ? void 0 : i.academyId) === (academy === null || academy === void 0 ? void 0 : academy.id);
32155
- })));
32156
- var isDeleteAble = !onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && data.isShared && ((_data$createdBy2 = data.createdBy) === null || _data$createdBy2 === void 0 ? void 0 : _data$createdBy2.id) === (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id);
32183
+ })))) && data.totalUses <= 0;
32184
+ var isDeleteAble = !onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && data.isShared && ((_data$createdBy2 = data.createdBy) === null || _data$createdBy2 === void 0 ? void 0 : _data$createdBy2.id) === (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id) && data.totalUses <= 0;
32157
32185
  var isSharable = !data.isPublic && data.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && data.createdBy.id === infoUser.id);
32158
32186
  var handleUpdateTextbook = function handleUpdateTextbook() {
32159
32187
  onUpdateTextbook(data);
@@ -32172,13 +32200,26 @@ var TextbookRow = function TextbookRow(_ref) {
32172
32200
  };
32173
32201
  return React__default.createElement(material.TableRow, {
32174
32202
  key: data.id
32175
- }, React__default.createElement(material.TableCell, null, calcOrderNumber(index)), React__default.createElement(material.TableCell, null, data.name), React__default.createElement(material.TableCell, null, data.subject.name), React__default.createElement(material.TableCell, null, utcToLocalTime(data.createdAt, t("date_format"))), React__default.createElement(material.TableCell, null, data.totalChapters), isTeacher && isTeacherSite && React__default.createElement(material.TableCell, null, (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id) === ((_data$createdBy3 = data.createdBy) === null || _data$createdBy3 === void 0 ? void 0 : _data$createdBy3.id) && data.isShared && React__default.createElement(fa.FaCheckCircle, {
32203
+ }, React__default.createElement(material.TableCell, null, calcOrderNumber(index)), React__default.createElement(material.TableCell, null, React__default.createElement(material.Box, {
32204
+ sx: {
32205
+ display: "flex",
32206
+ justifyContent: "center",
32207
+ alignItems: "start"
32208
+ }
32209
+ }, React__default.createElement("img", {
32210
+ src: data.coverImage,
32211
+ style: {
32212
+ objectFit: "cover"
32213
+ },
32214
+ height: 100
32215
+ }))), React__default.createElement(material.TableCell, null, data.name), React__default.createElement(material.TableCell, null, data.subject.name), React__default.createElement(material.TableCell, null, utcToLocalTime(data.createdAt, t("date_format"))), React__default.createElement(material.TableCell, null, data.totalChapters), React__default.createElement(material.TableCell, null, data.totalUses), isTeacher && isTeacherSite && React__default.createElement(material.TableCell, null, (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id) === ((_data$createdBy3 = data.createdBy) === null || _data$createdBy3 === void 0 ? void 0 : _data$createdBy3.id) && data.isShared && React__default.createElement(fa.FaCheckCircle, {
32176
32216
  color: green[700]
32177
- })), React__default.createElement(material.TableCell, null, !data.isPublic && data.sharedUsers.map(function (email, index) {
32178
- return index > 2 ? null : index === 2 ? React__default.createElement("div", null, "(+", data.sharedUsers.length - 2, ")") : React__default.createElement("div", {
32217
+ })), onAcademy && React__default.createElement(material.TableCell, null, !data.isPublic && ((_data$sharedUsers = data.sharedUsers) === null || _data$sharedUsers === void 0 ? void 0 : _data$sharedUsers.map(function (email, index) {
32218
+ var _data$sharedUsers2;
32219
+ return index > 2 ? null : index === 2 ? React__default.createElement("div", null, "(+", ((_data$sharedUsers2 = data.sharedUsers) === null || _data$sharedUsers2 === void 0 ? void 0 : _data$sharedUsers2.length) - 2, ")") : React__default.createElement("div", {
32179
32220
  key: index
32180
32221
  }, email.toLowerCase());
32181
- })), React__default.createElement(material.TableCell, null, React__default.createElement(material.Stack, {
32222
+ }))), React__default.createElement(material.TableCell, null, React__default.createElement(material.Stack, {
32182
32223
  direction: "row",
32183
32224
  spacing: 1,
32184
32225
  alignItems: "center"
@@ -32195,13 +32236,13 @@ var TextbookRow = function TextbookRow(_ref) {
32195
32236
  onClick: handleViewTextbook
32196
32237
  }, React__default.createElement(fa.FaEye, {
32197
32238
  size: 12
32198
- })), React__default.createElement(material.IconButton, {
32239
+ })), onAcademy && React__default.createElement(material.IconButton, {
32199
32240
  disabled: !isSharable,
32200
32241
  className: (!isSharable ? "bg-secondary" : "bg-info") + " text-white me-1",
32201
32242
  onClick: handleShareTextbook
32202
32243
  }, React__default.createElement(fa.FaShare, {
32203
32244
  size: 12
32204
- })), React__default.createElement(material.IconButton, {
32245
+ })), onAcademy && React__default.createElement(material.IconButton, {
32205
32246
  disabled: !isSharable,
32206
32247
  className: (!isSharable ? "bg-secondary" : "bg-success") + " text-white me-1",
32207
32248
  onClick: handleUpdateShareTextbook
@@ -32225,8 +32266,6 @@ var TextbookList = function TextbookList(props) {
32225
32266
  var _useTranslation = reactI18next.useTranslation(),
32226
32267
  t = _useTranslation.t;
32227
32268
  var _useTextbookList = useTextbookList(props),
32228
- isTeacherSite = _useTextbookList.isTeacherSite,
32229
- isTeacher = _useTextbookList.isTeacher,
32230
32269
  filter = _useTextbookList.filter,
32231
32270
  textbooks = _useTextbookList.textbooks,
32232
32271
  paging = _useTextbookList.paging,
@@ -32246,6 +32285,9 @@ var TextbookList = function TextbookList(props) {
32246
32285
  var _useTextbookShare = useTextbookShare(_extends({}, props, {
32247
32286
  getData: getData
32248
32287
  })),
32288
+ isAdmin = _useTextbookShare.isAdmin,
32289
+ isAdminSite = _useTextbookShare.isAdminSite,
32290
+ onAcademy = _useTextbookShare.onAcademy,
32249
32291
  filterShare = _useTextbookShare.filterShare,
32250
32292
  textSearchShareRef = _useTextbookShare.textSearchShareRef,
32251
32293
  pagingShare = _useTextbookShare.pagingShare,
@@ -32270,12 +32312,9 @@ var TextbookList = function TextbookList(props) {
32270
32312
  handleUpdateSharedTextbook = _useTextbookShare.handleUpdateSharedTextbook,
32271
32313
  currentModel = _useTextbookShare.currentModel;
32272
32314
  var textbookHeaders = React.useMemo(function () {
32273
- var headers = _$8.clone(TEXTBOOK_HEADERS);
32274
- if (isTeacher && isTeacherSite) headers.splice(5, 0, {
32275
- title: "teacher_personal_textbook"
32276
- });
32315
+ var headers = TEXTBOOK_HEADERS(isAdmin, isAdminSite, onAcademy);
32277
32316
  return headers;
32278
- }, [isTeacher, isTeacherSite]);
32317
+ }, [isAdmin, isAdminSite, onAcademy]);
32279
32318
  return React__default.createElement(LayoutList, {
32280
32319
  title: t(TEXTBOOK_PAGE_TITLE)
32281
32320
  }, React__default.createElement(material.Grid, {
@@ -33088,25 +33127,25 @@ var NotificationList = function NotificationList(_ref) {
33088
33127
 
33089
33128
  var TEXTBOOK_URL$2 = BASE_URL + "/api/textbooks";
33090
33129
  var PREPARED_TEXTBOOK_URL$2 = BASE_URL + "/api/textbooks/prepared-textbooks";
33091
- var SUPER_ADMIN_PREPARED_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook/prepared-textbooks";
33130
+ var SUPER_ADMIN_PREPARED_TEXTBOOK_URL$1 = SUPER_ADMIN_BASE_URL + "/api/textbook/prepared-textbooks";
33092
33131
  var FILE_URL = BASE_URL + "/api/file/images";
33093
33132
  var SUPER_FILE_URL = SUPER_ADMIN_BASE_URL + "/api/file/images";
33094
33133
  var uploadImageFileApi = function uploadImageFileApi(formData, isAdmin) {
33095
33134
  return apiUpload.post("" + (isAdmin ? SUPER_FILE_URL : FILE_URL), formData);
33096
33135
  };
33097
33136
  var getTextbookDetailApi = function getTextbookDetailApi(id, isAdmin) {
33098
- return api.get((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : TEXTBOOK_URL$2) + "/" + id);
33137
+ return api.get((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL$1 : TEXTBOOK_URL$2) + "/" + id);
33099
33138
  };
33100
33139
  var getTextbookListApi$3 = function getTextbookListApi(query, isAdmin) {
33101
- return api.get("" + (isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : PREPARED_TEXTBOOK_URL$2), {
33140
+ return api.get("" + (isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL$1 : PREPARED_TEXTBOOK_URL$2), {
33102
33141
  params: query
33103
33142
  });
33104
33143
  };
33105
33144
  var createTextbookApi$1 = function createTextbookApi(values, isAdmin) {
33106
- return api.post("" + (isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : PREPARED_TEXTBOOK_URL$2), values);
33145
+ return api.post("" + (isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL$1 : PREPARED_TEXTBOOK_URL$2), values);
33107
33146
  };
33108
33147
  var updateTextbookApi$1 = function updateTextbookApi(values, id, isAdmin) {
33109
- return api.put((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : PREPARED_TEXTBOOK_URL$2) + "/" + id, values);
33148
+ return api.put((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL$1 : PREPARED_TEXTBOOK_URL$2) + "/" + id, values);
33110
33149
  };
33111
33150
  var getCourseByTeacherAcademy = function getCourseByTeacherAcademy(email, academyId) {
33112
33151
  return api.get(TEXTBOOK_URL$2 + "/owner-teacher-course", {
@@ -33117,7 +33156,7 @@ var getCourseByTeacherAcademy = function getCourseByTeacherAcademy(email, academ
33117
33156
  });
33118
33157
  };
33119
33158
  var deleteTextbookApi$2 = function deleteTextbookApi(textbookId, isAdmin) {
33120
- return api["delete"]((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : TEXTBOOK_URL$2) + "/" + textbookId);
33159
+ return api["delete"]((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL$1 : TEXTBOOK_URL$2) + "/" + textbookId);
33121
33160
  };
33122
33161
 
33123
33162
  var useTextbookManagement = function useTextbookManagement(_ref) {
@@ -33157,10 +33196,10 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
33157
33196
  var isAdminSite = role === exports.Role.Admin;
33158
33197
  var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
33159
33198
  var isSuperAdminUser = !!user && user.isSuperAdmin;
33160
- var isEditable = !selectedTextbook || !onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && selectedTextbook.isShared && (((_selectedTextbook$cre = selectedTextbook.createdBy) === null || _selectedTextbook$cre === void 0 ? void 0 : _selectedTextbook$cre.id) === (user === null || user === void 0 ? void 0 : user.id) || selectedTextbook.textbookOwners.some(function (i) {
33199
+ var isEditable = !selectedTextbook || (!onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && selectedTextbook.isShared && (((_selectedTextbook$cre = selectedTextbook.createdBy) === null || _selectedTextbook$cre === void 0 ? void 0 : _selectedTextbook$cre.id) === (user === null || user === void 0 ? void 0 : user.id) || selectedTextbook.textbookOwners.some(function (i) {
33161
33200
  var _user$email, _user$email$trim;
33162
33201
  return i.email.trim().toUpperCase() === (user === null || user === void 0 ? void 0 : (_user$email = user.email) === null || _user$email === void 0 ? void 0 : (_user$email$trim = _user$email.trim()) === null || _user$email$trim === void 0 ? void 0 : _user$email$trim.toUpperCase()) && i.academyId === (academy === null || academy === void 0 ? void 0 : academy.id);
33163
- }));
33202
+ }))) && selectedTextbook.totalUses <= 0;
33164
33203
  var disabledTextbookOwners = !selectedTextbook && isAdmin || selectedTextbook && (!isEditable || isTeacher && ((_selectedTextbook$cre2 = selectedTextbook.createdBy) === null || _selectedTextbook$cre2 === void 0 ? void 0 : _selectedTextbook$cre2.id) !== (user === null || user === void 0 ? void 0 : user.id) || isAdmin && !isSuperAdminUser);
33165
33204
  var handleOpenConfirmDeleteChapterDialog = function handleOpenConfirmDeleteChapterDialog(chapter) {
33166
33205
  setSelectedChapter(chapter);