Skip to content

Commit

Permalink
Merge pull request #16 from fga-eps-mds/feature/destaca-disciplinas
Browse files Browse the repository at this point in the history
[#98] [#109] Destaca as disciplinas e lista professores
  • Loading branch information
codehg authored Aug 23, 2022
2 parents 7f8e824 + 1070188 commit daea975
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,101 @@
<template src="./consulta-disciplina.html"></template>
<template>
<div class="main-content hidden-scroll-bar">
<h1 class="tittle ml-4">
Disciplinas
</h1>

<script src="./consulta-disciplina.js"></script>
<div class="tittle sub-tittle ml-4 mb-4">
Disciplinas Cadastradas na Plataforma
</div>

<style src="./consulta-disciplina.css"></style>
<div class="ml-4 input-group">
<input
v-model="subjectSearch"
type="text"
id="caixaPesquisa"
class="search-input"
placeholder="Pesquise por uma disciplina">
<i class="fas fa-search input-group-prepend search-icon"></i>
</div>

<div>
<button
class="btn cd-btn ml-4 my-3"
onclick="window.location.href = '/disciplinas/cadastrar'">
<i class="fa-solid fa-plus-square mr-2 add-project"></i>Criar Disciplina
</button>
</div>

<div class="tabelas">
<ListagemConsultaDisciplinaComponent class="minhasDisciplinas"
:dataSubjects="mySubjects"
:subjectSearch="subjectSearch"/>

<hr class="mb-0 mt-5">

<ListagemConsultaDisciplinaComponent class="demaisDisciplinas"
:dataSubjects="subjects"
:subjectSearch="subjectSearch"/>
</div>
</div>
</template>

<script>
import SubjectService from '../../../services/SubjectService';
import ListagemConsultaDisciplinaComponent from './ListagemConsultaDisciplinaComponent.vue';
export default {
beforeMount() {
this.getSubjects();
},
components: {
ListagemConsultaDisciplinaComponent,
},
data: () => ({
subjectSearch: null,
isLoading: false,
wasLoaded: false,
isDeletingSubject: false,
subjects: [],
mySubjects: [],
subjectService: new SubjectService(),
}),
methods: {
getSubjects() {
this.$store.commit('OPEN_LOADING_MODAL', { title: 'Carregando...' });
this.subjectService.getSubjects().then((response) => {
this.subjects = response.data;
this.$store.commit('CLOSE_LOADING_MODAL');
this.separateSubjects();
}).catch(() => {
this.$store.commit('CLOSE_LOADING_MODAL');
this.makeToast('ERRO', 'Erro ao recuperar disciplinas', 'danger');
});
},
separateSubjects() {
this.subjects.map((sub) => {
sub.professors.map((prof) => {
if (prof.userid === this.$store.getters.user.userId) {
this.mySubjects.push(sub);
this.subjects = this.subjects.filter((item) => (
item.subjectid !== sub.subjectid));
}
return prof;
});
return null;
});
},
makeToast(toastTitle, toastMessage, toastVariant) {
this.$bvToast.toast(toastMessage, {
title: toastTitle, variant: toastVariant, solid: true, autoHideDelay: 4000,
});
},
},
};
</script>

<style src="./consulta-disciplina.css">
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<template>
<div class="mt-4">
<h2 class="tittle sub-tittle ml-4">{{ title }}</h2>

<table>
<thead>
<tr>
<td>Nome</td>
<td>Professores</td>
<td></td>
</tr>
</thead>

<tr v-for="subject in listSubjects" :key="subject.subjectid">
<td>{{subject.name}}</td>
<td>
<div v-for="professor in subject.professors" :key="professor.userid">
{{professor.fullname}}
</div>
</td>
<td class="botao">
<button
class="btn cd-btn"
@click="goToSubject(subject.subjectid)">
<i class="fa-solid fa-circle-info mr-2 ml-0"></i>Ver Detalhes
</button>
</td>
</tr>

<div v-if="!listSubjects.length" class="no-results align-content-center mt-3">
Sem Resultados Disponíveis
</div>
</table>
</div>
</template>

<script>
export default {
props: {
title: String,
dataSubjects: Array,
subjectSearch: String,
},
data: () => ({
listSubjects: [],
}),
watch: {
dataSubjects() {
this.listSubjects = this.dataSubjects;
},
subjectSearch() {
if (this.subjectSearch) {
this.listSubjects = this.dataSubjects.filter((item) => (
item.name.toLowerCase().includes(this.subjectSearch.toLowerCase())));
} else {
this.listSubjects = this.dataSubjects;
}
},
},
methods: {
goToSubject(id) {
this.$router.push({ path: `/disciplinas/visualizar/${id}` });
},
},
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,59 @@
overflow-x: hidden;
}

thead{
thead {
font-size: 25px;
color: #15355e;
font-weight: bold;
}

.minhasDisciplinas thead::after {
content: "Suas disciplinas";
font-size: 18px;
}

.demaisDisciplinas thead::after {
content: "Outras disciplinas";
font-size: 18px;
}

.demaisDisciplinas thead {
font-size: 0px;
padding: 0px;
margin: 0px;
}

.tabelas {
max-width: 1300px;
width: 100%;
align-content: flex-start;
padding-left: 20px;
}

.tabelas hr {
width: 100%;
max-width: 1300px;
display: inline-block;
border-bottom: 1px solid #94A6BC;
}

table {
border-spacing: 30px;
width: 100%;
max-width: 1500px;
border-spacing: 10px;
border-collapse: separate;
}

td {
max-width: 1500px;
width: 30%;
text-align: start;
}

.botao {
text-align: end;
}

tr {
border-top: hidden;
}
Expand All @@ -24,6 +67,7 @@ svg {
background-color: white;
color: #15355e;
border-color: #15355e;
padding: 10px 20px;
}

.search-input {
Expand All @@ -39,45 +83,31 @@ svg {
padding-top: 12px;
}

.table-div {
display: inline-table;
}

.no-results {
color: #15355e;
margin-left: 30vw;
font-size: 20px;
}

.add-project {
margin-left: 0px !important;
}

.tittle {
color: #15355E;
font-weight: bold;
font-size: 40px;
text-transform: uppercase
}

.sub-tittle {
font-size: 20px !important;
font-weight: normal !important;
}

header {
justify-content: center !important;
font-size: 20px;
font-weight: normal;
}

.btn-confirm {
/* .btn-confirm {
background-color: #dc3545 !important;
}
.btn-cancel {
border-color: #15355e !important;
color: #15355e !important;
background-color: white !important;
}
} */

.modal-tittle {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ export default {
data: {
columns: [
{
label: 'ITEM',
field: 'subjectid',
sort: 'asc',
label: 'Nome',
field: 'name',
},
{
label: 'TÍTULO',
field: 'name',
sort: 'desc',
label: 'Professores',
field: '',
},
{
label: '',
Expand Down Expand Up @@ -69,7 +67,8 @@ export default {
configTableRows() {
this.subjects.forEach((subject) => {
const row = subject;
row.buttons = '<button name="visualizar" class="btn cd-btn mx-2" id=' + subject.subjectid + '><i class="fa-solid fa-circle-info mr-2 ml-0"></i>VER DETALHES</button><button name="editar" class="btn cd-btn mx-2" id=' + subject.subjectid + '><i class="fas fa-edit mr-2 ml-0"></i>EDITAR</button><button name="excluir" class="btn cd-btn mx-2" id=' + subject.subjectid + '><i class="fa-solid fa-trash mr-2 ml-0"></i>EXCLUIR</button>';
row.buttons = '<button name="visualizar" class="btn cd-btn mx-2" id=' + subject.subjectid + '><i class="fa-solid fa-circle-info mr-2 ml-0"></i>VER DETALHES</button><button name="editar" class="btn cd-btn mx-2" id=';
row.professors = subject.professors[0].fullname;
this.data.rows.push(row);
});
},
Expand Down

0 comments on commit daea975

Please sign in to comment.