forked from VitorCarvalho67/Boot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8f4d0f
commit 6fd368c
Showing
9 changed files
with
251 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
main { | ||
height: calc(100vh - 80px); | ||
background-color: $primary-color-dark; | ||
@include flex-center; | ||
} | ||
|
||
.path { | ||
width: 100%; | ||
@include flex(row, flex-start, center); | ||
|
||
font-size: 0.9rem; | ||
@include font-inter(300); | ||
margin-bottom: 20px; | ||
> p { | ||
@include flex(column, center, center); | ||
@include font-inter(400); | ||
|
||
&:after { | ||
width: 100%; | ||
height: 3px; | ||
margin-top: 3px; | ||
background-color: $secondary-color-orange; | ||
} | ||
|
||
&:hover::after { | ||
animation: none; | ||
} | ||
} | ||
|
||
img { | ||
@include flex(column, center, center); | ||
width: 15px; | ||
transform: rotate(180deg); | ||
filter: invert(100%); | ||
margin-inline: 20px; | ||
} | ||
} | ||
|
||
.table { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
|
||
.table-header { | ||
border-left: 3px solid $secondary-color-orange; | ||
.table-cell { | ||
@include font-inter(600); | ||
} | ||
} | ||
|
||
.table-row { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
||
.table-cell { | ||
flex: 1; | ||
padding: 8px; | ||
border-right: 1px solid #ddd; | ||
font-size: 1rem; | ||
@include font-inter(300); | ||
color: $font-color-dark; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<template> | ||
<Header /> | ||
<div id="app"> | ||
<main> | ||
<AsideDashboard pageName='home' /> | ||
<div class="content"> | ||
<div class="path"> | ||
<p>Dashboard</p> | ||
<img :src="anguloIcon" alt=""> | ||
<p>Tabelas</p> | ||
<img :src="anguloIcon" alt=""> | ||
<p>Empresas</p> | ||
</div> | ||
<div class="table"> | ||
<div class="table-header"> | ||
<div class="table-row"> | ||
<div class="table-cell">Empresas Registradas</div> | ||
</div> | ||
</div> | ||
<div class="table-body"> | ||
<div class="table-row" v-for="empresa in empresas" :key="empresa.id"> | ||
<div class="table-cell"> | ||
<p>{{ empresa.name }}</p> | ||
<p>CNPJ: {{ empresa.cnpj }}</p> | ||
<p>Email: {{ empresa.email }}</p> | ||
<p>Registro: {{ formatarData(empresa.createdAt) }}</p> | ||
<p>Apoiadora: {{ empresa.patrocinador }}</p> | ||
<div v-if="(empresa.estagios).length > 0"> | ||
<p>{{ (empresa.estagios).length }} estágios:</p> | ||
<ul> | ||
<li v-for="estagio in empresa.estagios" :key="estagio">{{ estagio }}</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Header from '../../components/Header.vue'; | ||
import AsideDashboard from '../../components/admin/AsideDashboard.vue'; | ||
import anguloIcon from '../../assets/icons/angulo.png'; | ||
import { mixinAdmin } from '../../util/authMixins.js'; | ||
import { getFullEmpresas } from '../../services/api/admin'; | ||
export default { | ||
name: 'TableEmpresas', | ||
components: { | ||
Header, | ||
AsideDashboard, | ||
}, | ||
data() { | ||
return { | ||
anguloIcon, | ||
empresas: [], | ||
} | ||
}, | ||
methods: { | ||
async fetchEmpresas() { | ||
const data = await getFullEmpresas(this.admin.token); | ||
this.empresas = data.data; | ||
}, | ||
formatarData(data) { | ||
const dataAtual = new Date(); | ||
const dataMensagem = new Date(data); | ||
if (dataMensagem.toDateString() === dataAtual.toDateString()) { | ||
return dataMensagem.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); | ||
} else { | ||
const diff = Math.floor((dataAtual - dataMensagem) / (1000 * 60 * 60 * 24)); | ||
if (diff === 1) { | ||
return `Ontem, ${dataMensagem.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`; | ||
} else if (diff <= 7) { | ||
return `${dataMensagem.toLocaleDateString('pt-BR', { weekday: 'long' })}, ${dataMensagem.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`; | ||
} else { | ||
return dataMensagem.toLocaleString(); | ||
} | ||
} | ||
} | ||
}, | ||
mixins: [mixinAdmin], | ||
async created() { | ||
this.getToken(); | ||
await this.fetchEmpresas(); | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import "../../scss/pages/admin/_tableEmpresa.scss"; | ||
#app { | ||
display: flex; | ||
flex-direction: column; | ||
min-height: calc(100vh - 80px); | ||
main { | ||
display: flex; | ||
overflow: hidden; | ||
.content { | ||
flex: 1; | ||
padding: 20px; | ||
overflow-y: auto; | ||
height: 100%; | ||
@media (max-width: 1000px) { | ||
width: calc(100% - 100px); | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { prisma } from "../../../../prisma/client"; | ||
|
||
interface EmpresaWithEstagios { | ||
id: string; | ||
name: string; | ||
estagios: string[]; | ||
} | ||
|
||
export class GetEmpresasWithEstagiosUseCase { | ||
async execute(): Promise<EmpresaWithEstagios[]> { | ||
const empresas = await prisma.empresa.findMany({ | ||
include: { | ||
vaga: true, | ||
}, | ||
}); | ||
|
||
const empresasWithEstagios: EmpresaWithEstagios[] = empresas.map((empresa) => ({ | ||
...empresa, | ||
estagios: empresa.vaga.map((vaga) => vaga.titulo), | ||
})); | ||
|
||
return empresasWithEstagios; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters