mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
added generatedBy
This commit is contained in:
@@ -4,6 +4,7 @@ import { toast } from "sonner";
|
|||||||
|
|
||||||
import api from "@/utils/api.util";
|
import api from "@/utils/api.util";
|
||||||
import { useAdvertisements } from "@/contexts/AdminAdvertisementContext";
|
import { useAdvertisements } from "@/contexts/AdminAdvertisementContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -17,6 +18,7 @@ import { buildSelectionActions } from "../../config/advertisements/arc
|
|||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
import { useDateFormat } from "@/hooks/useDateFormat";
|
import { useDateFormat } from "@/hooks/useDateFormat";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedAdvertisementsTable() {
|
export default function ArchivedAdvertisementsTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -33,6 +35,7 @@ export default function ArchivedAdvertisementsTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { fmtDateTime } = useDateFormat();
|
const { fmtDateTime } = useDateFormat();
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
advertisements, attributes, pagination, setPagination, loading,
|
advertisements, attributes, pagination, setPagination, loading,
|
||||||
@@ -54,6 +57,7 @@ export default function ArchivedAdvertisementsTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedAdvertisements`,
|
filename: `${getTimestamp()}_ArchivedAdvertisements`,
|
||||||
sheetName: "Archived Advertisements",
|
sheetName: "Archived Advertisements",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useAssets } from "@/contexts/AdminAssetsContext";
|
import { useAssets } from "@/contexts/AdminAssetsContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,6 +15,7 @@ import { buildRowActions } from "../../config/assets/archive/row
|
|||||||
import { buildSelectionActions } from "../../config/assets/archive/selection.config";
|
import { buildSelectionActions } from "../../config/assets/archive/selection.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedAssetsTable() {
|
export default function ArchivedAssetsTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -30,6 +32,8 @@ export default function ArchivedAssetsTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
assets, attributes, pagination, setPagination, loading,
|
assets, attributes, pagination, setPagination, loading,
|
||||||
fetchArchivedAssets, restoreAsset, restoreAssets, fetchAssetFieldValues,
|
fetchArchivedAssets, restoreAsset, restoreAssets, fetchAssetFieldValues,
|
||||||
@@ -49,6 +53,7 @@ export default function ArchivedAssetsTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedAssets`,
|
filename: `${getTimestamp()}_ArchivedAssets`,
|
||||||
sheetName: "Archived Assets",
|
sheetName: "Archived Assets",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useMemo, useRef, useState } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useAssets } from "@/contexts/AdminAssetsContext";
|
import { useAssets } from "@/contexts/AdminAssetsContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -15,6 +16,7 @@ import { buildSelectionActions } from "../../config/assets/selection.config";
|
|||||||
import { buildRowActions } from "../../config/assets/rowActions.config";
|
import { buildRowActions } from "../../config/assets/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function AssetsTable() {
|
export default function AssetsTable() {
|
||||||
const [archiveTarget, setArchiveTarget] = useState(null);
|
const [archiveTarget, setArchiveTarget] = useState(null);
|
||||||
@@ -29,6 +31,8 @@ export default function AssetsTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
assets, attributes, pagination, setPagination, loading,
|
assets, attributes, pagination, setPagination, loading,
|
||||||
fetchAssets, archiveAsset, archiveAssets, fetchAssetFieldValues
|
fetchAssets, archiveAsset, archiveAssets, fetchAssetFieldValues
|
||||||
@@ -43,6 +47,7 @@ export default function AssetsTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_Assets`,
|
filename: `${getTimestamp()}_Assets`,
|
||||||
sheetName: "Assets",
|
sheetName: "Assets",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveViewPath = (row) => {
|
const resolveViewPath = (row) => {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { buildSelectionActions } from "../../config/courses/archive/selection.co
|
|||||||
import { buildRowActions } from "../../config/courses/archive/rowActions.config";
|
import { buildRowActions } from "../../config/courses/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedCoursesTable() {
|
export default function ArchivedCoursesTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -31,6 +32,8 @@ export default function ArchivedCoursesTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
courses, attributes, pagination, setPagination, loading, fetchArchivedCourses,
|
courses, attributes, pagination, setPagination, loading, fetchArchivedCourses,
|
||||||
restoreCourse, restoreCourses,
|
restoreCourse, restoreCourses,
|
||||||
@@ -46,6 +49,7 @@ export default function ArchivedCoursesTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedCourses`,
|
filename: `${getTimestamp()}_ArchivedCourses`,
|
||||||
sheetName: "Archived Courses",
|
sheetName: "Archived Courses",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = useMemo(() => buildRowActions({
|
const rowActions = useMemo(() => buildRowActions({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useEffect, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useCourses } from "@/contexts/AdminCoursesContext";
|
import { useCourses } from "@/contexts/AdminCoursesContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,6 +15,7 @@ import { buildSelectionActions } from "../../config/courses/lessons/archive/sele
|
|||||||
import { buildRowActions } from "../../config/courses/lessons/archive/rowActions.config";
|
import { buildRowActions } from "../../config/courses/lessons/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedLessonsTable({ courseId, unitId }) {
|
export default function ArchivedLessonsTable({ courseId, unitId }) {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -30,6 +32,8 @@ export default function ArchivedLessonsTable({ courseId, unitId }) {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
course, unit, lessons, attributes, pagination, setPagination, loading,
|
course, unit, lessons, attributes, pagination, setPagination, loading,
|
||||||
fetchArchivedLessons, restoreLesson, restoreLessons, fetchLessonFieldValues,
|
fetchArchivedLessons, restoreLesson, restoreLessons, fetchLessonFieldValues,
|
||||||
@@ -45,6 +49,7 @@ export default function ArchivedLessonsTable({ courseId, unitId }) {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_${course?.title}_${unit?.title}_Lessons`,
|
filename: `${getTimestamp()}_${course?.title}_${unit?.title}_Lessons`,
|
||||||
sheetName: "Archived Lessons",
|
sheetName: "Archived Lessons",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback(
|
const handleFetch = useCallback(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useCourses } from "@/contexts/AdminCoursesContext";
|
import { useCourses } from "@/contexts/AdminCoursesContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,6 +15,7 @@ import { buildSelectionActions } from "../../config/courses/units/archive/select
|
|||||||
import { buildRowActions } from "../../config/courses/units/archive/rowActions.config";
|
import { buildRowActions } from "../../config/courses/units/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedUnitsTable({ courseId }) {
|
export default function ArchivedUnitsTable({ courseId }) {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -30,6 +32,8 @@ export default function ArchivedUnitsTable({ courseId }) {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
course, units, attributes, pagination, setPagination, loading,
|
course, units, attributes, pagination, setPagination, loading,
|
||||||
fetchArchivedUnits, restoreUnit, restoreUnits, fetchUnitFieldValues,
|
fetchArchivedUnits, restoreUnit, restoreUnits, fetchUnitFieldValues,
|
||||||
@@ -45,6 +49,7 @@ export default function ArchivedUnitsTable({ courseId }) {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_${course?.title}_ArchivedUnits`,
|
filename: `${getTimestamp()}_${course?.title}_ArchivedUnits`,
|
||||||
sheetName: "Archived Units",
|
sheetName: "Archived Units",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback(
|
const handleFetch = useCallback(
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { buildSelectionActions } from "../../config/courses/selection.config";
|
|||||||
import { buildRowActions } from "../../config/courses/rowActions.config";
|
import { buildRowActions } from "../../config/courses/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function CoursesTable() {
|
export default function CoursesTable() {
|
||||||
const [archiveTarget, setArchiveTarget] = useState(null);
|
const [archiveTarget, setArchiveTarget] = useState(null);
|
||||||
@@ -29,6 +30,8 @@ export default function CoursesTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const { courses, attributes, pagination, setPagination, loading, fetchCourses, reorderCourses, archiveCourse, archiveCourses, fetchCourseFieldValues } = useCourses();
|
const { courses, attributes, pagination, setPagination, loading, fetchCourses, reorderCourses, archiveCourse, archiveCourses, fetchCourseFieldValues } = useCourses();
|
||||||
|
|
||||||
const handleRefsReady = (refs) => {
|
const handleRefsReady = (refs) => {
|
||||||
@@ -40,6 +43,7 @@ export default function CoursesTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_Courses`,
|
filename: `${getTimestamp()}_Courses`,
|
||||||
sheetName: "Courses",
|
sheetName: "Courses",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reorder — swaps this row with its neighbor in the currently displayed
|
// Reorder — swaps this row with its neighbor in the currently displayed
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useEffect, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useCourses } from "@/contexts/AdminCoursesContext";
|
import { useCourses } from "@/contexts/AdminCoursesContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import api from "@/utils/api.util";
|
import api from "@/utils/api.util";
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
@@ -16,6 +17,7 @@ import { buildSelectionActions } from "../../config/courses/lessons/selection.co
|
|||||||
import { buildRowActions } from "../../config/courses/lessons/rowActions.config";
|
import { buildRowActions } from "../../config/courses/lessons/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function LessonsTable({ courseId, unitId }) {
|
export default function LessonsTable({ courseId, unitId }) {
|
||||||
const [archiveTarget, setArchiveTarget] = useState(null);
|
const [archiveTarget, setArchiveTarget] = useState(null);
|
||||||
@@ -31,6 +33,8 @@ export default function LessonsTable({ courseId, unitId }) {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
course, unit, lessons, attributes, pagination, setPagination, loading,
|
course, unit, lessons, attributes, pagination, setPagination, loading,
|
||||||
fetchLessons, archiveLesson, archiveLessons, fetchLessonFieldValues
|
fetchLessons, archiveLesson, archiveLessons, fetchLessonFieldValues
|
||||||
@@ -45,6 +49,7 @@ export default function LessonsTable({ courseId, unitId }) {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_${course?.title}_${unit?.title}_Lessons`,
|
filename: `${getTimestamp()}_${course?.title}_${unit?.title}_Lessons`,
|
||||||
sheetName: "Lessons",
|
sheetName: "Lessons",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback(
|
const handleFetch = useCallback(
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { buildSelectionActions } from "../../config/courses/units/selection.conf
|
|||||||
import { buildRowActions } from "../../config/courses/units/rowActions.config";
|
import { buildRowActions } from "../../config/courses/units/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function UnitsTable({ courseId, returnTo }) {
|
export default function UnitsTable({ courseId, returnTo }) {
|
||||||
const [archiveTarget, setArchiveTarget] = useState(null);
|
const [archiveTarget, setArchiveTarget] = useState(null);
|
||||||
@@ -32,6 +33,8 @@ export default function UnitsTable({ courseId, returnTo }) {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
course, units, attributes, pagination, setPagination, loading,
|
course, units, attributes, pagination, setPagination, loading,
|
||||||
fetchUnits, archiveUnit, archiveUnits, fetchUnitFieldValues
|
fetchUnits, archiveUnit, archiveUnits, fetchUnitFieldValues
|
||||||
@@ -46,6 +49,7 @@ export default function UnitsTable({ courseId, returnTo }) {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_${course?.title}_Units`,
|
filename: `${getTimestamp()}_${course?.title}_Units`,
|
||||||
sheetName: "Units",
|
sheetName: "Units",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback(
|
const handleFetch = useCallback(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,6 +15,7 @@ import { buildArchivedSelectionActions } from "../../config/library/lessons/sele
|
|||||||
import { buildArchivedRowActions } from "../../config/library/lessons/rowActions.config";
|
import { buildArchivedRowActions } from "../../config/library/lessons/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedLessonLibraryTable() {
|
export default function ArchivedLessonLibraryTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -30,6 +32,8 @@ export default function ArchivedLessonLibraryTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
lessons, attributes, pagination, setPagination, loading,
|
lessons, attributes, pagination, setPagination, loading,
|
||||||
fetchArchivedLessons, restoreLesson, restoreLessons,
|
fetchArchivedLessons, restoreLesson, restoreLessons,
|
||||||
@@ -46,6 +50,7 @@ export default function ArchivedLessonLibraryTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedLessonLibrary`,
|
filename: `${getTimestamp()}_ArchivedLessonLibrary`,
|
||||||
sheetName: "Archived Lessons",
|
sheetName: "Archived Lessons",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback((params) => fetchArchivedLessons(params), [fetchArchivedLessons]);
|
const handleFetch = useCallback((params) => fetchArchivedLessons(params), [fetchArchivedLessons]);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,6 +15,7 @@ import { buildArchivedSelectionActions } from "../../config/library/units/select
|
|||||||
import { buildArchivedRowActions } from "../../config/library/units/rowActions.config";
|
import { buildArchivedRowActions } from "../../config/library/units/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedUnitLibraryTable() {
|
export default function ArchivedUnitLibraryTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -30,6 +32,8 @@ export default function ArchivedUnitLibraryTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
units, attributes, pagination, setPagination, loading,
|
units, attributes, pagination, setPagination, loading,
|
||||||
fetchArchivedUnits, restoreUnit, restoreUnits,
|
fetchArchivedUnits, restoreUnit, restoreUnits,
|
||||||
@@ -46,6 +50,7 @@ export default function ArchivedUnitLibraryTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedUnitLibrary`,
|
filename: `${getTimestamp()}_ArchivedUnitLibrary`,
|
||||||
sheetName: "Archived Units",
|
sheetName: "Archived Units",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback((params) => fetchArchivedUnits(params), [fetchArchivedUnits]);
|
const handleFetch = useCallback((params) => fetchArchivedUnits(params), [fetchArchivedUnits]);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -13,6 +14,7 @@ import { buildSelectionActions } from "../../config/library/lessons/selection.co
|
|||||||
import { buildRowActions } from "../../config/library/lessons/rowActions.config";
|
import { buildRowActions } from "../../config/library/lessons/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function LessonLibraryTable() {
|
export default function LessonLibraryTable() {
|
||||||
const [archiveTarget, setArchiveTarget] = useState(null);
|
const [archiveTarget, setArchiveTarget] = useState(null);
|
||||||
@@ -27,6 +29,8 @@ export default function LessonLibraryTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
lessons, attributes, pagination, setPagination, loading,
|
lessons, attributes, pagination, setPagination, loading,
|
||||||
fetchLessons, archiveLesson, archiveLessons,
|
fetchLessons, archiveLesson, archiveLessons,
|
||||||
@@ -42,6 +46,7 @@ export default function LessonLibraryTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_LessonLibrary`,
|
filename: `${getTimestamp()}_LessonLibrary`,
|
||||||
sheetName: "Lessons",
|
sheetName: "Lessons",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback((params) => fetchLessons(params), [fetchLessons]);
|
const handleFetch = useCallback((params) => fetchLessons(params), [fetchLessons]);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
import { useLibrary } from "@/contexts/AdminLibraryContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -13,6 +14,7 @@ import { buildSelectionActions } from "../../config/library/units/selection.conf
|
|||||||
import { buildRowActions } from "../../config/library/units/rowActions.config";
|
import { buildRowActions } from "../../config/library/units/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function UnitLibraryTable() {
|
export default function UnitLibraryTable() {
|
||||||
const [archiveTarget, setArchiveTarget] = useState(null);
|
const [archiveTarget, setArchiveTarget] = useState(null);
|
||||||
@@ -27,6 +29,8 @@ export default function UnitLibraryTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
units, attributes, pagination, setPagination, loading,
|
units, attributes, pagination, setPagination, loading,
|
||||||
fetchUnits, archiveUnit, archiveUnits,
|
fetchUnits, archiveUnit, archiveUnits,
|
||||||
@@ -42,6 +46,7 @@ export default function UnitLibraryTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_UnitLibrary`,
|
filename: `${getTimestamp()}_UnitLibrary`,
|
||||||
sheetName: "Units",
|
sheetName: "Units",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFetch = useCallback((params) => fetchUnits(params), [fetchUnits]);
|
const handleFetch = useCallback((params) => fetchUnits(params), [fetchUnits]);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useNotificationBroadcasts } from "@/contexts/AdminNotificationBroadcastContext";
|
import { useNotificationBroadcasts } from "@/contexts/AdminNotificationBroadcastContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,6 +15,7 @@ import { buildRowActions } from "../../config/notifications/arch
|
|||||||
import { buildSelectionActions } from "../../config/notifications/archive/selection.config";
|
import { buildSelectionActions } from "../../config/notifications/archive/selection.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedNotificationBroadcastsTable() {
|
export default function ArchivedNotificationBroadcastsTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null);
|
const [restoreTarget, setRestoreTarget] = useState(null);
|
||||||
@@ -30,6 +32,8 @@ export default function ArchivedNotificationBroadcastsTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
broadcasts, attributes, pagination, setPagination, loading,
|
broadcasts, attributes, pagination, setPagination, loading,
|
||||||
fetchArchivedBroadcasts, restoreBroadcast, restoreBroadcasts,
|
fetchArchivedBroadcasts, restoreBroadcast, restoreBroadcasts,
|
||||||
@@ -49,6 +53,7 @@ export default function ArchivedNotificationBroadcastsTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedNotificationBroadcasts`,
|
filename: `${getTimestamp()}_ArchivedNotificationBroadcasts`,
|
||||||
sheetName: "Archived Announcements",
|
sheetName: "Archived Announcements",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useAdminTask } from "@/contexts/AdminTaskContext";
|
import { useAdminTask } from "@/contexts/AdminTaskContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,10 +15,13 @@ import { buildSelectionActions } from "@/modules/admin/config/task_list/archive/
|
|||||||
import { buildRowActions } from "@/modules/admin/config/task_list/archive/rowActions.config";
|
import { buildRowActions } from "@/modules/admin/config/task_list/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchiveTaskListTable() {
|
export default function ArchiveTaskListTable() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
taskLists, attributes, pagination, loading,
|
taskLists, attributes, pagination, loading,
|
||||||
fetchArchivedTaskLists,
|
fetchArchivedTaskLists,
|
||||||
@@ -73,6 +77,7 @@ export default function ArchiveTaskListTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedTaskLists`,
|
filename: `${getTimestamp()}_ArchivedTaskLists`,
|
||||||
sheetName: "Archived Task Lists",
|
sheetName: "Archived Task Lists",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback, useEffect } from "react";
|
|||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
|
||||||
import { useAdminTask } from "@/contexts/AdminTaskContext";
|
import { useAdminTask } from "@/contexts/AdminTaskContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,6 +15,7 @@ import { buildSelectionActions } from "@/modules/admin/config/task_list/task/arc
|
|||||||
import { buildRowActions } from "@/modules/admin/config/task_list/task/archive/rowActions.config";
|
import { buildRowActions } from "@/modules/admin/config/task_list/task/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -30,6 +32,8 @@ export default function ArchivedTaskTable() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { taskListId } = useParams();
|
const { taskListId } = useParams();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
taskList, tasks, attributes, pagination, loading,
|
taskList, tasks, attributes, pagination, loading,
|
||||||
fetchTaskList, fetchArchivedTasks, fetchTaskFieldValues,
|
fetchTaskList, fetchArchivedTasks, fetchTaskFieldValues,
|
||||||
@@ -96,7 +100,8 @@ export default function ArchivedTaskTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedTasks`,
|
filename: `${getTimestamp()}_ArchivedTasks`,
|
||||||
sheetName: "Archived Tasks",
|
sheetName: "Archived Tasks",
|
||||||
}), [tasks, attributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [tasks, attributes, currentUser]);
|
||||||
|
|
||||||
const rowActions = useMemo(() => buildRowActions({
|
const rowActions = useMemo(() => buildRowActions({
|
||||||
navigate,
|
navigate,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useAdminTask } from "@/contexts/AdminTaskContext";
|
import { useAdminTask } from "@/contexts/AdminTaskContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,10 +15,13 @@ import { buildSelectionActions } from "../../config/task_list/selection.config";
|
|||||||
import { buildRowActions } from "../../config/task_list/rowActions.config";
|
import { buildRowActions } from "../../config/task_list/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function TaskListTable() {
|
export default function TaskListTable() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
taskLists, attributes, pagination, loading,
|
taskLists, attributes, pagination, loading,
|
||||||
fetchTaskLists, fetchArchivedTaskLists, fetchTaskListFieldValues,
|
fetchTaskLists, fetchArchivedTaskLists, fetchTaskListFieldValues,
|
||||||
@@ -77,7 +81,8 @@ export default function TaskListTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_TaskLists`,
|
filename: `${getTimestamp()}_TaskLists`,
|
||||||
sheetName: "Task Lists",
|
sheetName: "Task Lists",
|
||||||
}), [taskLists, attributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [taskLists, attributes, currentUser]);
|
||||||
|
|
||||||
// ── Row actions ───────────────────────────────────────────────────────────
|
// ── Row actions ───────────────────────────────────────────────────────────
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useTiers } from "@/contexts/AdminTiersContext";
|
import { useTiers } from "@/contexts/AdminTiersContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -14,10 +15,13 @@ import { buildSelectionActions } from "../../config/tiers/plans/archive/selectio
|
|||||||
import { buildRowActions } from "../../config/tiers/plans/archive/rowActions.config";
|
import { buildRowActions } from "../../config/tiers/plans/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchivedTierPlansTable() {
|
export default function ArchivedTierPlansTable() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
plans, planAttributes, planPagination, setPlanPagination,
|
plans, planAttributes, planPagination, setPlanPagination,
|
||||||
loading, fetchPlans, restorePlan, bulkRestorePlans,
|
loading, fetchPlans, restorePlan, bulkRestorePlans,
|
||||||
@@ -48,7 +52,8 @@ export default function ArchivedTierPlansTable() {
|
|||||||
attributes: planAttributes,
|
attributes: planAttributes,
|
||||||
filename: `${getTimestamp()}_ArchivedTierPlans`,
|
filename: `${getTimestamp()}_ArchivedTierPlans`,
|
||||||
sheetName: "Archived Tier Plans",
|
sheetName: "Archived Tier Plans",
|
||||||
}), [plans, planAttributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [plans, planAttributes, currentUser]);
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
navigate,
|
navigate,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useMemo, useRef, useCallback, useEffect, useState } from "react";
|
import { useMemo, useRef, useCallback, useEffect, useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useTiers } from "@/contexts/AdminTiersContext";
|
import { useTiers } from "@/contexts/AdminTiersContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
import { useDateFormat } from "@/hooks/useDateFormat";
|
import { useDateFormat } from "@/hooks/useDateFormat";
|
||||||
import api from "@/utils/api.util";
|
import api from "@/utils/api.util";
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
@@ -10,6 +11,7 @@ import { buildToolbarActions } from "../../config/tiers/payments/toolbar.config"
|
|||||||
import { buildSelectionActions } from "../../config/tiers/payments/selection.config";
|
import { buildSelectionActions } from "../../config/tiers/payments/selection.config";
|
||||||
import { buildRowActions } from "../../config/tiers/payments/rowActions.config";
|
import { buildRowActions } from "../../config/tiers/payments/rowActions.config";
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function PaymentsTable({ planId = null }) {
|
export default function PaymentsTable({ planId = null }) {
|
||||||
const tableRefsRef = useRef({
|
const tableRefsRef = useRef({
|
||||||
@@ -21,6 +23,7 @@ export default function PaymentsTable({ planId = null }) {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { fmtDateTime } = useDateFormat();
|
const { fmtDateTime } = useDateFormat();
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
payments, paymentAttributes,
|
payments, paymentAttributes,
|
||||||
@@ -40,6 +43,7 @@ export default function PaymentsTable({ planId = null }) {
|
|||||||
attributes: paymentAttributes,
|
attributes: paymentAttributes,
|
||||||
filename: `${getTimestamp()}_Payments`,
|
filename: `${getTimestamp()}_Payments`,
|
||||||
sheetName: "Payments",
|
sheetName: "Payments",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = useMemo(() => buildRowActions({
|
const rowActions = useMemo(() => buildRowActions({
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useNavigate, Link } from "react-router-dom";
|
|||||||
import { Layers } from "lucide-react";
|
import { Layers } from "lucide-react";
|
||||||
|
|
||||||
import { useTiers } from "@/contexts/AdminTiersContext";
|
import { useTiers } from "@/contexts/AdminTiersContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
import api from "@/utils/api.util";
|
import api from "@/utils/api.util";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
@@ -15,10 +16,13 @@ import { buildSelectionActions } from "../../config/tiers/plans/selection.config
|
|||||||
import { buildRowActions } from "../../config/tiers/plans/rowActions.config";
|
import { buildRowActions } from "../../config/tiers/plans/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function TierPlansTable() {
|
export default function TierPlansTable() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
plans, planAttributes, planPagination, setPlanPagination,
|
plans, planAttributes, planPagination, setPlanPagination,
|
||||||
loading, fetchPlans, deletePlan, bulkDeletePlans,
|
loading, fetchPlans, deletePlan, bulkDeletePlans,
|
||||||
@@ -64,7 +68,8 @@ export default function TierPlansTable() {
|
|||||||
attributes: planAttributes,
|
attributes: planAttributes,
|
||||||
filename: `${getTimestamp()}_TierPlans`,
|
filename: `${getTimestamp()}_TierPlans`,
|
||||||
sheetName: "Tier Plans",
|
sheetName: "Tier Plans",
|
||||||
}), [plans, planAttributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [plans, planAttributes, currentUser]);
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
navigate,
|
navigate,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useUserGroups } from "@/contexts/AdminUserGroupContext";
|
import { useUserGroups } from "@/contexts/AdminUserGroupContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
import { RestoreDialog } from "@/components/generic/Dialogs/RestoreDialog";
|
import { RestoreDialog } from "@/components/generic/Dialogs/RestoreDialog";
|
||||||
@@ -13,6 +14,7 @@ import { buildSelectionActions } from "../../config/user_groups/archive/selectio
|
|||||||
import { buildRowActions } from "../../config/user_groups/archive/rowActions.config";
|
import { buildRowActions } from "../../config/user_groups/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchiveGroupTable() {
|
export default function ArchiveGroupTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null); // single: row object
|
const [restoreTarget, setRestoreTarget] = useState(null); // single: row object
|
||||||
@@ -21,6 +23,7 @@ export default function ArchiveGroupTable() {
|
|||||||
const [deleteIds, setDeleteIds] = useState(null);
|
const [deleteIds, setDeleteIds] = useState(null);
|
||||||
const tableRefsRef = useRef({ getFilters: () => [], getSort: () => [], resetSelection: () => {} });
|
const tableRefsRef = useRef({ getFilters: () => [], getSort: () => [], resetSelection: () => {} });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
groups,
|
groups,
|
||||||
@@ -41,6 +44,7 @@ export default function ArchiveGroupTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedUserGroups`,
|
filename: `${getTimestamp()}_ArchivedUserGroups`,
|
||||||
sheetName: "ArchivedUserGroups",
|
sheetName: "ArchivedUserGroups",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useNavigate } from "react-router-dom";
|
|||||||
|
|
||||||
import { useUserGroups } from "@/contexts/AdminUserGroupContext";
|
import { useUserGroups } from "@/contexts/AdminUserGroupContext";
|
||||||
import { useDashboard } from "@/contexts/AdminDashboardContext";
|
import { useDashboard } from "@/contexts/AdminDashboardContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -20,6 +21,7 @@ import { buildRowActions } from "../../config/user_groups/rowActions.config";
|
|||||||
|
|
||||||
import { GROUP_STAT_MAP } from "@/data/adminDashboard.data";
|
import { GROUP_STAT_MAP } from "@/data/adminDashboard.data";
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function GroupTable() {
|
export default function GroupTable() {
|
||||||
const [createOpen, setCreateOpen] = useState(false);
|
const [createOpen, setCreateOpen] = useState(false);
|
||||||
@@ -36,6 +38,8 @@ export default function GroupTable() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
groups, attributes, pagination, setPagination, loading,
|
groups, attributes, pagination, setPagination, loading,
|
||||||
fetchGroups, fetchGroupFieldValues,
|
fetchGroups, fetchGroupFieldValues,
|
||||||
@@ -58,6 +62,7 @@ export default function GroupTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_UserGroups`,
|
filename: `${getTimestamp()}_UserGroups`,
|
||||||
sheetName: "UserGroups",
|
sheetName: "UserGroups",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useRef, useState } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useUsers } from "@/contexts/AdminUserContext";
|
import { useUsers } from "@/contexts/AdminUserContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
import { RestoreDialog } from "@/components/generic/Dialogs/RestoreDialog";
|
import { RestoreDialog } from "@/components/generic/Dialogs/RestoreDialog";
|
||||||
@@ -13,6 +14,7 @@ import { buildSelectionActions } from "../../config/users/archive/selection.conf
|
|||||||
import { buildRowActions } from "../../config/users/archive/rowActions.config";
|
import { buildRowActions } from "../../config/users/archive/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function ArchiveGroupTable() {
|
export default function ArchiveGroupTable() {
|
||||||
const [restoreTarget, setRestoreTarget] = useState(null); // single: row object
|
const [restoreTarget, setRestoreTarget] = useState(null); // single: row object
|
||||||
@@ -21,6 +23,7 @@ export default function ArchiveGroupTable() {
|
|||||||
const [deleteIds, setDeleteIds] = useState(null);
|
const [deleteIds, setDeleteIds] = useState(null);
|
||||||
const tableRefsRef = useRef({ getFilters: () => [], getSort: () => [], resetSelection: () => { } });
|
const tableRefsRef = useRef({ getFilters: () => [], getSort: () => [], resetSelection: () => { } });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
users,
|
users,
|
||||||
@@ -42,6 +45,7 @@ export default function ArchiveGroupTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_ArchivedUserGroups`,
|
filename: `${getTimestamp()}_ArchivedUserGroups`,
|
||||||
sheetName: "ArchivedUserGroups",
|
sheetName: "ArchivedUserGroups",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import { buildSelectionActions } from "../../config/users/selection.config";
|
|||||||
import { buildRowActions } from "../../config/users/rowActions.config";
|
import { buildRowActions } from "../../config/users/rowActions.config";
|
||||||
|
|
||||||
import { USER_STAT_MAP } from "@/data/adminDashboard.data";
|
import { USER_STAT_MAP } from "@/data/adminDashboard.data";
|
||||||
import { ROLE_CONFIG } from "@/data/profile.data";
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function UsersTable() {
|
export default function UsersTable() {
|
||||||
const [archiveTarget, setArchiveTarget] = useState(null);
|
const [archiveTarget, setArchiveTarget] = useState(null);
|
||||||
@@ -59,17 +59,13 @@ export default function UsersTable() {
|
|||||||
tableRefsRef.current = refs; // ← just store directly, no override needed
|
tableRefsRef.current = refs; // ← just store directly, no override needed
|
||||||
};
|
};
|
||||||
|
|
||||||
const generatedBy = currentUser
|
|
||||||
? `${currentUser.personal_info?.name?.full_name ?? currentUser.email} (${ROLE_CONFIG[currentUser.acc_type]?.label ?? currentUser.acc_type})`
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const exportConfig = {
|
const exportConfig = {
|
||||||
allData: users,
|
allData: users,
|
||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_Users`,
|
filename: `${getTimestamp()}_Users`,
|
||||||
sheetName: "Users",
|
sheetName: "Users",
|
||||||
title: "Users",
|
title: "Users",
|
||||||
generatedBy,
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { useAdminTask } from '@/contexts/AdminTaskContext';
|
import { useAdminTask } from '@/contexts/AdminTaskContext';
|
||||||
|
import { useAuth } from '@/contexts/AuthContext';
|
||||||
|
|
||||||
import DataTable from '@/components/generic/Table/DataTable';
|
import DataTable from '@/components/generic/Table/DataTable';
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -31,11 +32,14 @@ import { buildToolbarActions } from '@/modules/admin/config/task_list/task/toolb
|
|||||||
import { buildSelectionActions } from '@/modules/admin/config/task_list/task/selection.config';
|
import { buildSelectionActions } from '@/modules/admin/config/task_list/task/selection.config';
|
||||||
import { buildRowActions } from '@/modules/admin/config/task_list/task/rowActions.config';
|
import { buildRowActions } from '@/modules/admin/config/task_list/task/rowActions.config';
|
||||||
import { getTimestamp } from '@/utils/timestamp.util';
|
import { getTimestamp } from '@/utils/timestamp.util';
|
||||||
|
import { formatGeneratedBy } from '@/utils/generatedBy.util';
|
||||||
|
|
||||||
export default function Tasks() {
|
export default function Tasks() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { taskListId } = useParams();
|
const { taskListId } = useParams();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
taskList, tasks, attributes, pagination, loading,
|
taskList, tasks, attributes, pagination, loading,
|
||||||
fetchTaskList, fetchTasks, fetchArchivedTasks,
|
fetchTaskList, fetchTasks, fetchArchivedTasks,
|
||||||
@@ -94,7 +98,8 @@ export default function Tasks() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_Tasks`,
|
filename: `${getTimestamp()}_Tasks`,
|
||||||
sheetName: "Tasks",
|
sheetName: "Tasks",
|
||||||
}), [tasks, attributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [tasks, attributes, currentUser]);
|
||||||
|
|
||||||
// ── Reorder — swaps this row with its neighbor in the currently displayed
|
// ── Reorder — swaps this row with its neighbor in the currently displayed
|
||||||
// (unfiltered/default-sorted) list, then persists the new order_index set.
|
// (unfiltered/default-sorted) list, then persists the new order_index set.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { useAdminTask } from '@/contexts/AdminTaskContext';
|
import { useAdminTask } from '@/contexts/AdminTaskContext';
|
||||||
|
import { useAuth } from '@/contexts/AuthContext';
|
||||||
import { useDateFormat } from '@/hooks/useDateFormat';
|
import { useDateFormat } from '@/hooks/useDateFormat';
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
@@ -29,6 +30,7 @@ import {
|
|||||||
|
|
||||||
import { formatDate } from '@/utils/table.util';
|
import { formatDate } from '@/utils/table.util';
|
||||||
import { getTimestamp } from '@/utils/timestamp.util';
|
import { getTimestamp } from '@/utils/timestamp.util';
|
||||||
|
import { formatGeneratedBy } from '@/utils/generatedBy.util';
|
||||||
|
|
||||||
import { buildDataColumns, columnPinning } from '@/modules/admin/config/task_list/task_completion/columns.config';
|
import { buildDataColumns, columnPinning } from '@/modules/admin/config/task_list/task_completion/columns.config';
|
||||||
import { buildToolbarActions } from '@/modules/admin/config/task_list/task_completion/toolbar.config';
|
import { buildToolbarActions } from '@/modules/admin/config/task_list/task_completion/toolbar.config';
|
||||||
@@ -179,6 +181,7 @@ export default function ViewTask() {
|
|||||||
bulkArchiveCompletions, bulkRestoreCompletions,
|
bulkArchiveCompletions, bulkRestoreCompletions,
|
||||||
} = useAdminTask();
|
} = useAdminTask();
|
||||||
const { fmtDateTime } = useDateFormat();
|
const { fmtDateTime } = useDateFormat();
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState(
|
const [activeTab, setActiveTab] = useState(
|
||||||
searchParams.get('tab') === 'completions' ? 'completions' : 'overview'
|
searchParams.get('tab') === 'completions' ? 'completions' : 'overview'
|
||||||
@@ -256,7 +259,8 @@ export default function ViewTask() {
|
|||||||
attributes: completionAttributes,
|
attributes: completionAttributes,
|
||||||
filename: `${getTimestamp()}_Completions`,
|
filename: `${getTimestamp()}_Completions`,
|
||||||
sheetName: 'Completions',
|
sheetName: 'Completions',
|
||||||
}), [completions, completionAttributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [completions, completionAttributes, currentUser]);
|
||||||
|
|
||||||
const rowActions = buildCompletionRowActions({
|
const rowActions = buildCompletionRowActions({
|
||||||
navigate,
|
navigate,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { cn } from "@/lib/utils";
|
|||||||
|
|
||||||
import { useUserGroups } from "@/contexts/AdminUserGroupContext";
|
import { useUserGroups } from "@/contexts/AdminUserGroupContext";
|
||||||
import { useUsers } from "@/contexts/AdminUserContext";
|
import { useUsers } from "@/contexts/AdminUserContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
import { useDateFormat } from "@/hooks/useDateFormat";
|
import { useDateFormat } from "@/hooks/useDateFormat";
|
||||||
|
|
||||||
import { buildDataColumns, columnPinning } from "../../config/user_groups/view/columns.config";
|
import { buildDataColumns, columnPinning } from "../../config/user_groups/view/columns.config";
|
||||||
@@ -39,6 +40,7 @@ import { buildSelectionActions } from "../../config/user_groups/view/selection.c
|
|||||||
import { buildRowActions } from "../../config/user_groups/view/rowActions.config";
|
import { buildRowActions } from "../../config/user_groups/view/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
// ─── Invite Link Dialog ───────────────────────────────────────────────────────
|
// ─── Invite Link Dialog ───────────────────────────────────────────────────────
|
||||||
function InviteLinkDialog({ open, onOpenChange, group }) {
|
function InviteLinkDialog({ open, onOpenChange, group }) {
|
||||||
@@ -288,6 +290,8 @@ export default function ViewGroup() {
|
|||||||
const [assignTarget, setAssignTarget] = useState(null); // single row
|
const [assignTarget, setAssignTarget] = useState(null); // single row
|
||||||
const [assignIds, setAssignIds] = useState(null); // bulk ids[]
|
const [assignIds, setAssignIds] = useState(null); // bulk ids[]
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
group,
|
group,
|
||||||
groups,
|
groups,
|
||||||
@@ -327,6 +331,7 @@ export default function ViewGroup() {
|
|||||||
attributes: memberAttrs,
|
attributes: memberAttrs,
|
||||||
filename: `${getTimestamp()}_Group_${groupId}_Members`,
|
filename: `${getTimestamp()}_Group_${groupId}_Members`,
|
||||||
sheetName: "Members",
|
sheetName: "Members",
|
||||||
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { useMemo, useRef, useState, useCallback } from "react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { useStaffTasks } from "@/contexts/StaffTaskContext";
|
import { useStaffTasks } from "@/contexts/StaffTaskContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import DataTable from "@/components/generic/Table/DataTable";
|
import DataTable from "@/components/generic/Table/DataTable";
|
||||||
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
import { FilterSheet } from "@/components/generic/Sheet/FilterSheet";
|
||||||
@@ -20,10 +21,13 @@ import { buildSelectionActions } from "../config/task_list/selection.config";
|
|||||||
import { buildRowActions } from "../config/task_list/rowActions.config";
|
import { buildRowActions } from "../config/task_list/rowActions.config";
|
||||||
|
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
export default function TaskListTable() {
|
export default function TaskListTable() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
taskLists, attributes, pagination, setPagination, loading,
|
taskLists, attributes, pagination, setPagination, loading,
|
||||||
fetchTaskLists, fetchArchivedTaskLists, fetchTaskListFieldValues,
|
fetchTaskLists, fetchArchivedTaskLists, fetchTaskListFieldValues,
|
||||||
@@ -83,7 +87,8 @@ export default function TaskListTable() {
|
|||||||
attributes,
|
attributes,
|
||||||
filename: `${getTimestamp()}_TaskLists`,
|
filename: `${getTimestamp()}_TaskLists`,
|
||||||
sheetName: "Task Lists",
|
sheetName: "Task Lists",
|
||||||
}), [taskLists, attributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [taskLists, attributes, currentUser]);
|
||||||
|
|
||||||
// ── Row actions ───────────────────────────────────────────────────────────
|
// ── Row actions ───────────────────────────────────────────────────────────
|
||||||
const rowActions = buildRowActions({
|
const rowActions = buildRowActions({
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useMemo, useRef, useState, useCallback } from "react";
|
import { useMemo, useRef, useState, useCallback } from "react";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useStaffGroups } from "@/contexts/StaffGroupContext";
|
import { useStaffGroups } from "@/contexts/StaffGroupContext";
|
||||||
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
|
|
||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ import { buildRowActions } from "../../config/members/rowActions.config";
|
|||||||
|
|
||||||
import MemberDetailTabs from "../MemberDetailTabs";
|
import MemberDetailTabs from "../MemberDetailTabs";
|
||||||
import { getTimestamp } from "@/utils/timestamp.util";
|
import { getTimestamp } from "@/utils/timestamp.util";
|
||||||
|
import { formatGeneratedBy } from "@/utils/generatedBy.util";
|
||||||
|
|
||||||
// ── Helpers ───────────────────────────────────────────────────────────────────
|
// ── Helpers ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -43,6 +45,8 @@ export default function MembersTable() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { groupId } = useParams();
|
const { groupId } = useParams();
|
||||||
|
|
||||||
|
const { user: currentUser } = useAuth();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
members,
|
members,
|
||||||
memberAttributes,
|
memberAttributes,
|
||||||
@@ -82,7 +86,8 @@ export default function MembersTable() {
|
|||||||
attributes: memberAttributes,
|
attributes: memberAttributes,
|
||||||
filename: `${getTimestamp()}_GroupMembers`,
|
filename: `${getTimestamp()}_GroupMembers`,
|
||||||
sheetName: "Members",
|
sheetName: "Members",
|
||||||
}), [members, memberAttributes]);
|
generatedBy: formatGeneratedBy(currentUser),
|
||||||
|
}), [members, memberAttributes, currentUser]);
|
||||||
|
|
||||||
// ── Row actions ─────────────────────────────────────────────────────────────
|
// ── Row actions ─────────────────────────────────────────────────────────────
|
||||||
const rowActions = useMemo(() => buildRowActions({
|
const rowActions = useMemo(() => buildRowActions({
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// ─── utils/generatedBy.util.js ─────────────────────────────────────────────
|
||||||
|
import { ROLE_CONFIG } from "@/data/profile.data";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats the "Generated by" footer label for excel.util.js exports from an
|
||||||
|
* AuthContext user. Returns undefined (footer line omitted) if no user.
|
||||||
|
*
|
||||||
|
* @param {Object|null} user AuthContext `user`
|
||||||
|
* @returns {string|undefined} e.g. "Kenneth Obsequio (Administrator)"
|
||||||
|
*/
|
||||||
|
export function formatGeneratedBy(user) {
|
||||||
|
if (!user) return undefined;
|
||||||
|
return `${user.personal_info?.name?.full_name ?? user.email} (${ROLE_CONFIG[user.acc_type]?.label ?? user.acc_type})`;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user