Skip to content

Commit

Permalink
Merge pull request #32 from Daniel-Alvarenga/main
Browse files Browse the repository at this point in the history
Register Vagas and their view
  • Loading branch information
Daniel-Alvarenga authored Jul 6, 2024
2 parents a450164 + 98cdb5b commit 0bccafe
Show file tree
Hide file tree
Showing 26 changed files with 871 additions and 19 deletions.
11 changes: 10 additions & 1 deletion client/src/router/routes/funcionario.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import {
isInitingFuncionario,
isRecoveringFuncionario
} from '../guards/guards.js';
import RegisterVaga from '../../views/funcionario/RegisterVaga.vue';

export const funcionarioRoutes = [
{
path: '/funcionario/init',
name: 'InitFuncionario',
component: InitFuncionario
component: InitFuncionario,
},
{
path: '/funcionario/validate',
Expand Down Expand Up @@ -46,6 +47,14 @@ export const funcionarioRoutes = [
(await isRecoveringFuncionario()) ? next() : next("/funcionario/recovery");
}
},
{
path: '/funcionario/register/vaga',
name: 'RegisterVaga',
component: RegisterVaga,
beforeEnter: async (to, from, next) => {
(await isAuthFuncionario()) ? next() : next("/funcionario/init");
}
},
{
path: "/funcionario",
name: "Funcionario",
Expand Down
6 changes: 6 additions & 0 deletions client/src/router/routes/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import NotFound from '../../views/shared/NotFound.vue';
import PublicPerfilAluno from '../../views/shared/PerfilAluno.vue';
import PublicPerfilProfessor from '../../views/shared/PerfilProfessor.vue';
import Pesquisa from '../../views/shared/Pesquisa.vue';
import Vagas from '../../views/shared/Vagas.vue';
import { isAuthSomebody } from '../guards/guards';

export const sharedRoutes = [
Expand Down Expand Up @@ -34,6 +35,11 @@ export const sharedRoutes = [
name: 'Pesquisa',
component: Pesquisa
},
{
path: '/vagas',
name: 'Vagas',
component: Vagas
},
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
Expand Down
Empty file.
158 changes: 158 additions & 0 deletions client/src/scss/pages/shared/_vagas.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#app{
height: 100vh;

main {
@include flex(row, flex-start, start);
width: 100vw;
height: 100vh;
min-height: calc(100vh - 80px);
border-bottom: 1px solid #0000008f;
background-color: $primary-color-dark;
position: relative;

.content {
@include flex(column, flex-start, start);
width: calc(100% - 300px);
height: 100%;

@include m-screen(1200px) {
width: 100%;
}

.search {
@include flex(row, center, start);
height: 50px;
width: 62%;
padding: 20px 30px 20px 80px;

.box{
@include flex(row, cen, start);
height: 50px;
border-radius: 25px;
width: calc(100% - 40px);
background-color: $secondary-color-dark;

input {
color: $font-color-dark-2;
width: 94%;
height: 100%;
padding-inline: 15px;
outline: none;
background: transparent;
border: none;
font-size: medium
}

button {
@include flex-center;
height: 100%;
background-color: transparent;
border: none;

img {
height: 55%;
object-fit: cover;
opacity: 0.8;
filter: invert(100%)
}
}
}
}

>.box {
@include flex(column, flex-start, start);
padding: 50px 0px 0px 100px;
width: 70%;
height: 100%;

@include m-screen(1400px) {
@include flex(column, center, center);
padding: 50px 0px 0px 0px;
width: 100%;
}

.resultado {
@include flex(column, center, end);
text-align: right;
width: 80%;
color: $secondary-color-orange;
margin-right: 10px;
margin-bottom: 10px;
height: 100%;
font-size: small;
font-weight: 200;
@include font-inter(600);
}


.vaga {
@include flex(column, flex-start, start);
width: 80%;
height: 90px;
margin-bottom: 10px;

@include m-screen(1400px) {
width: 70%;
}

@include m-screen(800px) {
width: 90%;
}

a {
@include flex(row, flex-start, start);
width: 100%;
height: 100%;
background-color: $secondary-color-dark;
padding: 15px;
border-radius: 5px;
text-decoration: none;
color: $font-color-dark;

img {
height: 60px;
width: 60px;
object-fit: cover;
border-radius: 50%;
margin-right: 20px;
}

.infoVaga {
@include flex(row, space-between, start);
width: calc(100% - 60px);
height: 100%;

.who {
color: $primary-color-orange;
margin-right: 10px;
margin-bottom: 10px;
}

.contentVaga {
@include flex(column, flex-start, start);
}

.box-button{
height: 100%;
@include flex(column, center, center);

button{
background-color: $primary-color-orange;
padding: 10px 20px;
border-radius: 10px;
color: $secondary-color-dark;
border: solid 1px $primary-color-orange;
}
}

}

p {
@include font-inter(600);
}
}
}
}
}
}
}
39 changes: 39 additions & 0 deletions client/src/services/api/funcionario.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ export const validateRecovery = async(infoFuncionario) => {
}
}

export const registerVaga = async(infoVaga, token) => {
try {
const response = await api.post('funcionario/register/vaga', infoVaga, {
headers: {
authorization: `${token}`
}
});
return response;
} catch (error) {
return error.response.data;
}
}

export const refreshTokenFuncionario = async (token) => {
try {
const response = await api.get('funcionario/token/refresh', {
Expand All @@ -74,4 +87,30 @@ export const refreshTokenFuncionario = async (token) => {
} catch (error) {
return error.response.data;
}
}

export const getCursos = async(token) => {
try {
const response = await api.get('funcionario/cursos', {
headers: {
authorization: `${token}`
}
});
return response;
} catch (error) {
return error.response.data;
}
}

export const getEmpresas = async(token) => {
try {
const response = await api.get('funcionario/empresas', {
headers: {
authorization: `${token}`
}
});
return response;
} catch (error) {
return error.response.data;
}
}
9 changes: 9 additions & 0 deletions client/src/services/api/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,12 @@ export const getUsers = async () => {
return error.response.data;
}
}

export const getVagas = async () => {
try {
const response = await api.get('shared/vagas');
return response;
} catch (error) {
return error.response.data;
}
}
4 changes: 3 additions & 1 deletion client/src/util/authMixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ export const mixinFuncionario = {
try {
const response = await refreshTokenFuncionario(this.funcionario.token);
if (response.status >= 200 && response.status < 300) {
Cookies.set('token', `${response.data.token}`);
console.log("Auth funcionário")
Cookies.set('token-funcionario', `${response.data.token}`);
}
} catch (error) {
console.log("Erro em auth funcionário: " + error)
router.push({ path: '/funcionario/init' });
}
},
Expand Down
1 change: 1 addition & 0 deletions client/src/views/funcionario/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<h1>Bem-vindo profissional!</h1>
<nav>
<button @click="logout">Logout</button>
<router-link to="/funcionario/register/vaga">Registrar Vaga</router-link>
</nav>
</main>
<Footer />
Expand Down
Loading

0 comments on commit 0bccafe

Please sign in to comment.