From 5608c5ab8d2a992b642b7466d470d7724dde9928 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Fri, 29 Nov 2024 02:03:11 -0300 Subject: [PATCH 01/22] wip: open subject modal --- package.json | 2 + pnpm-lock.yaml | 22 ++ src/components/ReviewSubject.vue | 1 + src/components/SubjectReview.vue | 189 ++++++++++++++++++ .../matricula.content/UFABC-Matricula.vue | 74 +++++-- src/entrypoints/matricula.content/index.ts | 20 +- src/services/next.ts | 8 +- src/utils/gradesColors.ts | 12 ++ 8 files changed, 307 insertions(+), 21 deletions(-) create mode 100644 src/components/SubjectReview.vue create mode 100644 src/utils/gradesColors.ts diff --git a/package.json b/package.json index 890ae7c..feb71db 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,8 @@ "change-case": "^5.4.4", "dayjs": "^1.11.13", "element-plus": "^2.8.4", + "highcharts": "^12.0.1", + "highcharts-vue": "^2.0.1", "lodash-es": "^4.17.21", "lucide-vue-next": "^0.447.0", "mustache": "^4.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4dbade5..ba39573 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,12 @@ importers: element-plus: specifier: ^2.8.4 version: 2.8.8(vue@3.5.13(typescript@5.6.3)) + highcharts: + specifier: ^12.0.1 + version: 12.0.1 + highcharts-vue: + specifier: ^2.0.1 + version: 2.0.1(highcharts@12.0.1)(vue@3.5.13(typescript@5.6.3)) lodash-es: specifier: ^4.17.21 version: 4.17.21 @@ -1503,6 +1509,15 @@ packages: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true + highcharts-vue@2.0.1: + resolution: {integrity: sha512-7yVaKvsWlx7OgmKFXE2D99fi/0tr2A85H4KUz3jL7CRQhAwvEvXgtDIyTBGLHJsOC5L9VlppAI7k6KfIi0j0hg==} + peerDependencies: + highcharts: '>=5.0.0' + vue: '>=3.0.0' + + highcharts@12.0.1: + resolution: {integrity: sha512-86pku0cZnHfEu6uqbbEpU50XKHcAFFXeD4pYvxlVBRDLRDlxpT0WuClgJBuBJZof1ZjFUh1D7IxUxFgt9Epb7Q==} + highlight.js@10.7.3: resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==} @@ -4313,6 +4328,13 @@ snapshots: he@1.2.0: {} + highcharts-vue@2.0.1(highcharts@12.0.1)(vue@3.5.13(typescript@5.6.3)): + dependencies: + highcharts: 12.0.1 + vue: 3.5.13(typescript@5.6.3) + + highcharts@12.0.1: {} + highlight.js@10.7.3: {} hoek@2.16.3: diff --git a/src/components/ReviewSubject.vue b/src/components/ReviewSubject.vue index 0be6d49..291af26 100644 --- a/src/components/ReviewSubject.vue +++ b/src/components/ReviewSubject.vue @@ -181,6 +181,7 @@ async function setupSubjectStats() { closeDialog(); } } + function updateFilter() { pieChart.value.delegateMethod('showLoading', 'Carregando...'); diff --git a/src/components/SubjectReview.vue b/src/components/SubjectReview.vue new file mode 100644 index 0000000..cf845c8 --- /dev/null +++ b/src/components/SubjectReview.vue @@ -0,0 +1,189 @@ + + + + + diff --git a/src/entrypoints/matricula.content/UFABC-Matricula.vue b/src/entrypoints/matricula.content/UFABC-Matricula.vue index b9f4e31..422efbc 100644 --- a/src/entrypoints/matricula.content/UFABC-Matricula.vue +++ b/src/entrypoints/matricula.content/UFABC-Matricula.vue @@ -4,6 +4,7 @@ import Teachers from '@/components/Teachers.vue'; import { getComponents } from '@/services/next'; import { render } from 'vue'; import type { Student } from '@/scripts/sig/homepage'; +import SubjectReview from '@/components/SubjectReview.vue'; type Filter = { @@ -53,6 +54,21 @@ const shiftFilters = ref([ }, ]); +const subjectReview = ref<{ isOpen: boolean; subjectId: string | null }>({ + isOpen: false, + subjectId: null, +}); + +function openSubjectReview(subjectId: string) { + subjectReview.value.isOpen = true; + subjectReview.value.subjectId = subjectId; +} + +function closeSubjectReview() { + subjectReview.value.isOpen = false; + subjectReview.value.subjectId = null; +} + function changeSelected() { const notSelected = document.querySelectorAll('.notSelecionada') if (!selected.value) { @@ -63,16 +79,11 @@ function changeSelected() { } const studentId = getStudentId() - const graduationId = getStudentCourseId() if (!studentId) { console.log('show some message to the user') return } - storage.setItem(`sync:${student.value?.ra}`, { - studentId, - graduationId, - }) const enrollments = matriculas?.[studentId] || [] const tableRows = document.querySelectorAll('tr') @@ -144,6 +155,27 @@ function applyFilter(params: Filter) { } } +function handleClick(event: MouseEvent) { +const target = event.target as HTMLElement; + if (target.closest("#cortes")) { + const corteElement = target.closest("#cortes"); + if (!corteElement) { + return; + } + const corteId = + corteElement.parentElement?.parentElement?.getAttribute("value"); + // if (corteId) { + // openModal(corteId); + // } + } else if (target.matches("span.sa, span.sbc")) { + console.log(target) + const subjectId = target.getAttribute("subjectId"); + if (subjectId) { + openSubjectReview(subjectId); + } + } +} + async function buildComponents() { if (!teachers.value) { for (const $element of document.querySelectorAll('.isTeacherReview')) { @@ -184,13 +216,13 @@ async function buildComponents() { if (component.subject && subjectEl) { subjectEl.style.cursor = 'pointer' - // subjectEl.addEventListener('mouseenter', () => { - // subjectEl.style.textDecoration = 'underline'; - // }); + subjectEl.addEventListener('mouseenter', () => { + subjectEl.style.textDecoration = 'underline'; + }); - // subjectEl.addEventListener('mouseleave', () => { - // subjectEl.style.textDecoration = 'none'; - // }); + subjectEl.addEventListener('mouseleave', () => { + subjectEl.style.textDecoration = 'none'; + }); subjectEl.setAttribute('subjectId', component.subjectId); } @@ -211,9 +243,22 @@ async function buildComponents() { render(h(Cortes), cortesContainer) } } + onMounted(async () => { - await buildComponents(); + document.body.addEventListener("click", handleClick); + const studentId = getStudentId() + const graduationId = getStudentCourseId() + await storage.setItem(`sync:${student.value?.ra}`, { + studentId, + graduationId, + }) + teachers.value = true; + await buildComponents(); +}) + +onUnmounted(() => { + document.body.removeEventListener('click', handleClick) }) @@ -263,6 +308,11 @@ onMounted(async () => { + diff --git a/src/entrypoints/matricula.content/index.ts b/src/entrypoints/matricula.content/index.ts index 4af33bd..ad0c588 100644 --- a/src/entrypoints/matricula.content/index.ts +++ b/src/entrypoints/matricula.content/index.ts @@ -1,8 +1,13 @@ import { getUFEnrolled } from "@/services/ufabc-parser"; import UFABCMatricula from "@/entrypoints/matricula.content/UFABC-Matricula.vue"; -import './style.css' +import HighchartsVue from "highcharts-vue"; +import Highcharts from "highcharts"; +// import annotationsInit from "highcharts/modules/annotations"; +// import accessibility from "highcharts/modules/accessibility"; +import Highcharts3D from 'highcharts/highcharts-3d' import type { Student } from "@/scripts/sig/homepage"; import type { ContentScriptContext } from "wxt/client"; +import './style.css' @@ -39,6 +44,10 @@ async function mountUFABCMatriculaFilters(ctx: ContentScriptContext) { const wrapper = document.createElement("div"); container.append(wrapper); + // accessibility(Highcharts); + // annotationsInit(Highcharts) + // Highcharts3D(Highcharts); + const matriculas = await getUFEnrolled(); window.matriculas = matriculas; @@ -46,14 +55,15 @@ async function mountUFABCMatriculaFilters(ctx: ContentScriptContext) { const app = createApp(UFABCMatricula); app.provide("matriculas", window.matriculas); + app.use(HighchartsVue); app.mount(wrapper); return { app, wrapper }; }, - // biome-ignore lint/suspicious/noExplicitAny: - onRemove(mounted: any) { - mounted?.app.unmount(); - mounted?.wrapper.remove(); + async onRemove(mounted) { + const resolvedMounted = await mounted; + resolvedMounted?.app.unmount(); + resolvedMounted?.wrapper.remove(); }, }); } diff --git a/src/services/next.ts b/src/services/next.ts index 562d4db..043e1ff 100644 --- a/src/services/next.ts +++ b/src/services/next.ts @@ -23,10 +23,10 @@ export type SigHistory = { }[]; }; -type Concept = "A" | "B" | "C" | "D" | "O" | "F" +export type Grade = "A" | "B" | "C" | "D" | "O" | "F"; -type Distribution = { - conceito: Concept; +export type Distribution = { + conceito: Grade; weight: number; count: number; cr_medio: number; @@ -54,7 +54,7 @@ type DetailedReviews = { } } -type SubjectReview = { +export type SubjectReview = { subject: { _id: string, name: string, diff --git a/src/utils/gradesColors.ts b/src/utils/gradesColors.ts new file mode 100644 index 0000000..e6b5e15 --- /dev/null +++ b/src/utils/gradesColors.ts @@ -0,0 +1,12 @@ +import type { Grade } from '@/services/next' + +export function resolveColorForConcept(grade: Grade) { + return { + 'A': '#3fcf8c', + 'B': '#b8e986', + 'C': '#f8b74c', + 'D': '#ffa004', + 'F': '#f95469', + 'O': '#A9A9A9' + }[grade] || '#A9A9A9' +} From a0244af5e14edcfcdc2763a51e1f96ac97410718 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Fri, 29 Nov 2024 13:44:11 -0300 Subject: [PATCH 02/22] use tailwind --- src/components/SubjectReview.vue | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/SubjectReview.vue b/src/components/SubjectReview.vue index cf845c8..201f27b 100644 --- a/src/components/SubjectReview.vue +++ b/src/components/SubjectReview.vue @@ -160,30 +160,38 @@ watch(filterSelected, () => { width="800px" top="2vh" :model-value="isOpen" - class="ufabc-element-dialog mt-1"> -
+
-
+
Total de amostras {{samplesCount}}
-
+
Nenhum dado encontrado
- - * Dados baseados nos alunos que utilizam a extensão - + + - + From 6989d8b6bde234a60bf9f6836df42662457b7d1a Mon Sep 17 00:00:00 2001 From: Joabesv Date: Mon, 2 Dec 2024 23:38:39 -0300 Subject: [PATCH 03/22] make chart closer to old version --- src/components/SubjectReview.vue | 41 +++++++++++++++----------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/components/SubjectReview.vue b/src/components/SubjectReview.vue index 201f27b..8036cee 100644 --- a/src/components/SubjectReview.vue +++ b/src/components/SubjectReview.vue @@ -1,6 +1,8 @@ + + From ceab760b29b4822d3325a37ff6dbf9b4db743408 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Tue, 3 Dec 2024 20:20:07 -0300 Subject: [PATCH 07/22] feat: pass down matricula student --- src/entrypoints/matricula.content/index.ts | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/entrypoints/matricula.content/index.ts b/src/entrypoints/matricula.content/index.ts index ad0c588..34760a8 100644 --- a/src/entrypoints/matricula.content/index.ts +++ b/src/entrypoints/matricula.content/index.ts @@ -1,4 +1,4 @@ -import { getUFEnrolled } from "@/services/ufabc-parser"; +import { getUFComponents, getUFEnrolled } from "@/services/ufabc-parser"; import UFABCMatricula from "@/entrypoints/matricula.content/UFABC-Matricula.vue"; import HighchartsVue from "highcharts-vue"; import Highcharts from "highcharts"; @@ -9,12 +9,18 @@ import type { Student } from "@/scripts/sig/homepage"; import type { ContentScriptContext } from "wxt/client"; import './style.css' - +export type UFABCMatriculaStudent = { + studentId: number + graduationId: string +} export default defineContentScript({ async main(ctx) { - const ui = await mountUFABCMatriculaFilters(ctx); - ui.mount(); + const student = await storage.getItem('local:student') + const ufabcMatriculaStudent = await storage.getItem(`sync:${student?.ra}`) + + const ui = await mountUFABCMatriculaFilters(ctx, ufabcMatriculaStudent); + ui.mount(); const $meio = document.querySelector("#meio"); const $mountedUi = $meio?.firstChild as unknown as HTMLDivElement; @@ -24,8 +30,6 @@ export default defineContentScript({ $mountedUi.style.zIndex = "9"; // TODO(Joabesv): create student here - const student = await storage.getItem('local:student') - const ufabcMatriculaStudent = await storage.getItem(`sync:${student?.ra}`) console.log(student, ufabcMatriculaStudent) }, @@ -34,7 +38,7 @@ export default defineContentScript({ matches: ["https://ufabc-matricula-snapshot.vercel.app/*", 'https://api.ufabcnext.com/snapshot', 'https://matricula.ufabc.edu.br/matricula'], }) -async function mountUFABCMatriculaFilters(ctx: ContentScriptContext) { +async function mountUFABCMatriculaFilters(ctx: ContentScriptContext, student: UFABCMatriculaStudent | null) { return createShadowRootUi(ctx, { name: "matriculas-filter", position: "inline", @@ -49,11 +53,18 @@ async function mountUFABCMatriculaFilters(ctx: ContentScriptContext) { // Highcharts3D(Highcharts); + if (!student) { + return; + } + const matriculas = await getUFEnrolled(); + const ufabcComponents = await getUFComponents(); window.matriculas = matriculas; const app = createApp(UFABCMatricula); app.provide("matriculas", window.matriculas); + app.provide("components", ufabcComponents); + app.provide('student', student) app.use(HighchartsVue); From 718310b6758abe1753e126ea4653a4dd063717cb Mon Sep 17 00:00:00 2001 From: Joabesv Date: Tue, 3 Dec 2024 20:20:25 -0300 Subject: [PATCH 08/22] integrate component interactions --- .../matricula.content/UFABC-Matricula.vue | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/entrypoints/matricula.content/UFABC-Matricula.vue b/src/entrypoints/matricula.content/UFABC-Matricula.vue index 422efbc..7993d8f 100644 --- a/src/entrypoints/matricula.content/UFABC-Matricula.vue +++ b/src/entrypoints/matricula.content/UFABC-Matricula.vue @@ -59,6 +59,11 @@ const subjectReview = ref<{ isOpen: boolean; subjectId: string | null }>({ subjectId: null, }); +const kicksModal = ref<{ isOpen: boolean; corteId: string | null }>({ + isOpen: false, + corteId: null +}) + function openSubjectReview(subjectId: string) { subjectReview.value.isOpen = true; subjectReview.value.subjectId = subjectId; @@ -69,6 +74,17 @@ function closeSubjectReview() { subjectReview.value.subjectId = null; } + +function openKicksModal(corteId: string) { + kicksModal.value.isOpen = true; + kicksModal.value.corteId = corteId; +} + +function closeKicksModal() { + kicksModal.value.isOpen = false; + kicksModal.value.corteId = null; +} + function changeSelected() { const notSelected = document.querySelectorAll('.notSelecionada') if (!selected.value) { @@ -155,6 +171,7 @@ function applyFilter(params: Filter) { } } + function handleClick(event: MouseEvent) { const target = event.target as HTMLElement; if (target.closest("#cortes")) { @@ -164,11 +181,10 @@ const target = event.target as HTMLElement; } const corteId = corteElement.parentElement?.parentElement?.getAttribute("value"); - // if (corteId) { - // openModal(corteId); - // } + if (corteId) { + openKicksModal(corteId); + } } else if (target.matches("span.sa, span.sbc")) { - console.log(target) const subjectId = target.getAttribute("subjectId"); if (subjectId) { openSubjectReview(subjectId); @@ -308,11 +324,18 @@ onUnmounted(() => {
+ + + From 8b685b0a757d2b92bf92adf9caa78d1649f86649 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Tue, 3 Dec 2024 23:05:12 -0300 Subject: [PATCH 09/22] add lucide icon --- src/components/KicksModal.vue | 136 +++++++++++++++++++-- src/entrypoints/matricula.content/index.ts | 2 - 2 files changed, 124 insertions(+), 14 deletions(-) diff --git a/src/components/KicksModal.vue b/src/components/KicksModal.vue index 3b90b53..3f98d99 100644 --- a/src/components/KicksModal.vue +++ b/src/components/KicksModal.vue @@ -1,12 +1,91 @@ - From 40d354bcf466fb35fd8210b86d14daf1d3e9dafa Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 4 Dec 2024 13:31:39 -0300 Subject: [PATCH 12/22] wip: notifications of errors --- src/components/KicksModal.vue | 37 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/src/components/KicksModal.vue b/src/components/KicksModal.vue index 2742a5e..96c5f18 100644 --- a/src/components/KicksModal.vue +++ b/src/components/KicksModal.vue @@ -124,6 +124,7 @@ import { orderBy } from 'lodash-es'; import { FetchError } from 'ofetch'; import { Info } from 'lucide-vue-next' import draggable from 'vuedraggable' +import { ElNotification } from 'element-plus'; type Headers = { text: string; @@ -138,7 +139,15 @@ const props = defineProps<{ const emit = defineEmits(['close']); const loading = ref(false) -const kicks = ref([]) +const kicks = ref<{ + studentId: number; + cr: number | '-' + cp: number; + ik: string; + reserva: 'Sim' | 'Não' + curso: string + turno: 'Matutino' | 'Noturno' + }[]>([]) const headers = ref([]) const matriculaStudent = inject('student') const matriculas = inject('matriculas') @@ -171,15 +180,15 @@ const transformed = computed(() => { return kicks.value.map(d => ({ ...d, reserva: d.reserva ? 'Sim' : 'Não', - ik: d.ik.toFixed(3) + ik: Number(d.ik).toFixed(3) })) }) + const kicksForecast = computed(() => { - if (!props.corteId || !matriculas) { + if (!props.corteId || !matriculas || !matriculaStudent?.studentId) { return; } - console.log(props.corteId) const requests = matriculas[matriculaStudent?.studentId].reduce((a, c) => a + 1, 0); return kicks.value.length * component.value?.vacancies / requests }) @@ -199,13 +208,22 @@ async function fetch() { resort(); } catch(error: any) { if(error instanceof FetchError) { - if (error.name === 'forbidden') { - console.log('add dialog here', error) + if (error.response?.statusText === 'Forbidden') { + ElNotification({ + type: 'warning', + message: 'Não temos as disciplinas que você cursou, acesse o Sigaa' + }) } - console.log(error) + ElNotification({ + type: 'error', + message: 'Estamos com problemas no servidor, por favor tente novamente mais tarde!' + }) } - console.log(error) + ElNotification({ + type: 'error', + message: 'Erro Inesperado, recaregue a pagina e tente novamente' + }) } finally { loading.value = false } @@ -254,7 +272,7 @@ function tableRowClassname({ row, rowIndex }: TableData) { console.log(kicksForecast.value) if (row.studentId === matriculaStudent?.studentId) { return 'aluno-row' - } if (rowIndex <= kicksForecast.value) { + } if (kicksForecast.value && rowIndex <= kicksForecast.value) { return 'not-kicked-row' } if (rowIndex >= component.value?.vacancies) { return 'kicked-row' @@ -266,6 +284,7 @@ watch(() => props.isOpen, async (newIsOpen) => { if (newIsOpen && props.corteId) { headers.value = defaultHeaders.value const ufabcComponents = await getUFComponents() + // @ts-ignore const match = ufabcComponents.find(c => c.UFComponentId === Number.parseInt(props.corteId)) // @ts-ignore component.value = match From 807206c3ae5a7a48e4fd4b9a1d1d47bee0ec1067 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 4 Dec 2024 13:55:26 -0300 Subject: [PATCH 13/22] fix: forecast calc --- src/components/KicksModal.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/KicksModal.vue b/src/components/KicksModal.vue index 96c5f18..43421b6 100644 --- a/src/components/KicksModal.vue +++ b/src/components/KicksModal.vue @@ -189,7 +189,8 @@ const kicksForecast = computed(() => { if (!props.corteId || !matriculas || !matriculaStudent?.studentId) { return; } - const requests = matriculas[matriculaStudent?.studentId].reduce((a, c) => a + 1, 0); + const requests = Object.values(matriculas).reduce((count, current) => + current.includes(props.corteId?.toString()) ? count + 1 : count, 0); return kicks.value.length * component.value?.vacancies / requests }) @@ -269,7 +270,6 @@ type TableData = { } function tableRowClassname({ row, rowIndex }: TableData) { - console.log(kicksForecast.value) if (row.studentId === matriculaStudent?.studentId) { return 'aluno-row' } if (kicksForecast.value && rowIndex <= kicksForecast.value) { From 149bcc12c06d517600816a9e3bbdfb97bba64c76 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 4 Dec 2024 14:01:15 -0300 Subject: [PATCH 14/22] make it smooth --- src/components/KicksModal.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/KicksModal.vue b/src/components/KicksModal.vue index 43421b6..0fa3817 100644 --- a/src/components/KicksModal.vue +++ b/src/components/KicksModal.vue @@ -299,19 +299,19 @@ onMounted(async () => { diff --git a/src/components/TeacherReview.vue b/src/components/TeacherReview.vue new file mode 100644 index 0000000..7bffd64 --- /dev/null +++ b/src/components/TeacherReview.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/src/components/Teachers.vue b/src/components/Teachers.vue index 018b105..bb779bf 100644 --- a/src/components/Teachers.vue +++ b/src/components/Teachers.vue @@ -4,7 +4,7 @@ {{ teoria }} @@ -14,7 +14,7 @@ {{ pratica }} diff --git a/src/entrypoints/matricula.content/UFABC-Matricula.vue b/src/entrypoints/matricula.content/UFABC-Matricula.vue index 7993d8f..c9ea277 100644 --- a/src/entrypoints/matricula.content/UFABC-Matricula.vue +++ b/src/entrypoints/matricula.content/UFABC-Matricula.vue @@ -64,6 +64,12 @@ const kicksModal = ref<{ isOpen: boolean; corteId: string | null }>({ corteId: null }) +const teacherReview = ref<{ isOpen: boolean; teacherId: string | null; name: string | null }>({ + isOpen: false, + name: null, + teacherId: null +}) + function openSubjectReview(subjectId: string) { subjectReview.value.isOpen = true; subjectReview.value.subjectId = subjectId; @@ -74,6 +80,17 @@ function closeSubjectReview() { subjectReview.value.subjectId = null; } +function openTeacherReview(teacherId: string, name: string) { + teacherReview.value.isOpen = true + teacherReview.value.teacherId = teacherId + teacherReview.value.name = name; +} + +function closeTeacherReview() { + teacherReview.value.isOpen = false; + teacherReview.value.teacherId = null; + teacherReview.value.name = null; +} function openKicksModal(corteId: string) { kicksModal.value.isOpen = true; @@ -189,6 +206,12 @@ const target = event.target as HTMLElement; if (subjectId) { openSubjectReview(subjectId); } + } else if(target.matches('.ReviewTeacher')) { + const teacherId = target.getAttribute('data') + const teacherName = target.getAttribute('teacherName') + if (teacherId) { + openTeacherReview(teacherId, teacherName) + } } } @@ -335,7 +358,11 @@ onUnmounted(() => { :corte-id="kicksModal.corteId" @close="closeKicksModal" /> - + diff --git a/src/services/next.ts b/src/services/next.ts index 066f772..1a7de5e 100644 --- a/src/services/next.ts +++ b/src/services/next.ts @@ -130,6 +130,10 @@ export async function getSubjectReviews(subjectId: string) { return reviews; } +export async function getTeacherReviews(teacherId: string) { + const reviews = await nextService(`/entities/teachers/reviews/${teacherId}`) + return reviews; +} export async function getComponents() { const components = nextService('/entities/components') @@ -140,3 +144,15 @@ export async function getKicksInfo(kickId: string, studentId: string) { const kicksData = await nextService(`/entities/components/${kickId}/kicks?studentId=${studentId}`) return kicksData; } + + +export async function getStudent(login: string, ra: string) { + const student = await nextService('/entities/students/student', { + query: { + login, + ra + } + }) + + return student; +} From a921c237fde4f9846f262ffc225d85bf81fb9162 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Thu, 5 Dec 2024 16:51:20 -0300 Subject: [PATCH 16/22] feat: teacher review endpoint --- src/components/Teachers.vue | 8 +++---- src/services/next.ts | 45 ++++++++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/components/Teachers.vue b/src/components/Teachers.vue index bb779bf..9fe57a1 100644 --- a/src/components/Teachers.vue +++ b/src/components/Teachers.vue @@ -1,20 +1,20 @@