analytica-frontend-lib 1.4.75 → 1.4.76
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/dist/SimulationsPage/index.js +142 -67
- package/dist/SimulationsPage/index.js.map +1 -1
- package/dist/SimulationsPage/index.mjs +134 -59
- package/dist/SimulationsPage/index.mjs.map +1 -1
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -660,7 +660,7 @@ __export(SimulationsPage_exports, {
|
|
|
660
660
|
module.exports = __toCommonJS(SimulationsPage_exports);
|
|
661
661
|
|
|
662
662
|
// src/components/SimulationsPage/SimulationsPage.tsx
|
|
663
|
-
var
|
|
663
|
+
var import_react26 = require("react");
|
|
664
664
|
var import_phosphor_react16 = require("phosphor-react");
|
|
665
665
|
|
|
666
666
|
// src/components/PageContainer/PageContainer.tsx
|
|
@@ -697,7 +697,7 @@ init_Text();
|
|
|
697
697
|
init_Button();
|
|
698
698
|
|
|
699
699
|
// src/components/TableProvider/TableProvider.tsx
|
|
700
|
-
var
|
|
700
|
+
var import_react24 = require("react");
|
|
701
701
|
|
|
702
702
|
// src/components/Table/Table.tsx
|
|
703
703
|
var import_react3 = require("react");
|
|
@@ -2957,7 +2957,7 @@ var Search_default = Search;
|
|
|
2957
2957
|
init_Modal();
|
|
2958
2958
|
|
|
2959
2959
|
// src/components/CheckBoxGroup/CheckBoxGroup.tsx
|
|
2960
|
-
var
|
|
2960
|
+
var import_react23 = require("react");
|
|
2961
2961
|
|
|
2962
2962
|
// src/index.ts
|
|
2963
2963
|
init_Text();
|
|
@@ -7106,15 +7106,71 @@ var HeaderAlternative = (0, import_react20.forwardRef)(
|
|
|
7106
7106
|
}
|
|
7107
7107
|
);
|
|
7108
7108
|
|
|
7109
|
+
// src/components/SimulatedFilters/hooks.ts
|
|
7110
|
+
var import_react21 = require("react");
|
|
7111
|
+
function useUserAccessData(api) {
|
|
7112
|
+
const [state, setState] = (0, import_react21.useState)({
|
|
7113
|
+
isLoading: false,
|
|
7114
|
+
error: null,
|
|
7115
|
+
schools: [],
|
|
7116
|
+
schoolYears: [],
|
|
7117
|
+
classes: []
|
|
7118
|
+
});
|
|
7119
|
+
const hasFetched = (0, import_react21.useRef)(false);
|
|
7120
|
+
const fetchData = (0, import_react21.useCallback)(async () => {
|
|
7121
|
+
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
7122
|
+
try {
|
|
7123
|
+
const response = await api.get("/auth/me");
|
|
7124
|
+
const data = response.data.data;
|
|
7125
|
+
setState({
|
|
7126
|
+
isLoading: false,
|
|
7127
|
+
error: null,
|
|
7128
|
+
schools: data.schools.map((s) => ({
|
|
7129
|
+
id: s.id,
|
|
7130
|
+
name: s.name
|
|
7131
|
+
})),
|
|
7132
|
+
schoolYears: data.schoolYears.map((sy) => ({
|
|
7133
|
+
id: sy.id,
|
|
7134
|
+
name: sy.name,
|
|
7135
|
+
schoolId: sy.schoolId
|
|
7136
|
+
})),
|
|
7137
|
+
classes: data.classes.map((c) => ({
|
|
7138
|
+
id: c.id,
|
|
7139
|
+
name: c.name,
|
|
7140
|
+
schoolId: c.schoolId,
|
|
7141
|
+
schoolYearId: c.schoolYearId
|
|
7142
|
+
}))
|
|
7143
|
+
});
|
|
7144
|
+
} catch (err) {
|
|
7145
|
+
const errorMessage = err instanceof Error ? err.message : "Falha ao carregar dados";
|
|
7146
|
+
setState((prev) => ({
|
|
7147
|
+
...prev,
|
|
7148
|
+
isLoading: false,
|
|
7149
|
+
error: errorMessage
|
|
7150
|
+
}));
|
|
7151
|
+
}
|
|
7152
|
+
}, [api]);
|
|
7153
|
+
(0, import_react21.useEffect)(() => {
|
|
7154
|
+
if (!hasFetched.current) {
|
|
7155
|
+
hasFetched.current = true;
|
|
7156
|
+
fetchData();
|
|
7157
|
+
}
|
|
7158
|
+
}, [fetchData]);
|
|
7159
|
+
return {
|
|
7160
|
+
...state,
|
|
7161
|
+
refetch: fetchData
|
|
7162
|
+
};
|
|
7163
|
+
}
|
|
7164
|
+
|
|
7109
7165
|
// src/index.ts
|
|
7110
7166
|
init_utils();
|
|
7111
7167
|
|
|
7112
7168
|
// src/hooks/useSimulations.ts
|
|
7113
|
-
var
|
|
7169
|
+
var import_react22 = require("react");
|
|
7114
7170
|
var BASE_URL = "/performance/simulations";
|
|
7115
7171
|
var segment = (value) => encodeURIComponent(value);
|
|
7116
7172
|
var createUseSimulations = (apiClient) => () => {
|
|
7117
|
-
const fetchStudents = (0,
|
|
7173
|
+
const fetchStudents = (0, import_react22.useCallback)(
|
|
7118
7174
|
async (filters = {}) => {
|
|
7119
7175
|
const { page = 1, limit = 20, search, classIds } = filters;
|
|
7120
7176
|
const response = await apiClient.get(
|
|
@@ -7125,7 +7181,7 @@ var createUseSimulations = (apiClient) => () => {
|
|
|
7125
7181
|
},
|
|
7126
7182
|
[]
|
|
7127
7183
|
);
|
|
7128
|
-
const fetchStudentSimulations = (0,
|
|
7184
|
+
const fetchStudentSimulations = (0, import_react22.useCallback)(
|
|
7129
7185
|
async (userInstitutionId, filters = {}) => {
|
|
7130
7186
|
const { page = 1, limit = 20 } = filters;
|
|
7131
7187
|
const response = await apiClient.get(
|
|
@@ -7136,7 +7192,7 @@ var createUseSimulations = (apiClient) => () => {
|
|
|
7136
7192
|
},
|
|
7137
7193
|
[]
|
|
7138
7194
|
);
|
|
7139
|
-
const fetchSimulationDetail = (0,
|
|
7195
|
+
const fetchSimulationDetail = (0, import_react22.useCallback)(
|
|
7140
7196
|
async (userInstitutionId, simulationId) => {
|
|
7141
7197
|
const response = await apiClient.get(
|
|
7142
7198
|
`${BASE_URL}/students/${segment(userInstitutionId)}/${segment(simulationId)}`
|
|
@@ -7145,7 +7201,7 @@ var createUseSimulations = (apiClient) => () => {
|
|
|
7145
7201
|
},
|
|
7146
7202
|
[]
|
|
7147
7203
|
);
|
|
7148
|
-
const fetchNote = (0,
|
|
7204
|
+
const fetchNote = (0, import_react22.useCallback)(
|
|
7149
7205
|
async (userInstitutionId, simulationId) => {
|
|
7150
7206
|
const response = await apiClient.get(
|
|
7151
7207
|
`${BASE_URL}/students/${segment(userInstitutionId)}/${segment(simulationId)}/note`
|
|
@@ -7154,7 +7210,7 @@ var createUseSimulations = (apiClient) => () => {
|
|
|
7154
7210
|
},
|
|
7155
7211
|
[]
|
|
7156
7212
|
);
|
|
7157
|
-
const saveNote = (0,
|
|
7213
|
+
const saveNote = (0, import_react22.useCallback)(
|
|
7158
7214
|
async (userInstitutionId, simulationId, note) => {
|
|
7159
7215
|
const response = await apiClient.post(
|
|
7160
7216
|
`${BASE_URL}/students/${segment(userInstitutionId)}/${segment(simulationId)}/note`,
|
|
@@ -7164,7 +7220,7 @@ var createUseSimulations = (apiClient) => () => {
|
|
|
7164
7220
|
},
|
|
7165
7221
|
[]
|
|
7166
7222
|
);
|
|
7167
|
-
return (0,
|
|
7223
|
+
return (0, import_react22.useMemo)(
|
|
7168
7224
|
() => ({
|
|
7169
7225
|
fetchStudents,
|
|
7170
7226
|
fetchStudentSimulations,
|
|
@@ -7192,14 +7248,14 @@ var CheckboxGroup = ({
|
|
|
7192
7248
|
showSingleItem = false,
|
|
7193
7249
|
disableAutoSelection = false
|
|
7194
7250
|
}) => {
|
|
7195
|
-
const [openAccordion, setOpenAccordion] = (0,
|
|
7196
|
-
const onCategoriesChangeRef = (0,
|
|
7197
|
-
const previousCategoriesRef = (0,
|
|
7198
|
-
const appliedAutoSelectionRef = (0,
|
|
7199
|
-
(0,
|
|
7251
|
+
const [openAccordion, setOpenAccordion] = (0, import_react23.useState)("");
|
|
7252
|
+
const onCategoriesChangeRef = (0, import_react23.useRef)(onCategoriesChange);
|
|
7253
|
+
const previousCategoriesRef = (0, import_react23.useRef)(categories);
|
|
7254
|
+
const appliedAutoSelectionRef = (0, import_react23.useRef)("");
|
|
7255
|
+
(0, import_react23.useEffect)(() => {
|
|
7200
7256
|
onCategoriesChangeRef.current = onCategoriesChange;
|
|
7201
7257
|
}, [onCategoriesChange]);
|
|
7202
|
-
const categoriesWithAutoSelection = (0,
|
|
7258
|
+
const categoriesWithAutoSelection = (0, import_react23.useMemo)(() => {
|
|
7203
7259
|
if (disableAutoSelection) {
|
|
7204
7260
|
return categories;
|
|
7205
7261
|
}
|
|
@@ -7217,7 +7273,7 @@ var CheckboxGroup = ({
|
|
|
7217
7273
|
return category;
|
|
7218
7274
|
});
|
|
7219
7275
|
}, [categories, disableAutoSelection]);
|
|
7220
|
-
(0,
|
|
7276
|
+
(0, import_react23.useEffect)(() => {
|
|
7221
7277
|
const categoriesChanged = categories !== previousCategoriesRef.current;
|
|
7222
7278
|
previousCategoriesRef.current = categories;
|
|
7223
7279
|
const hasAutoSelectionChanges = categoriesWithAutoSelection.some(
|
|
@@ -7350,7 +7406,7 @@ var CheckboxGroup = ({
|
|
|
7350
7406
|
);
|
|
7351
7407
|
return groupedItems.length ? groupedItems : [{ itens: [] }];
|
|
7352
7408
|
};
|
|
7353
|
-
const formattedItemsMap = (0,
|
|
7409
|
+
const formattedItemsMap = (0, import_react23.useMemo)(() => {
|
|
7354
7410
|
const formattedItemsMap2 = {};
|
|
7355
7411
|
for (const category of categories) {
|
|
7356
7412
|
const formattedItems = calculateFormattedItems(category.key);
|
|
@@ -7620,7 +7676,7 @@ var CheckboxGroup = ({
|
|
|
7620
7676
|
openAccordion !== category.key && showDivider && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Divider_default, {})
|
|
7621
7677
|
] }, category.key);
|
|
7622
7678
|
};
|
|
7623
|
-
(0,
|
|
7679
|
+
(0, import_react23.useEffect)(() => {
|
|
7624
7680
|
if (!openAccordion) return;
|
|
7625
7681
|
const category = categories.find((c) => c.key === openAccordion);
|
|
7626
7682
|
if (!category) return;
|
|
@@ -7815,8 +7871,8 @@ function TableProvider({
|
|
|
7815
7871
|
containerClassName,
|
|
7816
7872
|
children
|
|
7817
7873
|
}) {
|
|
7818
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
7819
|
-
const [inputValue, setInputValue] = (0,
|
|
7874
|
+
const [searchQuery, setSearchQuery] = (0, import_react24.useState)("");
|
|
7875
|
+
const [inputValue, setInputValue] = (0, import_react24.useState)("");
|
|
7820
7876
|
const sortResultRaw = useTableSort(data, { syncWithUrl: true });
|
|
7821
7877
|
const sortResult = enableTableSort ? sortResultRaw : {
|
|
7822
7878
|
sortedData: data,
|
|
@@ -7827,7 +7883,7 @@ function TableProvider({
|
|
|
7827
7883
|
};
|
|
7828
7884
|
const { sortedData, sortColumn, sortDirection, handleSort } = sortResult;
|
|
7829
7885
|
const filterResultRaw = useTableFilter(initialFilters, { syncWithUrl: true });
|
|
7830
|
-
const disabledFilterResult = (0,
|
|
7886
|
+
const disabledFilterResult = (0, import_react24.useMemo)(
|
|
7831
7887
|
() => ({
|
|
7832
7888
|
filterConfigs: [],
|
|
7833
7889
|
activeFilters: {},
|
|
@@ -7858,10 +7914,10 @@ function TableProvider({
|
|
|
7858
7914
|
totalItems,
|
|
7859
7915
|
totalPages
|
|
7860
7916
|
} = paginationConfig;
|
|
7861
|
-
const [currentPage, setCurrentPage] = (0,
|
|
7862
|
-
const [itemsPerPage, setItemsPerPage] = (0,
|
|
7863
|
-
const [isFilterModalOpen, setIsFilterModalOpen] = (0,
|
|
7864
|
-
const combinedParams = (0,
|
|
7917
|
+
const [currentPage, setCurrentPage] = (0, import_react24.useState)(1);
|
|
7918
|
+
const [itemsPerPage, setItemsPerPage] = (0, import_react24.useState)(defaultItemsPerPage);
|
|
7919
|
+
const [isFilterModalOpen, setIsFilterModalOpen] = (0, import_react24.useState)(false);
|
|
7920
|
+
const combinedParams = (0, import_react24.useMemo)(() => {
|
|
7865
7921
|
const params = {
|
|
7866
7922
|
page: currentPage,
|
|
7867
7923
|
limit: itemsPerPage
|
|
@@ -7888,29 +7944,29 @@ function TableProvider({
|
|
|
7888
7944
|
enableFilters,
|
|
7889
7945
|
enableTableSort
|
|
7890
7946
|
]);
|
|
7891
|
-
(0,
|
|
7947
|
+
(0, import_react24.useEffect)(() => {
|
|
7892
7948
|
onParamsChange?.(combinedParams);
|
|
7893
7949
|
}, [combinedParams]);
|
|
7894
|
-
const handleSearchChange = (0,
|
|
7950
|
+
const handleSearchChange = (0, import_react24.useCallback)((value) => {
|
|
7895
7951
|
setSearchQuery(value);
|
|
7896
7952
|
setCurrentPage(1);
|
|
7897
7953
|
}, []);
|
|
7898
|
-
const handleInputChange = (0,
|
|
7954
|
+
const handleInputChange = (0, import_react24.useCallback)((e) => {
|
|
7899
7955
|
setInputValue(e.target.value);
|
|
7900
7956
|
}, []);
|
|
7901
|
-
const handleFilterApply = (0,
|
|
7957
|
+
const handleFilterApply = (0, import_react24.useCallback)(() => {
|
|
7902
7958
|
applyFilters();
|
|
7903
7959
|
setIsFilterModalOpen(false);
|
|
7904
7960
|
setCurrentPage(1);
|
|
7905
7961
|
}, [applyFilters]);
|
|
7906
|
-
const handlePageChange = (0,
|
|
7962
|
+
const handlePageChange = (0, import_react24.useCallback)((page) => {
|
|
7907
7963
|
setCurrentPage(page);
|
|
7908
7964
|
}, []);
|
|
7909
|
-
const handleItemsPerPageChange = (0,
|
|
7965
|
+
const handleItemsPerPageChange = (0, import_react24.useCallback)((items) => {
|
|
7910
7966
|
setItemsPerPage(items);
|
|
7911
7967
|
setCurrentPage(1);
|
|
7912
7968
|
}, []);
|
|
7913
|
-
const handleRowClickInternal = (0,
|
|
7969
|
+
const handleRowClickInternal = (0, import_react24.useCallback)(
|
|
7914
7970
|
(row, index) => {
|
|
7915
7971
|
if (enableRowClick && onRowClick) {
|
|
7916
7972
|
onRowClick(row, index);
|
|
@@ -7918,7 +7974,7 @@ function TableProvider({
|
|
|
7918
7974
|
},
|
|
7919
7975
|
[enableRowClick, onRowClick]
|
|
7920
7976
|
);
|
|
7921
|
-
const useInternalPagination = (0,
|
|
7977
|
+
const useInternalPagination = (0, import_react24.useMemo)(
|
|
7922
7978
|
() => enablePagination && !onParamsChange && totalItems === void 0 && totalPages === void 0,
|
|
7923
7979
|
[enablePagination, onParamsChange, totalItems, totalPages]
|
|
7924
7980
|
);
|
|
@@ -7926,7 +7982,7 @@ function TableProvider({
|
|
|
7926
7982
|
(totalItems ?? (useInternalPagination ? sortedData.length : data.length)) / itemsPerPage
|
|
7927
7983
|
);
|
|
7928
7984
|
const calculatedTotalItems = totalItems ?? (useInternalPagination ? sortedData.length : data.length);
|
|
7929
|
-
const displayData = (0,
|
|
7985
|
+
const displayData = (0, import_react24.useMemo)(() => {
|
|
7930
7986
|
if (!useInternalPagination) {
|
|
7931
7987
|
return sortedData;
|
|
7932
7988
|
}
|
|
@@ -8112,7 +8168,7 @@ function TableProvider({
|
|
|
8112
8168
|
var TableProvider_default = TableProvider;
|
|
8113
8169
|
|
|
8114
8170
|
// src/components/SimulationsPage/SimulationsDetailModal.tsx
|
|
8115
|
-
var
|
|
8171
|
+
var import_react25 = require("react");
|
|
8116
8172
|
var import_phosphor_react15 = require("phosphor-react");
|
|
8117
8173
|
init_Modal();
|
|
8118
8174
|
init_Text();
|
|
@@ -8200,10 +8256,10 @@ function NoteRow({
|
|
|
8200
8256
|
loading,
|
|
8201
8257
|
onSave
|
|
8202
8258
|
}) {
|
|
8203
|
-
const [editing, setEditing] = (0,
|
|
8204
|
-
const [draft, setDraft] = (0,
|
|
8205
|
-
const [saving, setSaving] = (0,
|
|
8206
|
-
const [error, setError] = (0,
|
|
8259
|
+
const [editing, setEditing] = (0, import_react25.useState)(false);
|
|
8260
|
+
const [draft, setDraft] = (0, import_react25.useState)("");
|
|
8261
|
+
const [saving, setSaving] = (0, import_react25.useState)(false);
|
|
8262
|
+
const [error, setError] = (0, import_react25.useState)(null);
|
|
8207
8263
|
const startEditing = () => {
|
|
8208
8264
|
setDraft(note?.note ?? "");
|
|
8209
8265
|
setError(null);
|
|
@@ -8283,10 +8339,7 @@ function SimulationItem({
|
|
|
8283
8339
|
value: simulation.id,
|
|
8284
8340
|
expanded,
|
|
8285
8341
|
onToggleExpanded: onToggle,
|
|
8286
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex-1 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime38.
|
|
8287
|
-
"Simulado ",
|
|
8288
|
-
index + 1
|
|
8289
|
-
] }) }),
|
|
8342
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex-1 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text_default, { weight: "bold", className: "text-text-950", children: simulation.title?.trim() ? simulation.title.trim() : `Simulado ${index + 1}` }) }),
|
|
8290
8343
|
contentClassName: "px-3 pb-4",
|
|
8291
8344
|
children: [
|
|
8292
8345
|
detail?.loading && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SkeletonCard, { className: "h-40" }),
|
|
@@ -8351,35 +8404,35 @@ function SimulationsDetailModal({
|
|
|
8351
8404
|
onClose,
|
|
8352
8405
|
student
|
|
8353
8406
|
}) {
|
|
8354
|
-
const useSimulations = (0,
|
|
8407
|
+
const useSimulations = (0, import_react25.useMemo)(() => createUseSimulations(api), [api]);
|
|
8355
8408
|
const {
|
|
8356
8409
|
fetchStudentSimulations,
|
|
8357
8410
|
fetchSimulationDetail,
|
|
8358
8411
|
fetchNote,
|
|
8359
8412
|
saveNote
|
|
8360
8413
|
} = useSimulations();
|
|
8361
|
-
const [list, setList] = (0,
|
|
8362
|
-
const [listLoading, setListLoading] = (0,
|
|
8363
|
-
const [listError, setListError] = (0,
|
|
8364
|
-
const [expandedId, setExpandedId] = (0,
|
|
8365
|
-
const [details, setDetails] = (0,
|
|
8366
|
-
const [notes, setNotes] = (0,
|
|
8367
|
-
const mountedRef = (0,
|
|
8368
|
-
(0,
|
|
8414
|
+
const [list, setList] = (0, import_react25.useState)(null);
|
|
8415
|
+
const [listLoading, setListLoading] = (0, import_react25.useState)(false);
|
|
8416
|
+
const [listError, setListError] = (0, import_react25.useState)(null);
|
|
8417
|
+
const [expandedId, setExpandedId] = (0, import_react25.useState)(null);
|
|
8418
|
+
const [details, setDetails] = (0, import_react25.useState)({});
|
|
8419
|
+
const [notes, setNotes] = (0, import_react25.useState)({});
|
|
8420
|
+
const mountedRef = (0, import_react25.useRef)(true);
|
|
8421
|
+
(0, import_react25.useEffect)(() => {
|
|
8369
8422
|
mountedRef.current = true;
|
|
8370
8423
|
return () => {
|
|
8371
8424
|
mountedRef.current = false;
|
|
8372
8425
|
};
|
|
8373
8426
|
}, []);
|
|
8374
|
-
const requestEpochRef = (0,
|
|
8375
|
-
(0,
|
|
8427
|
+
const requestEpochRef = (0, import_react25.useRef)(0);
|
|
8428
|
+
(0, import_react25.useEffect)(() => {
|
|
8376
8429
|
requestEpochRef.current += 1;
|
|
8377
8430
|
}, [isOpen, student?.userInstitutionId]);
|
|
8378
|
-
const isStaleResponse = (0,
|
|
8431
|
+
const isStaleResponse = (0, import_react25.useCallback)(
|
|
8379
8432
|
(epoch) => !mountedRef.current || requestEpochRef.current !== epoch,
|
|
8380
8433
|
[]
|
|
8381
8434
|
);
|
|
8382
|
-
(0,
|
|
8435
|
+
(0, import_react25.useEffect)(() => {
|
|
8383
8436
|
if (!isOpen || !student) return;
|
|
8384
8437
|
setList(null);
|
|
8385
8438
|
setExpandedId(null);
|
|
@@ -8399,7 +8452,7 @@ function SimulationsDetailModal({
|
|
|
8399
8452
|
active = false;
|
|
8400
8453
|
};
|
|
8401
8454
|
}, [isOpen, student, fetchStudentSimulations]);
|
|
8402
|
-
const handleToggle = (0,
|
|
8455
|
+
const handleToggle = (0, import_react25.useCallback)(
|
|
8403
8456
|
(simulationId) => {
|
|
8404
8457
|
if (!student) return;
|
|
8405
8458
|
const requestEpoch = requestEpochRef.current;
|
|
@@ -8455,7 +8508,7 @@ function SimulationsDetailModal({
|
|
|
8455
8508
|
isStaleResponse
|
|
8456
8509
|
]
|
|
8457
8510
|
);
|
|
8458
|
-
const makeSaveNote = (0,
|
|
8511
|
+
const makeSaveNote = (0, import_react25.useCallback)(
|
|
8459
8512
|
(simulationId) => async (text) => {
|
|
8460
8513
|
if (!student) return;
|
|
8461
8514
|
const requestEpoch = requestEpochRef.current;
|
|
@@ -8506,19 +8559,39 @@ function SimulationsDetailModal({
|
|
|
8506
8559
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8507
8560
|
var DEFAULT_LIMIT = 10;
|
|
8508
8561
|
function SimulationsPage({ api, noSearchImage }) {
|
|
8509
|
-
const useSimulations = (0,
|
|
8562
|
+
const useSimulations = (0, import_react26.useMemo)(() => createUseSimulations(api), [api]);
|
|
8510
8563
|
const { fetchStudents } = useSimulations();
|
|
8511
|
-
const
|
|
8512
|
-
const [
|
|
8513
|
-
const [
|
|
8514
|
-
const [
|
|
8515
|
-
const
|
|
8564
|
+
const { classes } = useUserAccessData(api);
|
|
8565
|
+
const [students, setStudents] = (0, import_react26.useState)([]);
|
|
8566
|
+
const [total, setTotal] = (0, import_react26.useState)(0);
|
|
8567
|
+
const [loading, setLoading] = (0, import_react26.useState)(true);
|
|
8568
|
+
const [selected, setSelected] = (0, import_react26.useState)(null);
|
|
8569
|
+
const initialFilters = (0, import_react26.useMemo)(
|
|
8570
|
+
() => [
|
|
8571
|
+
{
|
|
8572
|
+
key: "turma",
|
|
8573
|
+
label: "Turma",
|
|
8574
|
+
categories: [
|
|
8575
|
+
{
|
|
8576
|
+
key: "classIds",
|
|
8577
|
+
label: "Turma",
|
|
8578
|
+
selectedIds: [],
|
|
8579
|
+
itens: classes.map((c) => ({ id: c.id, name: c.name }))
|
|
8580
|
+
}
|
|
8581
|
+
]
|
|
8582
|
+
}
|
|
8583
|
+
],
|
|
8584
|
+
[classes]
|
|
8585
|
+
);
|
|
8586
|
+
const handleParamsChange = (0, import_react26.useCallback)(
|
|
8516
8587
|
(params) => {
|
|
8588
|
+
const classIds = Array.isArray(params.classIds) ? params.classIds : void 0;
|
|
8517
8589
|
setLoading(true);
|
|
8518
8590
|
fetchStudents({
|
|
8519
8591
|
page: params.page,
|
|
8520
8592
|
limit: params.limit,
|
|
8521
|
-
search: params.search?.trim() || void 0
|
|
8593
|
+
search: params.search?.trim() || void 0,
|
|
8594
|
+
classIds: classIds?.length ? classIds : void 0
|
|
8522
8595
|
}).then((result) => {
|
|
8523
8596
|
setStudents(result.data);
|
|
8524
8597
|
setTotal(result.total);
|
|
@@ -8529,7 +8602,7 @@ function SimulationsPage({ api, noSearchImage }) {
|
|
|
8529
8602
|
},
|
|
8530
8603
|
[fetchStudents]
|
|
8531
8604
|
);
|
|
8532
|
-
const columns = (0,
|
|
8605
|
+
const columns = (0, import_react26.useMemo)(
|
|
8533
8606
|
() => [
|
|
8534
8607
|
{
|
|
8535
8608
|
key: "name",
|
|
@@ -8581,7 +8654,9 @@ function SimulationsPage({ api, noSearchImage }) {
|
|
|
8581
8654
|
loading,
|
|
8582
8655
|
variant: "borderless",
|
|
8583
8656
|
enableSearch: true,
|
|
8657
|
+
enableFilters: true,
|
|
8584
8658
|
enablePagination: true,
|
|
8659
|
+
initialFilters,
|
|
8585
8660
|
rowKey: "userInstitutionId",
|
|
8586
8661
|
searchPlaceholder: "Buscar estudante",
|
|
8587
8662
|
onParamsChange: handleParamsChange,
|