-
Notifications
You must be signed in to change notification settings - Fork 36
/
form.html
69 lines (68 loc) · 2.94 KB
/
form.html
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
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="estilo-form.css" />
<title>Meu formulário</title>
</head>
<body>
<header>
<h1>Meu primeiro formulário</h1>
</header>
<section>
<form action="#" target="_self" method="POST" name="frmImovel" id="frmImovel">
<label for="paramLocator">Endereço Ethereum do locador do imóvel: </label>
<input type="text" name="paramLocator" id="paramLocator" size="45" maxlength="42" required autofocus />
<br />
<label for="paramRenter">Endereço Ethereum do locatário do imóvel: </label>
<input type="text" name="paramRenter" id="paramRenter" size="45" maxlength="42" required />
<br />
<label for="paramAddressHome">Endereço físico do imóvel: </label>
<input type="text" name="paramAddressHome" id="paramAddressHome" size="100" required placeholder="(informe a rua com o CEP do imóvel)" />
<br />
<label for="paramRentalValue">Valor do aluguel: </label>
<input type="number" name="paramRentalValue" id="paramRentalValue" size="10" min="1" max="99999" required />
<br />
<input type="submit" value="Registrar no Smart Contract" onclick="getFormData();" />
</form>
</section>
<hr />
<section>
<div>
<h1>Dados do contrato de locação</h1>
</div>
<div>
Informe o numero do contrato:
<input type="number" name="contractNumber" id="contractNumber" size="10" min="1" max="99999" />
<button onclick="getRentalContractData()">Buscar Dados</button>
</div>
<br />
<div>Endereço Ethereum do locador do imóvel: <span id="locator"></span></div>
<div>Endereço Ethereum do locatário do imóvel: <span id="renter"></span></div>
<div>Endereço físico do imóvel: <span id="addressHome"></span></div>
<div>Valor do aluguel: <span id="rentalValue"></span></div>
</section>
<script
type="text/javascript"
integrity="sha384-dq8L5gpIcUoGAeHh/6setfxuuDI0ngshPvCvksSAcQMMWCr5cVFAaijT//nxVyjb"
crossorigin="anonymous"
src="https://cdn-cors.ethers.io/lib/ethers-5.4.0.umd.min.js"
></script>
<script src="dado-contrato-no-ethereum.js"></script>
<script>
function getFormData() {
alert(document.frmImovel.paramLocator.value + " " + document.frmImovel.paramRenter.value);
//event.preventDefault();
}
function getRentalContractData() {
let contractNumberField = document.getElementById("contractNumber");
const userInput = contractNumberField.value * 1;
alert("valorInformadoPeloUsuario: " + userInput);
}
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
</script>
</body>
</html>