Skip to content

Commit

Permalink
minor changes & added javascript file
Browse files Browse the repository at this point in the history
  • Loading branch information
pratap360 committed Oct 2, 2023
1 parent fc6183a commit 38d50c0
Show file tree
Hide file tree
Showing 6 changed files with 420 additions and 74 deletions.
66 changes: 66 additions & 0 deletions js/prayers/default.js
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";




})
66 changes: 66 additions & 0 deletions js/prayers/firday_prayer.js
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";




})
66 changes: 66 additions & 0 deletions js/prayers/sunday_prayer.js
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";




})
1 change: 1 addition & 0 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $(document).ready(function () {
$(".sidenav").sidenav();
$('select').formSelect();
$('.modal').modal();
$('.tabs').tabs();
// $('.timepicker').timepicker();
// $('.datepicker').datepicker({
// autoClose: true,
Expand Down
Loading

0 comments on commit 38d50c0

Please sign in to comment.