Skip to content

Commit

Permalink
Merge pull request #108 from VitorCarvalho67/dev
Browse files Browse the repository at this point in the history
Fix error on GetEmpresa
  • Loading branch information
VitorCarvalho67 authored Nov 24, 2024
2 parents 503d13e + 46b354f commit 5197a11
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 6 deletions.
15 changes: 12 additions & 3 deletions client/src/components/empresa/AsideDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
</router-link>
</li>
</ul>
<ul>
<li>
<button @click="logout">
<img :src="icons.config">
<p v-if="showPs">Sair</p>
</button>
</li>
</ul>
</div>
<button @click="changePsVisualization">
<img :src="icons.angulo" alt="<">
Expand All @@ -47,10 +55,10 @@ import jobIcon from '../../assets/icons/estagio.png';
import rankingIcon from '../../assets/icons/trofeu.png';
import anguloIcon from '../../assets/icons/angulo.png';
import userIcon from '../../assets/icons/user.png';
import configIcon from '../../assets/icons/config.png';
import configIcon from '../../assets/icons/saida.png';
import formIcon from '../../assets/icons/forma.png';
import tablesIcon from '../../assets/icons/grafico-horizontal-simples.png';
import { mixinEmpresa } from '../../util/authMixins';
export default defineComponent({
name: 'AsideDashboard',
Expand Down Expand Up @@ -129,7 +137,8 @@ export default defineComponent({
},
beforeUnmount() {
window.removeEventListener('resize', this.checkScreenWidth);
}
},
mixins: [mixinEmpresa]
});
</script>

Expand Down
10 changes: 10 additions & 0 deletions client/src/router/routes/aluno.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import ChatAluno from '../../views/aluno/Message.vue';
import Pesquisa from '../../views/aluno/Pesquisa.vue';
import Vagas from '../../views/aluno/Vagas.vue';
import Ranking from '../../views/aluno/Ranking.vue';
import AlunoPerfilEmpresa from '../../views/aluno/PerfilEmpresa.vue';
import PublicPerfilEmpresa from '../../views/shared/PerfilEmpresa.vue';

import {
isRecoveringAluno,
Expand Down Expand Up @@ -136,6 +138,14 @@ export const alunoRoutes = [
(await isAuthAluno()) ? next() : next(`/aluno/profile/${to.params.rm}`);
}
},
{
path: "/aluno/empresa/:email",
name: "AlunoPerfilEmpresa",
component: AlunoPerfilEmpresa,
beforeEnter: async (to, from, next) => {
(await isAuthAluno()) ? next() : next(`/empresa/${to.params.email}`);
}
},
{
path: "/config",
name: "Config",
Expand Down
20 changes: 20 additions & 0 deletions client/src/scss/pages/empresa/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ main {
padding: 20px 30px;
}

.back-button {
@include flex(row, flex-end, center);
width: 100%;
margin-bottom: 20px;

a {
@include flex(row, flex-end, center);
text-decoration: none;
color: $font-color-dark;
@include font-inter(700);
font-size: 1rem;

img {
height: 15px;
margin-right: 5px;
filter: invert(100%);
}
}
}

.editButtons {
@include flex-center;
z-index: 2;
Expand Down
170 changes: 170 additions & 0 deletions client/src/views/aluno/PerfilEmpresa.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<template>
<Header />
<div id="app">
<main>
<AsideDashboard />
<div class="content">
<div class="back-button">
<router-link to="/vagas">
<img src="../../assets/icons/angulo.png" alt="Voltar" />
Voltar
</router-link>
</div>
<div class="capa">
<div class="capaProfile">
<img v-if="empresa.banner == 'default'" src="../../assets/imgs/defaultBanner.png"
alt="Capa" />
<img v-else :src="empresa.banner" alt="Capa" />
</div>
<div class="infoProfile">
<img v-if="empresa.imagem == 'default'" src="../../assets/icons/artwork.png" />
<img v-else :src="empresa.imagem" />
<div class="info">
<div class="box1">
<h1 v-text="empresa.nome"></h1>
</div>
</div>
</div>
</div>

<section class="sobreMim">
<h2>
Sobre a Empresa
</h2>
<div>
CNPJ: {{empresa.cnpj}}
Email: {{empresa.email}}
<p v-show="mode === 'view'">Site: <a :href="empresa.site" target="_blanck">{{empresa.site}}</a></p>
</div>
</section>
</div>
</main>
</div>
</template>

<script>
import Header from '../../components/Header.vue';
import Footer from '../../components/Footer.vue';
import AsideDashboard from '../../components/aluno/AsideDashboard.vue';
import router from '../../router/index.js'
import { mixinEmpresa } from '../../util/authMixins.js';
import imgLapis from "../../assets/icons/lapis.png";
import imgVerificar from "../../assets/icons/verificar.png";
import imgCruz from "../../assets/icons/cruz.png";
import { getEmpresa } from '../../services/api/shared.js';
import Cookies from 'js-cookie';
import { updateBanner, updateImage, updateSite } from '../../services/api/empresa.js';
export default {
name: 'PublicPerfilEmpresa',
components: {
Header,
AsideDashboard,
Footer
},
data() {
return {
empresa: {
email: '',
telefone: '',
endereco: '',
imagem: '',
banner: '',
patrocinada: '',
cnpj: '',
site: '',
siteSubmit: '',
token: '',
},
file: "",
fileSelected: false,
linkstatus: 0,
mode: "view",
modeImage: "view",
modeBanner: "view",
imgLapis,
imgVerificar,
imgCruz,
extracurriculares: [],
showAddForm: false,
}
},
methods: {
async GetEmpresa(){
try {
const response = await getEmpresa(this.empresa.email);
if (response.status >= 200 && response.status < 300) {
this.empresa = response.data;
this.empresa.siteSubmit = response.data.site;
} else {
console.error(
"Erro ao carregar dados da empresa",
response.message,
);
}
} catch (error) {
console.error(
"Erro ao carregar dados da empresa",
error.message,
);
}
},
previewProfileImage(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = (e) => {
this.empresa.imagem = e.target.result;
};
reader.readAsDataURL(file);
},
previewBannerImage(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = (e) => {
this.empresa.banner = e.target.result;
};
reader.readAsDataURL(file);
},
},
async created() {
this.empresa.email = this.$route.params.email;
await this.GetEmpresa(this.empresa.email);
}
}
</script>

<style lang="scss" scoped>
@import "../../scss/pages/empresa/_dashboard.scss";
#app {
display: flex;
flex-direction: column;
min-height: calc(100vh - 80px);
main {
display: flex;
flex: 1;
overflow: hidden;
.content {
flex: 1;
padding: 20px;
overflow-y: auto;
height: 100%;
@media (max-width: 1000px) {
width: calc(100% - 100px);
}
}
}
}
</style>
2 changes: 1 addition & 1 deletion client/src/views/aluno/Vaga.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="info-enterprise">
<strong>Empresa:</strong>
<router-link
:to="'/empresa/' + vaga.empresa.email">
:to="'/aluno/empresa/' + vaga.empresa.email">
{{ vaga.empresa.name }}
</router-link>
</div>
Expand Down
4 changes: 2 additions & 2 deletions server/src/modules/services/empresa/GetEmpresaUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export class GetEmpresaUseCase {
let bannerUrl = "default";

if (bannerName) {
const objectExists = await minioClient.statObject(bucketName, imageName);
const objectExists = await minioClient.statObject(bucketName, bannerName);
if(objectExists){
bannerUrl = await minioClient.presignedUrl('GET', bucketName, imageName, 24 * 60 * 60);
bannerUrl = await minioClient.presignedUrl('GET', bucketName, bannerName, 24 * 60 * 60);
}
}

Expand Down

0 comments on commit 5197a11

Please sign in to comment.