-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdoa.html
More file actions
187 lines (163 loc) · 7.76 KB
/
doa.html
File metadata and controls
187 lines (163 loc) · 7.76 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="estilizacao.css">
<title>Doação</title>
</head>
<body>
<img class="blue" src="imgs/Captura de tela de 2025-02-12 00-12-14.png" alt="">
<header>
<img class="in" src="imgs/Prato_Cheio2-removebg-preview.png" alt=""> Prato Cheio
</header>
<div class="overlay" id="overlay"></div>
<div class="modal" id="modal">
<h3>Escolha um valor</h3>
<form method="POST" action="doacao.php">
<div class="opcoes-valores">
<div class="valor-opcao" data-value="50">R$ 50,00</div>
<div class="valor-opcao" data-value="100">R$ 100,00</div>
<div class="valor-opcao" data-value="200">R$ 200,00</div>
<div class="valor-opcao" data-value="500">R$ 500,00</div>
</div>
<button class="fechar" id="fechar">Fechar</button>
</form>
</div>
<div class="robson">
<form method="POST" action="process.php">
<div class="valores">
<input type="radio" name="valor" id="val1" value="10">
<label for="val1" class="val">R$ 10,00</label>
<input type="radio" name="valor" id="val2" value="20">
<label for="val2" class="val">R$ 20,00</label>
<input type="radio" name="valor" id="val3" value="outro">
<label for="val3" class="val" id="outroValor">Outro valor</label>
</div>
<div class="opcoes">
<input type="radio" name="tipo" id="ind" value="individual">
<label for="ind" class="individual">
<span>Individual</span>
</label>
<input type="radio" name="tipo" id="men" value="mensal">
<label for="men" class="mensal">
<span>Mensal</span>
</label>
</div>
<input class="form-input" type="text" name="nome" placeholder="Nome">
<input class="form-input" type="text" name="sobrenome" placeholder="Sobrenome">
<input class="form-input" type="number" name="cpf" placeholder="CPF">
<input class="form-input" type="text" name="email" placeholder="Email">
<input class="form-input" type="number" name="numero" placeholder="Número">
<div class="botoes">
<a href="index.html"> <button class="voltar">Voltar</button></a>
<button type="submit" class="doar">Doar</button>
</div>
</form>
</div>
<div class="modal-doacao" id="modalDoacao">
<div class="modal-content">
<h2>Faça sua doação</h2>
<div class="item-doacao">
<img src="imgs/cesta-basica.png" alt="Cesta Básica">
<div class="item-info">
<span>Cesta básica</span>
<div class="quantidade-controle">
<button class="btn-qtd minus">-</button>
<input type="number" name="cesta_basica" value="0" min="0" class="qtd-input">
<button class="btn-qtd plus">+</button>
</div>
</div>
</div>
<div class="item-doacao">
<img src="imgs/alimentos.png" alt="Alimentos">
<div class="item-info">
<span>Alimentos não perecíveis</span>
<div class="quantidade-controle">
<button class="btn-qtd minus">-</button>
<input type="number" name="alimentos" value="0" min="0" class="qtd-input">
<button class="btn-qtd plus">+</button>
</div>
</div>
</div>
<div class="item-doacao">
<img src="imgs/alimentos.png" alt="Alimentos">
<div class="item-info">
<span>Marmitas e lanches</span>
<div class="quantidade-controle">
<button class="btn-qtd minus">-</button>
<input type="number" name="marmitas" value="0" min="0" class="qtd-input">
<button class="btn-qtd plus">+</button>
</div>
</div>
</div>
<div class="botoes-modal">
<button class="btn-cancelar">Cancelar</button>
<button type="submit" class="btn-confirmar" onclick="window.location.href='index.html'">Confirmar Doação</button>
</div>
</div>
</div>
<script>
document.getElementById("outroValor").addEventListener("click", function() {
document.getElementById("modal").style.display = "block";
document.getElementById("overlay").style.display = "block";
});
document.getElementById("fechar").addEventListener("click", function() {
document.getElementById("modal").style.display = "none";
document.getElementById("overlay").style.display = "none";
});
document.querySelectorAll(".valor-opcao").forEach(item => {
item.addEventListener("click", function() {
let valorSelecionado = this.getAttribute("data-value");
alert("Você vai doar R$ " + valorSelecionado + "!!!!");
document.getElementById("modal").style.display = "none";
document.getElementById("overlay").style.display = "none";
});
});
document.querySelectorAll('input[type="radio"]').forEach(radio => {
radio.addEventListener('click', function() {
if (this.checked) {
let wasChecked = this.getAttribute('data-was-checked') === 'true';
if (wasChecked) {
this.checked = false;
this.setAttribute('data-was-checked', 'false');
} else {
document.querySelectorAll('input[type="radio"]').forEach(r => {
r.setAttribute('data-was-checked', 'false');
});
this.setAttribute('data-was-checked', 'true');
}
}
});
});
// Adicione este script
document.querySelector('.doar').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('modalDoacao').style.display = 'block';
document.getElementById('overlay').style.display = 'block';
});
document.querySelector('.btn-cancelar').addEventListener('click', function() {
document.getElementById('modalDoacao').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
});
// Controle de quantidade
document.querySelectorAll('.btn-qtd').forEach(btn => {
btn.addEventListener('click', function() {
const input = this.parentElement.querySelector('.qtd-input');
const currentValue = parseInt(input.value) || 0;
if (this.classList.contains('plus')) {
input.value = currentValue + 1;
} else if (this.classList.contains('minus') && currentValue > 0) {
input.value = currentValue - 1;
}
});
});
// Formatação do input de dinheiro
document.querySelector('.input-dinheiro').addEventListener('input', function(e) {
let value = e.target.value.replace(/\D/g, '');
value = (parseInt(value) / 100).toFixed(2);
e.target.value = value;
});
</script>
</body>
</html>