survey completed

main
Sanju-15 6 months ago
commit 32cd89b2d3
  1. 16
      README.md
  2. 160
      index.html
  3. 51
      script.js

@ -0,0 +1,16 @@
## Github Setup
### Setup account
git config --global user.name "your_username"
git config --global user.email johndoe@example.com
# first time
git init
git checkout -b main
git add README.md
git commit -m "first commit"
git remote add origin https://hackethon.ai/hack/Sanju-15/aquaguardian.git
git push -u origin main
# already existing repo

@ -0,0 +1,160 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Water Conservation Survey</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
background-color: #f4f4f9;
color: #333;
}
.container {
max-width: 800px;
margin: 20px auto;
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #0066cc;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"], input[type="email"], textarea {
width: 100%;
padding: 8px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="radio"] {
margin-right: 10px;
}
textarea {
resize: vertical;
height: 80px;
}
button {
display: block;
width: 100%;
padding: 10px;
background-color: #0066cc;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #005bb5;
}
#tips {
margin-top: 20px;
padding: 15px;
background-color: #e0f7fa;
border-left: 4px solid #0066cc;
display: none;
}
</style>
</head>
<body>
<div class="container">
<h1>Water Conservation Survey</h1>
<form id="surveyForm">
<!-- Full Name -->
<div class="form-group">
<label for="fullName">Full Name:</label>
<input type="text" id="fullName" name="fullName" required>
</div>
<!-- Email -->
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<!-- General Awareness -->
<fieldset class="form-group">
<legend><strong>1. General Awareness</strong></legend>
<label>How much water do you think an average person uses daily?</label>
<input type="radio" name="dailyWaterUsage" value="Less than 50 liters"> Less than 50 liters<br>
<input type="radio" name="dailyWaterUsage" value="50-100 liters"> 50–100 liters<br>
<input type="radio" name="dailyWaterUsage" value="100-200 liters"> 100–200 liters<br>
<input type="radio" name="dailyWaterUsage" value="More than 200 liters"> More than 200 liters<br>
<label>Are you aware of your household’s daily water consumption?</label>
<input type="radio" name="householdWater" value="Yes"> Yes<br>
<input type="radio" name="householdWater" value="No"> No<br>
<input type="radio" name="householdWater" value="Not sure"> Not sure<br>
<label>Do you know how much water is wasted by a dripping tap per day?</label>
<input type="radio" name="drippingTap" value="Less than 5 liters"> Less than 5 liters<br>
<input type="radio" name="drippingTap" value="5-10 liters"> 5–10 liters<br>
<input type="radio" name="drippingTap" value="10-20 liters"> 10–20 liters<br>
<input type="radio" name="drippingTap" value="More than 20 liters"> More than 20 liters<br>
</fieldset>
<!-- Personal Habits -->
<fieldset class="form-group">
<legend><strong>2. Personal Habits</strong></legend>
<label>How often do you turn off the tap while brushing your teeth?</label>
<input type="radio" name="tapWhileBrushing" value="Always"> Always<br>
<input type="radio" name="tapWhileBrushing" value="Sometimes"> Sometimes<br>
<input type="radio" name="tapWhileBrushing" value="Never"> Never<br>
<label>Do you have a habit of fixing leaks in your home promptly?</label>
<input type="radio" name="fixLeaks" value="Yes"> Yes<br>
<input type="radio" name="fixLeaks" value="No"> No<br>
<label>How frequently do you reuse water (e.g., for gardening, cleaning)?</label>
<input type="radio" name="reuseWater" value="Always"> Always<br>
<input type="radio" name="reuseWater" value="Sometimes"> Sometimes<br>
<input type="radio" name="reuseWater" value="Never"> Never<br>
<label>What type of water-saving appliances do you use at home?</label>
<input type="radio" name="waterAppliances" value="Low-flow faucets"> Low-flow faucets<br>
<input type="radio" name="waterAppliances" value="Dual-flush toilets"> Dual-flush toilets<br>
<input type="radio" name="waterAppliances" value="Water-efficient washing machines"> Water-efficient washing machines<br>
<input type="radio" name="waterAppliances" value="None"> None<br>
</fieldset>
<!-- Feedback and Suggestions -->
<fieldset class="form-group">
<legend><strong>3. Feedback and Suggestions</strong></legend>
<label>What do you think is the biggest cause of water wastage in your community?</label>
<textarea name="waterWastageCause" required></textarea>
<label>What kind of resources or tools would help you adopt better water conservation practices?</label>
<textarea name="conservationResources"></textarea>
<label>Do you have any suggestions for improving water conservation in your area?</label>
<textarea name="conservationSuggestions"></textarea>
</fieldset>
<!-- Submit Button -->
<button type="submit">Submit Survey</button>
</form>
<!-- Tips Section -->
<div id="tips">
<h2>Tips for Water Conservation</h2>
<p id="tipsContent"></p>
</div>
</div>
</body>
<script src="script.js"></script>

@ -0,0 +1,51 @@
<script>
document.getElementById('surveyForm').addEventListener('submit', function(event) {
event.preventDefault();
// Collect form data
const formData = new FormData(event.target);
const tips = [];
// Analyze responses and provide tips
if (formData.get('dailyWaterUsage') === 'More than 200 liters') {
tips.push('Consider monitoring your water usage to identify areas of excess consumption.');
}
// Analyze responses and provide tips
if (formData.get('dailyWaterUsage') === 'Less than 50 liters') {
tips.push('You are using less water why bro.');
}
if (formData.get('householdWater') === 'No') {
tips.push('Start tracking your household water usage with a meter or app.');
}
if (formData.get('drippingTap') === 'More than 20 liters') {
tips.push('Fix dripping taps promptly to save water.');
}
if (formData.get('tapWhileBrushing') === 'Never') {
tips.push('Turn off the tap while brushing to save up to 10 liters of water per day.');
}
if (formData.get('fixLeaks') === 'No') {
tips.push('Regularly inspect and fix leaks to prevent water wastage.');
}
if (formData.get('reuseWater') === 'Never') {
tips.push('Reuse greywater from washing vegetables or clothes for gardening.');
}
if (formData.get('waterAppliances') === 'None') {
tips.push('Invest in water-efficient appliances like low-flow faucets and dual-flush toilets.');
}
// Display tips
const tipsContent = document.getElementById('tipsContent');
const tipsDiv = document.getElementById('tips');
if (tips.length > 0) {
tipsContent.innerHTML = tips.map(tip => `<li>${tip}</li>`).join('');
tipsDiv.style.display = 'block';
} else {
tipsContent.innerHTML = '<p>Thank you for your responses! You are already making great choices for water conservation.</p>';
tipsDiv.style.display = 'block';
}
});
</script>
</body>
</html>
Loading…
Cancel
Save