forked from lasthopeglobal/lasthopeweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor changes & added javascript file
- Loading branch information
Showing
6 changed files
with
420 additions
and
74 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
const { createClient } = supabase | ||
|
||
// just add the keys | ||
supabase = createClient("https://uryjsoflpaycebbdoijr.supabase.co", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVyeWpzb2ZscGF5Y2ViYmRvaWpyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2Nzg5MDM4ODAsImV4cCI6MTk5NDQ3OTg4MH0.7SMduIi9AHCtV_FE1JYwLmw4XpmL6c49RvapSfh2qPE") | ||
|
||
const form = document.querySelector("#prayerreq") | ||
|
||
form.addEventListener('submit', async (event) => { | ||
event.preventDefault() | ||
|
||
const prayerInput = form.querySelectorAll('input, textarea') | ||
|
||
const submision = {} | ||
|
||
prayerInput.forEach(element => { | ||
const { value, name } = element | ||
if (value) { | ||
submision[name] = value | ||
} | ||
}) | ||
|
||
console.log(submision) | ||
|
||
const { error, data } = await supabase.from('prayerreq').insert([submision], { returning: 'minimal' }) | ||
console.log(error, data) | ||
// return onclick=submit(); | ||
// error handling | ||
if (error) { | ||
alert('facing some issue in code') | ||
} else { | ||
alert('Your Prayer is Accepted') | ||
} | ||
|
||
// if (error){ | ||
// // alert("lafada kiya hai bahi") | ||
// $('#submit').on('click', function(e){ | ||
// // e.preventDefault(); | ||
// // Open popup modal | ||
// $('#error').modal('open'); | ||
// }); | ||
// }else{ | ||
// // Add click event listener to submit button | ||
// $('#submit').on('click', function(e){ | ||
// // e.preventDefault(); | ||
// // Open popup modal | ||
// $('#Success').modal('open'); | ||
// }); | ||
// } | ||
|
||
// reset the full form | ||
prayerInput.forEach(element => element.value = '') | ||
|
||
|
||
//? Redirect to a new page | ||
const successPagePath = "/pages/success.html"; | ||
|
||
window.location.href = successPagePath; | ||
|
||
// just update link after fully live | ||
// window.location.href = "http://127.0.0.1:5500/pages/success.html"; | ||
|
||
|
||
|
||
|
||
}) |
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,66 @@ | ||
|
||
let { createClientFir } = supabase | ||
|
||
// just add the keys | ||
supabase = createClient("https://uryjsoflpaycebbdoijr.supabase.co", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVyeWpzb2ZscGF5Y2ViYmRvaWpyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2Nzg5MDM4ODAsImV4cCI6MTk5NDQ3OTg4MH0.7SMduIi9AHCtV_FE1JYwLmw4XpmL6c49RvapSfh2qPE") | ||
|
||
let formFir = document.querySelector("#prayerreq_friday") | ||
|
||
formFir.addEventListener('submit', async (event) => { | ||
event.preventDefault() | ||
|
||
let prayerInput = formFir.querySelectorAll('input, textarea') | ||
|
||
let submision = {} | ||
|
||
prayerInput.forEach(element => { | ||
let { value, name } = element | ||
if (value) { | ||
submision[name] = value | ||
} | ||
}) | ||
|
||
console.log(submision) | ||
|
||
let { error, data } = await supabase.from('prayerreq_friday').insert([submision], { returning: 'minimal' }) | ||
console.log(error, data) | ||
// return onclick=submit(); | ||
// error handling | ||
if (error) { | ||
alert('facing some issue in code') | ||
} else { | ||
alert('Your Prayer is Accepted') | ||
} | ||
|
||
// if (error){ | ||
// // alert("lafada kiya hai bahi") | ||
// $('#submit').on('click', function(e){ | ||
// // e.preventDefault(); | ||
// // Open popup modal | ||
// $('#error').modal('open'); | ||
// }); | ||
// }else{ | ||
// // Add click event listener to submit button | ||
// $('#submit').on('click', function(e){ | ||
// // e.preventDefault(); | ||
// // Open popup modal | ||
// $('#Success').modal('open'); | ||
// }); | ||
// } | ||
|
||
// reset the full formFir | ||
prayerInput.forEach(element => element.value = '') | ||
|
||
|
||
//? Redirect to a new page | ||
let successPagePath = "/pages/success.html"; | ||
|
||
window.location.href = successPagePath; | ||
|
||
// just update link after fully live | ||
// window.location.href = "http://127.0.0.1:5500/pages/success.html"; | ||
|
||
|
||
|
||
|
||
}) |
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,66 @@ | ||
|
||
let { createClientSun } = supabase | ||
|
||
// just add the keys | ||
supabase = createClient("https://uryjsoflpaycebbdoijr.supabase.co", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVyeWpzb2ZscGF5Y2ViYmRvaWpyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2Nzg5MDM4ODAsImV4cCI6MTk5NDQ3OTg4MH0.7SMduIi9AHCtV_FE1JYwLmw4XpmL6c49RvapSfh2qPE") | ||
|
||
let formSun = document.querySelector("#prayerreq_sunday") | ||
|
||
formSun.addEventListener('submit', async (event) => { | ||
event.preventDefault() | ||
|
||
let prayerInput = formSun.querySelectorAll('input, textarea') | ||
|
||
let submision = {} | ||
|
||
prayerInput.forEach(element => { | ||
let { value, name } = element | ||
if (value) { | ||
submision[name] = value | ||
} | ||
}) | ||
|
||
console.log(submision) | ||
|
||
let { error, data } = await supabase.from('prayerreq_sunday').insert([submision], { returning: 'minimal' }) | ||
console.log(error, data) | ||
// return onclick=submit(); | ||
// error handling | ||
if (error) { | ||
alert('facing some issue in code') | ||
} else { | ||
alert('Your Prayer is Accepted') | ||
} | ||
|
||
// if (error){ | ||
// // alert("lafada kiya hai bahi") | ||
// $('#submit').on('click', function(e){ | ||
// // e.preventDefault(); | ||
// // Open popup modal | ||
// $('#error').modal('open'); | ||
// }); | ||
// }else{ | ||
// // Add click event listener to submit button | ||
// $('#submit').on('click', function(e){ | ||
// // e.preventDefault(); | ||
// // Open popup modal | ||
// $('#Success').modal('open'); | ||
// }); | ||
// } | ||
|
||
// reset the full formSun | ||
prayerInput.forEach(element => element.value = '') | ||
|
||
|
||
//? Redirect to a new page | ||
let successPagePath = "/pages/success.html"; | ||
|
||
window.location.href = successPagePath; | ||
|
||
// just update link after fully live | ||
// window.location.href = "http://127.0.0.1:5500/pages/success.html"; | ||
|
||
|
||
|
||
|
||
}) |
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
Oops, something went wrong.