@tumaet/prompt-ui-components 0.0.3 → 0.0.4
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/components/DatePicker.js +18 -0
- package/dist/components/DatePicker.js.map +1 -0
- package/dist/components/DateRangePicker.js +12 -0
- package/dist/components/DateRangePicker.js.map +1 -0
- package/dist/components/DeleteConfirmationDialog.js +13 -0
- package/dist/components/DeleteConfirmationDialog.js.map +1 -0
- package/dist/components/ErrorPage.js +9 -0
- package/dist/components/ErrorPage.js.map +1 -0
- package/dist/components/ExportedApplicationAnswerTable.js +16 -0
- package/dist/components/ExportedApplicationAnswerTable.js.map +1 -0
- package/dist/components/LoadingPage.js +6 -0
- package/dist/components/LoadingPage.js.map +1 -0
- package/dist/components/ManagementPageHeader.js +5 -0
- package/dist/components/ManagementPageHeader.js.map +1 -0
- package/dist/components/MissingConfig.js +12 -0
- package/dist/components/MissingConfig.js.map +1 -0
- package/dist/components/MultiSelect.js +96 -0
- package/dist/components/MultiSelect.js.map +1 -0
- package/dist/components/SaveChangesAlert.js +31 -0
- package/dist/components/SaveChangesAlert.js.map +1 -0
- package/dist/components/StudentProfile.js +14 -0
- package/dist/components/StudentProfile.js.map +1 -0
- package/dist/components/ThemeToggle.js +10 -0
- package/dist/components/ThemeToggle.js.map +1 -0
- package/dist/components/UnauthorizedPage.js +13 -0
- package/dist/components/UnauthorizedPage.js.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js +65 -0
- package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js.map +1 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-block.js +38 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-block.js.map +1 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js +12 -0
- package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js.map +1 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-block.js +34 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-block.js.map +1 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-popover.js +38 -0
- package/dist/components/minimal-tiptap/components/link/link-edit-popover.js.map +1 -0
- package/dist/components/minimal-tiptap/components/link/link-popover-block.js +28 -0
- package/dist/components/minimal-tiptap/components/link/link-popover-block.js.map +1 -0
- package/dist/components/minimal-tiptap/components/measured-container.js +16 -0
- package/dist/components/minimal-tiptap/components/measured-container.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/five.js +39 -0
- package/dist/components/minimal-tiptap/components/section/five.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/four.js +29 -0
- package/dist/components/minimal-tiptap/components/section/four.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js +23 -0
- package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/one.js +77 -0
- package/dist/components/minimal-tiptap/components/section/one.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/three.js +79 -0
- package/dist/components/minimal-tiptap/components/section/three.js.map +1 -0
- package/dist/components/minimal-tiptap/components/section/two.js +65 -0
- package/dist/components/minimal-tiptap/components/section/two.js.map +1 -0
- package/dist/components/minimal-tiptap/components/shortcut-key.js +11 -0
- package/dist/components/minimal-tiptap/components/shortcut-key.js.map +1 -0
- package/dist/components/minimal-tiptap/components/spinner.js +9 -0
- package/dist/components/minimal-tiptap/components/spinner.js.map +1 -0
- package/dist/components/minimal-tiptap/components/toolbar-button.js +15 -0
- package/dist/components/minimal-tiptap/components/toolbar-button.js.map +1 -0
- package/dist/components/minimal-tiptap/components/toolbar-section.js +27 -0
- package/dist/components/minimal-tiptap/components/toolbar-section.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js +16 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/color/color.js +20 -0
- package/dist/components/minimal-tiptap/extensions/color/color.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/color/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/color/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/file-handler/index.js +74 -0
- package/dist/components/minimal-tiptap/extensions/file-handler/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js +16 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js +39 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js +9 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js +167 -0
- package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js +11 -0
- package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js +88 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js +32 -0
- package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/image.js +225 -0
- package/dist/components/minimal-tiptap/extensions/image/image.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/image/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/image/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/index.js +10 -0
- package/dist/components/minimal-tiptap/extensions/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/link/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/link/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/link/link.js +74 -0
- package/dist/components/minimal-tiptap/extensions/link/link.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js +20 -0
- package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/selection/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/selection/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/selection/selection.js +31 -0
- package/dist/components/minimal-tiptap/extensions/selection/selection.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js +2 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js.map +1 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js +9 -0
- package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js.map +1 -0
- package/dist/components/minimal-tiptap/form-description-tiptap.js +26 -0
- package/dist/components/minimal-tiptap/form-description-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-container-size.js +44 -0
- package/dist/components/minimal-tiptap/hooks/use-container-size.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js +160 -0
- package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-theme.js +19 -0
- package/dist/components/minimal-tiptap/hooks/use-theme.js.map +1 -0
- package/dist/components/minimal-tiptap/hooks/use-throttle.js +24 -0
- package/dist/components/minimal-tiptap/hooks/use-throttle.js.map +1 -0
- package/dist/components/minimal-tiptap/index.js +2 -0
- package/dist/components/minimal-tiptap/index.js.map +1 -0
- package/dist/components/minimal-tiptap/mailing-tiptap.js +30 -0
- package/dist/components/minimal-tiptap/mailing-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/minimal-tiptap.js +29 -0
- package/dist/components/minimal-tiptap/minimal-tiptap.js.map +1 -0
- package/dist/components/minimal-tiptap/types.js +2 -0
- package/dist/components/minimal-tiptap/types.js.map +1 -0
- package/dist/components/minimal-tiptap/utils.js +156 -0
- package/dist/components/minimal-tiptap/utils.js.map +1 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/CoursePhaseParticipationsTablePage.js +71 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/CoursePhaseParticipationsTablePage.js.map +1 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/components/FilterMenu.js +43 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/components/FilterMenu.js.map +1 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/components/GroupActionsMenu.js +50 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/components/GroupActionsMenu.js.map +1 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/components/columns.js +84 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/components/columns.js.map +1 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/interfaces/ExtraParticipationTableData.js +2 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/interfaces/ExtraParticipationTableData.js.map +1 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/utils/downloadParticipations.js +70 -0
- package/dist/components/pages/CoursePhaseParticpationsTable/utils/downloadParticipations.js.map +1 -0
- package/dist/components/pages/Mailing/CoursePhaseMailing.js +88 -0
- package/dist/components/pages/Mailing/CoursePhaseMailing.js.map +1 -0
- package/dist/components/pages/Mailing/components/AvailableMailPlaceholders.js +61 -0
- package/dist/components/pages/Mailing/components/AvailableMailPlaceholders.js.map +1 -0
- package/dist/components/pages/Mailing/components/ConfirmSendEmailDialog.js +35 -0
- package/dist/components/pages/Mailing/components/ConfirmSendEmailDialog.js.map +1 -0
- package/dist/components/pages/Mailing/components/MailingEditor.js +29 -0
- package/dist/components/pages/Mailing/components/MailingEditor.js.map +1 -0
- package/dist/components/pages/Mailing/components/ManualMailSending.js +35 -0
- package/dist/components/pages/Mailing/components/ManualMailSending.js.map +1 -0
- package/dist/components/pages/Mailing/components/SettingsCard.js +14 -0
- package/dist/components/pages/Mailing/components/SettingsCard.js.map +1 -0
- package/dist/components/table/GroupActionDialog.js +8 -0
- package/dist/components/table/GroupActionDialog.js.map +1 -0
- package/dist/components/table/SortableHeader.js +7 -0
- package/dist/components/table/SortableHeader.js.map +1 -0
- package/dist/index.css +2 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/components/DatePicker.d.ts +6 -0
- package/dist/types/components/DateRangePicker.d.ts +8 -0
- package/dist/types/components/DeleteConfirmationDialog.d.ts +9 -0
- package/dist/types/components/ErrorPage.d.ts +9 -0
- package/dist/types/components/ExportedApplicationAnswerTable.d.ts +6 -0
- package/dist/types/components/LoadingPage.d.ts +1 -0
- package/dist/types/components/ManagementPageHeader.d.ts +5 -0
- package/dist/types/components/MissingConfig.d.ts +13 -0
- package/dist/types/components/MultiSelect.d.ts +68 -0
- package/dist/types/components/SaveChangesAlert.d.ts +8 -0
- package/dist/types/components/StudentProfile.d.ts +7 -0
- package/dist/types/components/ThemeToggle.d.ts +1 -0
- package/dist/types/components/UnauthorizedPage.d.ts +7 -0
- package/dist/types/components/index.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.d.ts +7 -0
- package/dist/types/components/minimal-tiptap/components/image/image-edit-block.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/image/image-edit-dialog.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/link/link-edit-block.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/components/link/link-edit-popover.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/link/link-popover-block.d.ts +8 -0
- package/dist/types/components/minimal-tiptap/components/measured-container.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/components/section/five.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/components/section/four.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/components/section/mailingPlaceholders.d.ts +10 -0
- package/dist/types/components/minimal-tiptap/components/section/one.d.ts +11 -0
- package/dist/types/components/minimal-tiptap/components/section/three.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/components/section/two.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/components/shortcut-key.d.ts +5 -0
- package/dist/types/components/minimal-tiptap/components/spinner.d.ts +5 -0
- package/dist/types/components/minimal-tiptap/components/toolbar-button.d.ts +10 -0
- package/dist/types/components/minimal-tiptap/components/toolbar-section.d.ts +16 -0
- package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/color/color.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/color/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/file-handler/index.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-actions.d.ts +17 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-overlay.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/image-view-block.d.ts +3 -0
- package/dist/types/components/minimal-tiptap/extensions/image/components/resize-handle.d.ts +6 -0
- package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.d.ts +24 -0
- package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-image-actions.d.ts +24 -0
- package/dist/types/components/minimal-tiptap/extensions/image/image.d.ts +52 -0
- package/dist/types/components/minimal-tiptap/extensions/image/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/index.d.ts +9 -0
- package/dist/types/components/minimal-tiptap/extensions/link/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/link/link.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/extensions/selection/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/selection/selection.d.ts +3 -0
- package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/form-description-tiptap.d.ts +4 -0
- package/dist/types/components/minimal-tiptap/hooks/use-container-size.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/hooks/use-minimal-tiptap.d.ts +13 -0
- package/dist/types/components/minimal-tiptap/hooks/use-theme.d.ts +2 -0
- package/dist/types/components/minimal-tiptap/hooks/use-throttle.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/index.d.ts +1 -0
- package/dist/types/components/minimal-tiptap/mailing-tiptap.d.ts +13 -0
- package/dist/types/components/minimal-tiptap/minimal-tiptap.d.ts +12 -0
- package/dist/types/components/minimal-tiptap/types.d.ts +25 -0
- package/dist/types/components/minimal-tiptap/utils.d.ts +38 -0
- package/dist/types/components/pages/CoursePhaseParticpationsTable/CoursePhaseParticipationsTablePage.d.ts +13 -0
- package/dist/types/components/pages/CoursePhaseParticpationsTable/components/FilterMenu.d.ts +7 -0
- package/dist/types/components/pages/CoursePhaseParticpationsTable/components/GroupActionsMenu.d.ts +10 -0
- package/dist/types/components/pages/CoursePhaseParticpationsTable/components/columns.d.ts +9 -0
- package/dist/types/components/pages/CoursePhaseParticpationsTable/interfaces/ExtraParticipationTableData.d.ts +5 -0
- package/dist/types/components/pages/CoursePhaseParticpationsTable/utils/downloadParticipations.d.ts +3 -0
- package/dist/types/components/pages/Mailing/CoursePhaseMailing.d.ts +6 -0
- package/dist/types/components/pages/Mailing/components/AvailableMailPlaceholders.d.ts +12 -0
- package/dist/types/components/pages/Mailing/components/ConfirmSendEmailDialog.d.ts +8 -0
- package/dist/types/components/pages/Mailing/components/MailingEditor.d.ts +12 -0
- package/dist/types/components/pages/Mailing/components/ManualMailSending.d.ts +7 -0
- package/dist/types/components/pages/Mailing/components/SettingsCard.d.ts +7 -0
- package/dist/types/components/table/GroupActionDialog.d.ts +11 -0
- package/dist/types/components/table/SortableHeader.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +22 -1
- package/src/index.css +1 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu';
|
|
5
|
+
import { MoreHorizontal, FileDown, CheckCircle, XCircle } from 'lucide-react';
|
|
6
|
+
import { ActionDialog } from '@/components/table/GroupActionDialog';
|
|
7
|
+
import { PassStatus } from '@tumaet/prompt-shared-state';
|
|
8
|
+
import { useUpdateCoursePhaseParticipationBatch } from '@/hooks/useUpdateCoursePhaseParticipationBatch';
|
|
9
|
+
import { useParams } from 'react-router-dom';
|
|
10
|
+
export const GroupActionsMenu = ({ selectedRows, onClose, onExport, disabled = false, }) => {
|
|
11
|
+
const { phaseId } = useParams();
|
|
12
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
13
|
+
const [dialogState, setDialogState] = useState({ type: null, isOpen: false });
|
|
14
|
+
const openDialog = (type) => {
|
|
15
|
+
setIsOpen(false);
|
|
16
|
+
setDialogState({ type, isOpen: true });
|
|
17
|
+
};
|
|
18
|
+
const closeDialog = () => setDialogState({ type: null, isOpen: false });
|
|
19
|
+
// modifiers
|
|
20
|
+
const { mutate: mutateUpdateCoursePhaseParticipations } = useUpdateCoursePhaseParticipationBatch();
|
|
21
|
+
const numberOfRowsSelected = selectedRows.rows.length;
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { open: isOpen, onOpenChange: setIsOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { disabled: disabled, children: [_jsx(MoreHorizontal, { className: 'h-4 w-4' }), "Actions"] }) }), _jsxs(DropdownMenuContent, { align: 'end', className: 'w-48', children: [_jsx(DropdownMenuLabel, { children: "Group Actions" }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: () => openDialog('setPassed'), children: [_jsx(CheckCircle, { className: 'mr-2 h-4 w-4' }), "Set Passed"] }), _jsxs(DropdownMenuItem, { onClick: () => openDialog('setFailed'), children: [_jsx(XCircle, { className: 'mr-2 h-4 w-4' }), "Set Failed"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: onExport, children: [_jsx(FileDown, { className: 'mr-2 h-4 w-4' }), "Export"] })] })] }), dialogState.isOpen && dialogState.type === 'setPassed' && (_jsx(ActionDialog, { title: 'Confirm Set Passed', description: `Are you sure you want to mark ${numberOfRowsSelected} participants as passed?`, confirmLabel: 'Set Passed', isOpen: dialogState.type === 'setPassed' && dialogState.isOpen, onClose: closeDialog, onConfirm: () => {
|
|
23
|
+
const mutations = selectedRows.rows.map((row) => {
|
|
24
|
+
const update = {
|
|
25
|
+
coursePhaseID: phaseId ?? '',
|
|
26
|
+
courseParticipationID: row.original.courseParticipationID,
|
|
27
|
+
passStatus: PassStatus.PASSED,
|
|
28
|
+
restrictedData: {},
|
|
29
|
+
studentReadableData: {},
|
|
30
|
+
};
|
|
31
|
+
return update;
|
|
32
|
+
});
|
|
33
|
+
mutateUpdateCoursePhaseParticipations(mutations);
|
|
34
|
+
onClose();
|
|
35
|
+
} })), dialogState.isOpen && dialogState.type === 'setFailed' && (_jsx(ActionDialog, { title: 'Confirm Set Failed', description: `Are you sure you want to mark ${numberOfRowsSelected} participants as failed?`, confirmLabel: 'Set Failed', isOpen: dialogState.type === 'setFailed' && dialogState.isOpen, onClose: closeDialog, onConfirm: () => {
|
|
36
|
+
const mutations = selectedRows.rows.map((row) => {
|
|
37
|
+
const update = {
|
|
38
|
+
coursePhaseID: phaseId ?? '',
|
|
39
|
+
courseParticipationID: row.original.courseParticipationID,
|
|
40
|
+
passStatus: PassStatus.FAILED,
|
|
41
|
+
restrictedData: {},
|
|
42
|
+
studentReadableData: {},
|
|
43
|
+
};
|
|
44
|
+
return update;
|
|
45
|
+
});
|
|
46
|
+
mutateUpdateCoursePhaseParticipations(mutations);
|
|
47
|
+
onClose();
|
|
48
|
+
} }))] }));
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=GroupActionsMenu.js.map
|
package/dist/components/pages/CoursePhaseParticpationsTable/components/GroupActionsMenu.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupActionsMenu.js","sourceRoot":"","sources":["../../../../../src/components/pages/CoursePhaseParticpationsTable/components/GroupActionsMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC7E,OAAO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CAAqC,CAAC,SAAS,CAAC,CAAA;oBAChD,OAAO,EAAE,CAAA;gBACX,CAAC,GACD,CACH,EAEA,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,IAAI,KAAK,WAAW,IAAI,CACzD,KAAC,YAAY,IACX,KAAK,EAAC,oBAAoB,EAC1B,WAAW,EAAE,iCAAiC,oBAAoB,0BAA0B,EAC5F,YAAY,EAAC,YAAY,EACzB,MAAM,EAAE,WAAW,CAAC,IAAI,KAAK,WAAW,IAAI,WAAW,CAAC,MAAM,EAC9D,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,GAAG,EAAE;oBACd,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC9C,MAAM,MAAM,GAAmC;4BAC7C,aAAa,EAAE,OAAO,IAAI,EAAE;4BAC5B,qBAAqB,EAAE,GAAG,CAAC,QAAQ,CAAC,qBAAqB;4BACzD,UAAU,EAAE,UAAU,CAAC,MAAM;4BAC7B,cAAc,EAAE,EAAE;4BAClB,mBAAmB,EAAE,EAAE;yBACxB,CAAA;wBACD,OAAO,MAAM,CAAA;oBACf,CAAC,CAAC,CAAA;oBACF,qCAAqC,CAAC,SAAS,CAAC,CAAA;oBAChD,OAAO,EAAE,CAAA;gBACX,CAAC,GACD,CACH,IACA,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import translations from '@/lib/translations.json';
|
|
3
|
+
import { SortableHeader } from '@/components/table/SortableHeader';
|
|
4
|
+
import { getStatusBadge } from '@/utils/getStatusBadge';
|
|
5
|
+
import { Checkbox } from '@/components/ui/checkbox';
|
|
6
|
+
export const columns = ({ prevDataKeys, restrictedDataKeys, studentReadableDataKeys, }) => {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
id: 'select',
|
|
10
|
+
header: ({ table }) => (_jsx(Checkbox, { checked: table.getIsAllPageRowsSelected() ||
|
|
11
|
+
(table.getIsSomePageRowsSelected() && 'indeterminate'), onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value), "aria-label": 'Select all' })),
|
|
12
|
+
cell: ({ row }) => (_jsx(Checkbox, { checked: row.getIsSelected(), onClick: (event) => {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
row.toggleSelected();
|
|
15
|
+
}, "aria-label": 'Select row' })),
|
|
16
|
+
enableSorting: false,
|
|
17
|
+
enableHiding: false,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'firstName', // required for filter bar
|
|
21
|
+
accessorKey: 'student.firstName',
|
|
22
|
+
header: ({ column }) => _jsx(SortableHeader, { column: column, title: 'First Name' }),
|
|
23
|
+
sortingFn: (rowA, rowB) => {
|
|
24
|
+
const valueA = rowA.original.student.firstName.toLowerCase() || '';
|
|
25
|
+
const valueB = rowB.original.student.firstName.toLowerCase() || '';
|
|
26
|
+
return valueA.localeCompare(valueB);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'lastName',
|
|
31
|
+
accessorKey: 'student.lastName',
|
|
32
|
+
header: ({ column }) => _jsx(SortableHeader, { column: column, title: 'Last Name' }),
|
|
33
|
+
sortingFn: (rowA, rowB) => {
|
|
34
|
+
const valueA = rowA.original.student.lastName.toLowerCase() || '';
|
|
35
|
+
const valueB = rowB.original.student.lastName.toLowerCase() || '';
|
|
36
|
+
return valueA.localeCompare(valueB);
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'passStatus',
|
|
41
|
+
accessorKey: 'passStatus',
|
|
42
|
+
header: ({ column }) => _jsx(SortableHeader, { column: column, title: 'Status' }),
|
|
43
|
+
cell: ({ row }) => {
|
|
44
|
+
const passStatus = row.original.passStatus;
|
|
45
|
+
return getStatusBadge(passStatus);
|
|
46
|
+
},
|
|
47
|
+
sortingFn: (rowA, rowB) => {
|
|
48
|
+
const statusOrder = ['passed', 'not_assessed', 'failed'];
|
|
49
|
+
const statusA = rowA.original.passStatus;
|
|
50
|
+
const statusB = rowB.original.passStatus;
|
|
51
|
+
return statusOrder.indexOf(statusA) - statusOrder.indexOf(statusB);
|
|
52
|
+
},
|
|
53
|
+
filterFn: (row, columnId, filterValue) => {
|
|
54
|
+
return filterValue.includes(row.original.passStatus);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'matriculationNumber',
|
|
59
|
+
accessorKey: 'student.matriculationNumber',
|
|
60
|
+
header: ({ column }) => _jsx(SortableHeader, { column: column, title: 'Mat Number' }),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: `universityLogin`,
|
|
64
|
+
accessorKey: 'student.universityLogin',
|
|
65
|
+
header: ({ column }) => (_jsx(SortableHeader, { column: column, title: translations.university['login-name'] })),
|
|
66
|
+
},
|
|
67
|
+
...prevDataKeys.map((key) => ({
|
|
68
|
+
id: key,
|
|
69
|
+
accessorKey: `prevData.${key}`,
|
|
70
|
+
header: ({ column }) => _jsx(SortableHeader, { column: column, title: key }),
|
|
71
|
+
})),
|
|
72
|
+
...restrictedDataKeys.map((key) => ({
|
|
73
|
+
id: key,
|
|
74
|
+
accessorKey: `restrictedData.${key}`,
|
|
75
|
+
header: ({ column }) => _jsx(SortableHeader, { column: column, title: key }),
|
|
76
|
+
})),
|
|
77
|
+
...studentReadableDataKeys.map((key) => ({
|
|
78
|
+
id: key,
|
|
79
|
+
accessorKey: `studentReadableData.${key}`,
|
|
80
|
+
header: ({ column }) => _jsx(SortableHeader, { column: column, title: key }),
|
|
81
|
+
})),
|
|
82
|
+
];
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=columns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columns.js","sourceRoot":"","sources":["../../../../../src/components/pages/CoursePhaseParticpationsTable/components/columns.tsx"],"names":[],"mappings":";AACA,OA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EAAE,kBAAkB,GAAG,EAAE;YACpC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAI;SACvE,CAAC,CAAC;QACH,GAAG,uBAAuB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACvC,EAAE,EAAE,GAAG;YACP,WAAW,EAAE,uBAAuB,GAAG,EAAE;YACzC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAI;SACvE,CAAC,CAAC;KACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtraParticipationTableData.js","sourceRoot":"","sources":["../../../../../src/components/pages/CoursePhaseParticpationsTable/interfaces/ExtraParticipationTableData.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { saveAs } from 'file-saver';
|
|
2
|
+
export const downloadParticipations = (data, prevDataKeys, restrictedDataKeys, studentReadableDataKeys, extraData = [], extraColumnHeader, filename = 'participation-export.csv') => {
|
|
3
|
+
if (!data || data.length === 0) {
|
|
4
|
+
console.error('No data available to download.');
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const csvHeaders = [
|
|
8
|
+
'firstName',
|
|
9
|
+
'lastName',
|
|
10
|
+
'email',
|
|
11
|
+
'matriculationNumber',
|
|
12
|
+
'universityLogin',
|
|
13
|
+
'hasUniversityAccount',
|
|
14
|
+
'courseParticipationID',
|
|
15
|
+
'gender',
|
|
16
|
+
'passStatus',
|
|
17
|
+
...prevDataKeys,
|
|
18
|
+
...restrictedDataKeys,
|
|
19
|
+
...studentReadableDataKeys,
|
|
20
|
+
];
|
|
21
|
+
if (extraColumnHeader !== undefined) {
|
|
22
|
+
csvHeaders.push(extraColumnHeader ?? '');
|
|
23
|
+
}
|
|
24
|
+
const csvRows = data.map((row) => {
|
|
25
|
+
// Extract student data
|
|
26
|
+
const student = row.student || {};
|
|
27
|
+
// Create a row with the required headers
|
|
28
|
+
return csvHeaders
|
|
29
|
+
.map((header) => {
|
|
30
|
+
if (header in student) {
|
|
31
|
+
// Fetch data from the `student` object
|
|
32
|
+
return JSON.stringify(student[header] ?? '');
|
|
33
|
+
}
|
|
34
|
+
else if (header === 'passStatus') {
|
|
35
|
+
// Fetch data from the main `ApplicationParticipation` object
|
|
36
|
+
return JSON.stringify(row.passStatus ?? '');
|
|
37
|
+
}
|
|
38
|
+
else if (prevDataKeys.includes(header)) {
|
|
39
|
+
// Fetch additional scores from the `meta_data` object
|
|
40
|
+
return JSON.stringify(row.prevData[header] ?? '');
|
|
41
|
+
}
|
|
42
|
+
else if (restrictedDataKeys.includes(header)) {
|
|
43
|
+
// Fetch additional scores from the `meta_data` object
|
|
44
|
+
return JSON.stringify(row.restrictedData[header] ?? '');
|
|
45
|
+
}
|
|
46
|
+
else if (studentReadableDataKeys.includes(header)) {
|
|
47
|
+
// Fetch additional scores from the `meta_data` object
|
|
48
|
+
return JSON.stringify(row.studentReadableData[header] ?? '');
|
|
49
|
+
}
|
|
50
|
+
else if (header === extraColumnHeader) {
|
|
51
|
+
// Fetch additional scores from the `meta_data` object
|
|
52
|
+
const extraDataItem = extraData.find((item) => item.courseParticipationID === row.courseParticipationID);
|
|
53
|
+
return JSON.stringify(extraDataItem?.stringValue ?? '');
|
|
54
|
+
}
|
|
55
|
+
else if (header === 'courseParticipationID') {
|
|
56
|
+
// Fetch data from the main `ApplicationParticipation` object
|
|
57
|
+
return JSON.stringify(row.courseParticipationID ?? '');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return JSON.stringify('');
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
.join(';');
|
|
64
|
+
});
|
|
65
|
+
const stringifiedHeaders = csvHeaders.map((header) => JSON.stringify(header));
|
|
66
|
+
const csvContent = [stringifiedHeaders.join(';'), ...csvRows].join('\n');
|
|
67
|
+
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
68
|
+
saveAs(blob, filename);
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=downloadParticipations.js.map
|
package/dist/components/pages/CoursePhaseParticpationsTable/utils/downloadParticipations.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadParticipations.js","sourceRoot":"","sources":["../../../../../src/components/pages/CoursePhaseParticpationsTable/utils/downloadParticipations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGnC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,IAA2C,EAC3C,YAAsB,EACtB,kBAA4B,EAC5B,uBAAiC,EACjC,YAA2C,EAAE,EAC7C,iBAAqC,EACrC,QAAQ,GAAG,0BAA0B,EACrC,EAAE;IACF,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAC/C,OAAM;IACR,CAAC;IAED,MAAM,UAAU,GAAG;QACjB,WAAW;QACX,UAAU;QACV,OAAO;QACP,qBAAqB;QACrB,iBAAiB;QACjB,sBAAsB;QACtB,uBAAuB;QACvB,QAAQ;QACR,YAAY;QACZ,GAAG,YAAY;QACf,GAAG,kBAAkB;QACrB,GAAG,uBAAuB;KAC3B,CAAA;IAED,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,UAAU,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAA;IAC1C,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/B,uBAAuB;QACvB,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,E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CAAC,CAAA;YACzD,CAAC;iBAAM,IAAI,MAAM,KAAK,uBAAuB,EAAE,CAAC;gBAC9C,6DAA6D;gBAC7D,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAA;YACxD,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,MAAM,kBAAkB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7E,MAAM,UAAU,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAExE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE,CAAC,CAAA;IACxE,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AACxB,CAAC,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
5
|
+
import { useModifyCoursePhase } from '@/hooks/useModifyCoursePhase';
|
|
6
|
+
import { useToast } from '@/hooks/use-toast';
|
|
7
|
+
import { AvailableMailPlaceholders, availablePlaceholders, } from './components/AvailableMailPlaceholders';
|
|
8
|
+
import { EmailTemplateEditor } from './components/MailingEditor';
|
|
9
|
+
import { SettingsCard } from './components/SettingsCard';
|
|
10
|
+
import { useGetMailingIsConfigured } from '@/hooks/useGetMailingIsConfigured';
|
|
11
|
+
import { MissingConfig } from '@/components/MissingConfig';
|
|
12
|
+
import { MailWarningIcon } from 'lucide-react';
|
|
13
|
+
import { useParams } from 'react-router-dom';
|
|
14
|
+
export const CoursePhaseMailing = ({ coursePhase }) => {
|
|
15
|
+
const { courseId } = useParams();
|
|
16
|
+
const { toast } = useToast();
|
|
17
|
+
const [initialMetaData, setInitialMetaData] = useState(null);
|
|
18
|
+
const [mailingMetaData, setMailingMetaData] = useState({
|
|
19
|
+
failedMailSubject: '',
|
|
20
|
+
failedMailContent: '',
|
|
21
|
+
passedMailSubject: '',
|
|
22
|
+
passedMailContent: '',
|
|
23
|
+
});
|
|
24
|
+
const isModified = JSON.stringify(initialMetaData) !== JSON.stringify(mailingMetaData);
|
|
25
|
+
const courseMailingIsConfigured = useGetMailingIsConfigured();
|
|
26
|
+
const [missingConfigs, setMissingConfigs] = useState([]);
|
|
27
|
+
// Updating state
|
|
28
|
+
const { mutate: mutateCoursePhase } = useModifyCoursePhase(() => {
|
|
29
|
+
toast({
|
|
30
|
+
title: 'Application mailing settings updated',
|
|
31
|
+
});
|
|
32
|
+
}, () => {
|
|
33
|
+
toast({
|
|
34
|
+
title: 'Error updating application mailing settings',
|
|
35
|
+
description: 'Please try again later',
|
|
36
|
+
variant: 'destructive',
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (coursePhase?.restrictedData) {
|
|
41
|
+
const parsedMetaData = coursePhase.restrictedData
|
|
42
|
+
.mailingSettings;
|
|
43
|
+
console.log(parsedMetaData);
|
|
44
|
+
if (!parsedMetaData) {
|
|
45
|
+
const emptyMailData = {
|
|
46
|
+
failedMailSubject: '',
|
|
47
|
+
failedMailContent: '',
|
|
48
|
+
passedMailSubject: '',
|
|
49
|
+
passedMailContent: '',
|
|
50
|
+
};
|
|
51
|
+
setMailingMetaData(emptyMailData);
|
|
52
|
+
setInitialMetaData(emptyMailData);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
setMailingMetaData(parsedMetaData);
|
|
56
|
+
setInitialMetaData(parsedMetaData);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [coursePhase]);
|
|
60
|
+
const handleInputChange = (e) => {
|
|
61
|
+
const { name, value } = e.target;
|
|
62
|
+
setMailingMetaData((prev) => ({ ...prev, [name]: value }));
|
|
63
|
+
};
|
|
64
|
+
const handleSubmit = (e) => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const updatedCoursePhase = {
|
|
67
|
+
id: coursePhase?.id ?? '',
|
|
68
|
+
restrictedData: {
|
|
69
|
+
mailingSettings: mailingMetaData,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
mutateCoursePhase(updatedCoursePhase);
|
|
73
|
+
};
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!courseMailingIsConfigured) {
|
|
76
|
+
setMissingConfigs([
|
|
77
|
+
{
|
|
78
|
+
title: 'Application Mailing',
|
|
79
|
+
description: 'Please configure course mailing settings',
|
|
80
|
+
link: `/management/course/${courseId}/mailing`,
|
|
81
|
+
icon: MailWarningIcon,
|
|
82
|
+
},
|
|
83
|
+
]);
|
|
84
|
+
}
|
|
85
|
+
}, [courseId, courseMailingIsConfigured]);
|
|
86
|
+
return (_jsxs("div", { className: 'space-y-6', children: [_jsx(MissingConfig, { elements: missingConfigs }), _jsx(SettingsCard, { mailingMetaData: mailingMetaData, isModified: isModified }), _jsx("h2", { className: 'text-2xl font-bold', children: "Mailing Templates " }), _jsx(AvailableMailPlaceholders, {}), initialMetaData && (_jsxs(Tabs, { defaultValue: 'pass', className: 'w-full', children: [_jsxs(TabsList, { className: 'grid w-full grid-cols-2', children: [_jsx(TabsTrigger, { value: 'pass', children: "1. Passed Students" }), _jsx(TabsTrigger, { value: 'failed', children: "2. Failed students" })] }), _jsx(TabsContent, { value: 'pass', children: _jsx(EmailTemplateEditor, { subject: mailingMetaData.passedMailSubject || '', content: mailingMetaData.passedMailContent || '', onInputChange: handleInputChange, label: 'Passed', subjectHTMLLabel: 'passedMailSubject', contentHTMLLabel: 'passedMailContent', placeholders: availablePlaceholders.map((placeholder) => placeholder.placeholder) }) }), _jsx(TabsContent, { value: 'failed', children: _jsx(EmailTemplateEditor, { subject: mailingMetaData.failedMailSubject || '', content: mailingMetaData.failedMailContent || '', onInputChange: handleInputChange, label: 'Failed', subjectHTMLLabel: 'failedMailSubject', contentHTMLLabel: 'failedMailContent', placeholders: availablePlaceholders.map((placeholder) => placeholder.placeholder) }) })] })), _jsx("div", { className: 'justify-end flex', children: _jsx(Button, { onClick: handleSubmit, type: 'submit', className: 'ml-auto', disabled: !isModified, children: "Save Changes" }) })] }));
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=CoursePhaseMailing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoursePhaseMailing.js","sourceRoot":"","sources":["../../../../src/components/pages/Mailing/CoursePhaseMailing.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAM5C,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAqB,MAAM,4BAA4B,CAAA;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,gBAAgB,EAAC,mBAAmB,EACpC,gBAAgB,EAAC,mBAAmB,EACpC,YAAY,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,GACjF,GACU,IACT,CACR,EAED,cAAK,SAAS,EAAC,kBAAkB,YAC/B,KAAC,MAAM,IAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,SAAS,EAAC,QAAQ,EAAE,CAAC,UAAU,6BAE7E,GACL,IACF,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ChevronDown, ChevronUp } from 'lucide-react';
|
|
4
|
+
import { Collapsible, CollapsibleContent } from '@/components/ui/collapsible';
|
|
5
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table';
|
|
6
|
+
import translations from '@/lib/translations.json';
|
|
7
|
+
export const availablePlaceholders = [
|
|
8
|
+
{
|
|
9
|
+
placeholder: '{{firstName}}',
|
|
10
|
+
description: 'The first name of the student',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
placeholder: '{{lastName}}',
|
|
14
|
+
description: 'The last name of the student',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
placeholder: '{{email}}',
|
|
18
|
+
description: 'The email of the student',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
placeholder: '{{matriculationNumber}}',
|
|
22
|
+
description: 'The matriculation number of the student. Might be empty',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
placeholder: '{{universityLogin}}',
|
|
26
|
+
description: `The ${translations.university['login-name']} of the student. Might be empty`,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
placeholder: '{{studyDegree}}',
|
|
30
|
+
description: 'The study degree of the student',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
placeholder: '{{currentSemester}}',
|
|
34
|
+
description: 'The current semester of the student',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
placeholder: '{{studyProgram}}',
|
|
38
|
+
description: 'The study program of the student',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
placeholder: '{{courseName}}',
|
|
42
|
+
description: 'The name of the course',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
placeholder: '{{courseStartDate}}',
|
|
46
|
+
description: 'The start date of the course',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
placeholder: '{{courseEndDate}}',
|
|
50
|
+
description: 'The end date of the course',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
export const AvailableMailPlaceholders = ({ customAdditionalPlaceholders, }) => {
|
|
54
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
55
|
+
const placeholders = [...availablePlaceholders];
|
|
56
|
+
if (customAdditionalPlaceholders) {
|
|
57
|
+
placeholders.push(...customAdditionalPlaceholders);
|
|
58
|
+
}
|
|
59
|
+
return (_jsxs(Collapsible, { open: isOpen, onOpenChange: setIsOpen, className: 'space-y-2 border rounded-md', children: [_jsxs("div", { className: 'flex items-center justify-between p-4 cursor-pointer', onClick: () => setIsOpen((prev) => !prev), children: [_jsxs("div", { children: [_jsx("h3", { className: 'text-sm font-medium', children: "Available Placeholders" }), _jsx("p", { className: 'text-xs text-muted-foreground mt-1', children: "Use these placeholders in your email templates. They will be replaced with actual values when the email is sent." })] }), isOpen ? _jsx(ChevronUp, { className: 'h-4 w-4' }) : _jsx(ChevronDown, { className: 'h-4 w-4' })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: 'border-t', children: _jsx("div", { className: 'max-h-[300px] overflow-auto', children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: 'w-[200px]', children: "Placeholder" }), _jsx(TableHead, { children: "Description" })] }) }), _jsx(TableBody, { children: placeholders.map((placeholder) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: 'font-mono text-sm', children: placeholder.placeholder }), _jsx(TableCell, { className: 'text-sm', children: placeholder.description })] }, placeholder.placeholder))) })] }) }) }) })] }));
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=AvailableMailPlaceholders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvailableMailPlaceholders.js","sourceRoot":"","sources":["../../../../../src/components/pages/Mailing/components/AvailableMailPlaceholders.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAC7E,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,uBAAuB,CAAA;AAC9B,OAAO,YAAY,MAAM,yBAAyB,CAAA;AAMlD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;QACE,WAAW,EAAE,eAAe;QAC5B,WAAW,EAAE,+BAA+B;KAC7C;IACD;QACE,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,8BAA8B;KAC5C;IACD;QACE,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,0BAA0B;KACxC;IACD;QACE,WAAW,EAAE,yBAAyB;QACtC,WAAW,EAAE,yDAAyD;KACvE;IACD;QACE,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE,OAAO,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,iCAAiC;KAC3F;IACD;QACE,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,iCAAiC;KAC/C;IACD;QACE,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE,qCAAqC;KACnD;IACD;QACE,WAAW,EAAE,k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,IACzB,GACC,EACd,KAAC,SAAS,cACP,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CACjC,MAAC,QAAQ,eACP,KAAC,SAAS,IAAC,SAAS,EAAC,mBAAmB,YAAE,WAAW,CAAC,WAAW,GAAa,EAC9E,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,YAAE,WAAW,CAAC,WAAW,GAAa,KAFvD,WAAW,CAAC,WAAW,CAG3B,CACZ,CAAC,GACQ,IACN,GACJ,GACF,GACa,IACT,CACf,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Send, Loader2, AlertCircle, CheckCircle, X } from 'lucide-react';
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
5
|
+
import { useMutation } from '@tanstack/react-query';
|
|
6
|
+
import { useParams } from 'react-router-dom';
|
|
7
|
+
import { PassStatus } from '@tumaet/prompt-shared-state';
|
|
8
|
+
import { sendStatusMail } from '@/network/mutations/sendStatusMail';
|
|
9
|
+
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
|
|
10
|
+
export const ConfirmSendEmailDialog = ({ isOpen, onClose, emailType, }) => {
|
|
11
|
+
const { phaseId } = useParams();
|
|
12
|
+
const { mutate: sendEmails, isPending, isError, error, data, reset, } = useMutation({
|
|
13
|
+
mutationFn: (statusToSend) => {
|
|
14
|
+
return sendStatusMail(phaseId ?? 'undefined', statusToSend);
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const onConfirm = () => {
|
|
18
|
+
sendEmails({ statusMailToBeSend: emailType });
|
|
19
|
+
};
|
|
20
|
+
const handleClose = () => {
|
|
21
|
+
reset();
|
|
22
|
+
onClose();
|
|
23
|
+
};
|
|
24
|
+
return (_jsx(Dialog, { open: isOpen, onOpenChange: handleClose, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isPending
|
|
25
|
+
? 'Sending Emails'
|
|
26
|
+
: isError
|
|
27
|
+
? 'Error'
|
|
28
|
+
: data
|
|
29
|
+
? 'Email Send Results'
|
|
30
|
+
: 'Confirm Email Send' }), _jsx(DialogDescription, { children: !isPending &&
|
|
31
|
+
!isError &&
|
|
32
|
+
!data &&
|
|
33
|
+
`Are you sure you want to send an Email to ALL students that ${emailType === PassStatus.PASSED ? 'have been accepted' : 'have been rejected'}?` })] }), isPending && (_jsxs(Alert, { children: [_jsx(Loader2, { className: 'h-4 w-4 animate-spin text-blue-500' }), _jsx(AlertTitle, { children: "Sending Mails" }), _jsx(AlertDescription, { children: "Please wait while we process your request." })] })), isError && (_jsxs(Alert, { variant: 'destructive', children: [_jsx(AlertCircle, { className: 'h-4 w-4' }), _jsx(AlertTitle, { children: "Error" }), _jsx(AlertDescription, { children: error?.message || 'An unexpected error occurred.' })] })), data && (_jsxs(Alert, { children: [_jsx(CheckCircle, { className: 'h-4 w-4 text-green-500' }), _jsx(AlertTitle, { children: "Email Send Results" }), _jsxs(AlertDescription, { children: ["Successfully sent: ", data.successfulEmails ? data.successfulEmails.length : 0, " emails", _jsx("br", {}), "Failed to send: ", data.failedEmails ? data.failedEmails.length : 0, " emails"] })] })), _jsxs(DialogFooter, { children: [!isPending && !isError && !data && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'outline', onClick: handleClose, children: "Cancel" }), _jsxs(Button, { onClick: onConfirm, children: [_jsx(Send, { className: 'mr-2 h-4 w-4' }), "Confirm Send"] })] })), (isError || data) && (_jsxs(Button, { onClick: handleClose, children: [_jsx(X, { className: 'mr-2 h-4 w-4' }), "Close"] }))] })] }) }));
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ConfirmSendEmailDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmSendEmailDialog.js","sourceRoot":"","sources":["../../../../../src/components/pages/Mailing/components/ConfirmSendEmailDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAkB,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAQ3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,MAAM,EACN,OAAO,EACP,SAAS,GACmB,EAAe,EAAE;IAC7C,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAuB,CAAA;IAEpD,MAAM,EACJ,MAAM,EAAE,UAAU,EAClB,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAI,EACJ,KAAK,GACN,GAAG,WAAW,CAAC;QACd,UAAU,EAAE,CAAC,YAA4B,EAAE,EAAE;YAC3C,OAAO,cAAc,CAAC,OAAO,IAAI,WAAW,EAAE,YAAY,CAAC,CAAA;QAC7D,CAAC;KACF,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,UAAU,CAAC,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC,CAAA;IAC/C,CAAC,CAAA;IAED,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,KAAK,EAAE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AC,CAAC,CAAC,eAChD,IACb,CACT,EAED,MAAC,YAAY,eACV,CAAC,SAAS,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,IAAI,CAClC,8BACE,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,WAAW,uBAErC,EACT,MAAC,MAAM,IAAC,OAAO,EAAE,SAAS,aACxB,KAAC,IAAI,IAAC,SAAS,EAAC,cAAc,GAAG,oBAE1B,IACR,CACJ,EACA,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CACpB,MAAC,MAAM,IAAC,OAAO,EAAE,WAAW,aAC1B,KAAC,CAAC,IAAC,SAAS,EAAC,cAAc,GAAG,aAEvB,CACV,IACY,IACD,GACT,CACV,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Label } from '@/components/ui/label';
|
|
4
|
+
import { TooltipProvider } from '@/components/ui/tooltip';
|
|
5
|
+
import { Input } from '@/components/ui/input';
|
|
6
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
7
|
+
import MailingTiptapEditor from '@/components/minimal-tiptap/mailing-tiptap';
|
|
8
|
+
export const EmailTemplateEditor = ({ subject, content, onInputChange, label, subjectHTMLLabel, contentHTMLLabel, placeholders, }) => {
|
|
9
|
+
// Local state to hold warning message
|
|
10
|
+
const [subjectWarning, setSubjectWarning] = useState('');
|
|
11
|
+
// Regular expression to allow only ASCII characters
|
|
12
|
+
const asciiOnlyRegex = /^[\x20-\x7F]*$/;
|
|
13
|
+
// Custom onChange handler for subject input
|
|
14
|
+
const handleSubjectChange = (e) => {
|
|
15
|
+
const value = e.target.value;
|
|
16
|
+
if (!asciiOnlyRegex.test(value)) {
|
|
17
|
+
// Set a warning message and do not propagate the change
|
|
18
|
+
setSubjectWarning('Warning: Only ASCII characters are allowed.');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// Clear any warning and propagate the valid change
|
|
22
|
+
setSubjectWarning('');
|
|
23
|
+
onInputChange(e);
|
|
24
|
+
};
|
|
25
|
+
return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { children: [label, " Mail Template"] }) }), _jsxs(CardContent, { className: 'space-y-4', children: [_jsxs("div", { children: [_jsxs(Label, { htmlFor: subjectHTMLLabel, children: [label, " Subject"] }), _jsx(Input, { type: 'text', name: subjectHTMLLabel, value: subject, onChange: handleSubjectChange, className: 'w-full mt-1' }), subjectWarning && _jsx("p", { className: 'text-red-500 text-sm mt-1', children: subjectWarning })] }), _jsxs("div", { children: [_jsxs(Label, { htmlFor: contentHTMLLabel, children: [label, " E-Mail Template"] }), _jsx(TooltipProvider, { children: _jsx(MailingTiptapEditor, { value: content, onChange: (newContent) => onInputChange({
|
|
26
|
+
target: { name: contentHTMLLabel, value: newContent },
|
|
27
|
+
}), className: 'w-full mt-1', editorContentClassName: 'p-4', output: 'html', placeholder: 'Type your email here...', autofocus: false, editable: true, editorClassName: 'focus:outline-none', placeholders: placeholders }) })] })] })] }));
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=MailingEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailingEditor.js","sourceRoot":"","sources":["../../../../../src/components/pages/Mailing/components/MailingEditor.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,mBAAmB,MAAM,4CAA4C,CA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d,QAAQ,EAAE,CAAC,UAAU,EAAE,EAAE,CACvB,aAAa,CAAC;wCACZ,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE;qCAC/C,CAAC,EAEX,SAAS,EAAC,aAAa,EACvB,sBAAsB,EAAC,KAAK,EAC5B,MAAM,EAAC,MAAM,EACb,WAAW,EAAC,yBAAyB,EACrC,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,IAAI,EACd,eAAe,EAAC,oBAAoB,EACpC,YAAY,EAAE,YAAY,GAC1B,GACc,IACd,IACM,IACT,CACR,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@/components/ui/button';
|
|
3
|
+
import { Send } from 'lucide-react';
|
|
4
|
+
import { PassStatus } from '@tumaet/prompt-shared-state';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { ConfirmSendEmailDialog } from './ConfirmSendEmailDialog';
|
|
7
|
+
import { Label } from '@/components/ui/label';
|
|
8
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
|
9
|
+
import { useGetMailingIsConfigured } from '@/hooks/useGetMailingIsConfigured';
|
|
10
|
+
export const ManualMailSending = ({ mailingMetaData, isModified, }) => {
|
|
11
|
+
const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false);
|
|
12
|
+
const [sendEmailType, setSendEmailType] = useState(null);
|
|
13
|
+
const courseMailingIsConfigured = useGetMailingIsConfigured();
|
|
14
|
+
const isDisabled = (type) => {
|
|
15
|
+
if (isModified)
|
|
16
|
+
return true;
|
|
17
|
+
const contentCheck = type === PassStatus.PASSED
|
|
18
|
+
? mailingMetaData?.passedMailContent && mailingMetaData?.passedMailSubject
|
|
19
|
+
: mailingMetaData?.failedMailContent && mailingMetaData?.failedMailSubject;
|
|
20
|
+
return !(contentCheck && courseMailingIsConfigured);
|
|
21
|
+
};
|
|
22
|
+
const tooltipMessage = courseMailingIsConfigured
|
|
23
|
+
? 'Configure the mail subject and content and save changes before sending.'
|
|
24
|
+
: 'Configure the mailing in the course mail settings before sending.';
|
|
25
|
+
return (_jsx(_Fragment, { children: _jsxs(TooltipProvider, { children: [_jsxs("div", { className: 'flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2', children: [_jsxs("div", { className: 'space-y-0.5', children: [_jsx(Label, { children: "Manual Acceptance Emails" }), _jsx("p", { className: 'text-sm text-muted-foreground', children: "Send an acceptance mail to ALL accepted students." })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { children: _jsxs(Button, { className: 'w-full sm:w-auto', variant: 'outline', onClick: (e) => {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
setSendEmailType(PassStatus.PASSED);
|
|
28
|
+
setConfirmationDialogOpen(true);
|
|
29
|
+
}, disabled: isDisabled(PassStatus.PASSED), children: [_jsx(Send, { className: 'mr-2 h-4 w-4' }), "Send Acceptance Mails"] }) }), isDisabled(PassStatus.PASSED) && _jsxs(TooltipContent, { children: [tooltipMessage, " "] })] })] }), _jsxs("div", { className: 'flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2', children: [_jsxs("div", { className: 'space-y-0.5', children: [_jsx(Label, { children: "Manual Rejection Emails" }), _jsx("p", { className: 'text-sm text-muted-foreground', children: "Send a rejection mail to ALL rejected students." })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { children: _jsxs(Button, { className: 'w-full sm:w-auto', variant: 'outline', onClick: (e) => {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
setSendEmailType(PassStatus.FAILED);
|
|
32
|
+
setConfirmationDialogOpen(true);
|
|
33
|
+
}, disabled: isDisabled(PassStatus.FAILED), children: [_jsx(Send, { className: 'mr-2 h-4 w-4' }), "Send Rejection Mails"] }) }), isDisabled(PassStatus.FAILED) && _jsxs(TooltipContent, { children: [tooltipMessage, " "] })] })] }), confirmationDialogOpen && sendEmailType && (_jsx(ConfirmSendEmailDialog, { isOpen: confirmationDialogOpen, onClose: () => setConfirmationDialogOpen(false), emailType: sendEmailType }))] }) }));
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ManualMailSending.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManualMailSending.js","sourceRoot":"","sources":["../../../../../src/components/pages/Mailing/components/ManualMailSending.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,UAAU,EAAgC,MAAM,6BAA6B,CAAA;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAO7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,eAAe,EACf,UAAU,GACa,EAAe,EAAE;IACxC,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3E,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAA;IAE3E,MAAM,yBAAyB,GAAG,yBAAyB,EAAE,CAAA;IAE7D,MAAM,UAAU,GAAG,CAAC,IAAgB,EAAE,EAAE;QACtC,IAAI,UAAU;YAAE,OAAO,IAAI,CAAA;QAE3B,MAAM,YAAY,GAChB,IAAI,KAAK,UAAU,CAAC,MAAM;YACxB,CAAC,CAAC,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CAAC,CAAC,cAAc,EAAE,CAAA;4CAClB,gBAAgB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;4CACnC,yBAAyB,CAAC,IAAI,CAAC,CAAA;wCACjC,CAAC,EACD,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,aAEvC,KAAC,IAAI,IAAC,SAAS,EAAC,cAAc,GAAG,4BAE1B,GACM,EAChB,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAC,cAAc,eAAE,cAAc,SAAmB,IAC5E,IACN,EACL,sBAAsB,IAAI,aAAa,IAAI,CAC1C,KAAC,sBAAsB,IACrB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAC/C,SAAS,EAAE,aAAa,GACxB,CACH,IACe,GACjB,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from '@/components/ui/badge';
|
|
3
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
|
4
|
+
import { ManualMailSending } from './ManualMailSending';
|
|
5
|
+
import { Info } from 'lucide-react';
|
|
6
|
+
export const SettingsCard = ({ mailingMetaData, isModified }) => {
|
|
7
|
+
const someMailFunctionDisabled = isModified ||
|
|
8
|
+
!mailingMetaData?.passedMailContent ||
|
|
9
|
+
!mailingMetaData?.passedMailSubject ||
|
|
10
|
+
!mailingMetaData?.failedMailContent ||
|
|
11
|
+
!mailingMetaData?.failedMailSubject;
|
|
12
|
+
return (_jsx(_Fragment, { children: _jsxs(Card, { className: 'w-full', children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: 'flex items-center justify-between', children: [_jsx(CardTitle, { children: "E-Mail Settings" }), isModified && (_jsx(Badge, { variant: 'outline', className: 'bg-yellow-100 text-yellow-800 border-yellow-300', children: "Unsaved Changes" }))] }), _jsx(CardDescription, { children: "Configure email settings for the application phase" })] }), _jsxs(CardContent, { className: 'space-y-6', children: [someMailFunctionDisabled && (_jsxs("div", { className: 'flex items-start space-x-2 text-sm text-muted-foreground bg-muted p-3 rounded-md', children: [_jsx(Info, { className: 'h-4 w-4 mt-0.5 flex-shrink-0' }), _jsx("p", { children: "Some of the following mailing options are disabled. Please make sure to configure and save the corresponding mail subject and content." })] })), _jsx("div", { className: 'space-y-4', children: _jsx(ManualMailSending, { mailingMetaData: mailingMetaData, isModified: isModified }) })] })] }) }));
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=SettingsCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsCard.js","sourceRoot":"","sources":["../../../../../src/components/pages/Mailing/components/SettingsCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAOnC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,eAAe,EAAE,UAAU,EAAqB,EAAe,EAAE;IAC9F,MAAM,wBAAwB,GAC5B,UAAU;QACV,CAAC,eAAe,EAAE,iBAAiB;QACnC,CAAC,eAAe,EAAE,iBAAiB;QACnC,CAAC,eAAe,EAAE,iBAAiB;QACnC,CAAC,eAAe,EAAE,iBAAiB,CAAA;IAErC,OAAO,CACL,4BACE,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,aACtB,MAAC,UAAU,eACT,eAAK,SAAS,EAAC,mCAAmC,aAChD,KAAC,SAAS,kCAA4B,EACrC,UAAU,IAAI,CACb,KAAC,KAAK,IAAC,OAAO,EAAC,SAAS,EAAC,SAAS,EAAC,iDAAiD,gCAE5E,CACT,IACG,EACN,KAAC,eAAe,qEAAqE,IAC1E,EACb,MAAC,WAAW,IAAC,SAAS,EAAC,WAAW,aAC/B,wBAAwB,IAAI,CAC3B,eAAK,SAAS,EAAC,kFAAkF,aAC/F,KAAC,IAAI,IAAC,SAAS,EAAC,8BAA8B,GAAG,EACjD,iKAGI,IACA,CACP,EACD,cAAK,SAAS,EAAC,WAAW,YACxB,KAAC,iBAAiB,IAAC,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,GAAI,GAC3E,IACM,IACT,GACN,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@/components/ui/button';
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog';
|
|
4
|
+
export const ActionDialog = ({ title, description, confirmLabel, confirmVariant = 'default', isOpen, onClose, onConfirm, }) => (_jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: 'outline', onClick: onClose, children: "Cancel" }), _jsx(Button, { variant: confirmVariant, onClick: () => {
|
|
5
|
+
onConfirm();
|
|
6
|
+
onClose();
|
|
7
|
+
}, children: confirmLabel })] })] }) }));
|
|
8
|
+
//# sourceMappingURL=GroupActionDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupActionDialog.js","sourceRoot":"","sources":["../../../src/components/table/GroupActionDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,wBAAwB,CAAA;AAY/B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,YAAY,EACZ,cAAc,GAAG,SAAS,EAC1B,MAAM,EACN,OAAO,EACP,SAAS,GACS,EAAE,EAAE,CAAC,CACvB,KAAC,MAAM,IAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,YACzC,MAAC,aAAa,eACZ,MAAC,YAAY,eACX,KAAC,WAAW,cAAE,KAAK,GAAe,EAClC,KAAC,iBAAiB,cAAE,WAAW,GAAqB,IACvC,EACf,MAAC,YAAY,eACX,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,OAAO,uBAEjC,EACT,KAAC,MAAM,IACL,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,GAAG,EAAE;4BACZ,SAAS,EAAE,CAAA;4BACX,OAAO,EAAE,CAAA;wBACX,CAAC,YAEA,YAAY,GACN,IACI,IACD,GACT,CACV,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
export const SortableHeader = ({ column, title }) => {
|
|
5
|
+
return (_jsxs(Button, { variant: 'ghost', onClick: () => column.toggleSorting(column.getIsSorted() === 'asc'), children: [title, column.getIsSorted() === 'asc' ? (_jsx(ArrowUp, { className: 'ml-2 h-4 w-4' })) : column.getIsSorted() === 'desc' ? (_jsx(ArrowDown, { className: 'ml-2 h-4 w-4' })) : (_jsx(ArrowUpDown, { className: 'ml-2 h-4 w-4' }))] }));
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=SortableHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortableHeader.js","sourceRoot":"","sources":["../../../src/components/table/SortableHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAkC,EAAE,EAAE;IAClF,OAAO,CACL,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,aACxF,KAAK,EACL,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAChC,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,GAAG,CACrC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,CACpC,KAAC,SAAS,IAAC,SAAS,EAAC,cAAc,GAAG,CACvC,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IAAC,SAAS,EAAC,cAAc,GAAG,CACzC,IACM,CACV,CAAA;AACH,CAAC,CAAA"}
|