Skip to content

Commit

Permalink
forms
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiyaret-Sandhu committed Mar 12, 2024
1 parent 57b790d commit d2cde96
Show file tree
Hide file tree
Showing 50,266 changed files with 6,283,268 additions and 19 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 2 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ section
color: #fff;
display: inline-block;
padding: 0.5rem 3rem;
clip-path: polygon(100% 0, 93% 50%, 100% 99%, 0% 100%, 7% 50%, 0% 0%);
border-radius: 0.5rem;
/* clip-path: polygon(100% 0, 93% 50%, 100% 99%, 0% 100%, 7% 50%, 0% 0%); */
}

.btn
Expand Down
218 changes: 218 additions & 0 deletions forms/Delivery/dist/bundle.js

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions forms/Delivery/dist/image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const firebaseConfig = {
apiKey: "AIzaSyCz_uy2uoot9oQcl_2L8CoNVCrOWceWk8o",
authDomain: "groco-ad815.firebaseapp.com",
projectId: "groco-ad815",
storageBucket: "groco-ad815.appspot.com",
messagingSenderId: "192212069035",
appId: "1:192212069035:web:8d84c98f7b1de4bef125ee"
};

// Initialize Firebase
firebase.initializeApp(firebaseConfig);

let imagePer = "";
let imageUrl = "";

function uploadImage() {
const ref = firebase.storage().ref();
const file = document.querySelector("#photo").files[0];
const name = +new Date() + "-" + file.name;
const metadata = {
contentType: file.type
};
const task = ref.child(name).put(file, metadata);

// Register three observers:
// 1. 'state_changed' observer, called any time the state changes
task.on('state_changed', function(snapshot) {
// Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log('Upload is ' + progress + '% done');
imagePer = 'Upload is ' + progress.toFixed(2) + '% done';
// Update the progress in the corresponding <div> element
document.querySelector('.imgpercent').innerText = imagePer;
switch (snapshot.state) {
case firebase.storage.TaskState.PAUSED: // or 'paused'
console.log('Upload is paused');
break;
case firebase.storage.TaskState.RUNNING: // or 'running'
console.log('Upload is running');
break;
}
});

task.then(snapshot => snapshot.ref.getDownloadURL())
.then(url => {
console.log(url);
alert('image uploaded successfully');
imageUrl = url;
// Update the image URL in the corresponding <div> element
document.querySelector('.imageurl').innerText = imageUrl;
const img = document.getElementById('image');
if (img) {
img.src = url;
imageUrl = url;
}
})
.catch(console.error);
}

const errorMsgElement = document.querySelector('span#errorMsg');

document.getElementById('upload').addEventListener('click', function() {
uploadImage();
});


export { imageUrl };
Binary file added forms/Delivery/dist/img/favicon.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added forms/Delivery/dist/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 147 additions & 0 deletions forms/Delivery/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product Form</title>
<link rel="icon" type="image/icon" href="img/favicon.PNG">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<meta name="description" content="The Groco - Online grocery store , wide range of products , great deals , high end products , cheap | low prices , home delivery , online payment , cash on delivery , Buy "/>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://unpkg.com/swiper@7/swiper-bundle.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<!-- <link rel="stylesheet" href="style.scss"> -->
<script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-storage.js"></script>

</head>
<body>
<header class="header">

<a href="#" class="logo">
<img class="groco_logo" src="img/logo.png" alt="THE GROCO LOGO">
</a>

<nav class="navbar">
<a href="#home">| &#127968; Home |</a>
<a href="#features"> | &#128736; Features | </a>
<a href="#products"> | &#128230; Products | </a>
<a href="#categories"> | &#128218; Categories | </a>
<a href="#review"> | &#127775; Review | </a>
<a href="#blogs"> | &#128221; Blogs | </a>
</nav>
</header>
<section class="container">
<h2 class="productForm">Product Form</h2>
<form id="productForm" class="add">
<input type="text" id="name" name="name" required placeholder="Name / नाम / ਨਾਮ"><br>
<input type="number" id="phone" name="phone" placeholder="Phone Number / फ़ोन नंबर / ਫੋਨ ਨੰਬਰ" required><br>
<input type="number" id="age" name="age" min="18" max="50" step="1" required placeholder="Age / आयु / ਉਮਰ"><br>
<select id="state" name="state" required>
<option value="" hidden>Select State / राज्य चुनें / ਰਾਜ ਚੁਣੋ</option>
<option value="punjab">Punjab / पंजाब / ਪੰਜਾਬ</option>
<option value="haryana">Haryana / हरयाणा / ਹਰਿਆਣਾ</option>
</select><br>
<select id="district" name="district" required>
<option value="">Select District / जिला चुनें / ਜਿਲਾ ਚੁਣੋ</option>
</select><br>

<input type="file" id="photo" />
<div class="file-input-wrapper">
<label for="photo" class="file-input-label">Choose File</label>
</div>
<br>
<button id="upload">Upload Driving Lisence Image</button>

<div class="imgpercent"></div>

<div class="imageurl"></div>

<br>

</section>
<!-- <button type="submit">Submit</button> -->
</form>

</body>

<script src="image.js" type="module" ></script>
<script src="bundle.js"></script>

<script>
document.getElementById('state').addEventListener('change', function() {
var state = this.value;
var districtSelect = document.getElementById('district');
districtSelect.innerHTML = ''; // Clear existing options
if (state === 'punjab') {
// Populate Punjab districts
var punjabDistricts = [
"Not Selected / ਚੁਣਿਆ ਨਹੀਂ / चयन नहीं",
"Amritsar / ਅੰਮ੍ਰਿਤਸਰ / अमृतसर",
"Barnala / ਬਰਨਾਲਾ / बरनाला",
"Bathinda / ਬਠਿੰਡਾ / बठिंडा",
"Faridkot / ਫ਼ਰੀਦਕੋਟ / फरीदकोट",
"Fatehgarh Sahib / ਫਤਿਹਗੜ੍ਹ ਸਾਹਿਬ / फतेहगढ़ साहिब",
"Fazilka / ਫ਼ਾਜਿਲਕਾ / फ़ाज़िल्का",
"Firozpur / ਫ਼ਿਰੋਜ਼ਪੁਰ / फ़िरोज़पुर",
"Gurdaspur / ਗੁਰਦਾਸਪੁਰ / गुरदासपुर",
"Hoshiarpur / ਹੋਸ਼ਿਆਰਪੁਰ / होशियारपुर",
"Jalandhar / ਜਲੰਧਰ / जालंधर",
"Kapurthala / ਕਪੂਰਥਲਾ / कपूरथला",
"Ludhiana / ਲੁਧਿਆਣਾ / लुधियाना",
"Malerkotla / ਮਾਲੇਰਕੋਟਲਾ / मालेरकोटला",
"Mansa / ਮਾਨਸਾ / मानसा",
"Moga / ਮੋਗਾ / मोगा",
"Pathankot / ਪਠਾਨਕੋਟ / पठानकोट",
"Patiala / ਪਟਿਆਲਾ / पटियाला",
"Rupnagar / ਰੂਪਨਗਰ / रूपनगर",
"Sahibzada Ajit Singh Nagar / ਸਾਹਿਬਜ਼ਾਦਾ ਅਜੀਤ ਸਿੰਘ ਨਗਰ / साहिबज़ादा अजीत सिंह नगर",
"Sangrur / ਸੰਗਰੂਰ / संगरूर",
"Shahid Bhagat Singh Nagar / ਸ਼ਹੀਦ ਭਗਤ ਸਿੰਘ ਨਗਰ / शहीद भगत सिंह नगर",
"Sri Muktsar Sahib / ਸ੍ਰੀ ਮੁਕਤਸਰ ਸਾਹਿਬ / श्री मुक्तसर साहिब",
"Tarn Taran / ਤਰਨ ਤਾਰਨ / तरन तारन"
];
punjabDistricts.forEach(function(district) {
var option = document.createElement('option');
option.textContent = district;
option.value = district;
districtSelect.appendChild(option);
});
} else if (state === 'haryana') {
// Populate Haryana districts
var haryanaDistricts =[
"Not Selected / चयनित नहीं",
"Ambala / अम्बाला",
"Bhiwani / भिवानी",
"Charkhi Dadri / चरखी दादरी",
"Fatehabad / फतेहाबाद",
"Faridabad / फरीदाबाद",
"Gurugram / गुरुग्राम",
"Hisar / हिसार",
"Jhajjar / झज्जर",
"Jind / जींद",
"Kaithal / कैथल",
"Karnal / करनाल",
"Kurukshetra / कुरुक्षेत्र",
"Mahendragarh / महेंद्रगढ़",
"Nuh / नूह",
"Palwal / पलवल",
"Panchkula / पंचकुला",
"Panipat / पानीपत",
"Rewari / रेवाड़ी",
"Rohtak / रोहतक",
"Sirsa / सिरसा",
"Sonipat / सोनीपत",
"Yamunanagar / यमुनानगर"
];
haryanaDistricts.forEach(function(district) {
var option = document.createElement('option');
option.textContent = district;
option.value = district;
districtSelect.appendChild(option);
});
}
});
</script>

</html>
Loading

0 comments on commit d2cde96

Please sign in to comment.