From badedea3068540febe37fbb76d7e50efb80b755f Mon Sep 17 00:00:00 2001 From: aditi naithani Date: Thu, 1 Oct 2020 22:40:29 +0530 Subject: [PATCH 1/3] changes added in individual js file --- assets/js/ind.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/js/ind.js b/assets/js/ind.js index b406092..f4d08da 100644 --- a/assets/js/ind.js +++ b/assets/js/ind.js @@ -17,11 +17,11 @@ var keys; var loader = document.getElementById('loader'); loader.style.display = "none"; -var org_proof = document.getElementById('uploadbutton1'); -var org_img = document.getElementById('uploadbutton2'); +var ind_proof = document.getElementById('uploadbutton1'); +var ind_img = document.getElementById('uploadbutton2'); var head_proof = document.getElementById('uploadbutton3'); -var org_head_proof = document.getElementById('uploadbutton4'); -var folder = ["org_proof", "org_img", "head_proof", "org_head_proof"]; +var ind_head_proof = document.getElementById('uploadbutton4'); +var folder = ["ind_proof", "ind_img", "head_proof", "ind_head_proof"]; const name = document.getElementById('name'); const add = document.getElementById('add'); @@ -44,13 +44,13 @@ var uid; var storageRef = firebase.storage(); -org_proof.onchange = function () { +ind_proof.onchange = function () { if (this.files[0].size > 512000) { alert("File is too big!,it should be less than 500kb"); this.value = ""; }; }; -org_img.onchange = function () { +ind_img.onchange = function () { if (this.files[0].size > 512000) { alert("File is too big!,it should be less than 500kb"); this.value = ""; @@ -62,7 +62,7 @@ head_proof.onchange = function () { this.value = ""; }; }; -org_head_proof.onchange = function () { +ind_head_proof.onchange = function () { if (this.files[0].size > 512000) { alert("File is too big!,it should be less than 500kb"); this.value = ""; @@ -138,8 +138,8 @@ async function putStorageItem(item) { }); } -function org_reg() { - if (org_proof.value == "" || org_img.value == "" || head_proof.value == "" || org_head_proof.value == "") { +function ind_reg() { + if (ind_proof.value == "" || ind_img.value == "" || head_proof.value == "" || ind_head_proof.value == "") { alert('Upload Document'); } else { From b9b48f8b7edd71410e5c3289b90505c671a274da Mon Sep 17 00:00:00 2001 From: Aditi <60543251+aditi-n21@users.noreply.github.com> Date: Fri, 16 Oct 2020 08:27:19 +0530 Subject: [PATCH 2/3] Delete ind.js --- assets/js/ind.js | 148 ----------------------------------------------- 1 file changed, 148 deletions(-) delete mode 100644 assets/js/ind.js diff --git a/assets/js/ind.js b/assets/js/ind.js deleted file mode 100644 index f4d08da..0000000 --- a/assets/js/ind.js +++ /dev/null @@ -1,148 +0,0 @@ -var firebaseConfig = { - apiKey: "AIzaSyDQRPjwzQY6wO1e0oxQMamKRPW7td_wQbs", - authDomain: "charity-app-e31cc.firebaseapp.com", - databaseURL: "https://charity-app-e31cc.firebaseio.com", - projectId: "charity-app-e31cc", - storageBucket: "charity-app-e31cc.appspot.com", - messagingSenderId: "233446000003", - appId: "1:233446000003:web:d253ffd11f923d21a422b6", - measurementId: "G-NJ0H9ZQ056" -}; - -firebase.initializeApp(firebaseConfig); -const database = firebase.database(); - -var keys; - -var loader = document.getElementById('loader'); -loader.style.display = "none"; - -var ind_proof = document.getElementById('uploadbutton1'); -var ind_img = document.getElementById('uploadbutton2'); -var head_proof = document.getElementById('uploadbutton3'); -var ind_head_proof = document.getElementById('uploadbutton4'); -var folder = ["ind_proof", "ind_img", "head_proof", "ind_head_proof"]; - -const name = document.getElementById('name'); -const add = document.getElementById('add'); -const state = document.getElementById('state'); -const country = document.getElementById('country'); -const qual = document.getElementById('qual'); -const occ = document.getElementById('occ'); -const money = document.getElementById('need'); -const head = document.getElementById('head'); -const occhead = document.getElementById('occhead'); -const income = document.getElementById('income'); -const email = document.getElementById('email'); -const mobile_num = document.getElementById('mobile_num'); -const para = document.getElementById('para'); - -const usersRef = database.ref('Individual'); -const autoId = usersRef.push().key; -const auth = firebase.auth(); -var uid; -var storageRef = firebase.storage(); - - -ind_proof.onchange = function () { - if (this.files[0].size > 512000) { - alert("File is too big!,it should be less than 500kb"); - this.value = ""; - }; -}; -ind_img.onchange = function () { - if (this.files[0].size > 512000) { - alert("File is too big!,it should be less than 500kb"); - this.value = ""; - }; -}; -head_proof.onchange = function () { - if (this.files[0].size > 512000) { - alert("File is too big!,it should be less than 500kb"); - this.value = ""; - }; -}; -ind_head_proof.onchange = function () { - if (this.files[0].size > 512000) { - alert("File is too big!,it should be less than 500kb"); - this.value = ""; - }; -}; - - -auth.onAuthStateChanged((user) => { - if (user) { - // User is signed in. - let user = firebase.auth().currentUser; - - if (user != null) { - uid = user.uid; - } - } else { - alert('null'); - } -}); - -async function push_data() { - loader.style.display = "block"; - usersRef.child(autoId).set({ - ID: `Individual/${autoId}`, - ind_name: name.value, - ind_add: add.value, - state_name: state.value, - country_name: country.value, - qual_name: qual.value, - occ_name: occ.value, - money_name: money.value, - head_name: head.value, - occhead_name: occhead.value, - income_name: income.value, - email_name: email.value, - mobile_numb: mobile_num.value, - para_name: para.value, - - user_id: uid, - status: 'under verification', - fund: 0, - }); - let firebaseRefKey = firebase.database().ref('All users').child(uid).child('Individual'); - firebaseRefKey.child(autoId).set({ status: 'under verification' }); - - - for (i = 0; i < 4; i++) { - await putStorageItem(folder[i]).then((res) => { - console.log(res); - }) - } - alert("Thanks for registration, its under verification"); - window.location.replace('../index.html'); -} - -async function putStorageItem(item) { - return new Promise(function (resolve, reject) { - var upload = storageRef.ref(`images/${autoId}/${item}`).put(window[item].files[0]); - upload.on('state_changed', function (snapshot) { - var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100; - console.log("upload is " + progress + " done."); - }, function (error) { - document.write(error.message); - reject(error); - }, function () { - upload.snapshot.ref.getDownloadURL().then(function (downloadURL) { - usersRef.child(autoId).update({ [item]: downloadURL }); - resolve("done !"); - }); - } - ); - - }); -} - -function ind_reg() { - if (ind_proof.value == "" || ind_img.value == "" || head_proof.value == "" || ind_head_proof.value == "") { - alert('Upload Document'); - } - else { - push_data(); - } -} \ No newline at end of file From 4dd19e6139c41e3c989ac4f2f881d5ff54ee2bfd Mon Sep 17 00:00:00 2001 From: Aditi <60543251+aditi-n21@users.noreply.github.com> Date: Fri, 16 Oct 2020 08:35:51 +0530 Subject: [PATCH 3/3] Create ind.js --- assets/js/ind.js | 148 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 assets/js/ind.js diff --git a/assets/js/ind.js b/assets/js/ind.js new file mode 100644 index 0000000..716c4e2 --- /dev/null +++ b/assets/js/ind.js @@ -0,0 +1,148 @@ +var firebaseConfig = { + apiKey: "AIzaSyDQRPjwzQY6wO1e0oxQMamKRPW7td_wQbs", + authDomain: "charity-app-e31cc.firebaseapp.com", + databaseURL: "https://charity-app-e31cc.firebaseio.com", + projectId: "charity-app-e31cc", + storageBucket: "charity-app-e31cc.appspot.com", + messagingSenderId: "233446000003", + appId: "1:233446000003:web:d253ffd11f923d21a422b6", + measurementId: "G-NJ0H9ZQ056" +}; + +firebase.initializeApp(firebaseConfig); +const database = firebase.database(); + +var keys; + +var loader = document.getElementById('loader'); +loader.style.display = "none"; + +var ind_proof = document.getElementById('uploadbutton1'); +var ind_img = document.getElementById('uploadbutton2'); +var head_proof = document.getElementById('uploadbutton3'); +var ind_head_proof = document.getElementById('uploadbutton4'); +var folder = ["ind_proof", "ind_img", "head_proof", "ind_head_proof"]; + +const name = document.getElementById('name'); +const add = document.getElementById('add'); +const state = document.getElementById('state'); +const country = document.getElementById('country'); +const qual = document.getElementById('qual'); +const occ = document.getElementById('occ'); +const money = document.getElementById('need'); +const head = document.getElementById('head'); +const occhead = document.getElementById('occhead'); +const income = document.getElementById('income'); +const email = document.getElementById('email'); +const mobile_num = document.getElementById('mobile_num'); +const para = document.getElementById('para'); + +const usersRef = database.ref('Individual'); +const autoId = usersRef.push().key; +const auth = firebase.auth(); +var uid; +var storageRef = firebase.storage(); + + +ind_proof.onchange = function () { + if (this.files[0].size > 512000) { + alert("File is too big!,it should be less than 500kb"); + this.value = ""; + }; +}; +ind_img.onchange = function () { + if (this.files[0].size > 512000) { + alert("File is too big!,it should be less than 500kb"); + this.value = ""; + }; +}; +head_proof.onchange = function () { + if (this.files[0].size > 512000) { + alert("File is too big!,it should be less than 500kb"); + this.value = ""; + }; +}; +ind_head_proof.onchange = function () { + if (this.files[0].size > 512000) { + alert("File is too big!,it should be less than 500kb"); + this.value = ""; + }; +}; + + +auth.onAuthStateChanged((user) => { + if (user) { + // User is signed in. + let user = firebase.auth().currentUser; + + if (user != null) { + uid = user.uid; + } + } else { + alert('null'); + } +}); + +async function push_data() { + loader.style.display = "block"; + usersRef.child(autoId).set({ + ID: `Individual/${autoId}`, + ind_name: name.value, + ind_add: add.value, + state_name: state.value, + country_name: country.value, + qual_name: qual.value, + occ_name: occ.value, + money_name: money.value, + head_name: head.value, + occhead_name: occhead.value, + income_name: income.value, + email_name: email.value, + mobile_numb: mobile_num.value, + para_name: para.value, + + user_id: uid, + status: 'under verification', + fund: 0, + }); + let firebaseRefKey = firebase.database().ref('All users').child(uid).child('Individual'); + firebaseRefKey.child(autoId).set({ status: 'under verification' }); + + + for (i = 0; i < 4; i++) { + await putStorageItem(folder[i]).then((res) => { + console.log(res); + }) + } + alert("Thanks for registration, its under verification"); + window.location.replace('../index.html'); +} + +async function putStorageItem(item) { + return new Promise(function (resolve, reject) { + var upload = storageRef.ref(`images/${autoId}/${item}`).put(window[item].files[0]); + upload.on('state_changed', function (snapshot) { + var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100; + console.log("upload is " + progress + " done."); + }, function (error) { + document.write(error.message); + reject(error); + }, function () { + upload.snapshot.ref.getDownloadURL().then(function (downloadURL) { + usersRef.child(autoId).update({ [item]: downloadURL }); + resolve("done !"); + }); + } + ); + + }); +} + +function ind_reg() { + if (ind_proof.value == "" || ind_img.value == "" || head_proof.value == "" || ind_head_proof.value == "") { + alert('Upload Document'); + } + else { + push_data(); + } +}