Skip to content

Commit 0f191c8

Browse files
Merge pull request VitorCarvalho67#55 from Daniel-Alvarenga/main
Add uses of client-side table get routes
2 parents 1d094d5 + 3e2cc3a commit 0f191c8

File tree

14 files changed

+305
-61
lines changed

14 files changed

+305
-61
lines changed

client/src/components/admin/AsideDashboard.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
</router-link>
7575
</li>
7676
<li>
77-
<router-link to="/admin">
77+
<router-link to="/admin/table/estagio">
7878
<p v-if="showPs">Estágios</p>
7979
</router-link>
8080
</li>

client/src/router/routes/admin.js

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import TableCursos from '../../views/admin/TableCurso.vue';
1010
import TableFuncionarios from '../../views/admin/TableFuncionario.vue';
1111
import TableProfessores from '../../views/admin/TableProfessor.vue';
1212
import TableTurmas from '../../views/admin/TableTurma.vue';
13+
import TableEstagio from '../../views/admin/TableEstagio.vue';
1314

1415
import {
1516
isAuthAdmin
@@ -92,4 +93,9 @@ export const adminRoutes = [
9293
name: 'TableTurmas',
9394
component: TableTurmas,
9495
},
96+
{
97+
path: '/admin/table/estagio',
98+
name: 'TableEstagio',
99+
component: TableEstagio,
100+
},
95101
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
main {
2+
height: calc(100vh - 80px);
3+
background-color: $primary-color-dark;
4+
@include flex-center;
5+
}
6+
7+
.path {
8+
width: 100%;
9+
@include flex(row, flex-start, center);
10+
11+
font-size: 0.9rem;
12+
@include font-inter(300);
13+
margin-bottom: 20px;
14+
> p {
15+
@include flex(column, center, center);
16+
@include font-inter(400);
17+
18+
&:after {
19+
width: 100%;
20+
height: 3px;
21+
margin-top: 3px;
22+
background-color: $secondary-color-orange;
23+
}
24+
25+
&:hover::after {
26+
animation: none;
27+
}
28+
}
29+
30+
img {
31+
@include flex(column, center, center);
32+
width: 15px;
33+
transform: rotate(180deg);
34+
filter: invert(100%);
35+
margin-inline: 20px;
36+
}
37+
}
38+
39+
.table {
40+
display: flex;
41+
flex-direction: column;
42+
width: 100%;
43+
44+
.table-header {
45+
border-left: 3px solid $secondary-color-orange;
46+
.table-cell {
47+
@include font-inter(600);
48+
}
49+
}
50+
51+
.table-row {
52+
display: flex;
53+
flex-direction: row;
54+
}
55+
56+
.table-cell {
57+
flex: 1;
58+
padding: 8px;
59+
border-right: 1px solid #ddd;
60+
font-size: 1rem;
61+
@include font-inter(300);
62+
color: $font-color-dark;
63+
}
64+
}

client/src/services/api/admin.js

+80-1
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,83 @@ export const refreshTokenAdmin = async (token) => {
144144
} catch (error) {
145145
return error.response.data;
146146
}
147-
}
147+
}
148+
149+
export const getFullCoordenadores = async(token) => {
150+
try {
151+
const response = await api.get('admin/table/coordenadores', {
152+
headers: {
153+
authorization: `${token}`
154+
}
155+
});
156+
return response;
157+
} catch (error) {
158+
return error.response.data;
159+
}
160+
}
161+
162+
export const getFullCursos = async(token) => {
163+
try {
164+
const response = await api.get('admin/table/cursos', {
165+
headers: {
166+
authorization: `${token}`
167+
}
168+
});
169+
return response;
170+
} catch (error) {
171+
return error.response.data;
172+
}
173+
}
174+
175+
export const getFullEstagios = async(token) => {
176+
try {
177+
const response = await api.get('admin/table/estagios', {
178+
headers: {
179+
authorization: `${token}`
180+
}
181+
});
182+
return response;
183+
} catch (error) {
184+
return error.response.data;
185+
}
186+
}
187+
188+
export const getFullFuncionarios = async(token) => {
189+
try {
190+
const response = await api.get('admin/table/funcionarios', {
191+
headers: {
192+
authorization: `${token}`
193+
}
194+
});
195+
return response;
196+
} catch (error) {
197+
return error.response.data;
198+
}
199+
}
200+
201+
export const getFullTurmas = async(token) => {
202+
try {
203+
const response = await api.get('admin/table/turmas', {
204+
headers: {
205+
authorization: `${token}`
206+
}
207+
});
208+
return response;
209+
} catch (error) {
210+
return error.response.data;
211+
}
212+
}
213+
214+
export const getFullProfessores = async(token) => {
215+
try {
216+
const response = await api.get('admin/table/professores', {
217+
headers: {
218+
authorization: `${token}`
219+
}
220+
});
221+
return response;
222+
} catch (error) {
223+
return error.response.data;
224+
}
225+
}
226+

client/src/views/admin/TableCoordenador.vue

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
<div class="table">
1515
<div class="table-header">
1616
<div class="table-row">
17-
<div class="table-cell">Nome dos coordenadores Registrados</div>
17+
<div class="table-cell">Coordenadores Registrados</div>
1818
</div>
1919
</div>
2020
<div class="table-body">
2121
<div class="table-row" v-for="coordenador in coordenadores" :key="coordenador.id">
22-
<div class="table-cell">{{ coordenador.name }}</div>
22+
<div class="table-cell">{{ coordenador }}</div>
23+
<!-- <div class="table-cell">{{ coordenador.name }}</div>
24+
<div v-if="coordenador.curso[0]" class="table-cell">{{ coordenador.curso[0].name }}</div>
25+
<div v-else class="table-cell">Não está atrelado a nenhum curso</div> -->
2326
</div>
2427
</div>
2528
</div>
@@ -35,7 +38,7 @@ import AsideDashboard from '../../components/admin/AsideDashboard.vue';
3538
import anguloIcon from '../../assets/icons/angulo.png';
3639
3740
import { mixinAdmin } from '../../util/authMixins.js';
38-
import { getCoordenadores } from '../../services/api/admin';
41+
import { getFullCoordenadores } from '../../services/api/admin';
3942
4043
export default {
4144
name: 'TableCoordenadores',
@@ -51,7 +54,7 @@ export default {
5154
},
5255
methods: {
5356
async fetchCoordenadores() {
54-
const data = await getCoordenadores(this.admin.token);
57+
const data = await getFullCoordenadores(this.admin.token);
5558
this.coordenadores = data.data;
5659
}
5760
},

client/src/views/admin/TableCurso.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</div>
2020
<div class="table-body">
2121
<div class="table-row" v-for="curso in cursos" :key="curso.id">
22-
<div class="table-cell">{{ curso.name }}</div>
22+
<div class="table-cell">{{ curso }}</div>
2323
</div>
2424
</div>
2525
</div>
@@ -35,7 +35,7 @@ import AsideDashboard from '../../components/admin/AsideDashboard.vue';
3535
import anguloIcon from '../../assets/icons/angulo.png';
3636
3737
import { mixinAdmin } from '../../util/authMixins.js';
38-
import { getCursos } from '../../services/api/admin';
38+
import { getFullCursos } from '../../services/api/admin';
3939
4040
export default {
4141
name: 'TableCursos',
@@ -51,7 +51,7 @@ export default {
5151
},
5252
methods: {
5353
async fetchCursos() {
54-
const data = await getCursos(this.admin.token);
54+
const data = await getFullCursos(this.admin.token);
5555
this.cursos = data.data;
5656
}
5757
},
+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<template>
2+
<Header />
3+
<div id="app">
4+
<main>
5+
<AsideDashboard pageName='home' />
6+
<div class="content">
7+
<div class="path">
8+
<p>Dashboard</p>
9+
<img :src="anguloIcon" alt="">
10+
<p>Tabelas</p>
11+
<img :src="anguloIcon" alt="">
12+
<p>estagios</p>
13+
</div>
14+
<div class="table">
15+
<div class="table-header">
16+
<div class="table-row">
17+
<div class="table-cell">Estagios Registradas</div>
18+
</div>
19+
</div>
20+
<div class="table-body">
21+
<div class="table-row" v-for="estagio in estagios" :key="estagio.id">
22+
<div class="table-cell">{{ estagio }}</div>
23+
</div>
24+
</div>
25+
</div>
26+
</div>
27+
</main>
28+
</div>
29+
</template>
30+
31+
32+
<script>
33+
import Header from '../../components/Header.vue';
34+
import AsideDashboard from '../../components/admin/AsideDashboard.vue';
35+
import anguloIcon from '../../assets/icons/angulo.png';
36+
37+
import { mixinAdmin } from '../../util/authMixins.js';
38+
import { getFullEstagios } from '../../services/api/admin.js';
39+
40+
export default {
41+
name: 'TableEstagios',
42+
components: {
43+
Header,
44+
AsideDashboard,
45+
},
46+
data() {
47+
return {
48+
anguloIcon,
49+
estagios: []
50+
}
51+
},
52+
methods: {
53+
async fetchEstagios() {
54+
const data = await getFullEstagios(this.admin.token);
55+
this.estagios = data.data;
56+
}
57+
},
58+
mixins: [mixinAdmin],
59+
async created() {
60+
this.getToken();
61+
await this.fetchEstagios();
62+
}
63+
}
64+
</script>
65+
66+
<style lang="scss" scoped>
67+
@import "../../scss/pages/admin/_tableEstagio.scss";
68+
69+
#app {
70+
display: flex;
71+
flex-direction: column;
72+
min-height: calc(100vh - 80px);
73+
74+
main {
75+
display: flex;
76+
overflow: hidden;
77+
78+
.content {
79+
flex: 1;
80+
padding: 20px;
81+
overflow-y: auto;
82+
height: 100%;
83+
84+
@media (max-width: 1000px) {
85+
width: calc(100% - 100px);
86+
}
87+
}
88+
}
89+
}
90+
</style>

client/src/views/admin/TableFuncionario.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<div class="table">
1515
<div class="table-header">
1616
<div class="table-row">
17-
<div class="table-cell">Nome dos Funcionários Registrados</div>
17+
<div class="table-cell">Funcionários Registrados</div>
1818
</div>
1919
</div>
2020
<div class="table-body">
21-
<div class="table-row" v-for="Funcionario in Funcionarios" :key="Funcionario.id">
22-
<div class="table-cell">{{ Funcionario.name }}</div>
21+
<div class="table-row" v-for="funcionario in funcionarios" :key="funcionario.id">
22+
<div class="table-cell">{{ funcionario }}</div>
2323
</div>
2424
</div>
2525
</div>
@@ -35,7 +35,7 @@ import AsideDashboard from '../../components/admin/AsideDashboard.vue';
3535
import anguloIcon from '../../assets/icons/angulo.png';
3636
3737
import { mixinAdmin } from '../../util/authMixins.js';
38-
// import { getFuncionarios } from '../../services/api/admin';
38+
import { getFullFuncionarios } from '../../services/api/admin';
3939
4040
export default {
4141
name: 'TableFuncionarios',
@@ -46,19 +46,19 @@ export default {
4646
data() {
4747
return {
4848
anguloIcon,
49-
Funcionarios: []
49+
funcionarios: []
5050
}
5151
},
5252
methods: {
5353
async fetchFuncionarios() {
54-
const data = await getFuncionarios(this.admin.token);
55-
this.Funcionarios = data.data;
54+
const data = await getFullFuncionarios(this.admin.token);
55+
this.funcionarios = data.data;
5656
}
5757
},
5858
mixins: [mixinAdmin],
5959
async created() {
6060
this.getToken();
61-
// await this.fetchFuncionarios();
61+
await this.fetchFuncionarios();
6262
}
6363
}
6464
</script>

0 commit comments

Comments
 (0)