-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.html
173 lines (153 loc) · 5.59 KB
/
contact.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VOLUNTEERS WITHOUT FRONTIERS (VWF) - Contact</title>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header>
<nav class="navbar">
<div class="container">
<div class="logo">
<a href="/">VWF</a>
</div>
<ul class="nav-links">
<li><a href="/">Home</a></li>
<li><a href="/post.html">Posts</a></li>
<li><a href="/aboutus.html">About</a></li>
<li><a href="programs.html">Programs</a></li>
<li><a href="resources.html">Resources</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="gallery.html">Gallery</a></li>
</ul>
<div class="hamburger-icon">
<i class="fa fa-bars"></i>
</div>
</div>
</nav>
</header>
<main>
<div class="contact-container">
<h1>Contact Us</h1>
<form>
<label for="name">Name</label>
<input type="text" id="name" name="name" required />
<label for="email">Email</label>
<input type="email" id="email" name="email" required />
<label for="phone">Phone</label>
<input type="tel" id="phone" name="phone" required />
<label for="message">Message</label>
<textarea id="message" name="message" rows="5" required></textarea>
<button type="submit" onclick="submitForm()">Send Message</button>
</form>
<!-- Success message div -->
<div id="successMessage" class="success-message">
Message sent successfully!
</div>
</div>
</main>
<br />
<footer>
<div class="footer-container">
<section class="footer-column">
<h3>About Us</h3>
<p id="about-us-desc">
We are a non-profit organization for the livelihood enhancement of
landless and rural communities in the far western Nepal.
</p>
</section>
<section class="footer-column">
<h3>Quick Links</h3>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/post.html">Post</a></li>
<li><a href="aboutus.html">About</a></li>
<li><a href="programs.html">Programs</a></li>
<li><a href="resources.html">Resources</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="gallery.html">Gallery</a></li>
</ul>
</section>
<section class="footer-column" id="contact">
<h3>Contact Us</h3>
<p>Address: Tikapur-1, Sudurpaschim Province, Nepal</p>
<p>
<a href="mailto: janak.mahar2044@gmail.com">
Email: janak.mahar2044@gmail.com</a
>
</p>
<p>
<a href="tel: +977 09150922">Phone: +977 091560922 </a>
</p>
<p>
<a href="tel: +977 9858422956">Office Head: +977 9858422956 </a>
</p>
<p>
<a href="tel: +977 9865878427">Management Head: +977 9865878427 </a>
</p>
</section>
</div>
<p class="footer-bottom" id="footer-year"></p>
</footer>
<script src="./config.js"></script>
<script>
// Set Hamburger Icon
const hamburgerIcon = document.querySelector('.hamburger-icon');
const navLinks = document.querySelector('.nav-links');
const mainContent = document.querySelector('main');
hamburgerIcon.addEventListener('click', function () {
navLinks.classList.toggle('active');
mainContent.classList.toggle('main-menu-active-padding');
});
const backendUrl = window.config.backendUrl;
function submitForm() {
const form = document.querySelector('form');
const formData = {
name: form.name.value,
email: form.email.value,
phone: form.phone.value,
message: form.message.value,
};
const successMessage = document.getElementById('successMessage');
form.addEventListener('submit', async function (event) {
event.preventDefault();
try {
// Send a POST request to the backend URL
const response = await fetch(`${backendUrl}/api/v1/contacts`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(formData),
});
if (response.ok) {
// Display the success message
alert('Message Sent Successfully');
// Reset the form after displaying the success message (you can remove this if not needed)
form.reset();
} else {
// Handle the case where the request was not successful
console.error('Failed to submit the form');
}
} catch (error) {
// Handle errors that occur during the fetch operation
console.error('Error during form submission:', error);
}
});
}
</script>
</body>
</html>