Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#34 #2

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes
Binary file added Images/pet.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions admin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="menu.css" type="text/css">
<link rel="stylesheet" href="cadastro.css" type="text/css">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<title>Painel do usuário</title>
<style>
.not_logged {
display: none;
}
</style>
</head>
<body>
<script>
$(document).ready(function () {
if (!sessionStorage.token) {
$(".logged").hide();
alert("Por favor, faça login.");
document.location += "/../login.html";
return;
}

$("#usu_email").val(sessionStorage.usu_email);
$("#usu_ra").val(sessionStorage.usu_ra);
$("#usu_nome").val(sessionStorage.usu_nome);

$("#submitAlterar").click(function (e) {
e.preventDefault();

var usu_email = $("#usu_email").val();
var usu_ra = $("#usu_ra").val();
var usu_nome = $("#usu_nome").val();

$.ajax({
url: "http://localhost:2017/private/user",
headers: {
Authorization: "Bearer " + sessionStorage.token,
},
type: "PUT",
data: { usu_email, usu_nome, usu_ra },
success: (r)=>{
sessionStorage.usu_email = usu_email;
sessionStorage.usu_nome = usu_nome;
sessionStorage.usu_ra = usu_ra;
alert('Dados alterados com sucesso');
document.location += "/../usuario.html";
},
error: (e)=>{
alert(e.responseJSON.msg);
}
});
});

$("#submitDoacao").click(function (e) {
e.preventDefault();

var doa_quantidade = $("#doa_quantidade").val();

$.ajax({
url: "http://localhost:2017/private/doacao",
headers: {
Authorization: "Bearer " + sessionStorage.token,
},
type: "POST",
data: { doa_quantidade },
success: (r)=>{
alert('Doação registrada. Entregue as tampinhas no local de coleta para confirmação.');
document.location += "/../index.html";
},
error: (e)=>{
alert(e.responseJSON.msg);
}
});
});
});
</script>
<div class="menu">
<div id="areaLogo">
<H1 id="principal">UEMG SOLIDÁRIA</H1>
</div>
<div id="areaMenu">
<a class="links" href="index.html">Início</a>
<a class="links" href="campanha.html">Campanha</a>
<a class="links" href="hospital.html">Hospital</a>
<a class="links" href="curso.html"> Curso Sistemas de Informação</a>
<a class="links" href="uemg.html">UEMG</a>
</div>
</div>
<div class="logged">
<section class="painel_user">
<h3>Operações</h3>

<p>
<a class="links" href="datatable.html?method=GetUsuarios&camp_id=1">Criar doação</a>
</p>
<p class="operacoes">
<a class="links" href="datatable.html?method=GetDoacoes&camp_id=1&search=confirmar">Confirmar doações</a>
</p>
<p class="operacoes">
<a class="links" href="datatable.html?method=GetDoacoes&camp_id=1&search=estornar">Estornar doações</a>
</p>
</section>
</div>
</body>
</html>
27 changes: 26 additions & 1 deletion cadastro.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ body{
height: 550px auto;
}

.logged{
display: flex;
flex-flow: row wrap;
justify-content: space-around;
}

.painel_user{
font-size: 16px;
background: #571669;
max-width: 50vh;
margin: 30px auto;
padding: 0px 10px 10px 10px;
border-radius: 10px;
border: 2 solid;
height: 45vh;
}

.painel_user.doar {
height: 35vh;
}

h3{
font-size: 32px;
color: #fff;
Expand All @@ -71,10 +92,14 @@ h3{
margin-bottom: 10px;
border-radius: 4px;
border: 0 solid;
width: 94%;
width: 92%;
height: 8px;
}

.field.number{
height: 15px;
}

.enviar input{
background-color: #fff;
height: 40px;
Expand Down
80 changes: 64 additions & 16 deletions cadastro.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="menu.css">
<link rel="stylesheet" href="cadastro.css" type="text/css">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<title>Cadastro</title>
<style >
<style>
.cadastro_blocked {
display: none;
}
.image{
margin: 30px;
text-align: right;
Expand All @@ -19,6 +26,48 @@
</style>
</head>
<body>
<script>
$(document).ready(function () {
if (typeof(Storage) === "undefined") {
$(".cadastro").hide();
$(".cadastro_blocked").show();
alert('Por favor, atualize ou troque seu navegador.');
}
$("#submit").click(function (e) {
e.preventDefault();

var usu_email = $("#usu_email").val();
var usu_password = $("#usu_password").val();
var usu_password2 = $("#usu_password2").val();
var usu_ra = $("#usu_ra").val();
var usu_nome = $("#usu_nome").val();

if (usu_password === usu_password2) {
var forms = document.getElementsByClassName('field');
const validation = Object.values(forms).every((input) => {
if (input.required) {
return input.checkValidity();
}
return true;
});

$.post("http://localhost:2017/public/user",
{ usu_email, usu_password, usu_nome, usu_ra },
(r)=>{
sessionStorage.token = r.token;
Object.keys(r.user).forEach((key) => {
sessionStorage[key] = r.user[key];
});
document.location += "/../usuario.html";
}
).fail((e)=>{
alert(e.responseJSON.msg);
})
}

});
});
</script>
<div class="menu">

<div id="areaLogo">
Expand All @@ -35,40 +84,39 @@ <H1 id="principal">UEMG SOLIDÁRIA</H1>


<section class="content">
<div class="cadastro_blocked">
<h3>Erro no navegador</h3>
</div>
<div class="cadastro">
<div class="image">
<img src="./Images/curso.jpg"
width="20%"></div>
</div>
<h3>Cadastre-se</h3>

<form class="form" method="POST">
<form class="form" method="POST" action="#">
<p>
<input type="text" class="field"
name="name" placeholder="Nome Completo" required>
id="usu_nome" placeholder="Nome Completo" required>
</p>
<p>
<input type="email" class="field" name="email"
<input type="email" class="field" id="usu_email"
placeholder="Email" required>
</p>
<p>
<input type="date" class="field" required>
</p>

</p>
<p>
<input type="text" name="ra"class="field"
placeholder="Seu RA">
<input type="text" id="usu_ra" class="field"
placeholder="Número de RA" required>
</p>
<p>
<input type="text" name="password" class="field"
placeholder="Digite sua Senha">
<input type="text" id="usu_password" class="field"
placeholder="Digite sua Senha" required>
</p>
<p>
<input type="text" name="confirmPassword" class="field"
placeholder="Confirme sua senha">
<input type="text" id="usu_password2" class="field"
placeholder="Confirme sua senha" required>
</p>
<p class="enviar">
<input type="submit" value="Cadastrar" name="enviar">
<input type="submit" value="Cadastrar" id="submit">
</p>
</form>
</div><p>
Expand Down
Loading