@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,548 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Badge } from '@/components/ui/badge';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
5
|
+
import { Card, CardContent } from '@/components/ui/card';
|
|
6
|
+
import { EntityPicker } from '@/components/ui/entity-picker';
|
|
7
|
+
import { KpiCardsGrid, type KpiCardItem } from '@/components/ui/kpi-cards-grid';
|
|
8
|
+
import { Separator } from '@/components/ui/separator';
|
|
9
|
+
import {
|
|
10
|
+
Sheet,
|
|
11
|
+
SheetContent,
|
|
12
|
+
SheetHeader,
|
|
13
|
+
SheetTitle,
|
|
14
|
+
} from '@/components/ui/sheet';
|
|
15
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
16
|
+
import { useApp } from '@hed-hog/next-app-provider';
|
|
17
|
+
import {
|
|
18
|
+
BookOpen,
|
|
19
|
+
Building2,
|
|
20
|
+
CalendarDays,
|
|
21
|
+
ExternalLink,
|
|
22
|
+
Globe,
|
|
23
|
+
Link2,
|
|
24
|
+
Pencil,
|
|
25
|
+
RefreshCw,
|
|
26
|
+
UserCheck,
|
|
27
|
+
} from 'lucide-react';
|
|
28
|
+
import { useTranslations } from 'next-intl';
|
|
29
|
+
import { useRouter } from 'next/navigation';
|
|
30
|
+
import { useEffect, useState } from 'react';
|
|
31
|
+
import { ActivityPanel } from './enterprise-activity-panel';
|
|
32
|
+
import { AdministratorsTab } from './enterprise-administrators-tab';
|
|
33
|
+
import { ClassesTab } from './enterprise-classes-tab';
|
|
34
|
+
import { CompanyIdentityCard } from './enterprise-company-identity-card';
|
|
35
|
+
import { CoursesTab } from './enterprise-courses-tab';
|
|
36
|
+
import { STATUS_LABEL, STATUS_VARIANT } from './enterprise-detail-constants';
|
|
37
|
+
import { EnterpriseSheet, type EnterpriseFormValues } from './enterprise-sheet';
|
|
38
|
+
import { StudentsTab } from './enterprise-students-tab';
|
|
39
|
+
import type { EnterpriseAccount } from './enterprise-types';
|
|
40
|
+
import { UserDistributionChart } from './enterprise-user-distribution-chart';
|
|
41
|
+
|
|
42
|
+
// ── Props ─────────────────────────────────────────────────────────────────────
|
|
43
|
+
|
|
44
|
+
export interface EnterpriseDetailSheetProps {
|
|
45
|
+
open: boolean;
|
|
46
|
+
onOpenChange: (open: boolean) => void;
|
|
47
|
+
account: EnterpriseAccount | null;
|
|
48
|
+
onAccountUpdate?: (updated: EnterpriseAccount) => void;
|
|
49
|
+
onDataChange?: () => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ── Component ─────────────────────────────────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
export function EnterpriseDetailSheet({
|
|
55
|
+
open,
|
|
56
|
+
onOpenChange,
|
|
57
|
+
account,
|
|
58
|
+
onAccountUpdate,
|
|
59
|
+
onDataChange,
|
|
60
|
+
}: EnterpriseDetailSheetProps) {
|
|
61
|
+
// Local mirror so saves refresh the sheet without closing it
|
|
62
|
+
const [currentAccount, setCurrentAccount] =
|
|
63
|
+
useState<EnterpriseAccount | null>(account);
|
|
64
|
+
const [editSheetOpen, setEditSheetOpen] = useState(false);
|
|
65
|
+
const [companyPickerOpen, setCompanyPickerOpen] = useState(false);
|
|
66
|
+
const [companyPickerValue, setCompanyPickerValue] = useState<
|
|
67
|
+
string | number | null
|
|
68
|
+
>(null);
|
|
69
|
+
const [savingCompany, setSavingCompany] = useState(false);
|
|
70
|
+
const { request } = useApp();
|
|
71
|
+
const router = useRouter();
|
|
72
|
+
const t = useTranslations('lms.EnterpriseDetailPage');
|
|
73
|
+
|
|
74
|
+
// Sync whenever the parent switches the account (e.g. clicking a different row)
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
setCurrentAccount(account);
|
|
77
|
+
}, [account]);
|
|
78
|
+
|
|
79
|
+
// Refetch full account when sheet opens so studentsCount / managersCount are populated
|
|
80
|
+
// (the list endpoint omits these counts; only getById computes them)
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!open || !account?.id) return;
|
|
83
|
+
request<EnterpriseAccount>({
|
|
84
|
+
url: `/lms/enterprise/${account.id}`,
|
|
85
|
+
method: 'GET',
|
|
86
|
+
})
|
|
87
|
+
.then((res) => {
|
|
88
|
+
const refreshed: EnterpriseAccount = (res as any).data ?? res;
|
|
89
|
+
setCurrentAccount(refreshed);
|
|
90
|
+
})
|
|
91
|
+
.catch(() => {
|
|
92
|
+
// keep the stale list-row data as fallback
|
|
93
|
+
});
|
|
94
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
|
+
}, [open, account?.id]);
|
|
96
|
+
|
|
97
|
+
async function handleInternalSave(_values: EnterpriseFormValues) {
|
|
98
|
+
if (!currentAccount) return;
|
|
99
|
+
try {
|
|
100
|
+
const res = await request<EnterpriseAccount>({
|
|
101
|
+
url: `/lms/enterprise/${currentAccount.id}`,
|
|
102
|
+
method: 'GET',
|
|
103
|
+
});
|
|
104
|
+
const refreshed: EnterpriseAccount = (res as any).data ?? res;
|
|
105
|
+
setCurrentAccount(refreshed);
|
|
106
|
+
onAccountUpdate?.(refreshed);
|
|
107
|
+
} catch {
|
|
108
|
+
// fallback: update local state optimistically without CRM name resolution
|
|
109
|
+
setCurrentAccount((prev) =>
|
|
110
|
+
prev
|
|
111
|
+
? {
|
|
112
|
+
...prev,
|
|
113
|
+
name: _values.name,
|
|
114
|
+
slug: _values.slug,
|
|
115
|
+
status: _values.status,
|
|
116
|
+
crmAccountId: _values.crmAccountId,
|
|
117
|
+
crmAccountName: prev.crmAccountName,
|
|
118
|
+
portalEnabled: _values.portalEnabled,
|
|
119
|
+
licenseLimit: _values.licenseLimit ?? null,
|
|
120
|
+
updatedAt: new Date().toISOString(),
|
|
121
|
+
}
|
|
122
|
+
: prev
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function handleTabMutate() {
|
|
128
|
+
onDataChange?.();
|
|
129
|
+
if (!currentAccount?.id) return;
|
|
130
|
+
try {
|
|
131
|
+
const res = await request<EnterpriseAccount>({
|
|
132
|
+
url: `/lms/enterprise/${currentAccount.id}`,
|
|
133
|
+
method: 'GET',
|
|
134
|
+
});
|
|
135
|
+
const refreshed: EnterpriseAccount = (res as any).data ?? res;
|
|
136
|
+
setCurrentAccount(refreshed);
|
|
137
|
+
onAccountUpdate?.(refreshed);
|
|
138
|
+
} catch {
|
|
139
|
+
// ignore — tab already reflects the mutation via its own refetch
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function handleCompanySave(newPersonId: number) {
|
|
144
|
+
if (!currentAccount?.id) return;
|
|
145
|
+
setSavingCompany(true);
|
|
146
|
+
try {
|
|
147
|
+
await request({
|
|
148
|
+
url: `/lms/enterprise/${currentAccount.id}`,
|
|
149
|
+
method: 'PATCH',
|
|
150
|
+
data: { crm_person_id: newPersonId },
|
|
151
|
+
});
|
|
152
|
+
setCompanyPickerOpen(false);
|
|
153
|
+
setCompanyPickerValue(null);
|
|
154
|
+
await handleTabMutate();
|
|
155
|
+
} catch {
|
|
156
|
+
// toast handled by caller
|
|
157
|
+
} finally {
|
|
158
|
+
setSavingCompany(false);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const kpiItems: KpiCardItem[] = currentAccount
|
|
163
|
+
? [
|
|
164
|
+
{
|
|
165
|
+
key: 'students',
|
|
166
|
+
title: t('kpis.students.label'),
|
|
167
|
+
value: currentAccount.studentsCount,
|
|
168
|
+
description: t('kpis.students.description'),
|
|
169
|
+
icon: UserCheck,
|
|
170
|
+
accentClassName:
|
|
171
|
+
'from-emerald-500/20 via-emerald-400/10 to-transparent',
|
|
172
|
+
iconContainerClassName: 'bg-emerald-50 text-emerald-600',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
key: 'classes',
|
|
176
|
+
title: t('kpis.contractedClasses.label'),
|
|
177
|
+
value: currentAccount.classesCount,
|
|
178
|
+
description: t('kpis.contractedClasses.description'),
|
|
179
|
+
icon: CalendarDays,
|
|
180
|
+
accentClassName:
|
|
181
|
+
'from-violet-500/20 via-violet-400/10 to-transparent',
|
|
182
|
+
iconContainerClassName: 'bg-violet-50 text-violet-600',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
key: 'courses',
|
|
186
|
+
title: t('kpis.courses.label'),
|
|
187
|
+
value: currentAccount.coursesCount,
|
|
188
|
+
description: t('kpis.courses.description'),
|
|
189
|
+
icon: BookOpen,
|
|
190
|
+
accentClassName: 'from-blue-500/20 via-cyan-500/10 to-transparent',
|
|
191
|
+
iconContainerClassName: 'bg-blue-50 text-blue-600',
|
|
192
|
+
},
|
|
193
|
+
]
|
|
194
|
+
: [];
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<>
|
|
198
|
+
{/* ── Detail Sheet ── */}
|
|
199
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
200
|
+
<SheetContent
|
|
201
|
+
side="right"
|
|
202
|
+
className="flex w-full flex-col gap-0 overflow-y-auto p-0 sm:max-w-5xl"
|
|
203
|
+
>
|
|
204
|
+
{currentAccount && (
|
|
205
|
+
<>
|
|
206
|
+
<SheetHeader className="flex flex-row items-center justify-between gap-4 border-b px-6 py-4">
|
|
207
|
+
<div className="flex items-center gap-3">
|
|
208
|
+
<SheetTitle className="text-base">
|
|
209
|
+
{currentAccount.name}
|
|
210
|
+
</SheetTitle>
|
|
211
|
+
<Badge variant={STATUS_VARIANT[currentAccount.status]}>
|
|
212
|
+
{STATUS_LABEL[currentAccount.status]}
|
|
213
|
+
</Badge>
|
|
214
|
+
</div>
|
|
215
|
+
</SheetHeader>
|
|
216
|
+
|
|
217
|
+
<div className="flex-1 px-6 py-4">
|
|
218
|
+
<Tabs defaultValue="overview">
|
|
219
|
+
<div className="flex justify-between">
|
|
220
|
+
<TabsList>
|
|
221
|
+
<TabsTrigger value="overview">
|
|
222
|
+
{t('tabs.overview')}
|
|
223
|
+
</TabsTrigger>
|
|
224
|
+
<TabsTrigger value="empresa">
|
|
225
|
+
{t('tabs.empresa')}
|
|
226
|
+
</TabsTrigger>
|
|
227
|
+
<TabsTrigger value="classes">
|
|
228
|
+
{t('tabs.classes')}
|
|
229
|
+
</TabsTrigger>
|
|
230
|
+
<TabsTrigger value="courses">
|
|
231
|
+
{t('tabs.courses')}
|
|
232
|
+
</TabsTrigger>
|
|
233
|
+
<TabsTrigger value="students">
|
|
234
|
+
{t('tabs.students')}
|
|
235
|
+
</TabsTrigger>
|
|
236
|
+
<TabsTrigger value="administrators">
|
|
237
|
+
{t('tabs.administrators')}
|
|
238
|
+
</TabsTrigger>
|
|
239
|
+
</TabsList>
|
|
240
|
+
<Button
|
|
241
|
+
variant="outline"
|
|
242
|
+
size="sm"
|
|
243
|
+
onClick={() => setEditSheetOpen(true)}
|
|
244
|
+
className="shrink-0"
|
|
245
|
+
>
|
|
246
|
+
<Pencil className="mr-2 h-4 w-4" />
|
|
247
|
+
{t('actions.edit')}
|
|
248
|
+
</Button>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
{/* ── Overview tab ── */}
|
|
252
|
+
<TabsContent value="overview" className="mt-5 space-y-5">
|
|
253
|
+
{/* Company identity card — click opens edit sheet */}
|
|
254
|
+
<CompanyIdentityCard
|
|
255
|
+
account={currentAccount}
|
|
256
|
+
onEditClick={() => setEditSheetOpen(true)}
|
|
257
|
+
/>
|
|
258
|
+
|
|
259
|
+
{/* KPI row */}
|
|
260
|
+
<KpiCardsGrid items={kpiItems} />
|
|
261
|
+
|
|
262
|
+
{/* Charts row */}
|
|
263
|
+
<div className="grid grid-cols-1 gap-5 lg:grid-cols-2">
|
|
264
|
+
<UserDistributionChart account={currentAccount} />
|
|
265
|
+
<ActivityPanel enterpriseId={currentAccount.id} />
|
|
266
|
+
</div>
|
|
267
|
+
</TabsContent>
|
|
268
|
+
|
|
269
|
+
{/* ── Empresa tab ── */}
|
|
270
|
+
<TabsContent value="empresa" className="mt-4 space-y-4">
|
|
271
|
+
{/* ── Linked company card ── */}
|
|
272
|
+
{currentAccount.crmAccountId &&
|
|
273
|
+
currentAccount.crmAccountName ? (
|
|
274
|
+
<Card className="border-border/60">
|
|
275
|
+
<CardContent className="p-5">
|
|
276
|
+
<div className="flex items-start justify-between gap-4">
|
|
277
|
+
<div className="flex items-center gap-4">
|
|
278
|
+
<div className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl border bg-muted/40">
|
|
279
|
+
<Building2 className="h-6 w-6 text-muted-foreground" />
|
|
280
|
+
</div>
|
|
281
|
+
<div>
|
|
282
|
+
<p className="text-base font-semibold leading-tight">
|
|
283
|
+
{currentAccount.crmAccount?.tradeName ||
|
|
284
|
+
currentAccount.crmAccountName}
|
|
285
|
+
</p>
|
|
286
|
+
{currentAccount.crmAccount?.tradeName &&
|
|
287
|
+
currentAccount.crmAccount.tradeName !==
|
|
288
|
+
currentAccount.crmAccountName && (
|
|
289
|
+
<p className="text-xs text-muted-foreground">
|
|
290
|
+
{currentAccount.crmAccountName}
|
|
291
|
+
</p>
|
|
292
|
+
)}
|
|
293
|
+
{currentAccount.crmAccount?.lifecycleStage && (
|
|
294
|
+
<Badge
|
|
295
|
+
variant="outline"
|
|
296
|
+
className="mt-1 text-[10px]"
|
|
297
|
+
>
|
|
298
|
+
{currentAccount.crmAccount.lifecycleStage}
|
|
299
|
+
</Badge>
|
|
300
|
+
)}
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
<Button
|
|
304
|
+
variant="outline"
|
|
305
|
+
size="sm"
|
|
306
|
+
onClick={() =>
|
|
307
|
+
router.push(
|
|
308
|
+
`/contact/accounts?id=${currentAccount.crmAccountId}`
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
className="shrink-0"
|
|
312
|
+
>
|
|
313
|
+
<ExternalLink className="mr-2 h-4 w-4" />
|
|
314
|
+
{t('empresa.openRecord')}
|
|
315
|
+
</Button>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
<Separator className="my-4" />
|
|
319
|
+
|
|
320
|
+
<dl className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
|
321
|
+
{currentAccount.crmAccount?.industry && (
|
|
322
|
+
<div>
|
|
323
|
+
<dt className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground">
|
|
324
|
+
{t('empresa.industry')}
|
|
325
|
+
</dt>
|
|
326
|
+
<dd className="mt-0.5 text-sm">
|
|
327
|
+
{currentAccount.crmAccount.industry}
|
|
328
|
+
</dd>
|
|
329
|
+
</div>
|
|
330
|
+
)}
|
|
331
|
+
{currentAccount.crmAccount?.website && (
|
|
332
|
+
<div>
|
|
333
|
+
<dt className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground">
|
|
334
|
+
{t('empresa.website')}
|
|
335
|
+
</dt>
|
|
336
|
+
<dd className="mt-0.5 text-sm">
|
|
337
|
+
<a
|
|
338
|
+
href={currentAccount.crmAccount.website}
|
|
339
|
+
target="_blank"
|
|
340
|
+
rel="noopener noreferrer"
|
|
341
|
+
className="flex items-center gap-1 text-primary hover:underline"
|
|
342
|
+
>
|
|
343
|
+
<Globe className="h-3 w-3" />
|
|
344
|
+
{currentAccount.crmAccount.website.replace(
|
|
345
|
+
/^https?:\/\//,
|
|
346
|
+
''
|
|
347
|
+
)}
|
|
348
|
+
</a>
|
|
349
|
+
</dd>
|
|
350
|
+
</div>
|
|
351
|
+
)}
|
|
352
|
+
<div>
|
|
353
|
+
<dt className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground">
|
|
354
|
+
{t('empresa.recordId')}
|
|
355
|
+
</dt>
|
|
356
|
+
<dd className="mt-0.5 font-mono text-sm">
|
|
357
|
+
#{currentAccount.crmAccountId}
|
|
358
|
+
</dd>
|
|
359
|
+
</div>
|
|
360
|
+
</dl>
|
|
361
|
+
|
|
362
|
+
<div className="mt-4 flex justify-end">
|
|
363
|
+
<Button
|
|
364
|
+
variant="ghost"
|
|
365
|
+
size="sm"
|
|
366
|
+
className="text-muted-foreground"
|
|
367
|
+
onClick={() => setCompanyPickerOpen((v) => !v)}
|
|
368
|
+
>
|
|
369
|
+
<RefreshCw className="mr-2 h-3.5 w-3.5" />
|
|
370
|
+
{t('empresa.changeCompany')}
|
|
371
|
+
</Button>
|
|
372
|
+
</div>
|
|
373
|
+
</CardContent>
|
|
374
|
+
</Card>
|
|
375
|
+
) : (
|
|
376
|
+
/* ── Empty state ── */
|
|
377
|
+
<div className="flex flex-col items-center justify-center py-10 text-center">
|
|
378
|
+
<div className="mb-4 text-muted-foreground/30">
|
|
379
|
+
<Link2 className="h-12 w-12" />
|
|
380
|
+
</div>
|
|
381
|
+
<p className="text-sm font-medium text-muted-foreground">
|
|
382
|
+
{t('empresa.emptyTitle')}
|
|
383
|
+
</p>
|
|
384
|
+
<p className="mt-1 max-w-xs text-xs text-muted-foreground/60">
|
|
385
|
+
{t('empresa.emptyDescription')}
|
|
386
|
+
</p>
|
|
387
|
+
<Button
|
|
388
|
+
variant="outline"
|
|
389
|
+
size="sm"
|
|
390
|
+
className="mt-6"
|
|
391
|
+
onClick={() => setCompanyPickerOpen(true)}
|
|
392
|
+
>
|
|
393
|
+
<Link2 className="mr-2 h-4 w-4" />
|
|
394
|
+
{t('empresa.linkCompany')}
|
|
395
|
+
</Button>
|
|
396
|
+
</div>
|
|
397
|
+
)}
|
|
398
|
+
|
|
399
|
+
{/* ── Inline company picker (replace / create) ── */}
|
|
400
|
+
{companyPickerOpen && (
|
|
401
|
+
<Card className="border-dashed border-border/80">
|
|
402
|
+
<CardContent className="p-5">
|
|
403
|
+
<p className="mb-3 text-sm font-medium">
|
|
404
|
+
{currentAccount.crmAccountId
|
|
405
|
+
? t('empresa.replaceCompany')
|
|
406
|
+
: t('empresa.selectCompany')}
|
|
407
|
+
</p>
|
|
408
|
+
<EntityPicker
|
|
409
|
+
name="companyPicker"
|
|
410
|
+
value={companyPickerValue}
|
|
411
|
+
onChange={(val) => setCompanyPickerValue(val)}
|
|
412
|
+
label=""
|
|
413
|
+
placeholder={t('empresa.pickerPlaceholder')}
|
|
414
|
+
searchPlaceholder={t(
|
|
415
|
+
'empresa.pickerSearchPlaceholder'
|
|
416
|
+
)}
|
|
417
|
+
emptyLabel={t('empresa.pickerEmptyLabel')}
|
|
418
|
+
entityLabel={t('empresa.pickerEntityLabel')}
|
|
419
|
+
clearable={false}
|
|
420
|
+
valueType="number"
|
|
421
|
+
loadOptions={async ({ page, pageSize, search }) => {
|
|
422
|
+
const params = new URLSearchParams({
|
|
423
|
+
page: String(page),
|
|
424
|
+
pageSize: String(pageSize),
|
|
425
|
+
});
|
|
426
|
+
if (search.trim())
|
|
427
|
+
params.set('search', search.trim());
|
|
428
|
+
const res = await request<{
|
|
429
|
+
data: Array<{ id: number; name: string }>;
|
|
430
|
+
total: number;
|
|
431
|
+
lastPage?: number;
|
|
432
|
+
}>({
|
|
433
|
+
url: `/person/accounts?${params}`,
|
|
434
|
+
method: 'GET',
|
|
435
|
+
});
|
|
436
|
+
return {
|
|
437
|
+
items: res.data.data ?? [],
|
|
438
|
+
hasMore: page < (res.data.lastPage ?? 1),
|
|
439
|
+
};
|
|
440
|
+
}}
|
|
441
|
+
getOptionValue={(opt) => (opt as any).id}
|
|
442
|
+
getOptionLabel={(opt) => (opt as any).name ?? ''}
|
|
443
|
+
createFields={[
|
|
444
|
+
{
|
|
445
|
+
name: 'name',
|
|
446
|
+
label: t('empresa.createFieldLabel'),
|
|
447
|
+
placeholder: t(
|
|
448
|
+
'empresa.createFieldPlaceholder'
|
|
449
|
+
),
|
|
450
|
+
required: true,
|
|
451
|
+
},
|
|
452
|
+
]}
|
|
453
|
+
mapSearchToCreateValues={(search) => ({
|
|
454
|
+
name: search,
|
|
455
|
+
})}
|
|
456
|
+
onCreate={async (values) => {
|
|
457
|
+
const res = await request<{
|
|
458
|
+
id: number;
|
|
459
|
+
name: string;
|
|
460
|
+
}>({
|
|
461
|
+
url: '/person/accounts',
|
|
462
|
+
method: 'POST',
|
|
463
|
+
data: {
|
|
464
|
+
name: (values.name ?? '').trim(),
|
|
465
|
+
status: 'active',
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
const created = res.data as unknown as {
|
|
469
|
+
id: number;
|
|
470
|
+
name: string;
|
|
471
|
+
};
|
|
472
|
+
// immediately save the new company link
|
|
473
|
+
await handleCompanySave(created.id);
|
|
474
|
+
return created;
|
|
475
|
+
}}
|
|
476
|
+
/>
|
|
477
|
+
<div className="mt-4 flex justify-end gap-2">
|
|
478
|
+
<Button
|
|
479
|
+
variant="outline"
|
|
480
|
+
size="sm"
|
|
481
|
+
onClick={() => {
|
|
482
|
+
setCompanyPickerOpen(false);
|
|
483
|
+
setCompanyPickerValue(null);
|
|
484
|
+
}}
|
|
485
|
+
>
|
|
486
|
+
{t('actions.cancel')}
|
|
487
|
+
</Button>
|
|
488
|
+
<Button
|
|
489
|
+
size="sm"
|
|
490
|
+
disabled={!companyPickerValue || savingCompany}
|
|
491
|
+
onClick={() =>
|
|
492
|
+
handleCompanySave(companyPickerValue as number)
|
|
493
|
+
}
|
|
494
|
+
>
|
|
495
|
+
{savingCompany
|
|
496
|
+
? t('actions.saving')
|
|
497
|
+
: t('actions.save')}
|
|
498
|
+
</Button>
|
|
499
|
+
</div>
|
|
500
|
+
</CardContent>
|
|
501
|
+
</Card>
|
|
502
|
+
)}
|
|
503
|
+
</TabsContent>
|
|
504
|
+
|
|
505
|
+
<TabsContent value="classes" className="mt-4">
|
|
506
|
+
<ClassesTab
|
|
507
|
+
enterpriseId={currentAccount.id}
|
|
508
|
+
onMutate={handleTabMutate}
|
|
509
|
+
/>
|
|
510
|
+
</TabsContent>
|
|
511
|
+
|
|
512
|
+
<TabsContent value="courses" className="mt-4">
|
|
513
|
+
<CoursesTab
|
|
514
|
+
enterpriseId={currentAccount.id}
|
|
515
|
+
onMutate={handleTabMutate}
|
|
516
|
+
/>
|
|
517
|
+
</TabsContent>
|
|
518
|
+
|
|
519
|
+
<TabsContent value="students" className="mt-4">
|
|
520
|
+
<StudentsTab
|
|
521
|
+
enterpriseId={currentAccount.id}
|
|
522
|
+
onMutate={handleTabMutate}
|
|
523
|
+
/>
|
|
524
|
+
</TabsContent>
|
|
525
|
+
|
|
526
|
+
<TabsContent value="administrators" className="mt-4">
|
|
527
|
+
<AdministratorsTab
|
|
528
|
+
enterpriseId={currentAccount.id}
|
|
529
|
+
onMutate={handleTabMutate}
|
|
530
|
+
/>
|
|
531
|
+
</TabsContent>
|
|
532
|
+
</Tabs>
|
|
533
|
+
</div>
|
|
534
|
+
</>
|
|
535
|
+
)}
|
|
536
|
+
</SheetContent>
|
|
537
|
+
</Sheet>
|
|
538
|
+
|
|
539
|
+
{/* ── Edit Sheet (slides over the detail sheet) ── */}
|
|
540
|
+
<EnterpriseSheet
|
|
541
|
+
open={editSheetOpen}
|
|
542
|
+
onOpenChange={setEditSheetOpen}
|
|
543
|
+
editingAccount={currentAccount}
|
|
544
|
+
onSave={handleInternalSave}
|
|
545
|
+
/>
|
|
546
|
+
</>
|
|
547
|
+
);
|
|
548
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const AVATAR_COLORS: Array<{ bg: string; text: string }> = [
|
|
2
|
+
{ bg: 'bg-blue-500', text: 'text-white' },
|
|
3
|
+
{ bg: 'bg-emerald-500', text: 'text-white' },
|
|
4
|
+
{ bg: 'bg-violet-500', text: 'text-white' },
|
|
5
|
+
{ bg: 'bg-rose-500', text: 'text-white' },
|
|
6
|
+
{ bg: 'bg-amber-500', text: 'text-white' },
|
|
7
|
+
{ bg: 'bg-cyan-500', text: 'text-white' },
|
|
8
|
+
{ bg: 'bg-indigo-500', text: 'text-white' },
|
|
9
|
+
{ bg: 'bg-orange-500', text: 'text-white' },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export function getAvatarColor(name: string): { bg: string; text: string } {
|
|
13
|
+
let hash = 0;
|
|
14
|
+
for (let i = 0; i < name.length; i++) {
|
|
15
|
+
hash = (hash * 31 + name.charCodeAt(i)) & 0xffff;
|
|
16
|
+
}
|
|
17
|
+
return AVATAR_COLORS[hash % AVATAR_COLORS.length]!;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getInitials(name: string): string {
|
|
21
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
22
|
+
if (parts.length === 0) return '?';
|
|
23
|
+
if (parts.length === 1) return (parts[0] ?? '').slice(0, 2).toUpperCase();
|
|
24
|
+
return (
|
|
25
|
+
((parts[0] ?? '')[0] ?? '') + ((parts[1] ?? '')[0] ?? '')
|
|
26
|
+
).toUpperCase();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function formatDateShort(iso: string | null): string {
|
|
30
|
+
if (!iso) return '—';
|
|
31
|
+
const [y, m, d] = iso.split('-');
|
|
32
|
+
return `${d}/${m}/${y}`;
|
|
33
|
+
}
|