@hed-hog/lms 0.0.304 → 0.0.306
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/README.md +413 -401
- package/dist/certificate/certificate.controller.d.ts +90 -0
- package/dist/certificate/certificate.controller.d.ts.map +1 -0
- package/dist/certificate/certificate.controller.js +121 -0
- package/dist/certificate/certificate.controller.js.map +1 -0
- package/dist/certificate/certificate.module.d.ts +3 -0
- package/dist/certificate/certificate.module.d.ts.map +1 -0
- package/dist/certificate/certificate.module.js +26 -0
- package/dist/certificate/certificate.module.js.map +1 -0
- package/dist/certificate/certificate.service.d.ts +115 -0
- package/dist/certificate/certificate.service.d.ts.map +1 -0
- package/dist/certificate/certificate.service.js +343 -0
- package/dist/certificate/certificate.service.js.map +1 -0
- package/dist/certificate/dto/create-certificate-template.dto.d.ts +8 -0
- package/dist/certificate/dto/create-certificate-template.dto.d.ts.map +1 -0
- package/dist/certificate/dto/create-certificate-template.dto.js +44 -0
- package/dist/certificate/dto/create-certificate-template.dto.js.map +1 -0
- package/dist/certificate/dto/update-certificate-template.dto.d.ts +6 -0
- package/dist/certificate/dto/update-certificate-template.dto.d.ts.map +1 -0
- package/dist/certificate/dto/update-certificate-template.dto.js +9 -0
- package/dist/certificate/dto/update-certificate-template.dto.js.map +1 -0
- package/dist/class-group/class-group.controller.d.ts +305 -0
- package/dist/class-group/class-group.controller.d.ts.map +1 -0
- package/dist/class-group/class-group.controller.js +257 -0
- package/dist/class-group/class-group.controller.js.map +1 -0
- package/dist/class-group/class-group.module.d.ts +3 -0
- package/dist/class-group/class-group.module.d.ts.map +1 -0
- package/dist/class-group/class-group.module.js +25 -0
- package/dist/class-group/class-group.module.js.map +1 -0
- package/dist/class-group/class-group.service.d.ts +354 -0
- package/dist/class-group/class-group.service.d.ts.map +1 -0
- package/dist/class-group/class-group.service.js +1356 -0
- package/dist/class-group/class-group.service.js.map +1 -0
- package/dist/class-group/dto/create-class-group.dto.d.ts +33 -0
- package/dist/class-group/dto/create-class-group.dto.d.ts.map +1 -0
- package/dist/class-group/dto/create-class-group.dto.js +165 -0
- package/dist/class-group/dto/create-class-group.dto.js.map +1 -0
- package/dist/class-group/dto/create-session.dto.d.ts +22 -0
- package/dist/class-group/dto/create-session.dto.d.ts.map +1 -0
- package/dist/class-group/dto/create-session.dto.js +117 -0
- package/dist/class-group/dto/create-session.dto.js.map +1 -0
- package/dist/class-group/dto/enrollment.dto.d.ts +22 -0
- package/dist/class-group/dto/enrollment.dto.d.ts.map +1 -0
- package/dist/class-group/dto/enrollment.dto.js +89 -0
- package/dist/class-group/dto/enrollment.dto.js.map +1 -0
- package/dist/class-group/dto/update-class-group.dto.d.ts +6 -0
- package/dist/class-group/dto/update-class-group.dto.d.ts.map +1 -0
- package/dist/class-group/dto/update-class-group.dto.js +9 -0
- package/dist/class-group/dto/update-class-group.dto.js.map +1 -0
- package/dist/class-group/dto/update-session.dto.d.ts +7 -0
- package/dist/class-group/dto/update-session.dto.d.ts.map +1 -0
- package/dist/class-group/dto/update-session.dto.js +24 -0
- package/dist/class-group/dto/update-session.dto.js.map +1 -0
- package/dist/course/course-structure.controller.d.ts +127 -0
- package/dist/course/course-structure.controller.d.ts.map +1 -0
- package/dist/course/course-structure.controller.js +115 -0
- package/dist/course/course-structure.controller.js.map +1 -0
- package/dist/course/course-structure.service.d.ts +142 -0
- package/dist/course/course-structure.service.d.ts.map +1 -0
- package/dist/course/course-structure.service.js +445 -0
- package/dist/course/course-structure.service.js.map +1 -0
- package/dist/course/course.controller.d.ts +195 -0
- package/dist/course/course.controller.d.ts.map +1 -0
- package/dist/course/course.controller.js +104 -0
- package/dist/course/course.controller.js.map +1 -0
- package/dist/course/course.module.d.ts +3 -0
- package/dist/course/course.module.d.ts.map +1 -0
- package/dist/course/course.module.js +28 -0
- package/dist/course/course.module.js.map +1 -0
- package/dist/course/course.service.d.ts +215 -0
- package/dist/course/course.service.d.ts.map +1 -0
- package/dist/course/course.service.js +743 -0
- package/dist/course/course.service.js.map +1 -0
- package/dist/course/dto/create-course-structure-lesson.dto.d.ts +24 -0
- package/dist/course/dto/create-course-structure-lesson.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course-structure-lesson.dto.js +118 -0
- package/dist/course/dto/create-course-structure-lesson.dto.js.map +1 -0
- package/dist/course/dto/create-course-structure-session.dto.d.ts +7 -0
- package/dist/course/dto/create-course-structure-session.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course-structure-session.dto.js +40 -0
- package/dist/course/dto/create-course-structure-session.dto.js.map +1 -0
- package/dist/course/dto/create-course.dto.d.ts +26 -0
- package/dist/course/dto/create-course.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course.dto.js +138 -0
- package/dist/course/dto/create-course.dto.js.map +1 -0
- package/dist/course/dto/update-course-structure-lesson.dto.d.ts +6 -0
- package/dist/course/dto/update-course-structure-lesson.dto.d.ts.map +1 -0
- package/dist/course/dto/update-course-structure-lesson.dto.js +9 -0
- package/dist/course/dto/update-course-structure-lesson.dto.js.map +1 -0
- package/dist/course/dto/update-course-structure-session.dto.d.ts +6 -0
- package/dist/course/dto/update-course-structure-session.dto.d.ts.map +1 -0
- package/dist/course/dto/update-course-structure-session.dto.js +9 -0
- package/dist/course/dto/update-course-structure-session.dto.js.map +1 -0
- package/dist/course/dto/update-course.dto.d.ts +6 -0
- package/dist/course/dto/update-course.dto.d.ts.map +1 -0
- package/dist/course/dto/update-course.dto.js +9 -0
- package/dist/course/dto/update-course.dto.js.map +1 -0
- package/dist/dashboard/dashboard.controller.d.ts +101 -0
- package/dist/dashboard/dashboard.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard.controller.js +40 -0
- package/dist/dashboard/dashboard.controller.js.map +1 -0
- package/dist/dashboard/dashboard.module.d.ts +3 -0
- package/dist/dashboard/dashboard.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard.module.js +25 -0
- package/dist/dashboard/dashboard.module.js.map +1 -0
- package/dist/dashboard/dashboard.service.d.ts +130 -0
- package/dist/dashboard/dashboard.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard.service.js +626 -0
- package/dist/dashboard/dashboard.service.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.d.ts +4 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.js +22 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.d.ts +5 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.js +27 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.d.ts +5 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.js +27 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.d.ts +7 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.js +36 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.js.map +1 -0
- package/dist/enterprise/dto/create-enterprise.dto.d.ts +10 -0
- package/dist/enterprise/dto/create-enterprise.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/create-enterprise.dto.js +54 -0
- package/dist/enterprise/dto/create-enterprise.dto.js.map +1 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.d.ts +4 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.js +22 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.js.map +1 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.d.ts +5 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.js +27 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.js.map +1 -0
- package/dist/enterprise/dto/update-enterprise.dto.d.ts +6 -0
- package/dist/enterprise/dto/update-enterprise.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/update-enterprise.dto.js +9 -0
- package/dist/enterprise/dto/update-enterprise.dto.js.map +1 -0
- package/dist/enterprise/enterprise.controller.d.ts +269 -0
- package/dist/enterprise/enterprise.controller.d.ts.map +1 -0
- package/dist/enterprise/enterprise.controller.js +311 -0
- package/dist/enterprise/enterprise.controller.js.map +1 -0
- package/dist/enterprise/enterprise.module.d.ts +3 -0
- package/dist/enterprise/enterprise.module.d.ts.map +1 -0
- package/dist/enterprise/enterprise.module.js +25 -0
- package/dist/enterprise/enterprise.module.js.map +1 -0
- package/dist/enterprise/enterprise.service.d.ts +282 -0
- package/dist/enterprise/enterprise.service.d.ts.map +1 -0
- package/dist/enterprise/enterprise.service.js +627 -0
- package/dist/enterprise/enterprise.service.js.map +1 -0
- package/dist/evaluation/evaluation.controller.d.ts +56 -0
- package/dist/evaluation/evaluation.controller.d.ts.map +1 -0
- package/dist/evaluation/evaluation.controller.js +76 -0
- package/dist/evaluation/evaluation.controller.js.map +1 -0
- package/dist/evaluation/evaluation.module.d.ts +3 -0
- package/dist/evaluation/evaluation.module.d.ts.map +1 -0
- package/dist/evaluation/evaluation.module.js +25 -0
- package/dist/evaluation/evaluation.module.js.map +1 -0
- package/dist/evaluation/evaluation.service.d.ts +67 -0
- package/dist/evaluation/evaluation.service.d.ts.map +1 -0
- package/dist/evaluation/evaluation.service.js +378 -0
- package/dist/evaluation/evaluation.service.js.map +1 -0
- package/dist/exam/dto/create-exam-question.dto.d.ts +25 -0
- package/dist/exam/dto/create-exam-question.dto.d.ts.map +1 -0
- package/dist/exam/dto/create-exam-question.dto.js +117 -0
- package/dist/exam/dto/create-exam-question.dto.js.map +1 -0
- package/dist/exam/dto/create-exam.dto.d.ts +11 -0
- package/dist/exam/dto/create-exam.dto.d.ts.map +1 -0
- package/dist/exam/dto/create-exam.dto.js +63 -0
- package/dist/exam/dto/create-exam.dto.js.map +1 -0
- package/dist/exam/dto/reorder-exam-questions.dto.d.ts +4 -0
- package/dist/exam/dto/reorder-exam-questions.dto.d.ts.map +1 -0
- package/dist/exam/dto/reorder-exam-questions.dto.js +23 -0
- package/dist/exam/dto/reorder-exam-questions.dto.js.map +1 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.d.ts +14 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.d.ts.map +1 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.js +68 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.js.map +1 -0
- package/dist/exam/dto/start-exam-attempt.dto.d.ts +4 -0
- package/dist/exam/dto/start-exam-attempt.dto.d.ts.map +1 -0
- package/dist/exam/dto/start-exam-attempt.dto.js +23 -0
- package/dist/exam/dto/start-exam-attempt.dto.js.map +1 -0
- package/dist/exam/dto/submit-exam-attempt.dto.d.ts +5 -0
- package/dist/exam/dto/submit-exam-attempt.dto.d.ts.map +1 -0
- package/dist/exam/dto/submit-exam-attempt.dto.js +23 -0
- package/dist/exam/dto/submit-exam-attempt.dto.js.map +1 -0
- package/dist/exam/dto/update-exam-question.dto.d.ts +6 -0
- package/dist/exam/dto/update-exam-question.dto.d.ts.map +1 -0
- package/dist/exam/dto/update-exam-question.dto.js +9 -0
- package/dist/exam/dto/update-exam-question.dto.js.map +1 -0
- package/dist/exam/dto/update-exam.dto.d.ts +6 -0
- package/dist/exam/dto/update-exam.dto.d.ts.map +1 -0
- package/dist/exam/dto/update-exam.dto.js +9 -0
- package/dist/exam/dto/update-exam.dto.js.map +1 -0
- package/dist/exam/exam-attempt.controller.d.ts +273 -0
- package/dist/exam/exam-attempt.controller.d.ts.map +1 -0
- package/dist/exam/exam-attempt.controller.js +84 -0
- package/dist/exam/exam-attempt.controller.js.map +1 -0
- package/dist/exam/exam-attempt.service.d.ts +302 -0
- package/dist/exam/exam-attempt.service.d.ts.map +1 -0
- package/dist/exam/exam-attempt.service.js +776 -0
- package/dist/exam/exam-attempt.service.js.map +1 -0
- package/dist/exam/exam.controller.d.ts +162 -0
- package/dist/exam/exam.controller.d.ts.map +1 -0
- package/dist/exam/exam.controller.js +158 -0
- package/dist/exam/exam.controller.js.map +1 -0
- package/dist/exam/exam.module.d.ts +3 -0
- package/dist/exam/exam.module.d.ts.map +1 -0
- package/dist/exam/exam.module.js +27 -0
- package/dist/exam/exam.module.js.map +1 -0
- package/dist/exam/exam.service.d.ts +179 -0
- package/dist/exam/exam.service.d.ts.map +1 -0
- package/dist/exam/exam.service.js +597 -0
- package/dist/exam/exam.service.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/instructor/dto/create-instructor.dto.d.ts +10 -0
- package/dist/instructor/dto/create-instructor.dto.d.ts.map +1 -0
- package/dist/instructor/dto/create-instructor.dto.js +55 -0
- package/dist/instructor/dto/create-instructor.dto.js.map +1 -0
- package/dist/instructor/dto/update-instructor.dto.d.ts +9 -0
- package/dist/instructor/dto/update-instructor.dto.d.ts.map +1 -0
- package/dist/instructor/dto/update-instructor.dto.js +51 -0
- package/dist/instructor/dto/update-instructor.dto.js.map +1 -0
- package/dist/instructor/instructor.controller.d.ts +52 -0
- package/dist/instructor/instructor.controller.d.ts.map +1 -0
- package/dist/instructor/instructor.controller.js +98 -0
- package/dist/instructor/instructor.controller.js.map +1 -0
- package/dist/instructor/instructor.module.d.ts +3 -0
- package/dist/instructor/instructor.module.d.ts.map +1 -0
- package/dist/instructor/instructor.module.js +25 -0
- package/dist/instructor/instructor.module.js.map +1 -0
- package/dist/instructor/instructor.service.d.ts +79 -0
- package/dist/instructor/instructor.service.d.ts.map +1 -0
- package/dist/instructor/instructor.service.js +528 -0
- package/dist/instructor/instructor.service.js.map +1 -0
- package/dist/lms.module.d.ts.map +1 -1
- package/dist/lms.module.js +36 -4
- package/dist/lms.module.js.map +1 -1
- package/dist/reports/reports.controller.d.ts +69 -0
- package/dist/reports/reports.controller.d.ts.map +1 -0
- package/dist/reports/reports.controller.js +40 -0
- package/dist/reports/reports.controller.js.map +1 -0
- package/dist/reports/reports.module.d.ts +3 -0
- package/dist/reports/reports.module.d.ts.map +1 -0
- package/dist/reports/reports.module.js +25 -0
- package/dist/reports/reports.module.js.map +1 -0
- package/dist/reports/reports.service.d.ts +80 -0
- package/dist/reports/reports.service.d.ts.map +1 -0
- package/dist/reports/reports.service.js +366 -0
- package/dist/reports/reports.service.js.map +1 -0
- package/dist/training/dto/create-training.dto.d.ts +19 -0
- package/dist/training/dto/create-training.dto.d.ts.map +1 -0
- package/dist/training/dto/create-training.dto.js +98 -0
- package/dist/training/dto/create-training.dto.js.map +1 -0
- package/dist/training/dto/update-training.dto.d.ts +6 -0
- package/dist/training/dto/update-training.dto.d.ts.map +1 -0
- package/dist/training/dto/update-training.dto.js +9 -0
- package/dist/training/dto/update-training.dto.js.map +1 -0
- package/dist/training/training.controller.d.ts +195 -0
- package/dist/training/training.controller.d.ts.map +1 -0
- package/dist/training/training.controller.js +104 -0
- package/dist/training/training.controller.js.map +1 -0
- package/dist/training/training.module.d.ts +3 -0
- package/dist/training/training.module.d.ts.map +1 -0
- package/dist/training/training.module.js +25 -0
- package/dist/training/training.module.js.map +1 -0
- package/dist/training/training.service.d.ts +213 -0
- package/dist/training/training.service.d.ts.map +1 -0
- package/dist/training/training.service.js +497 -0
- package/dist/training/training.service.js.map +1 -0
- package/hedhog/data/dashboard.yaml +6 -0
- package/hedhog/data/dashboard_component.yaml +153 -0
- package/hedhog/data/dashboard_component_role.yaml +97 -0
- package/hedhog/data/dashboard_item.yaml +167 -0
- package/hedhog/data/dashboard_role.yaml +6 -0
- package/hedhog/data/instructor_qualification.yaml +16 -0
- package/hedhog/data/menu.yaml +129 -19
- package/hedhog/data/role.yaml +25 -1
- package/hedhog/data/route.yaml +867 -0
- package/hedhog/frontend/app/_components/class-form-sheet.tsx.ejs +1992 -0
- package/hedhog/frontend/app/_components/course-form-sheet.tsx.ejs +480 -0
- package/hedhog/frontend/app/_components/create-lms-instructor-sheet.tsx.ejs +591 -0
- package/hedhog/frontend/app/_components/create-lms-person-sheet.tsx.ejs +164 -0
- package/hedhog/frontend/app/_components/create-lms-student-person-sheet.tsx.ejs +120 -0
- package/hedhog/frontend/app/_components/lms-class-calendar.tsx.ejs +272 -0
- package/hedhog/frontend/app/_components/mobile-calendar.tsx.ejs +277 -0
- package/hedhog/frontend/app/_lib/editor/canvasInstance.ts.ejs +48 -0
- package/hedhog/frontend/app/_lib/editor/pctHelpers.ts.ejs +50 -0
- package/hedhog/frontend/app/_lib/editor/templateSerializer.ts.ejs +268 -0
- package/hedhog/frontend/app/_lib/editor/types.ts.ejs +94 -0
- package/hedhog/frontend/app/_lib/store/useTemplateStore.ts.ejs +284 -0
- package/hedhog/frontend/app/certificates/issued/page.tsx.ejs +638 -0
- package/hedhog/frontend/app/certificates/models/CanvasStage.tsx.ejs +916 -0
- package/hedhog/frontend/app/certificates/models/LeftPanel.tsx.ejs +200 -0
- package/hedhog/frontend/app/certificates/models/RightPanel.tsx.ejs +769 -0
- package/hedhog/frontend/app/certificates/models/TemplateEditorPage.tsx.ejs +104 -0
- package/hedhog/frontend/app/certificates/models/TopBar.tsx.ejs +354 -0
- package/hedhog/frontend/app/certificates/models/editor/page.tsx.ejs +5 -0
- package/hedhog/frontend/app/certificates/models/page.tsx.ejs +883 -0
- package/hedhog/frontend/app/classes/[id]/_components/event-summary-popover.tsx.ejs +279 -0
- package/hedhog/frontend/app/classes/[id]/_components/quick-create-session-popover.tsx.ejs +1027 -0
- package/hedhog/frontend/app/classes/[id]/page.tsx.ejs +3130 -993
- package/hedhog/frontend/app/classes/page.tsx.ejs +2731 -759
- package/hedhog/frontend/app/courses/[id]/_components/CourseCertificateCard.tsx.ejs +80 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseClassificationCard.tsx.ejs +226 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseContentCard.tsx.ejs +71 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseDangerZoneCard.tsx.ejs +42 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseFlagsCard.tsx.ejs +111 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseMainInfoCard.tsx.ejs +113 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseMediaCard.tsx.ejs +215 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseMultiEntityPicker.tsx.ejs +236 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseRelationsCard.tsx.ejs +141 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseSectionCard.tsx.ejs +57 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseSummaryCard.tsx.ejs +60 -0
- package/hedhog/frontend/app/courses/[id]/_components/course-edit-types.ts.ejs +33 -0
- package/hedhog/frontend/app/courses/[id]/page.tsx.ejs +933 -1103
- package/hedhog/frontend/app/courses/[id]/structure/page.tsx.ejs +699 -117
- package/hedhog/frontend/app/courses/page.tsx.ejs +1018 -1042
- package/hedhog/frontend/app/enterprise/[id]/page.tsx.ejs +317 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-activity-panel.tsx.ejs +88 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-admin-create-sheet.tsx.ejs +318 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-administrators-tab.tsx.ejs +332 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-class-create-sheet.tsx.ejs +58 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-classes-tab.tsx.ejs +390 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-company-identity-card.tsx.ejs +112 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-course-create-sheet.tsx.ejs +183 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-courses-tab.tsx.ejs +363 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-detail-constants.ts.ejs +88 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-detail-sheet.tsx.ejs +548 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-detail-utils.ts.ejs +33 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-mocks.ts.ejs +277 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-person-picker.ts.ejs +31 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-progress-bar.tsx.ejs +21 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-related-tab.tsx.ejs +224 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-sheet.tsx.ejs +397 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-student-create-sheet.tsx.ejs +167 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-students-tab.tsx.ejs +267 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-system-user-picker.ts.ejs +42 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-types.ts.ejs +96 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-user-create-sheet.tsx.ejs +207 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-user-distribution-chart.tsx.ejs +149 -0
- package/hedhog/frontend/app/enterprise/page.tsx.ejs +596 -0
- package/hedhog/frontend/app/evaluations/page.tsx.ejs +1250 -0
- package/hedhog/frontend/app/exams/[id]/attempt/page.tsx.ejs +642 -196
- package/hedhog/frontend/app/exams/[id]/page.tsx.ejs +11 -0
- package/hedhog/frontend/app/exams/[id]/questions/page.tsx.ejs +1316 -436
- package/hedhog/frontend/app/exams/page.tsx.ejs +799 -546
- package/hedhog/frontend/app/layout.tsx.ejs +5 -0
- package/hedhog/frontend/app/page.tsx.ejs +3 -1220
- package/hedhog/frontend/app/reports/courses/page.tsx.ejs +843 -0
- package/hedhog/frontend/app/reports/dashboard/page.tsx.ejs +890 -0
- package/hedhog/frontend/app/reports/page.tsx.ejs +802 -808
- package/hedhog/frontend/app/reports/students/page.tsx.ejs +772 -0
- package/hedhog/frontend/app/training/page.tsx.ejs +1873 -628
- package/hedhog/frontend/messages/en.json +1606 -111
- package/hedhog/frontend/messages/pt.json +1636 -134
- package/hedhog/frontend/widgets/active-classes-kpi.tsx.ejs +74 -0
- package/hedhog/frontend/widgets/active-courses-kpi.tsx.ejs +74 -0
- package/hedhog/frontend/widgets/approval-rate-kpi.tsx.ejs +81 -0
- package/hedhog/frontend/widgets/category-distribution-chart.tsx.ejs +119 -0
- package/hedhog/frontend/widgets/class-calendar.tsx.ejs +440 -0
- package/hedhog/frontend/widgets/completion-rate-kpi.tsx.ejs +81 -0
- package/hedhog/frontend/widgets/engagement-chart.tsx.ejs +120 -0
- package/hedhog/frontend/widgets/footer-summary.tsx.ejs +80 -0
- package/hedhog/frontend/widgets/issued-certificates-kpi.tsx.ejs +74 -0
- package/hedhog/frontend/widgets/latest-enrollments.tsx.ejs +166 -0
- package/hedhog/frontend/widgets/student-growth-chart.tsx.ejs +89 -0
- package/hedhog/frontend/widgets/top-courses-chart.tsx.ejs +104 -0
- package/hedhog/frontend/widgets/total-students-kpi.tsx.ejs +78 -0
- package/hedhog/frontend/widgets/upcoming-classes.tsx.ejs +152 -0
- package/hedhog/table/course.yaml +19 -1
- package/hedhog/table/course_class_group.yaml +8 -0
- package/hedhog/table/course_class_session.yaml +33 -0
- package/hedhog/table/course_instructor.yaml +27 -0
- package/hedhog/table/enterprise.yaml +29 -0
- package/hedhog/table/enterprise_class_group.yaml +20 -0
- package/hedhog/table/enterprise_course.yaml +23 -0
- package/hedhog/table/enterprise_student.yaml +24 -0
- package/hedhog/table/enterprise_user.yaml +35 -0
- package/hedhog/table/instructor_qualification.yaml +26 -0
- package/hedhog/table/instructor_qualification_assignment.yaml +22 -0
- package/hedhog/table/question.yaml +6 -0
- package/package.json +6 -6
- package/src/certificate/certificate.controller.ts +83 -0
- package/src/certificate/certificate.module.ts +13 -0
- package/src/certificate/certificate.service.ts +413 -0
- package/src/certificate/dto/create-certificate-template.dto.ts +25 -0
- package/src/certificate/dto/update-certificate-template.dto.ts +6 -0
- package/src/class-group/class-group.controller.ts +189 -0
- package/src/class-group/class-group.module.ts +12 -0
- package/src/class-group/class-group.service.ts +1802 -0
- package/src/class-group/dto/create-class-group.dto.ts +139 -0
- package/src/class-group/dto/create-session.dto.ts +102 -0
- package/src/class-group/dto/enrollment.dto.ts +70 -0
- package/src/class-group/dto/update-class-group.dto.ts +4 -0
- package/src/class-group/dto/update-session.dto.ts +9 -0
- package/src/course/course-structure.controller.ts +85 -0
- package/src/course/course-structure.service.ts +525 -0
- package/src/course/course.controller.ts +69 -0
- package/src/course/course.module.ts +15 -0
- package/src/course/course.service.ts +920 -0
- package/src/course/dto/create-course-structure-lesson.dto.ts +97 -0
- package/src/course/dto/create-course-structure-session.dto.ts +22 -0
- package/src/course/dto/create-course.dto.ts +111 -0
- package/src/course/dto/update-course-structure-lesson.dto.ts +6 -0
- package/src/course/dto/update-course-structure-session.dto.ts +6 -0
- package/src/course/dto/update-course.dto.ts +4 -0
- package/src/dashboard/dashboard.controller.ts +14 -0
- package/src/dashboard/dashboard.module.ts +12 -0
- package/src/dashboard/dashboard.service.ts +726 -0
- package/src/enterprise/dto/add-enterprise-class-group.dto.ts +7 -0
- package/src/enterprise/dto/add-enterprise-course.dto.ts +11 -0
- package/src/enterprise/dto/add-enterprise-student.dto.ts +16 -0
- package/src/enterprise/dto/add-enterprise-user.dto.ts +23 -0
- package/src/enterprise/dto/create-enterprise.dto.ts +41 -0
- package/src/enterprise/dto/update-enterprise-student.dto.ts +7 -0
- package/src/enterprise/dto/update-enterprise-user.dto.ts +11 -0
- package/src/enterprise/dto/update-enterprise.dto.ts +4 -0
- package/src/enterprise/enterprise.controller.ts +233 -0
- package/src/enterprise/enterprise.module.ts +12 -0
- package/src/enterprise/enterprise.service.ts +712 -0
- package/src/evaluation/evaluation.controller.ts +44 -0
- package/src/evaluation/evaluation.module.ts +12 -0
- package/src/evaluation/evaluation.service.ts +394 -0
- package/src/exam/dto/create-exam-question.dto.ts +103 -0
- package/src/exam/dto/create-exam.dto.ts +41 -0
- package/src/exam/dto/reorder-exam-questions.dto.ts +8 -0
- package/src/exam/dto/save-exam-attempt-answers.dto.ts +55 -0
- package/src/exam/dto/start-exam-attempt.dto.ts +8 -0
- package/src/exam/dto/submit-exam-attempt.dto.ts +8 -0
- package/src/exam/dto/update-exam-question.dto.ts +4 -0
- package/src/exam/dto/update-exam.dto.ts +4 -0
- package/src/exam/exam-attempt.controller.ts +65 -0
- package/src/exam/exam-attempt.service.ts +1008 -0
- package/src/exam/exam.controller.ts +102 -0
- package/src/exam/exam.module.ts +14 -0
- package/src/exam/exam.service.ts +784 -0
- package/src/index.ts +29 -0
- package/src/instructor/dto/create-instructor.dto.ts +43 -0
- package/src/instructor/dto/update-instructor.dto.ts +38 -0
- package/src/instructor/instructor.controller.ts +73 -0
- package/src/instructor/instructor.module.ts +12 -0
- package/src/instructor/instructor.service.ts +646 -0
- package/src/lms.module.ts +36 -4
- package/src/reports/reports.controller.ts +14 -0
- package/src/reports/reports.module.ts +12 -0
- package/src/reports/reports.service.ts +485 -0
- package/src/training/dto/create-training.dto.ts +81 -0
- package/src/training/dto/update-training.dto.ts +4 -0
- package/src/training/training.controller.ts +68 -0
- package/src/training/training.module.ts +12 -0
- package/src/training/training.service.ts +574 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
|
|
4
|
+
import { Badge } from '@/components/ui/badge';
|
|
5
|
+
import { Button } from '@/components/ui/button';
|
|
6
|
+
import {
|
|
7
|
+
Select,
|
|
8
|
+
SelectContent,
|
|
9
|
+
SelectItem,
|
|
10
|
+
SelectTrigger,
|
|
11
|
+
SelectValue,
|
|
12
|
+
} from '@/components/ui/select';
|
|
13
|
+
import {
|
|
14
|
+
Table,
|
|
15
|
+
TableBody,
|
|
16
|
+
TableCell,
|
|
17
|
+
TableHead,
|
|
18
|
+
TableHeader,
|
|
19
|
+
TableRow,
|
|
20
|
+
} from '@/components/ui/table';
|
|
21
|
+
import { formatDate } from '@/lib/format-date';
|
|
22
|
+
import { useApp, useQuery } from '@hed-hog/next-app-provider';
|
|
23
|
+
import { CalendarDays, SquareArrowOutUpRight, Trash2 } from 'lucide-react';
|
|
24
|
+
import { useRouter } from 'next/navigation';
|
|
25
|
+
import { useCallback, useState } from 'react';
|
|
26
|
+
import { toast } from 'sonner';
|
|
27
|
+
import { EnterpriseClassCreateSheet } from './enterprise-class-create-sheet';
|
|
28
|
+
import {
|
|
29
|
+
CLASS_STATUS_LABEL,
|
|
30
|
+
CLASS_STATUS_VARIANT,
|
|
31
|
+
} from './enterprise-detail-constants';
|
|
32
|
+
import { getAvatarColor, getInitials } from './enterprise-detail-utils';
|
|
33
|
+
import { RelatedTabLayout } from './enterprise-related-tab';
|
|
34
|
+
import type {
|
|
35
|
+
EnterpriseClass,
|
|
36
|
+
EnterpriseClassStatus,
|
|
37
|
+
} from './enterprise-types';
|
|
38
|
+
|
|
39
|
+
const CLASSES_PAGE_SIZE_DEFAULT = 6;
|
|
40
|
+
|
|
41
|
+
async function loadClassGroupOptions(
|
|
42
|
+
request: ReturnType<typeof useApp>['request'],
|
|
43
|
+
args: { page: number; pageSize: number; search: string }
|
|
44
|
+
) {
|
|
45
|
+
const params = new URLSearchParams({
|
|
46
|
+
page: String(args.page),
|
|
47
|
+
pageSize: String(args.pageSize),
|
|
48
|
+
search: args.search,
|
|
49
|
+
});
|
|
50
|
+
const res = await request<{
|
|
51
|
+
data: Array<{
|
|
52
|
+
id: number;
|
|
53
|
+
code: string | null;
|
|
54
|
+
title: string | null;
|
|
55
|
+
courseTitle: string | null;
|
|
56
|
+
startDate: string | null;
|
|
57
|
+
endDate: string | null;
|
|
58
|
+
capacity: number | null;
|
|
59
|
+
status: string;
|
|
60
|
+
deliveryMode: string | null;
|
|
61
|
+
}>;
|
|
62
|
+
page: number;
|
|
63
|
+
lastPage: number;
|
|
64
|
+
}>({
|
|
65
|
+
url: `/lms/classes?${params}`,
|
|
66
|
+
method: 'GET',
|
|
67
|
+
});
|
|
68
|
+
const data = res.data ?? res;
|
|
69
|
+
return {
|
|
70
|
+
items: (data.data ?? []).map((c) => ({
|
|
71
|
+
id: c.id,
|
|
72
|
+
courseClassGroupId: c.id,
|
|
73
|
+
code: c.code ?? null,
|
|
74
|
+
title: c.title ?? null,
|
|
75
|
+
courseTitle: c.courseTitle ?? null,
|
|
76
|
+
startDate: c.startDate ?? null,
|
|
77
|
+
endDate: c.endDate ?? null,
|
|
78
|
+
capacity: c.capacity ?? null,
|
|
79
|
+
enrolledCount: 0,
|
|
80
|
+
status: c.status ?? 'open',
|
|
81
|
+
deliveryMode: c.deliveryMode ?? null,
|
|
82
|
+
})) as EnterpriseClass[],
|
|
83
|
+
hasMore: data.page < data.lastPage,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function ClassesTab({
|
|
88
|
+
enterpriseId,
|
|
89
|
+
onMutate,
|
|
90
|
+
}: {
|
|
91
|
+
enterpriseId: number;
|
|
92
|
+
onMutate?: () => void;
|
|
93
|
+
}) {
|
|
94
|
+
const router = useRouter();
|
|
95
|
+
const { request, currentLocaleCode, getSettingValue } = useApp();
|
|
96
|
+
|
|
97
|
+
const [search, setSearch] = useState('');
|
|
98
|
+
const [statusFilter, setStatusFilter] = useState<
|
|
99
|
+
'all' | EnterpriseClassStatus
|
|
100
|
+
>('all');
|
|
101
|
+
const [page, setPage] = useState(1);
|
|
102
|
+
const [pageSize, setPageSize] = useState(CLASSES_PAGE_SIZE_DEFAULT);
|
|
103
|
+
const [pickerValue, setPickerValue] = useState<string | number | null>(null);
|
|
104
|
+
const [pickerClass, setPickerClass] = useState<EnterpriseClass | null>(null);
|
|
105
|
+
const [createSheetOpen, setCreateSheetOpen] = useState(false);
|
|
106
|
+
|
|
107
|
+
const loadPickerOptions = useCallback(
|
|
108
|
+
(args: { page: number; pageSize: number; search: string }) =>
|
|
109
|
+
loadClassGroupOptions(request, args),
|
|
110
|
+
[request]
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const queryParams = new URLSearchParams({
|
|
114
|
+
page: String(page),
|
|
115
|
+
pageSize: String(pageSize),
|
|
116
|
+
search,
|
|
117
|
+
...(statusFilter !== 'all' ? { status: statusFilter } : {}),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const { data, refetch } = useQuery({
|
|
121
|
+
queryKey: [
|
|
122
|
+
'enterprise-classes',
|
|
123
|
+
enterpriseId,
|
|
124
|
+
page,
|
|
125
|
+
pageSize,
|
|
126
|
+
search,
|
|
127
|
+
statusFilter,
|
|
128
|
+
],
|
|
129
|
+
queryFn: async () => {
|
|
130
|
+
const res = await request<any>({
|
|
131
|
+
url: `/lms/enterprise/${enterpriseId}/classes?${queryParams}`,
|
|
132
|
+
method: 'GET',
|
|
133
|
+
});
|
|
134
|
+
return (res as any).data ?? res;
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const classes: EnterpriseClass[] = data?.data ?? [];
|
|
139
|
+
const total: number = data?.total ?? 0;
|
|
140
|
+
|
|
141
|
+
async function handleRemove(classGroupId: number) {
|
|
142
|
+
try {
|
|
143
|
+
await request({
|
|
144
|
+
url: `/lms/enterprise/${enterpriseId}/classes/${classGroupId}`,
|
|
145
|
+
method: 'DELETE',
|
|
146
|
+
});
|
|
147
|
+
toast.success('Class removed from enterprise.');
|
|
148
|
+
refetch();
|
|
149
|
+
onMutate?.();
|
|
150
|
+
} catch {
|
|
151
|
+
toast.error('Failed to remove class.');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function handleAdd() {
|
|
156
|
+
if (!pickerClass) return;
|
|
157
|
+
try {
|
|
158
|
+
await request({
|
|
159
|
+
url: `/lms/enterprise/${enterpriseId}/classes`,
|
|
160
|
+
method: 'POST',
|
|
161
|
+
data: {
|
|
162
|
+
course_class_group_id:
|
|
163
|
+
pickerClass.courseClassGroupId ?? pickerClass.id,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
setPickerValue(null);
|
|
167
|
+
setPickerClass(null);
|
|
168
|
+
refetch();
|
|
169
|
+
onMutate?.();
|
|
170
|
+
} catch {
|
|
171
|
+
toast.error('Failed to add class.');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<>
|
|
177
|
+
<RelatedTabLayout<EnterpriseClass>
|
|
178
|
+
search={search}
|
|
179
|
+
onSearchChange={(v) => {
|
|
180
|
+
setSearch(v);
|
|
181
|
+
setPage(1);
|
|
182
|
+
}}
|
|
183
|
+
searchPlaceholder="Search by code or course..."
|
|
184
|
+
filters={
|
|
185
|
+
<Select
|
|
186
|
+
value={statusFilter}
|
|
187
|
+
onValueChange={(v) => {
|
|
188
|
+
setStatusFilter(v as 'all' | EnterpriseClassStatus);
|
|
189
|
+
setPage(1);
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<SelectTrigger className="w-44">
|
|
193
|
+
<SelectValue placeholder="All statuses" />
|
|
194
|
+
</SelectTrigger>
|
|
195
|
+
<SelectContent>
|
|
196
|
+
<SelectItem value="all">All statuses</SelectItem>
|
|
197
|
+
<SelectItem value="open">Open</SelectItem>
|
|
198
|
+
<SelectItem value="ongoing">Ongoing</SelectItem>
|
|
199
|
+
<SelectItem value="completed">Completed</SelectItem>
|
|
200
|
+
<SelectItem value="cancelled">Cancelled</SelectItem>
|
|
201
|
+
</SelectContent>
|
|
202
|
+
</Select>
|
|
203
|
+
}
|
|
204
|
+
pickerPlaceholder="Select a class..."
|
|
205
|
+
pickerEntityLabel="class"
|
|
206
|
+
pickerValue={pickerValue}
|
|
207
|
+
onPickerChange={(value, option) => {
|
|
208
|
+
setPickerValue(value);
|
|
209
|
+
setPickerClass(option);
|
|
210
|
+
}}
|
|
211
|
+
loadPickerOptions={loadPickerOptions}
|
|
212
|
+
getPickerOptionValue={(c) => c.courseClassGroupId ?? c.id}
|
|
213
|
+
getPickerOptionLabel={(c) => c.code ?? c.title ?? String(c.id)}
|
|
214
|
+
getPickerOptionDescription={(c) => c.courseTitle ?? undefined}
|
|
215
|
+
renderPickerOption={({ option: c }) => (
|
|
216
|
+
<div className="flex items-center gap-2 min-w-0">
|
|
217
|
+
<Avatar
|
|
218
|
+
className={`size-7 shrink-0 rounded-lg ${getAvatarColor(c.courseTitle ?? '').bg}`}
|
|
219
|
+
>
|
|
220
|
+
<AvatarFallback
|
|
221
|
+
className={`rounded-lg text-xs font-semibold ${getAvatarColor(c.courseTitle ?? '').bg} ${getAvatarColor(c.courseTitle ?? '').text}`}
|
|
222
|
+
>
|
|
223
|
+
{getInitials(c.courseTitle ?? c.code ?? '')}
|
|
224
|
+
</AvatarFallback>
|
|
225
|
+
</Avatar>
|
|
226
|
+
<div className="min-w-0">
|
|
227
|
+
<div className="truncate font-mono text-sm">
|
|
228
|
+
{c.code ?? c.title ?? '—'}
|
|
229
|
+
</div>
|
|
230
|
+
{c.courseTitle && (
|
|
231
|
+
<div className="truncate text-xs text-muted-foreground">
|
|
232
|
+
{c.courseTitle}
|
|
233
|
+
</div>
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
)}
|
|
238
|
+
onCreateNew={() => setCreateSheetOpen(true)}
|
|
239
|
+
createLabel="Create new class"
|
|
240
|
+
onAdd={handleAdd}
|
|
241
|
+
addLabel="Add"
|
|
242
|
+
addDisabled={!pickerClass}
|
|
243
|
+
currentPage={page}
|
|
244
|
+
pageSize={pageSize}
|
|
245
|
+
totalItems={total}
|
|
246
|
+
onPageChange={setPage}
|
|
247
|
+
onPageSizeChange={(s) => {
|
|
248
|
+
setPageSize(s);
|
|
249
|
+
setPage(1);
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
{classes.length === 0 ? (
|
|
253
|
+
<div className="flex flex-col items-center justify-center py-16 text-center">
|
|
254
|
+
<CalendarDays className="mb-4 h-10 w-10 text-muted-foreground/30" />
|
|
255
|
+
<p className="text-sm font-medium text-muted-foreground">
|
|
256
|
+
No classes found.
|
|
257
|
+
</p>
|
|
258
|
+
<p className="mt-1 text-xs text-muted-foreground/60">
|
|
259
|
+
Adjust the search or status filter to see results.
|
|
260
|
+
</p>
|
|
261
|
+
</div>
|
|
262
|
+
) : (
|
|
263
|
+
<div className="rounded-lg border border-border/60">
|
|
264
|
+
<Table>
|
|
265
|
+
<TableHeader>
|
|
266
|
+
<TableRow>
|
|
267
|
+
<TableHead>Class</TableHead>
|
|
268
|
+
<TableHead>Status</TableHead>
|
|
269
|
+
<TableHead>Period</TableHead>
|
|
270
|
+
<TableHead className="text-center">Capacity</TableHead>
|
|
271
|
+
<TableHead className="w-10" />
|
|
272
|
+
</TableRow>
|
|
273
|
+
</TableHeader>
|
|
274
|
+
<TableBody>
|
|
275
|
+
{classes.map((cls) => (
|
|
276
|
+
<TableRow
|
|
277
|
+
key={cls.id}
|
|
278
|
+
className="cursor-pointer"
|
|
279
|
+
onClick={() =>
|
|
280
|
+
router.push(
|
|
281
|
+
`/lms/classes/${cls.courseClassGroupId ?? cls.id}`
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
>
|
|
285
|
+
<TableCell>
|
|
286
|
+
<div className="flex items-center gap-3">
|
|
287
|
+
<Avatar
|
|
288
|
+
className={`size-8 rounded-lg ${getAvatarColor(cls.courseTitle ?? '').bg}`}
|
|
289
|
+
>
|
|
290
|
+
<AvatarFallback
|
|
291
|
+
className={`rounded-lg text-xs font-semibold ${getAvatarColor(cls.courseTitle ?? '').bg} ${getAvatarColor(cls.courseTitle ?? '').text}`}
|
|
292
|
+
>
|
|
293
|
+
{getInitials(cls.courseTitle ?? cls.code ?? '')}
|
|
294
|
+
</AvatarFallback>
|
|
295
|
+
</Avatar>
|
|
296
|
+
<div className="min-w-0">
|
|
297
|
+
<p className="font-mono text-sm">
|
|
298
|
+
{cls.code ?? cls.title ?? '—'}
|
|
299
|
+
</p>
|
|
300
|
+
<p className="truncate text-xs text-muted-foreground">
|
|
301
|
+
{cls.courseTitle ?? '—'}
|
|
302
|
+
</p>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
</TableCell>
|
|
306
|
+
<TableCell>
|
|
307
|
+
<Badge
|
|
308
|
+
variant={
|
|
309
|
+
CLASS_STATUS_VARIANT[
|
|
310
|
+
cls.status as EnterpriseClassStatus
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
>
|
|
314
|
+
{CLASS_STATUS_LABEL[
|
|
315
|
+
cls.status as EnterpriseClassStatus
|
|
316
|
+
] ?? cls.status}
|
|
317
|
+
</Badge>
|
|
318
|
+
</TableCell>
|
|
319
|
+
<TableCell className="text-sm text-muted-foreground">
|
|
320
|
+
{cls.startDate
|
|
321
|
+
? formatDate(
|
|
322
|
+
cls.startDate,
|
|
323
|
+
getSettingValue,
|
|
324
|
+
currentLocaleCode
|
|
325
|
+
)
|
|
326
|
+
: '—'}
|
|
327
|
+
{' — '}
|
|
328
|
+
{cls.endDate
|
|
329
|
+
? formatDate(
|
|
330
|
+
cls.endDate,
|
|
331
|
+
getSettingValue,
|
|
332
|
+
currentLocaleCode
|
|
333
|
+
)
|
|
334
|
+
: '—'}
|
|
335
|
+
</TableCell>
|
|
336
|
+
<TableCell className="text-center text-sm">
|
|
337
|
+
{cls.capacity ?? (
|
|
338
|
+
<span className="text-muted-foreground">—</span>
|
|
339
|
+
)}
|
|
340
|
+
</TableCell>
|
|
341
|
+
<TableCell
|
|
342
|
+
className="flex items-center gap-1"
|
|
343
|
+
onClick={(e) => e.stopPropagation()}
|
|
344
|
+
>
|
|
345
|
+
<Button
|
|
346
|
+
variant="ghost"
|
|
347
|
+
size="icon"
|
|
348
|
+
className="h-8 w-8"
|
|
349
|
+
onClick={() =>
|
|
350
|
+
router.push(
|
|
351
|
+
`/lms/classes/${cls.courseClassGroupId ?? cls.id}`
|
|
352
|
+
)
|
|
353
|
+
}
|
|
354
|
+
>
|
|
355
|
+
<SquareArrowOutUpRight className="h-4 w-4" />
|
|
356
|
+
</Button>
|
|
357
|
+
<Button
|
|
358
|
+
variant="ghost"
|
|
359
|
+
size="icon"
|
|
360
|
+
className="h-8 w-8 text-destructive hover:text-destructive"
|
|
361
|
+
onClick={() =>
|
|
362
|
+
handleRemove(
|
|
363
|
+
cls.courseClassGroupId ?? (cls.id as number)
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
>
|
|
367
|
+
<Trash2 className="h-4 w-4" />
|
|
368
|
+
</Button>
|
|
369
|
+
</TableCell>
|
|
370
|
+
</TableRow>
|
|
371
|
+
))}
|
|
372
|
+
</TableBody>
|
|
373
|
+
</Table>
|
|
374
|
+
</div>
|
|
375
|
+
)}
|
|
376
|
+
</RelatedTabLayout>
|
|
377
|
+
|
|
378
|
+
<EnterpriseClassCreateSheet
|
|
379
|
+
open={createSheetOpen}
|
|
380
|
+
onOpenChange={setCreateSheetOpen}
|
|
381
|
+
enterpriseId={enterpriseId}
|
|
382
|
+
onCreated={() => {
|
|
383
|
+
setCreateSheetOpen(false);
|
|
384
|
+
refetch();
|
|
385
|
+
onMutate?.();
|
|
386
|
+
}}
|
|
387
|
+
/>
|
|
388
|
+
</>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
|
|
4
|
+
import { Badge } from '@/components/ui/badge';
|
|
5
|
+
import { Card, CardContent } from '@/components/ui/card';
|
|
6
|
+
import { formatDate } from '@/lib/format-date';
|
|
7
|
+
import { useApp } from '@hed-hog/next-app-provider';
|
|
8
|
+
import { CalendarDays, CheckCircle2, Globe, Link2, Pencil } from 'lucide-react';
|
|
9
|
+
import { useTranslations } from 'next-intl';
|
|
10
|
+
import { STATUS_LABEL, STATUS_VARIANT } from './enterprise-detail-constants';
|
|
11
|
+
import { getAvatarColor, getInitials } from './enterprise-detail-utils';
|
|
12
|
+
import type { EnterpriseAccount } from './enterprise-types';
|
|
13
|
+
|
|
14
|
+
export function CompanyIdentityCard({
|
|
15
|
+
account,
|
|
16
|
+
onEditClick,
|
|
17
|
+
}: {
|
|
18
|
+
account: EnterpriseAccount;
|
|
19
|
+
onEditClick: () => void;
|
|
20
|
+
}) {
|
|
21
|
+
const { bg, text } = getAvatarColor(account.name);
|
|
22
|
+
const { currentLocaleCode, getSettingValue } = useApp();
|
|
23
|
+
const t = useTranslations('lms.EnterpriseDetailPage');
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Card
|
|
27
|
+
className="cursor-pointer border-border/60 transition-all hover:border-primary/40 hover:shadow-md"
|
|
28
|
+
onClick={onEditClick}
|
|
29
|
+
title={t('identityCard.editTooltip')}
|
|
30
|
+
>
|
|
31
|
+
<CardContent className="p-5">
|
|
32
|
+
<div className="flex flex-col gap-4 sm:flex-row sm:items-start">
|
|
33
|
+
{/* Avatar */}
|
|
34
|
+
<Avatar className={`size-16 shrink-0 rounded-2xl ${bg}`}>
|
|
35
|
+
<AvatarFallback
|
|
36
|
+
className={`rounded-2xl text-xl font-bold ${bg} ${text}`}
|
|
37
|
+
>
|
|
38
|
+
{getInitials(account.name)}
|
|
39
|
+
</AvatarFallback>
|
|
40
|
+
</Avatar>
|
|
41
|
+
|
|
42
|
+
{/* Identity body */}
|
|
43
|
+
<div className="min-w-0 flex-1 space-y-2">
|
|
44
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
45
|
+
<h2 className="text-lg font-semibold leading-tight">
|
|
46
|
+
{account.name}
|
|
47
|
+
</h2>
|
|
48
|
+
<Badge variant={STATUS_VARIANT[account.status]}>
|
|
49
|
+
{STATUS_LABEL[account.status]}
|
|
50
|
+
</Badge>
|
|
51
|
+
{account.portalEnabled && (
|
|
52
|
+
<Badge
|
|
53
|
+
variant="outline"
|
|
54
|
+
className="border-blue-500/20 bg-blue-500/10 text-blue-600"
|
|
55
|
+
>
|
|
56
|
+
<Globe className="mr-1 h-3 w-3" />
|
|
57
|
+
Portal
|
|
58
|
+
</Badge>
|
|
59
|
+
)}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<p className="font-mono text-xs text-muted-foreground">
|
|
63
|
+
{account.slug}
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
<div className="flex flex-wrap items-center gap-x-5 gap-y-1 pt-1 text-xs text-muted-foreground">
|
|
67
|
+
{account.crmAccountId && account.crmAccountName && (
|
|
68
|
+
<span className="flex items-center gap-1">
|
|
69
|
+
<Link2 className="h-3.5 w-3.5 shrink-0" />
|
|
70
|
+
<span>
|
|
71
|
+
{t('identityCard.empresaLabel')}:{' '}
|
|
72
|
+
<span className="font-medium text-foreground">
|
|
73
|
+
{account.crmAccountName}
|
|
74
|
+
</span>
|
|
75
|
+
</span>
|
|
76
|
+
</span>
|
|
77
|
+
)}
|
|
78
|
+
<span className="flex items-center gap-1">
|
|
79
|
+
<CalendarDays className="h-3.5 w-3.5 shrink-0" />
|
|
80
|
+
<span>
|
|
81
|
+
{t('identityCard.createdLabel')}:{' '}
|
|
82
|
+
{formatDate(
|
|
83
|
+
account.createdAt,
|
|
84
|
+
getSettingValue,
|
|
85
|
+
currentLocaleCode
|
|
86
|
+
)}
|
|
87
|
+
</span>
|
|
88
|
+
</span>
|
|
89
|
+
<span className="flex items-center gap-1">
|
|
90
|
+
<CheckCircle2 className="h-3.5 w-3.5 shrink-0" />
|
|
91
|
+
<span>
|
|
92
|
+
{t('identityCard.updatedLabel')}:{' '}
|
|
93
|
+
{formatDate(
|
|
94
|
+
account.updatedAt,
|
|
95
|
+
getSettingValue,
|
|
96
|
+
currentLocaleCode
|
|
97
|
+
)}
|
|
98
|
+
</span>
|
|
99
|
+
</span>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
{/* Edit hint */}
|
|
104
|
+
<div className="flex shrink-0 items-center gap-1 self-start text-xs text-muted-foreground/40">
|
|
105
|
+
<Pencil className="h-3.5 w-3.5" />
|
|
106
|
+
<span>{t('identityCard.editHint')}</span>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</CardContent>
|
|
110
|
+
</Card>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useApp, useQuery } from '@hed-hog/next-app-provider';
|
|
4
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
5
|
+
import { useTranslations } from 'next-intl';
|
|
6
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { useForm } from 'react-hook-form';
|
|
8
|
+
import { toast } from 'sonner';
|
|
9
|
+
import {
|
|
10
|
+
CourseFormSheet,
|
|
11
|
+
DEFAULT_COURSE_FORM_VALUES,
|
|
12
|
+
getCourseSheetSchema,
|
|
13
|
+
type CourseCategoryOption,
|
|
14
|
+
type CourseSheetFormValues,
|
|
15
|
+
} from '../../_components/course-form-sheet';
|
|
16
|
+
|
|
17
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
function toApiLevel(level: CourseSheetFormValues['nivel']) {
|
|
20
|
+
if (level === 'iniciante') return 'beginner';
|
|
21
|
+
if (level === 'intermediario') return 'intermediate';
|
|
22
|
+
return 'advanced';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function toApiStatus(status: CourseSheetFormValues['status']) {
|
|
26
|
+
if (status === 'ativo') return 'published';
|
|
27
|
+
if (status === 'rascunho') return 'draft';
|
|
28
|
+
return 'archived';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getContrastColor(hex: string) {
|
|
32
|
+
const cleaned = hex.replace('#', '');
|
|
33
|
+
if (cleaned.length !== 6) return '#FFFFFF';
|
|
34
|
+
const r = parseInt(cleaned.slice(0, 2), 16);
|
|
35
|
+
const g = parseInt(cleaned.slice(2, 4), 16);
|
|
36
|
+
const b = parseInt(cleaned.slice(4, 6), 16);
|
|
37
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
38
|
+
return luminance > 0.6 ? '#111827' : '#FFFFFF';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type ApiCategory = {
|
|
42
|
+
id: number;
|
|
43
|
+
slug: string;
|
|
44
|
+
name: string;
|
|
45
|
+
status?: 'active' | 'inactive';
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type ApiCategoryList = {
|
|
49
|
+
data: ApiCategory[];
|
|
50
|
+
total: number;
|
|
51
|
+
page: number;
|
|
52
|
+
pageSize: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type ApiCreatedCourse = {
|
|
56
|
+
id: number;
|
|
57
|
+
title: string;
|
|
58
|
+
slug: string;
|
|
59
|
+
status: string;
|
|
60
|
+
level: string | null;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// ── Props ─────────────────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
export interface EnterpriseCourseCreateSheetProps {
|
|
66
|
+
open: boolean;
|
|
67
|
+
onOpenChange: (open: boolean) => void;
|
|
68
|
+
enterpriseId: number;
|
|
69
|
+
onCreated?: () => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ── Component ─────────────────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
export function EnterpriseCourseCreateSheet({
|
|
75
|
+
open,
|
|
76
|
+
onOpenChange,
|
|
77
|
+
enterpriseId,
|
|
78
|
+
onCreated,
|
|
79
|
+
}: EnterpriseCourseCreateSheetProps) {
|
|
80
|
+
const t = useTranslations('lms.CoursesPage');
|
|
81
|
+
const { request } = useApp();
|
|
82
|
+
const [saving, setSaving] = useState(false);
|
|
83
|
+
|
|
84
|
+
const form = useForm<CourseSheetFormValues>({
|
|
85
|
+
resolver: zodResolver(getCourseSheetSchema(t)),
|
|
86
|
+
defaultValues: DEFAULT_COURSE_FORM_VALUES,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Reset form when opening fresh
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (open) form.reset(DEFAULT_COURSE_FORM_VALUES);
|
|
92
|
+
}, [open, form]);
|
|
93
|
+
|
|
94
|
+
const { data: categoryListData, refetch: refetchCategories } =
|
|
95
|
+
useQuery<ApiCategoryList>({
|
|
96
|
+
queryKey: ['enterprise-course-create-categories'],
|
|
97
|
+
queryFn: async () => {
|
|
98
|
+
const res = await request<ApiCategoryList>({
|
|
99
|
+
url: '/category',
|
|
100
|
+
method: 'GET',
|
|
101
|
+
params: { page: 1, pageSize: 500, status: 'all' },
|
|
102
|
+
});
|
|
103
|
+
const payload = res.data as ApiCategoryList | ApiCategory[];
|
|
104
|
+
if (Array.isArray(payload)) {
|
|
105
|
+
return {
|
|
106
|
+
data: payload,
|
|
107
|
+
total: payload.length,
|
|
108
|
+
page: 1,
|
|
109
|
+
pageSize: payload.length,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return payload;
|
|
113
|
+
},
|
|
114
|
+
initialData: { data: [], total: 0, page: 1, pageSize: 500 },
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Load categories when sheet opens
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (open) void refetchCategories();
|
|
120
|
+
}, [open, refetchCategories]);
|
|
121
|
+
|
|
122
|
+
const categoryOptions = useMemo<CourseCategoryOption[]>(
|
|
123
|
+
() =>
|
|
124
|
+
(categoryListData?.data ?? [])
|
|
125
|
+
.filter((c) => !!c.slug)
|
|
126
|
+
.map((c) => ({ value: c.slug, label: c.name || c.slug }))
|
|
127
|
+
.sort((a, b) => a.label.localeCompare(b.label)),
|
|
128
|
+
[categoryListData]
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
async function onSubmit(data: CourseSheetFormValues) {
|
|
132
|
+
setSaving(true);
|
|
133
|
+
try {
|
|
134
|
+
const payload = {
|
|
135
|
+
slug: data.nomeInterno.trim(),
|
|
136
|
+
title: data.tituloComercial,
|
|
137
|
+
description: data.descricao,
|
|
138
|
+
level: toApiLevel(data.nivel),
|
|
139
|
+
status: toApiStatus(data.status),
|
|
140
|
+
categorySlugs: data.categorias,
|
|
141
|
+
primaryColor: data.primaryColor,
|
|
142
|
+
primaryContrastColor: getContrastColor(data.primaryColor),
|
|
143
|
+
secondaryColor: data.secondaryColor,
|
|
144
|
+
secondaryContrastColor: getContrastColor(data.secondaryColor),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const response = await request<ApiCreatedCourse>({
|
|
148
|
+
url: '/lms/courses',
|
|
149
|
+
method: 'POST',
|
|
150
|
+
data: payload,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const created = response.data;
|
|
154
|
+
|
|
155
|
+
await request({
|
|
156
|
+
url: `/lms/enterprise/${enterpriseId}/courses`,
|
|
157
|
+
method: 'POST',
|
|
158
|
+
data: { course_id: created.id },
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
toast.success(t('toasts.courseCreated'));
|
|
162
|
+
onCreated?.();
|
|
163
|
+
onOpenChange(false);
|
|
164
|
+
} catch {
|
|
165
|
+
toast.error('Não foi possível criar o curso.');
|
|
166
|
+
} finally {
|
|
167
|
+
setSaving(false);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<CourseFormSheet
|
|
173
|
+
open={open}
|
|
174
|
+
onOpenChange={onOpenChange}
|
|
175
|
+
editing={false}
|
|
176
|
+
saving={saving}
|
|
177
|
+
form={form}
|
|
178
|
+
onSubmit={onSubmit}
|
|
179
|
+
categories={categoryOptions}
|
|
180
|
+
t={t}
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
}
|