-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57b790d
commit d2cde96
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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">| 🏠 Home |</a> | ||
<a href="#features"> | 🛠 Features | </a> | ||
<a href="#products"> | 📦 Products | </a> | ||
<a href="#categories"> | 📚 Categories | </a> | ||
<a href="#review"> | 🌟 Review | </a> | ||
<a href="#blogs"> | 📝 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> |
Oops, something went wrong.