Compare commits

...

16 Commits

Author SHA1 Message Date
Subhodip Ghosh 49de3574a3 search 2023-05-25 21:42:17 +05:30
Kar fefb39141d pagination 2023-05-23 01:02:11 +05:30
Subhodip Ghosh b3df941551 all-page-under-session 2023-05-22 20:51:47 +05:30
Kar 23ef8d9803 pagination 2023-05-21 23:40:30 +05:30
Kar e2b3a28f36 s3 2023-05-21 17:56:12 +05:30
Kar c5d0167d3c s3 2023-05-21 17:55:37 +05:30
Kar 96b933edc1 s3 2023-05-21 02:56:35 +05:30
Kar 300df6001b lint 2023-05-20 23:04:29 +05:30
Kar 54f74f8860 login 2023-05-20 19:16:59 +05:30
Kar 37786c459e p 2023-05-19 19:57:07 +05:30
Kar 4ea8d4d839 s2 2023-05-19 02:08:06 +05:30
Subhodip Ghosh 27657679d7 0 2023-05-18 21:13:56 +05:30
Subhodip Ghosh 3e7e6b8943 edit-school-same-data-in-all-school-is 2023-05-18 13:52:48 +05:30
Kar 81cfb6ce00 userEdit 2023-05-18 02:43:11 +05:30
Subhodip Ghosh 2b85a5a356 edit-user 2023-05-17 22:14:19 +05:30
Subhodip Ghosh a8e3dc48df edit-user 2023-05-17 11:51:16 +05:30
51 changed files with 3039 additions and 1252 deletions

BIN
data/appSchool-test.db Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
uname,status,user,type,year,start_month,start_date,end_date,plan,klas,lang,phone,pass,anual,early_start_programme,toddlers,interakto,email,country,state,city,address,school uname,status,user,type,year,start_month,start_date,end_date,plan,klas,lang,phone,pass,annual,early_start_programme,toddlers,interakto,email,country,state,city,address,school
name 1,published,,parent,,Feb,2023-05-14,2024-05-13,,IK2,,70000000011,,Jan,Feb,Mar,Jul,1@email.com,IN,WB,Habra,sample road near landmark,individual name 1,published,,parent,,Feb,2023-05-14,2024-05-13,,IK2,,70000000011,,Jan,Feb,Mar,Jul,1@email.com,IN,WB,Habra,sample road near landmark,individual
name 5,published,,parent,,Feb,2023-05-14,2024-05-13,,IK2,,70000000011,,Jan,Feb,Mar,Jul,5@email.com,IN,WB,Habra,sample road near landmark,individual name 5,published,,parent,,Feb,2023-05-14,2024-05-13,,IK2,,70000000011,,Jan,Feb,Mar,Jul,5@email.com,IN,WB,Habra,sample road near landmark,individual
name 4,published,,parent,,Feb,2023-05-14,2024-05-13,,IK2,,70000000011,,Jan,Feb,Mar,Jul,4@email.com,IN,WB,Habra,sample road near landmark,individual name 4,published,,parent,,Feb,2023-05-14,2024-05-13,,IK2,,70000000011,,Jan,Feb,Mar,Jul,4@email.com,IN,WB,Habra,sample road near landmark,individual
@ -6,3 +6,6 @@ name 3,published,,parent,,Apr,2023-05-14,2024-05-13,,IK2,,70000000011,,Feb,Sept,
name 2,published,,parent,,Apr,2023-05-14,2024-05-13,,IK2,,70000000011,,Feb,Sept,Oct,Jul,2@email.com,IN,WB,Habra,sample road near landmark,individual name 2,published,,parent,,Apr,2023-05-14,2024-05-13,,IK2,,70000000011,,Feb,Sept,Oct,Jul,2@email.com,IN,WB,Habra,sample road near landmark,individual
name 6,published,,parent,,Jun,2023-05-14,2024-05-13,,IK3,,70000000011,,Mar,Sept,Jul,Apr,6@email.com,BD,55,Lalmonirhat,sample road near landmark,individual name 6,published,,parent,,Jun,2023-05-14,2024-05-13,,IK3,,70000000011,,Mar,Sept,Jul,Apr,6@email.com,BD,55,Lalmonirhat,sample road near landmark,individual
teacher name,published,,teacher,,Apr,2023-05-15,2024-05-13,,IK2,,99999 99933,,Mar,0,0,0,t1@email.com,IN,WB,Barasat,,individual teacher name,published,,teacher,,Apr,2023-05-15,2024-05-13,,IK2,,99999 99933,,Mar,0,0,0,t1@email.com,IN,WB,Barasat,,individual
suvankar,published,,teacher,,Apr,2023-05-15,2024-05-13,,IK2,,0,,Mar,0,0,0,suvvv@email.com,IN,WB,Barasat,,individual
teacher name,published,,teacher,,Apr,2023-05-15,2024-05-13,,IK2,,99999 99933,,Mar,0,0,0,t1@email.com,IN,WB,Barasat,,individual
Name 11,published,,parent,,Feb,2023-05-14,2024-05-13,,IK2,,70000000011,,Jan,Feb,Mar,Jul,1@email.com,IN,WB,Habra,sample road near landmark,individual

1 uname status user type year start_month start_date end_date plan klas lang phone pass anual annual early_start_programme toddlers interakto email country state city address school
2 name 1 published parent Feb 2023-05-14 2024-05-13 IK2 70000000011 Jan Jan Feb Mar Jul 1@email.com IN WB Habra sample road near landmark individual
3 name 5 published parent Feb 2023-05-14 2024-05-13 IK2 70000000011 Jan Jan Feb Mar Jul 5@email.com IN WB Habra sample road near landmark individual
4 name 4 published parent Feb 2023-05-14 2024-05-13 IK2 70000000011 Jan Jan Feb Mar Jul 4@email.com IN WB Habra sample road near landmark individual
6 name 2 published parent Apr 2023-05-14 2024-05-13 IK2 70000000011 Feb Feb Sept Oct Jul 2@email.com IN WB Habra sample road near landmark individual
7 name 6 published parent Jun 2023-05-14 2024-05-13 IK3 70000000011 Mar Mar Sept Jul Apr 6@email.com BD 55 Lalmonirhat sample road near landmark individual
8 teacher name published teacher Apr 2023-05-15 2024-05-13 IK2 99999 99933 Mar Mar 0 0 0 t1@email.com IN WB Barasat individual
9 suvankar published teacher Apr 2023-05-15 2024-05-13 IK2 0 Mar 0 0 0 suvvv@email.com IN WB Barasat individual
10 teacher name published teacher Apr 2023-05-15 2024-05-13 IK2 99999 99933 Mar 0 0 0 t1@email.com IN WB Barasat individual
11 Name 11 published parent Feb 2023-05-14 2024-05-13 IK2 70000000011 Jan Feb Mar Jul 1@email.com IN WB Habra sample road near landmark individual

View File

@ -14,20 +14,27 @@
"@types/react-dom": "18.2.1", "@types/react-dom": "18.2.1",
"argon2": "^0.30.3", "argon2": "^0.30.3",
"autoprefixer": "10.4.14", "autoprefixer": "10.4.14",
"axios": "^1.4.0",
"csv-parser": "^3.0.0", "csv-parser": "^3.0.0",
"eslint": "8.39.0", "eslint": "8.39.0",
"eslint-config-next": "13.3.1", "eslint-config-next": "13.3.1",
"formidable": "^2.1.1", "formidable": "^2.1.1",
"formik": "^2.2.9",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"jwt-decode": "^3.1.2",
"next": "13.3.1", "next": "13.3.1",
"next-auth": "^4.22.1",
"postcss": "8.4.23", "postcss": "8.4.23",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-phone-number-input": "^3.2.22", "react-phone-number-input": "^3.2.22",
"react-select": "^5.7.3", "react-select": "^5.7.3",
"react-select-country-list": "^2.2.3", "react-select-country-list": "^2.2.3",
"rxjs": "^7.8.1",
"sqlite3": "^5.1.6", "sqlite3": "^5.1.6",
"tailwindcss": "3.3.2", "tailwindcss": "3.3.2",
"typescript": "5.0.4" "typescript": "5.0.4",
} "yup": "^1.1.1"
},
"devDependencies": {}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

1
public/img/4.svg Normal file
View File

@ -0,0 +1 @@
<svg width="20px" height="20px" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7.5 4.5L11.5 6.5V14.5H3.5V6.5L7.5 4.5ZM7.5 4.5V0M0 14.5H15M1.5 14.5V8.5H3.5M13.5 14.5V8.5H11.5M6.5 14.5V11.5H8.5V14.5M7.5 0.5H10.5V2.5H7.5M7.5 9.5C6.94772 9.5 6.5 9.05228 6.5 8.5C6.5 7.94772 6.94772 7.5 7.5 7.5C8.05228 7.5 8.5 7.94772 8.5 8.5C8.5 9.05228 8.05228 9.5 7.5 9.5Z" stroke="#ffffff"></path> </g></svg>

After

Width:  |  Height:  |  Size: 595 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>

Before

Width:  |  Height:  |  Size: 629 B

View File

@ -1,24 +1,49 @@
import Image from 'next/image' import { signIn, signOut, useSession } from 'next-auth/react'
import { Inter } from 'next/font/google' import Link from 'next/link'
const inter = Inter({ subsets: ['latin'] })
export default function Home() { export default function NavBar() {
const { data: session } = useSession()
// console.log(session)
if (session) {
return (
<main>
<div>
<section className="container-fluid bg-[#FFF6F2]">
<div className="container mx-auto px-4">
<div className='flex flex-row p-2 justify-center whitespace-nowrap'>
<Link href="/add-school-form" className='text-grey-400 hover:bg-blue-200 rounded-lg p-2 pt-1 pb-1 ml-2 mr-2'>Add School </Link>
<Link href="/school-list" className='text-grey-400 hover:bg-blue-200 rounded-lg p-2 pt-1 pb-1 ml-2 mr-2'>School List</Link>
<Link href="/add-user-form" className='text-grey-400 hover:bg-blue-200 rounded-lg p-2 pt-1 pb-1 ml-2 mr-2'>Add User </Link>
<Link href="/upload-user" className='text-grey-400 hover:bg-blue-200 rounded-lg p-2 pt-1 pb-1 ml-2 mr-2'>Upload User </Link>
<Link href="/user-list" className='text-grey-400 hover:bg-blue-200 rounded-lg p-2 pt-1 pb-1 ml-2 mr-2'> User List </Link>
<Link href="#" className='text-grey-400 hover:bg-blue-200 rounded-lg p-2 pt-1 pb-1 ml-2 mr-2' onClick={() => signOut()}>Sign out</Link>
</div>
</div>
</section>
</div>
</main>
)
}
return ( return (
<main> <>
<div> Not signed in <br />
<section className="container-fluid bg-[#FFF6F2]"> <button onClick={() => signIn()}>Sign in</button>
<div className="container mx-auto px-4"> </>
<div className='flex flex-row gap-x-2 md:gap-x-16 p-4 justify-center whitespace-nowrap'>
<a href="/add-school-form">Add School </a>|
<a href="/school-list">School List</a>|
<a href="/add-user-form">Add User </a>|
<a href="/user-list">User List </a>
</div>
</div>
</section>
</div>
</main>
) )
// return (
// <div className='container mx-auto flex-col justify-center place-items-center 2xl:px-[500px] mt-24 '>
// <>
// <div className='grid grid-rows-2 lg:py-56 rounded-xl place-items-center bg-[#FFF6F2]'>
// <p className='text-center text-2xl italic'>Logged out Successfully </p>
// <button onClick={() => signIn()} className="bg-[#FE4501] w-fit px-6 py-1.5 rounded-lg text-white font-bold text-xl">Sign in Now</button>
// </div>
// </>
// </div>
// )
} }

View File

@ -29,7 +29,7 @@ export default function Modal() {
country: event.target.country.value, country: event.target.country.value,
state: event.target.state.value, state: event.target.state.value,
cities: event.target.cities.value, cities: event.target.cities.value,
anual: event.target.anual.value, annual: event.target.annual.value,
toddlers: event.target.toddlers.value, toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value, early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value, interakto: event.target.interakto.value,
@ -119,8 +119,8 @@ export default function Modal() {
<label htmlFor="phone" className='text-xl font-bold'> Phone</label> <label htmlFor="phone" className='text-xl font-bold'> Phone</label>
</div> </div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label> <label htmlFor="annual" className='text-xl font-bold'>annual</label>
<select name="anual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <select name="annual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0" >-NA-</option> <option value="0" >-NA-</option>
<option value="January">January</option> <option value="January">January</option>
<option value="February">February</option> <option value="February">February</option>

View File

@ -0,0 +1,18 @@
import { useSession } from "next-auth/react";
import { useEffect } from "react";
const RefreshTokenHandler = (props) => {
const { data: session } = useSession();
useEffect(() => {
if(!!session) {
// We did set the token to be ready to refresh after 23 hours, here we set interval of 23 hours 30 minutes.
const timeRemaining = Math.round((((session.accessTokenExpiry - 30 * 60 * 1000) - Date.now()) / 1000));
props.setInterval(timeRemaining > 0 ? timeRemaining : 0);
}
}, [session]);
return null;
}
export default RefreshTokenHandler;

29
src/components/useAuth.js Normal file
View File

@ -0,0 +1,29 @@
import { signOut, useSession } from "next-auth/react";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
export default function useAuth(shouldRedirect) {
const { data: session } = useSession();
const router = useRouter();
const [isAuthenticated, setIsAuthenticated] = useState(false);
useEffect(() => {
if (session?.error === "RefreshAccessTokenError") {
signOut({ callbackUrl: '/login', redirect: shouldRedirect });
}
if (session === null) {
if (router.route !== '/login') {
router.replace('/login');
}
setIsAuthenticated(false);
} else if (session !== undefined) {
if (router.route === '/login') {
router.replace('/');
}
setIsAuthenticated(true);
}
}, [session]);
return isAuthenticated;
}

View File

@ -1,6 +1,18 @@
import '@/styles/globals.css' import '@/styles/globals.css'
import type { AppProps } from 'next/app' import type { AppProps } from 'next/app'
import { SessionProvider } from 'next-auth/react';
import { useState } from 'react';
import RefreshTokenHandler from '../components/refreshTokenHandler.js';
export default function App({ Component, pageProps }: AppProps) { export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} /> const [interval, setInterval] = useState(0);
return (
<SessionProvider session={pageProps.session} refetchInterval={interval}>
<Component {...pageProps} />
<RefreshTokenHandler setInterval={setInterval} />
</SessionProvider>
)
// return <Component {...pageProps} />
} }

View File

@ -0,0 +1,170 @@
import NavBar from '../components/NavBar'
import { signIn, signOut, useSession } from 'next-auth/react'
import { useId, useState, useEffect, useMemo } from 'react';
import Select from 'react-select'
import countryList from 'react-select-country-list'
import 'react-phone-number-input/style.css'
import PhoneInput from 'react-phone-number-input'
export default function AddSchool() {
const uploadToServer = async (event) => {
const body = new FormData();
body.append("file", agreement.files[0]);
body.append("fName", `${router.query.school}.pdf`);
const response = await fetch("/api/fileUpload-test", {
method: "POST",
body
});
};
const [countryValue, setCountryValue] =useState('')
const options = useMemo(() => countryList().getData(), [])
const [phoneValue, setphoneValue] = useState()
const [allStates, setAllStates] = useState([])
const [allCities, setAllCities] = useState([])
const { data: session } = useSession()
const handleSelectAllStates = stateCode => {
setAllCities([])
fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${countryValue.value}&state=${stateCode.value}`)
.then(res => res.json())
.then(data => {
// console.log("handleSelectAllStates:", data, options)
let newData = data && data.length > 0 && data.map(n => {
return {
label: n.name,
value: n.name
}
})
setAllCities(newData)
})
}
const selectCountry = countryValue => {
setAllStates([])
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=${countryValue.value}`)
.then(res => res.json())
.then(data => {
// console.log("countryValue:", data, options)
let newData = data && data.length > 0 && data.map(n => {
return {
label: n.name,
value: n.iso2
}
})
setAllStates(newData)
setAllCities([])
})
setCountryValue(countryValue)
}
// console.log(phoneValue)
// const selectCountry = countryValue => {
// setCountryValue(countryValue)
// }
const handleSubmit = async (event) => {
event.preventDefault()
const data = {
// "status":"published",
name: event.target.name.value,
location: event.target.location.value,
expiry: event.target.expiry.value,
status: event.target.status.value,
annual: event.target.annual.value,
toddlers: event.target.toddlers.value,
address: event.target.address.value,
interakto: event.target.interakto.value,
email: event.target.email.value,
pin: event.target.pin.value,
// phone: event.target.phone.value,
// email: event.target.email.value,
}
const JSONdata = JSON.stringify(data)
console.log(data)
const endpoint = '/api/addSchool-test'
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSONdata,
}
const response = await fetch(endpoint, options)
const result = await response.json()
// alert(`Is this your full name: ${result.data}`)
alert(`School Saved`)
}
if (session) {
return (
<main>
<div>
<NavBar />
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
<div className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<div className='flex flex-col justify-center place-items-center'>
<img src="/img/1.svg" alt="" />
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>School Registration Form</p>
</div>
<form onSubmit={handleSubmit} className='w-full px-6 md:px-20'>
<div className='flex flex-col'>
<label htmlFor="name">Name</label>
<input type="text" name="name" id="name" className='p-2 border-2 rounded-full' />
</div>
<div className='flex flex-col'>
<label htmlFor="location">Location</label>
<input type="text" name="location" id="location" className='p-2 border-2 rounded-full' />
</div>
<div className='flex flex-col'>
<label htmlFor="expiry">Expiry</label>
<input type="date" name="expiry" id="expiry" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex flex-col'>
<label htmlFor="status">Status</label>
<input type="text" name="status" id="status" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex flex-col'>
<label htmlFor="toddlers">Toddlers</label>
<input type="text" name="toddlers" id="toddlers" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex flex-col'>
<label htmlFor="address">Address</label>
<input type="text" name="address" id="address" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex flex-col'>
<label htmlFor="annual">annual</label>
<input type="text" name="annual" id="annual" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex flex-col'>
<label htmlFor="interakto">Interakto</label>
<input type="text" name="interakto" id="interakto" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex flex-col'>
<label htmlFor="email">Email</label>
<input type="email" name="email" id="email" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex flex-col'>
<label htmlFor="pin">Pin Code</label>
<input type="text" name="pin" id="pin" className='p-2 border-2 rounded-full'/>
</div>
<div className='flex justify-center pt-8'>
<input type="submit" value="Save" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' />
</div>
</form>
<div className='flex flex-col'>
<label htmlFor="file">Files Upload</label>
<input type="file" name="file" id="agreement" className='p-2 border-2 rounded-full'/>
</div>
</div>
</section>
</div>
</main>
)
}
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
}

View File

@ -1,16 +1,18 @@
import NavBar from '../components/NavBar' import NavBar from '../components/NavBar'
import { signIn, signOut, useSession } from 'next-auth/react'
import { useId, useState, useEffect, useMemo } from 'react'; import { useId, useState, useEffect, useMemo } from 'react';
import Select from 'react-select' import Select from 'react-select'
import countryList from 'react-select-country-list' import countryList from 'react-select-country-list'
import 'react-phone-number-input/style.css' import 'react-phone-number-input/style.css'
import PhoneInput from 'react-phone-number-input' import PhoneInput from 'react-phone-number-input'
export default function addSchoolForm() { export default function AddSchool() {
const [countryValue, setCountryValue] = useState('') const [countryValue, setCountryValue] =useState('')
const options = useMemo(() => countryList().getData(), []) const options = useMemo(() => countryList().getData(), [])
const [phoneValue, setphoneValue] = useState() const [phoneValue, setphoneValue] = useState()
const [allStates, setAllStates] = useState([]) const [allStates, setAllStates] = useState([])
const [allCities, setAllCities] = useState([]) const [allCities, setAllCities] = useState([])
const { data: session } = useSession()
const handleSelectAllStates = stateCode => { const handleSelectAllStates = stateCode => {
setAllCities([]) setAllCities([])
@ -52,23 +54,23 @@ export default function addSchoolForm() {
event.preventDefault() event.preventDefault()
const data = { const data = {
"status":"published", "status":"published",
name: event.target.schoolName.value, sname: event.target.sname.value,
country: event.target.country.value, country: event.target.country.value,
state: event.target.state.value, state: event.target.state.value,
cities: event.target.cities.value, city: event.target.city.value,
anual: event.target.anual.value, annual: event.target.annual.value,
toddlers: event.target.toddlers.value, toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value, early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value, interakto: event.target.interakto.value,
agreement_expiry_date: event.target.agreement_expiry_date.value, agg_expiry: event.target.agg_expiry.value,
school_agreement: event.target.school_agreement.value, usage_expiry: event.target.usage_expiry.value,
school_contact_number: event.target.school_contact_number.value, phone: event.target.phone.value,
school_email_id: event.target.school_email_id.value, email: event.target.email.value,
} }
const JSONdata = JSON.stringify(data) const JSONdata = JSON.stringify(data)
console.log(data) console.log(data)
const endpoint = 'https://management.beanstalkedu.com/items/school' const endpoint = '/api/addSchool'
const options = { const options = {
method: 'POST', method: 'POST',
headers: { headers: {
@ -82,8 +84,8 @@ export default function addSchoolForm() {
// alert(`Is this your full name: ${result.data}`) // alert(`Is this your full name: ${result.data}`)
alert(`School Saved`) alert(`School Saved`)
} }
if (session) {
return ( return (
<main> <main>
<div> <div>
<NavBar /> <NavBar />
@ -96,11 +98,11 @@ export default function addSchoolForm() {
<form onSubmit={handleSubmit} className='w-full px-6 md:px-20'> <form onSubmit={handleSubmit} className='w-full px-6 md:px-20'>
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="school" className='text-xl font-bold'>School Name</label> <label htmlFor="school" className='text-xl font-bold'>School Name</label>
<input type="text" name="schoolName" placeholder='School Name' className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' /> <input type="text" name="sname" placeholder='School Name' className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> </div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="school_email_id" className='text-xl font-bold'> Email ID</label> <label htmlFor="email" className='text-xl font-bold'> Email ID</label>
<input type="text" name="school_email_id" id="school_email_id" placeholder='School Email ID' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' /> <input type="text" name="email" id="email" placeholder='School Email ID' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> </div>
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label> <label htmlFor="country" className='text-xl font-bold'>Country</label>
@ -120,10 +122,10 @@ export default function addSchoolForm() {
{ {
allCities && allCities.length > 0 && allCities && allCities.length > 0 &&
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="Cities" className='text-xl font-bold'>Cities</label> <label htmlFor="cyti" className='text-xl font-bold'>City</label>
<Select <Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="cities" options={allCities} value={allCities[0].name} name="city" options={allCities} value={allCities[0].name}
// onChange={() => {}} // onChange={() => {}}
/> />
</div>} </div>}
@ -132,8 +134,8 @@ export default function addSchoolForm() {
<PhoneInput className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' name="phone" placeholder="Enter phone number" value={phoneValue} onChange={setphoneValue}/> <PhoneInput className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' name="phone" placeholder="Enter phone number" value={phoneValue} onChange={setphoneValue}/>
</div> </div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label> <label htmlFor="annual" className='text-xl font-bold'> Annual</label>
<select name="anual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <select name="annual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0" >-NA-</option> <option value="0" >-NA-</option>
<option value="Jan">Jan</option> <option value="Jan">Jan</option>
<option value="Feb">Feb</option> <option value="Feb">Feb</option>
@ -168,7 +170,7 @@ export default function addSchoolForm() {
</select> </select>
</div> </div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label> <label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Programme</label>
<select name="early_start_programme" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <select name="early_start_programme" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0" >-NA-</option> <option value="0" >-NA-</option>
<option value="Jan">Jan</option> <option value="Jan">Jan</option>
@ -189,22 +191,26 @@ export default function addSchoolForm() {
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label> <label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<select name="interakto" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <select name="interakto" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="na">-NA-</option> <option value="na">-NA-</option>
<option value="Jan"> Jan</option> <option value="Jan"> Jan</option>
<option value="Feb"> Feb</option> <option value="Feb"> Feb</option>
<option value="Mar"> Mar</option> <option value="Mar"> Mar</option>
<option value="Apr"> Apr</option> <option value="Apr"> Apr</option>
<option value="May"> May</option> <option value="May"> May</option>
<option value="Jun"> Jun</option> <option value="Jun"> Jun</option>
<option value="Jul"> Jul</option> <option value="Jul"> Jul</option>
<option value="Aug"> Aug</option> <option value="Aug"> Aug</option>
<option value="Sept"> Sept</option> <option value="Sept"> Sept</option>
<option value="Nov"> Nov</option> <option value="Nov"> Nov</option>
<option value="Dec"> Dec</option> <option value="Dec"> Dec</option>
</select> </select>
</div> </div>
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="agreement_expiry_date" className='text-xl font-bold pt-4'>Agreement Expiry Date</label> <label htmlFor="agg_expiry" className='text-xl font-bold pt-4'>Agreement Expiry Date</label>
<input type="date" name="agreement_expiry_date" id="agreement_expiry_date" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' /> <input type="date" name="agg_expiry" id="agg_expiry" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="usage_expiry" className='text-xl font-bold pt-4'>Usage Expiry Date</label>
<input type="date" name="usage_expiry" id="usage_expiry" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> </div>
{/* <div className='flex flex-col w-full'> {/* <div className='flex flex-col w-full'>
<label htmlFor="school_agreement" className='text-xl font-bold pt-4'>Upload School Agreement</label> <label htmlFor="school_agreement" className='text-xl font-bold pt-4'>Upload School Agreement</label>
@ -220,4 +226,12 @@ export default function addSchoolForm() {
</div> </div>
</main> </main>
) )
}
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
} }

View File

@ -1,5 +1,6 @@
// https://management.beanstalkedu.com/items/school // https://management.beanstalkedu.com/items/school
// import React from 'react'; // import React from 'react';
import { signIn, signOut, useSession } from 'next-auth/react'
import {useId, useState, useEffect, useMemo} from 'react'; import {useId, useState, useEffect, useMemo} from 'react';
import Select from 'react-select' import Select from 'react-select'
import countryList from 'react-select-country-list' import countryList from 'react-select-country-list'
@ -29,6 +30,7 @@ export default function addUserForm() {
const options = useMemo(() => countryList().getData(), []) const options = useMemo(() => countryList().getData(), [])
const [phoneValue, setphoneValue] = useState() const [phoneValue, setphoneValue] = useState()
let [individualValue = true, setindividualValue] = useState() let [individualValue = true, setindividualValue] = useState()
const { data: session } = useSession()
const [allStates, setAllStates] = useState([]) const [allStates, setAllStates] = useState([])
const [allCities, setAllCities] = useState([]) const [allCities, setAllCities] = useState([])
@ -75,7 +77,7 @@ export default function addUserForm() {
} }
const [school, setSchool] = useState(null); const [school, setSchool] = useState(null);
useEffect(() => { useEffect(() => {
fetch(`https://management.beanstalkedu.com/items/school`) fetch(`/api/listSchlools`)
.then(res => res.json()) .then(res => res.json())
.then(data => { .then(data => {
setSchool(data) setSchool(data)
@ -108,7 +110,7 @@ export default function addUserForm() {
interakto: event.target.interakto.value, interakto: event.target.interakto.value,
} }
const JSONdata = JSON.stringify(data) const JSONdata = JSON.stringify(data)
const endpoint = '/api/addUsers' const endpoint = '/api/addUser'
const options = { const options = {
method: 'POST', method: 'POST',
headers: { headers: {
@ -154,233 +156,242 @@ export default function addUserForm() {
// setLanguage(newAllLang) // setLanguage(newAllLang)
setCurrentType(e.target.value) setCurrentType(e.target.value)
} }
return ( if (session) {
<main> return (
<div> <main>
<NavBar/> <div>
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'> <NavBar/>
<div <section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'> <div
<div className='flex flex-col justify-center place-items-center'> className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<img src="/img/2.svg" alt=""/> <div className='flex flex-col justify-center place-items-center'>
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>User Registration Form</p> <img src="/img/2.svg" alt=""/>
</div> <p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>User Registration Form</p>
<form onSubmit={handleFormsubmit} action="" className='w-full px-6 md:px-20'>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="class" className='text-xl font-bold'>Type</label>
<select name="type" onChange={handleTypeOnChange} className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value={typeParent}>Parent</option>
<option value="teacher">Teacher</option>
<option value="coordinator">Coordinator</option>
<option value="master">Master</option>
</select>
</div> </div>
<div className='flex flex-col w-full'> <form onSubmit={handleFormsubmit} action="" className='w-full px-6 md:px-20'>
<label htmlFor="name" className='text-xl font-bold'> Name</label> <div className='flex flex-col w-full pt-4'>
<input type="text" name="uname" <label htmlFor="class" className='text-xl font-bold'>Type</label>
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' <select name="type" onChange={handleTypeOnChange} className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
placeholder='Enter your Name'/> <option value={typeParent}>Parent</option>
</div> <option value="teacher">Teacher</option>
<div className='flex flex-col w-full'> <option value="coordinator">Coordinator</option>
<label htmlFor="email" className='text-xl font-bold'>Email</label> <option value="master">Master</option>
<input type="email" name="email" placeholder='ex. xyz@email.com' </select>
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/> </div>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="country" instanceId={useId()} options={options} value={countryValue}
onChange={selectCountry}/>
</div>
{allStates && allStates.length > 0 &&
<div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'>State</label>
<Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="state" options={allStates} value={allStates[0].name}
onChange={handleSelectAllStates}/>
</div>}
{
allCities && allCities.length > 0 &&
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="city" className='text-xl font-bold'>City</label> <label htmlFor="name" className='text-xl font-bold'>Name</label>
<input type="text" name="uname"
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
placeholder='Enter your Name'/>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="email" className='text-xl font-bold'>Email</label>
<input type="email" name="email" placeholder='ex. xyz@email.com'
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<Select <Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="city" options={allCities} value={allCities[0].name} name="country" instanceId={useId()} options={options} value={countryValue}
// onChange={() => {}} onChange={selectCountry}/>
/> </div>
{allStates && allStates.length > 0 &&
<div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'>State</label>
<Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="state" options={allStates} value={allStates[0].name}
onChange={handleSelectAllStates}/>
</div>} </div>}
<div className='flex flex-col w-full'> {
<label htmlFor="phone" className='text-xl font-bold'> Phone</label> allCities && allCities.length > 0 &&
<PhoneInput <div className='flex flex-col w-full'>
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' <label htmlFor="city" className='text-xl font-bold'>City</label>
name="phone" placeholder="Enter phone number" value={phoneValue} <Select
onChange={setphoneValue}/> className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
</div> name="city" options={allCities} value={allCities[0].name}
<div className='flex flex-col w-full pt-4'> // onChange={() => {}}
<label htmlFor="" className='text-xl font-bold'>School name</label> />
<select name="schoolID" onChange={individual} </div>}
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <div className='flex flex-col w-full'>
<option value="0"> individual</option> <label htmlFor="phone" className='text-xl font-bold'> Phone</label>
{school && school.data.map(data => <PhoneInput
<option value={data.id} key={data.id}>{data.name}</option> className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
)} name="phone" placeholder="Enter phone number" value={phoneValue}
</select> onChange={setphoneValue}/>
</div> </div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="class" className='text-xl font-bold'>Class</label> <label htmlFor="" className='text-xl font-bold'>School name</label>
<select name="klas" <select name="schoolID" onChange={individual}
className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0">-Select-</option> <option value="0"> individual</option>
<option value="IK1">IK1</option> {school && school.map(data =>
<option value="IK2">IK2</option> <option value={data.id} key={data.id}>{data.name}</option>
<option value="IK3">IK3</option> )}
<option value="PG">PG</option> </select>
</select> </div>
</div> <div className='flex flex-col w-full pt-4'>
{individualValue && <label htmlFor="class" className='text-xl font-bold'>Class</label>
<div> <select name="klas"
<div className='flex flex-col w-full pt-4'> className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label> <option value="0">-Select-</option>
<select name="anual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <option value="IK1">IK1</option>
<option value="0">-NA-</option> <option value="IK2">IK2</option>
<option value="Jan">Jan</option> <option value="IK3">IK3</option>
<option value="Feb">Feb</option> <option value="PG">PG</option>
<option value="Mar">Mar</option> </select>
<option value="Apr">Apr</option> </div>
<option value="May">May</option> {individualValue &&
<option value="Jun">Jun</option> <div>
<option value="Jul">Jul</option> <div className='flex flex-col w-full pt-4'>
<option value="Aug">Aug</option> <label htmlFor="anual" className='text-xl font-bold'>Anual</label>
<option value="Sept">Sept</option> <select name="anual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="Oct">Oct</option> <option value="0">-NA-</option>
<option value="Nov">Nov</option> <option value="Jan">Jan</option>
<option value="Dec">Dec</option> <option value="Feb">Feb</option>
</select> <option value="Mar">Mar</option>
</div> <option value="Apr">Apr</option>
<div className='flex flex-col w-full pt-4'> <option value="May">May</option>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Programme</label> <option value="Jun">Jun</option>
<select name="early_start_programme" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <option value="Jul">Jul</option>
<option value="0">-NA-</option> <option value="Aug">Aug</option>
<option value="Jan">Jan</option> <option value="Sept">Sept</option>
<option value="Feb">Feb</option> <option value="Oct">Oct</option>
<option value="Mar">Mar</option> <option value="Nov">Nov</option>
<option value="Apr">Apr</option> <option value="Dec">Dec</option>
<option value="May">May</option> </select>
<option value="Jun">Jun</option> </div>
<option value="Jul">Jul</option> <div className='flex flex-col w-full pt-4'>
<option value="Aug">Aug</option> <label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Programme</label>
<option value="Sept">Sept</option> <select name="early_start_programme" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="Oct">Oct</option> <option value="0">-NA-</option>
<option value="Nov">Nov</option> <option value="Jan">Jan</option>
<option value="Dec">Dec</option> <option value="Feb">Feb</option>
</select> <option value="Mar">Mar</option>
</div> <option value="Apr">Apr</option>
<div className='flex flex-col w-full pt-4'> <option value="May">May</option>
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label> <option value="Jun">Jun</option>
<select name="toddlers" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <option value="Jul">Jul</option>
<option value="0">-NA-</option> <option value="Aug">Aug</option>
<option value="Jan">Jan</option> <option value="Sept">Sept</option>
<option value="Feb">Feb</option> <option value="Oct">Oct</option>
<option value="Mar">Mar</option> <option value="Nov">Nov</option>
<option value="Apr">Apr</option> <option value="Dec">Dec</option>
<option value="May">May</option> </select>
<option value="Jun">Jun</option> </div>
<option value="Jul">Jul</option> <div className='flex flex-col w-full pt-4'>
<option value="Aug">Aug</option> <label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
<option value="Sept">Sept</option> <select name="toddlers" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="Oct">Oct</option> <option value="0">-NA-</option>
<option value="Nov">Nov</option> <option value="Jan">Jan</option>
<option value="Dec">Dec</option> <option value="Feb">Feb</option>
</select> <option value="Mar">Mar</option>
</div> <option value="Apr">Apr</option>
<div className='flex flex-col w-full pt-4'> <option value="May">May</option>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label> <option value="Jun">Jun</option>
<select name="interakto" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <option value="Jul">Jul</option>
<option value="0">-NA-</option> <option value="Aug">Aug</option>
<option value="Jan">Jan</option> <option value="Sept">Sept</option>
<option value="Feb">Feb</option> <option value="Oct">Oct</option>
<option value="Mar">Mar</option> <option value="Nov">Nov</option>
<option value="Apr">Apr</option> <option value="Dec">Dec</option>
<option value="May">May</option> </select>
<option value="Jun">Jun</option> </div>
<option value="Jul">Jul</option> <div className='flex flex-col w-full pt-4'>
<option value="Aug">Aug</option> <label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<option value="Sept">Sept</option> <select name="interakto" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="Oct">Oct</option> <option value="0">-NA-</option>
<option value="Nov">Nov</option> <option value="Jan">Jan</option>
<option value="Dec">Dec</option> <option value="Feb">Feb</option>
</select> <option value="Mar">Mar</option>
</div> <option value="Apr">Apr</option>
<option value="May">May</option>
<option value="Jun">Jun</option>
<option value="Jul">Jul</option>
<option value="Aug">Aug</option>
<option value="Sept">Sept</option>
<option value="Oct">Oct</option>
<option value="Nov">Nov</option>
<option value="Dec">Dec</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="lang" className='text-xl font-bold'>Language</label> <label htmlFor="lang" className='text-xl font-bold'>Language</label>
<div className='grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-y-2 pt-2'> <div className='grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-y-2 pt-2'>
{/* <label className='cursor-pointer' htmlFor="Assamese"> Assamese </label> &nbsp; <input type="checkbox" name="lang" value="Assamese" className='check-box'/> <br /> {/* <label className='cursor-pointer' htmlFor="Assamese"> Assamese </label> &nbsp; <input type="checkbox" name="lang" value="Assamese" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Bengali"> Bengali </label> &nbsp; <input type="checkbox" name="lang" value="Bengali" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="Bengali"> Bengali </label> &nbsp; <input type="checkbox" name="lang" value="Bengali" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="English"> English </label> &nbsp; <input type="checkbox" name="lang" value="English" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="English"> English </label> &nbsp; <input type="checkbox" name="lang" value="English" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Hindi"> Hindi </label> &nbsp; <input type="checkbox" name="lang" value="Hindi" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="Hindi"> Hindi </label> &nbsp; <input type="checkbox" name="lang" value="Hindi" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Telegu"> Telegu </label> &nbsp; <input type="checkbox" name="lang" value="Telegu" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="Telegu"> Telegu </label> &nbsp; <input type="checkbox" name="lang" value="Telegu" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Punjabi"> Punjabi </label> &nbsp; <input type="checkbox" name="lang" value="Punjabi" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="Punjabi"> Punjabi </label> &nbsp; <input type="checkbox" name="lang" value="Punjabi" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Malayalam"> Malayalam </label> &nbsp; <input type="checkbox" name="lang" value="Malayalam" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="Malayalam"> Malayalam </label> &nbsp; <input type="checkbox" name="lang" value="Malayalam" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Tamil"> Tamil </label> &nbsp; <input type="checkbox" name="lang" value="Tamil" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="Tamil"> Tamil </label> &nbsp; <input type="checkbox" name="lang" value="Tamil" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Kannada"> Kannada </label> &nbsp; <input type="checkbox" name="lang" value="Kannada" className='check-box'/> <br /> <label className='cursor-pointer' htmlFor="Kannada"> Kannada </label> &nbsp; <input type="checkbox" name="lang" value="Kannada" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Gujrati"> Gujrati </label> &nbsp; <input type="checkbox" name="lang" value="Gujrati" className='check-box'/> <br /> */} <label className='cursor-pointer' htmlFor="Gujrati"> Gujrati </label> &nbsp; <input type="checkbox" name="lang" value="Gujrati" className='check-box'/> <br /> */}
{allLanguage && allLanguage.length && allLanguage.map(n => { {allLanguage && allLanguage.length && allLanguage.map(n => {
return ( return (
<div key={n.lang} className=''> <div key={n.lang} className=''>
<label className='cursor-pointer' <label className='cursor-pointer'
htmlFor="assamese">{n.lang}</label>&nbsp; htmlFor="assamese">{n.lang}</label>&nbsp;
<input type="checkbox" disabled={n.disabled} name="lang" value={n.lang} checked={n.value} <input type="checkbox" disabled={n.disabled} name="lang" value={n.lang} checked={n.value}
onChange={handleOnLanguageChange} onChange={handleOnLanguageChange}
className='check-box'/> className='check-box'/>
</div> </div>
) )
})} })}
</div>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="start_month" className='text-xl font-bold'>Start Month</label>
<select name="start_month" id="start_month" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0">-Select-</option>
<option value="Jan"> Jan</option>
<option value="Feb"> Feb</option>
<option value="Mar"> Mar</option>
<option value="Apr"> Apr</option>
<option value="May"> May</option>
<option value="Jun"> Jun</option>
<option value="Jul"> Jul</option>
<option value="Aug"> Aug</option>
<option value="Sept"> Sept</option>
<option value="Nov"> Nov</option>
<option value="Dec"> Dec</option>
</select>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="start_date" className='text-xl font-bold pt-4'>Start
Date</label>
<input type="date" name="start_date" id="start_date"
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="end_date" className='text-xl font-bold pt-4'>Subscription Expiry
Date.</label>
<input type="date" name="end_date" id="end_date"
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
</div> </div>
</div> </div>
<div className='flex flex-col w-full pt-4'> }
<label htmlFor="start_month" className='text-xl font-bold'>Start Month</label> <div className='flex justify-center pt-8'>
<select name="start_month" id="start_month" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <button type="submit"
<option value="0">-Select-</option> className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Save
<option value="Jan"> Jan</option> </button>
<option value="Feb"> Feb</option> {/* <input type="submit" value="Submit Now" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' /> */}
<option value="Mar"> Mar</option>
<option value="Apr"> Apr</option>
<option value="May"> May</option>
<option value="Jun"> Jun</option>
<option value="Jul"> Jul</option>
<option value="Aug"> Aug</option>
<option value="Sept"> Sept</option>
<option value="Nov"> Nov</option>
<option value="Dec"> Dec</option>
</select>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="start_date" className='text-xl font-bold pt-4'>Start
Date</label>
<input type="date" name="start_date" id="start_date"
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="end_date" className='text-xl font-bold pt-4'>Subscription Expiry
Date.</label>
<input type="date" name="end_date" id="end_date"
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
</div>
</div> </div>
} </form>
<div className='flex justify-center pt-8'> </div>
<button type="submit" </section>
className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Save </div>
</button> </main>
{/* <input type="submit" value="Submit Now" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' /> */} )
</div> }
</form> return (
</div> <>
</section> Not signed in <br />
</div> <button onClick={() => signIn()}>Sign in</button>
</main> </>
) )
} }

View File

@ -0,0 +1,34 @@
export default function handler(req, res) {
const sqlite3 = require('sqlite3').verbose();
// console.log(req.body)
// Open a new database connection
let name, location, expiry, status, toddlers, address, annual, interakto, email, pin = "";
// if(req.body.name) name =req.body.name;
// if(req.body.status) status =req.body.status;
// if(req.body.status) status ="published";
if(req.body.name) name =req.body.name;
if(req.body.location) location =req.body.location;
if(req.body.expiry) expiry =req.body.expiry;
if(req.body.status) status =req.body.status;
if(req.body.toddlers) toddlers =req.body.toddlers;
if(req.body.address) address =req.body.address;
if(req.body.annual) annual =req.body.annual;
if(req.body.state) state =req.body.state;
if(req.body.interakto) interakto =req.body.interakto;
if(req.body.email) email =req.body.email;
if(req.body.pin) pin =req.body.pin;
// if(req.body.usage_expiry) usage_expiry =req.body.usage_expiry;
console.log(address)
const db = new sqlite3.Database('data/appSchool-test.db');
db.run(`INSERT INTO school (sname, city, usage_expiry, status, toddlers, address, annual, interakto, email, pin ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ? )`, [ name, location, expiry, status, toddlers, address, annual, interakto, email, pin ],
function(err) {
if (err) {
return console.log(err.message);
}
}
);
db.close();
res.status(200).json({ msg: 'ok' });
}

View File

@ -0,0 +1,37 @@
export default function handler(req, res) {
const sqlite3 = require('sqlite3').verbose();
// console.log(req.body)
// Open a new database connection
let sname, status, phone, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, agg_expiry, usage_expiry = "";
if(req.body.sname) sname =req.body.sname;
// if(req.body.status) status =req.body.status;
if(req.body.status) status ="published";
if(req.body.phone) phone =req.body.phone;
if(req.body.annual) annual =req.body.annual;
if(req.body.early_start_programme) early_start_programme =req.body.early_start_programme;
if(req.body.toddlers) toddlers =req.body.toddlers;
if(req.body.interakto) interakto =req.body.interakto;
if(req.body.email) email =req.body.email;
if(req.body.country) country =req.body.country;
if(req.body.state) state =req.body.state;
if(req.body.city) city =req.body.city;
if(req.body.address) address =req.body.address;
if(req.body.agg_expiry) agg_expiry =req.body.agg_expiry;
if(req.body.usage_expiry) usage_expiry =req.body.usage_expiry;
const db = new sqlite3.Database('data/appUser.db');
db.run(`INSERT INTO school (sname, status, phone, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, agg_expiry, usage_expiry ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [ sname, status, phone, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, agg_expiry, usage_expiry],
function(err) {
if (err) {
return console.log(err.message);
}
}
);
db.close();
res.status(200).json({ msg: 'ok' });
}

View File

@ -3,7 +3,7 @@ export default function handler(req, res) {
console.log(req.body) console.log(req.body)
// Open a new database connection // Open a new database connection
let uname, status, type, start_month, start_date, end_date, plan, klas, lang, phone, pass, anual, early_start_programme, toddlers, interakto, email, country, state, city, address, school=""; let uname, status, type, start_month, start_date, end_date, plan, klas, lang, phone, pass, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, school="";
if(req.body.uname) uname =req.body.uname; if(req.body.uname) uname =req.body.uname;
if(req.body.status) status =req.body.status; if(req.body.status) status =req.body.status;
@ -14,11 +14,10 @@ export default function handler(req, res) {
if(req.body.end_date) end_date =req.body.end_date; if(req.body.end_date) end_date =req.body.end_date;
if(req.body.plan) plan =req.body.plan; if(req.body.plan) plan =req.body.plan;
if(req.body.klas) klas =req.body.klas; if(req.body.klas) klas =req.body.klas;
if(req.body.lang) lang =req.body.lang; if(req.body.lang) lang =req.body.lang; lang=JSON.stringify(lang);
if(req.body.lang) lang =req.body.lang;
if(req.body.phone) phone =req.body.phone; if(req.body.phone) phone =req.body.phone;
if(req.body.pass) pass =req.body.pass; if(req.body.pass) pass =req.body.pass;
if(req.body.anual) anual =req.body.anual; if(req.body.annual) annual =req.body.annual;
if(req.body.early_start_programme) early_start_programme =req.body.early_start_programme; if(req.body.early_start_programme) early_start_programme =req.body.early_start_programme;
if(req.body.toddlers) toddlers =req.body.toddlers; if(req.body.toddlers) toddlers =req.body.toddlers;
if(req.body.interakto) interakto =req.body.interakto; if(req.body.interakto) interakto =req.body.interakto;
@ -29,7 +28,7 @@ export default function handler(req, res) {
if(req.body.address) address =req.body.address; if(req.body.address) address =req.body.address;
if(req.body.school) school =req.body.school; if(req.body.school) school =req.body.school;
const db = new sqlite3.Database('data/appUser.db'); const db = new sqlite3.Database('data/appUser.db');
db.run(`INSERT INTO user (uname, status, type, start_month, start_date, end_date, plan, klas, lang, phone, pass, anual, early_start_programme, toddlers, interakto, email, country, state, city, address, school ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [ uname, status, type, start_month, start_date, end_date, plan, klas, lang, phone, pass, anual, early_start_programme, toddlers, interakto, email, country, state, city, address, school], db.run(`INSERT INTO user (uname, status, type, start_month, start_date, end_date, plan, klas, lang, phone, pass, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, school ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [ uname, status, type, start_month, start_date, end_date, plan, klas, lang, phone, pass, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, school],
function(err) { function(err) {
if (err) { if (err) {
return console.log(err.message); return console.log(err.message);

View File

@ -1,36 +1,56 @@
import csv from 'csv-parser'; import csv from 'csv-parser';
import fs from 'fs'; import formidable from "formidable";
import fs from "fs";
import sqlite3 from 'sqlite3'; import sqlite3 from 'sqlite3';
export const config = {
api: {
bodyParser: false
}
};
export default function handler(req,res) { export default function handler(req,res) {
const form = new formidable.IncomingForm();
form.parse(req, async function (err, fields, files) {
const DB_NAME = 'data/appUser.db'; // console.log('ppp')
const TABLE_NAME = 'user'; console.log(files.file.filepath)
const DB_NAME = 'data/appUser.db';
const TABLE_NAME = 'user';
// Open a connection to the SQLite database // Open a connection to the SQLite database
const db = new sqlite3.Database(DB_NAME); const db = new sqlite3.Database(DB_NAME);
fs.createReadStream('data/user.csv') // fs.createReadStream('data/user.csv')
.pipe(csv()) fs.createReadStream(files.file.filepath)
.on('data', (data) => { .pipe(csv())
const values = Object.values(data); .on('data', (data) => {
const placeholders = values.map(() => '?').join(','); const values = Object.values(data);
const sql = `INSERT INTO ${TABLE_NAME} (${Object.keys(data).join(',')}) VALUES (${placeholders})`; const placeholders = values.map(() => '?').join(',');
db.run(sql, values, (err) => { const sql = `INSERT INTO ${TABLE_NAME} (${Object.keys(data).join(',')}) VALUES (${placeholders})`;
if (err) { db.run(sql, values, (err) => {
console.error(err); if (err) {
} console.error(err);
}
});
})
.on('end', () => {
console.log(`Data inserted successfully into table ${TABLE_NAME}`);
fs.unlinkSync(files.file.filepath);
db.close();
}); });
})
.on('end', () => {
console.log(`Data inserted successfully into table ${TABLE_NAME}`);
// Close the database connection
db.close(); // console.log(fields)
// await saveFile(files.file,fields.fName? fields.fName:files.file.originalFilename );
return res.status(201).send("");
}); });
res.status(200).json({ name: 'John Doe' })
res.status(200).json({ msg: 'ok' })
} }

View File

@ -0,0 +1,124 @@
import NextAuth from "next-auth/next";
import CredentialsProvider from "next-auth/providers/credentials";
import { signIn } from "next-auth/react";
import jwt_decode from "jwt-decode";
const pubAPI = process.env.DIRECTUS_PUBLIC_API;
export const options = {
providers: [
CredentialsProvider({
name: "Credentials",
credentials: {
email: { label: "Email", type: "text" },
password: { label: "Mot de passe", type: "password" },
},
async authorize(credentials, req) {
const payload = {
email: credentials.email,
password: credentials.password,
};
const res = await fetch(pubAPI + "auth/login", {
method: "POST",
body: JSON.stringify(payload),
headers: { "Content-Type": "application/json" },
credentials: "include",
});
const user = await res.json();
// console.log(user)
if (!res.ok) {
throw new Error("Email ou mot de passe incorrect.");
}
if (res.ok && user) {
return user;
}
return null;
},
}),
],
session: {
jwt: true,
},
callbacks: {
async jwt({ token, user, account }) {
if (account && user) {
var tokenJwt =user.data.access_token
var roleID = jwt_decode(tokenJwt).role;
return {
...token,
roleID:roleID,
accessToken: user.data.access_token,
expires: Date.now() + user.data.expires,
refreshToken: user.data.refresh_token,
error: user.data.error,
};
}
if (Date.now() < token.expires) {
return token;
}
const refreshed = await refreshAccessToken(token);
return await refreshed;
},
async session({ session, token }) {
session.user.roleID = token.roleID;
session.user.accessToken = token.accessToken;
session.user.refreshToken = token.refreshToken;
session.user.expires = token.expires;
session.user.error = token.error;
return session;
},
},
secret: process.env.NEXTAUTH_SECRET,
pages: {
signIn: "/login",
},
debug: true,
};
async function refreshAccessToken(token) {
try {
const response = await fetch(pubAPI + "auth/refresh", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ refresh_token: token.refreshToken }),
credentials: "include",
});
const refreshedTokens = await response.json();
if (!response.ok) {
signIn();
}
if (response.ok && refreshedTokens) {
return {
...token,
accessToken: refreshedTokens.data.access_token,
expires: Date.now() + refreshedTokens.data.expires,
refreshToken: refreshedTokens.data.refresh_token,
};
}
} catch (error) {
console.log(
new Date().toUTCString() + " Error in refreshAccessToken:",
error
);
return {
...token,
error: "RefreshAccessTokenError",
};
}
}
const nextauthfunc = (req, res) => NextAuth(req, res, options);
export default nextauthfunc;

View File

@ -0,0 +1,41 @@
export default function handler(req, res) {
const sqlite3 = require('sqlite3').verbose();
console.log(req.body)
// Open a new database connection
let sname, status, phone, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, agg_expiry, usage_expiry = "";
if(req.body.sname) sname =req.body.sname;
if(req.body.status) status =req.body.status;
// if(req.body.status) status ="published";
if(req.body.phone) phone =req.body.phone;
if(req.body.annual) annual =req.body.annual;
if(req.body.early_start_programme) early_start_programme =req.body.early_start_programme;
if(req.body.toddlers) toddlers =req.body.toddlers;
if(req.body.interakto) interakto =req.body.interakto;
if(req.body.email) email =req.body.email;
if(req.body.country) country =req.body.country;
if(req.body.state) state =req.body.state;
if(req.body.city) city =req.body.city;
if(req.body.address) address =req.body.address;
if(req.body.agg_expiry) agg_expiry =req.body.agg_expiry;
if(req.body.usage_expiry) usage_expiry =req.body.usage_expiry;
const db = new sqlite3.Database('data/appUser.db');
console.log(req.body.userId)
db.run(`UPDATE school SET sname = ?, status = ?, phone = ?, annual = ?, early_start_programme = ?, toddlers = ?, interakto = ?, email = ?, country = ?, state = ?, city = ?, address = ?, agg_expiry = ?, usage_expiry = ? WHERE id = ? `, [ sname, status, phone, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, agg_expiry, usage_expiry, req.body.schoolId],
function(err) {
if (err) {
res.status(400).json({ msg: 'Err400D' });
return console.log(err.message);
}
res.status(200).json({ msg: 'ok' });
}
);
db.close();
}

56
src/pages/api/editUser.js Normal file
View File

@ -0,0 +1,56 @@
export default function handler(req, res) {
const sqlite3 = require('sqlite3').verbose();
// console.log(req.body)
// Open a new database connection
let uname, status, type, start_month, start_date, end_date, klas, lang, phone, pass, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, school="";
if(req.body.uname) uname =req.body.uname;
if(req.body.status) status =req.body.status;
if(req.body.type) type =req.body.type;
if(req.body.start_date) start_date =req.body.start_date;
if(req.body.end_date) end_date =req.body.end_date;
if(req.body.klas) klas =req.body.klas;
if(req.body.lang) lang =req.body.lang;
if(req.body.lang) lang =req.body.lang;
if(req.body.phone) phone =req.body.phone;
if(req.body.pass) pass =req.body.pass;
if(req.body.annual) annual =req.body.annual;
if(req.body.early_start_programme) early_start_programme =req.body.early_start_programme;
if(req.body.toddlers) toddlers =req.body.toddlers;
if(req.body.interakto) interakto =req.body.interakto;
if(req.body.email) email =req.body.email;
if(req.body.country) country =req.body.country;
if(req.body.state) state =req.body.state;
if(req.body.city) city =req.body.city;
if(req.body.address) address =req.body.address;
if(req.body.school) school =req.body.school;
const db = new sqlite3.Database('data/appUser.db');
var msg=null;
console.log(req.body.userId)
db.run(`UPDATE user SET uname = ?, status = ?, type = ?, start_month = ?, start_date = ?, end_date = ?, klas = ?, lang = ?, phone = ?, annual = ?, early_start_programme = ?, toddlers = ?, interakto = ?, email = ?, country = ?, state = ?, city = ?, address = ?, school = ? WHERE id = ? `, [ uname, status, type, start_month, start_date, end_date, klas, lang, phone, annual, early_start_programme, toddlers, interakto, email, country, state, city, address, school, req.body.userId],
function(err) {
if (err) {
msg={ msg: 'Err400D' };
res.status(400).send({ msg: 'Err400D' });
// return console.log(err.message);
}
// console.log('message');
msg="{ msg: 'ok' }";
// res.statusCode = 200;
// res.setHeader('Content-Type', 'application/json');
// res.setHeader('Cache-Control', 'max-age=180000');
// res.end(JSON.stringify({ msg: 'ok' }));
// res.status(200).json({ msg: 'ok' });
}
);
db.close();
res.statusCode = 200;
res.setHeader('Content-Type', 'application/json');
res.setHeader('Cache-Control', 'max-age=180000');
res.end(JSON.stringify(msg));
}

View File

@ -0,0 +1,38 @@
import formidable from "formidable";
import fs from "fs";
export const config = {
api: {
bodyParser: false
}
};
const post = async (req, res) => {
const form = new formidable.IncomingForm();
form.parse(req, async function (err, fields, files) {
console.log(fields)
await saveFile(files.file,fields.fName? fields.fName:files.file.originalFilename );
return res.status(201).send("");
});
};
const saveFile = async (file,fName) => {
console.log(file.filepath)
console.log(fName)
const data = fs.readFileSync(file.filepath);
fs.writeFileSync(`./public/uploaded/${fName}`, data);
fs.unlinkSync(file.filepath);
return;
};
export default (req, res) => {
req.method === "POST"
? post(req, res)
: req.method === "PUT"
? console.log("PUT")
: req.method === "DELETE"
? console.log("DELETE")
: req.method === "GET"
? console.log("GET")
: res.status(404).send("");
};

View File

@ -10,15 +10,15 @@ export const config = {
const post = async (req, res) => { const post = async (req, res) => {
const form = new formidable.IncomingForm(); const form = new formidable.IncomingForm();
form.parse(req, async function (err, fields, files) { form.parse(req, async function (err, fields, files) {
// console.log(fields) console.log(fields)
await saveFile(files.file,fields.fName? fields.fName:files.file.originalFilename ); await saveFile(files.file,fields.fName? fields.fName:files.file.originalFilename );
return res.status(201).send(""); return res.status(201).send("");
}); });
}; };
const saveFile = async (file,fName) => { const saveFile = async (file,fName) => {
// console.log(file.filepath) console.log(file.filepath)
// console.log(fName) console.log(fName)
const data = fs.readFileSync(file.filepath); const data = fs.readFileSync(file.filepath);
fs.writeFileSync(`./public/uploaded/${fName}`, data); fs.writeFileSync(`./public/uploaded/${fName}`, data);
fs.unlinkSync(file.filepath); fs.unlinkSync(file.filepath);

View File

@ -0,0 +1,41 @@
import csv from 'csv-parser';
import fs from 'fs';
import sqlite3 from 'sqlite3';
export default function handler(req,res) {
const DB_NAME = 'data/appUser.db';
const TABLE_NAME = 'school';
const db = new sqlite3.Database(DB_NAME);
const query = `SELECT * FROM ${TABLE_NAME}`;
function getAllRows(tableName) {
return new Promise((resolve, reject) => {
const sql = `SELECT * FROM ${tableName} WHERE id = ?`;
db.all(sql, [req.query.school], (err, rows) => {
if (err) {
reject(err);
return;
}
const data = rows;
resolve(data);
});
});
};
async function doSomething() {
try {
const returnData = await getAllRows('school');
res.setHeader('Content-Type', 'application/json')
res.status(200).json(returnData)
// console.log(data);
} catch (err) {
console.error(err);
}
}
doSomething();
}

View File

@ -0,0 +1,67 @@
import csv from 'csv-parser';
import fs from 'fs';
import sqlite3 from 'sqlite3';
export default function handler(req,res) {
const DB_NAME = 'data/appUser.db';
const TABLE_NAME = 'user';
// Open a connection to the SQLite database
const db = new sqlite3.Database(DB_NAME);
const query = `SELECT * FROM ${TABLE_NAME}`;
function getAllRows(tableName) {
return new Promise((resolve, reject) => {
const sql = `SELECT * FROM ${tableName} WHERE id = ?`;
db.all(sql, [req.query.user], (err, rows) => {
if (err) {
reject(err);
return;
}
const data = rows;
resolve(data);
});
});
};
async function doSomething() {
try {
const returnData = await getAllRows('user');
res.setHeader('Content-Type', 'application/json')
res.status(200).json(returnData)
// console.log(data);
} catch (err) {
console.error(err);
}
}
doSomething();
// const returnData = getAllRows('user');
// console.log(getAllRows('user'));
// const returnData= db.run('SELECT * FROM user');
// fs.createReadStream('data/user.csv')
// .pipe(csv())
// .on('data', (data) => {
// const values = Object.values(data);
// const placeholders = values.map(() => '?').join(',');
// const sql = `INSERT INTO ${TABLE_NAME} (${Object.keys(data).join(',')}) VALUES (${placeholders})`;
// db.run(sql, values, (err) => {
// if (err) {
// console.error(err);
// }
// });
// })
// .on('end', () => {
// console.log(`Data inserted successfully into table ${TABLE_NAME}`);
// // Close the database connection
// db.close();
// });
}

View File

@ -0,0 +1,73 @@
import csv from 'csv-parser';
import fs from 'fs';
import sqlite3 from 'sqlite3';
export default function handler(req,res) {
console.log(req.body.school)
// const {
// query: { name, keyword },
// method,
// } = req;
// console.log(name, keyword, method);
const DB_NAME = 'data/appSchool-test.db';
const TABLE_NAME = 'school';
// Open a connection to the SQLite database
const db = new sqlite3.Database(DB_NAME);
const query = `SELECT * FROM ${TABLE_NAME}`;
function getAllRows(tableName) {
return new Promise((resolve, reject) => {
const sql = `SELECT * FROM ${tableName}`;
db.all(sql, [], (err, rows) => {
if (err) {
reject(err);
return;
}
const data = rows;
resolve(data);
});
});
};
async function doSomething() {
try {
const returnData = await getAllRows(TABLE_NAME);
res.setHeader('Content-Type', 'application/json')
res.status(200).json(returnData)
// console.log(data);
} catch (err) {
console.error(err);
}
}
doSomething();
// const returnData = getAllRows('user');
// console.log(getAllRows('user'));
// const returnData= db.run('SELECT * FROM user');
// fs.createReadStream('data/user.csv')
// .pipe(csv())
// .on('data', (data) => {
// const values = Object.values(data);
// const placeholders = values.map(() => '?').join(',');
// const sql = `INSERT INTO ${TABLE_NAME} (${Object.keys(data).join(',')}) VALUES (${placeholders})`;
// db.run(sql, values, (err) => {
// if (err) {
// console.error(err);
// }
// });
// })
// .on('end', () => {
// console.log(`Data inserted successfully into table ${TABLE_NAME}`);
// // Close the database connection
// db.close();
// });
}

View File

@ -0,0 +1,73 @@
import csv from 'csv-parser';
import fs from 'fs';
import sqlite3 from 'sqlite3';
export default function handler(req,res) {
console.log(req.body.school)
// const {
// query: { name, keyword },
// method,
// } = req;
// console.log(name, keyword, method);
const DB_NAME = 'data/appUser.db';
const TABLE_NAME = 'school';
// Open a connection to the SQLite database
const db = new sqlite3.Database(DB_NAME);
const query = `SELECT * FROM ${TABLE_NAME}`;
function getAllRows(tableName) {
return new Promise((resolve, reject) => {
const sql = `SELECT * FROM ${tableName}`;
db.all(sql, [], (err, rows) => {
if (err) {
reject(err);
return;
}
const data = rows;
resolve(data);
});
});
};
async function doSomething() {
try {
const returnData = await getAllRows(TABLE_NAME);
res.setHeader('Content-Type', 'application/json')
res.status(200).json(returnData)
// console.log(data);
} catch (err) {
console.error(err);
}
}
doSomething();
// const returnData = getAllRows('user');
// console.log(getAllRows('user'));
// const returnData= db.run('SELECT * FROM user');
// fs.createReadStream('data/user.csv')
// .pipe(csv())
// .on('data', (data) => {
// const values = Object.values(data);
// const placeholders = values.map(() => '?').join(',');
// const sql = `INSERT INTO ${TABLE_NAME} (${Object.keys(data).join(',')}) VALUES (${placeholders})`;
// db.run(sql, values, (err) => {
// if (err) {
// console.error(err);
// }
// });
// })
// .on('end', () => {
// console.log(`Data inserted successfully into table ${TABLE_NAME}`);
// // Close the database connection
// db.close();
// });
}

View File

@ -0,0 +1,91 @@
import csv from 'csv-parser';
import fs from 'fs';
import sqlite3 from 'sqlite3';
export default function handler(req,res) {
console.log(req.body.school)
// const {
// query: { name, keyword },
// method,
// } = req;
// console.log(name, keyword, method);
const DB_NAME = 'data/appUser.db';
const TABLE_NAME = 'user';
// Open a connection to the SQLite database
const db = new sqlite3.Database(DB_NAME);
const query = `SELECT * FROM ${TABLE_NAME}`;
function getAllRows(tableName) {
return new Promise((resolve, reject) => {
db.get(`SELECT COUNT(*) AS count FROM ${tableName}`, (err, row) => {
if (err) {
console.error(err.message);
return;
}
// Access the row count
const rowCount = row.count;
// console.log(`Row count: ${rowCount}`);
const pageNo=0;
const perPage=5;
let noOfPage= Math.floor(rowCount/perPage); if((rowCount % perPage) !=0) noOfPage++;
console.log(`noOfPage: ${noOfPage}`);
const offset=(rowCount-5*perPage*pageNo)-1;
const sql = `SELECT * FROM ${tableName} ORDER BY id DESC LIMIT 5 OFFSET ${rowCount-1}`;
db.all(sql, [], (err, rows) => {
if (err) {
reject(err);
return;
}
const data = rows;
resolve(data);
});
});
});
};
async function doSomething() {
try {
const returnData = await getAllRows('user');
res.setHeader('Content-Type', 'application/json')
res.status(200).json(returnData)
// console.log(data);
} catch (err) {
console.error(err);
}
}
doSomething();
// const returnData = getAllRows('user');
// console.log(getAllRows('user'));
// const returnData= db.run('SELECT * FROM user');
// fs.createReadStream('data/user.csv')
// .pipe(csv())
// .on('data', (data) => {
// const values = Object.values(data);
// const placeholders = values.map(() => '?').join(',');
// const sql = `INSERT INTO ${TABLE_NAME} (${Object.keys(data).join(',')}) VALUES (${placeholders})`;
// db.run(sql, values, (err) => {
// if (err) {
// console.error(err);
// }
// });
// })
// .on('end', () => {
// console.log(`Data inserted successfully into table ${TABLE_NAME}`);
// // Close the database connection
// db.close();
// });
}

View File

@ -4,6 +4,14 @@ import sqlite3 from 'sqlite3';
export default function handler(req,res) { export default function handler(req,res) {
// const query = req.query;
const { page, limit } = req.query;
console.log(page)
// const {
// query: { name, keyword },
// method,
// } = req;
// console.log(name, keyword, method);
const DB_NAME = 'data/appUser.db'; const DB_NAME = 'data/appUser.db';
const TABLE_NAME = 'user'; const TABLE_NAME = 'user';
@ -13,22 +21,40 @@ export default function handler(req,res) {
const query = `SELECT * FROM ${TABLE_NAME}`; const query = `SELECT * FROM ${TABLE_NAME}`;
function getAllRows(tableName) { function getAllRows(tableName, pageNumber, pageSize) {
const offset = (pageNumber - 1) * pageSize;
const sql = `SELECT * FROM ${tableName} LIMIT ${pageSize} OFFSET ${offset}`;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const sql = `SELECT * FROM ${tableName}`;
db.all(sql, [], (err, rows) => { db.all(sql, [], (err, rows) => {
if (err) { if (err) {
reject(err); reject(err);
return; return;
} }
const data = rows; db.get(`SELECT COUNT(*) AS count FROM ${tableName}`, (err, row) => {
if (err) {
console.error(err.message);
return;
}
// Access the row count
const rowCount = row.count;
console.log(`Row count: ${rowCount}`);
const maxPageNumber = Math.ceil(rowCount / pageSize);
const pages = Array.from({ length: maxPageNumber }, (_, index) => index + 1);
let tData={data:rows,maxPageNumber:pages}
const data = tData;
resolve(data); resolve(data);
});
// let tData={data:rows,page:7}
// const data = tData;
// resolve(data);
}); });
}); });
}; };
async function doSomething() { async function doSomething() {
try { try {
const returnData = await getAllRows('user'); const returnData = await getAllRows('user',page,limit);
res.setHeader('Content-Type', 'application/json') res.setHeader('Content-Type', 'application/json')
res.status(200).json(returnData) res.status(200).json(returnData)
// console.log(data); // console.log(data);

View File

@ -1,7 +1,7 @@
export default function handler(req, res) { export default function handler(req, res) {
// const sqlite3 = require('sqlite3').verbose(); // const sqlite3 = require('sqlite3').verbose();
console.log(req.body) // console.log(req.body)
const sqlite3 = require('sqlite3'); const sqlite3 = require('sqlite3');
const argon2 = require('argon2'); const argon2 = require('argon2');
const jwt = require('jsonwebtoken'); const jwt = require('jsonwebtoken');
@ -10,43 +10,63 @@ const jwt = require('jsonwebtoken');
const db = new sqlite3.Database('data/appUser.db'); const db = new sqlite3.Database('data/appUser.db');
// Fetch the user record // Fetch the user record
const username = 'example_user'; const username = req.body.email;
const sql = 'SELECT pass FROM user_table WHERE username = ?'; // console.log(username)
const sql = 'SELECT * FROM user WHERE email = ?';
db.get(sql, [username], async (err, userRecord) => { db.get(sql, [username], async (err, userRecord) => {
if (err) { if (err) {
console.error(err); console.error(err);
return; return;
} }
if (userRecord) { if (userRecord) {
const storedHash = userRecord.password_hash; const storedHash = userRecord.pass;
const providedPassword = 'example_password'; console.log(storedHash)
const providedPassword = req.body.password;
try { try {
// Verify the provided password with the stored hash // Verify the provided password with the stored hash
const isPasswordValid = await argon2.verify(storedHash, providedPassword); const isPasswordValid = await argon2.verify(storedHash, providedPassword);
if (isPasswordValid) { if (isPasswordValid) {
// Passwords match, generate JWT token // Passwords match, generate JWT token
const secretKey = process.env.JWT_SEC; const secretKey = process.env.TOKEN_HEADER_KEY;
const tokenPayload = { username: username }; const tokenPayload = {
const jwtToken = jwt.sign(tokenPayload, secretKey, { algorithm: 'HS256' }); email:userRecord.email,
role: userRecord.type,
iat: Math.floor(Date.now() / 1000),
exp: Math.floor(Date.now() / 1000) + 3600*24*7,
// Return the JWT token };
console.log(jwtToken); const jwtToken = jwt.sign(tokenPayload, secretKey, { algorithm: 'HS256' });
} else { const jwtTokenData ={
console.log('Invalid password'); data:{
} access_token:jwtToken,
} catch (err) { role: userRecord.type,
console.error(err); email: userRecord.email,
expires: 3600*24*7,
}
};
// Return the JWT token
res.status(200).json(jwtTokenData);
console.log(jwtToken);
} else {
console.log('Invalid password');
res.status(400).json({err:'400P'});
} }
} else { } catch (err) {
console.log('User not found'); console.error(err);
} }
} else {
res.status(400).json({err:'400U'});
console.log('User not found');
}
// Close the database connection // Close the database connection
db.close(); db.close();
}); });
res.status(200).json({ name: 'John Doe' }); // res.status(200).json({ name: 'John Doe' });
} }

View File

@ -0,0 +1,79 @@
import csv from 'csv-parser';
import fs from 'fs';
import sqlite3 from 'sqlite3';
export default function handler(req,res) {
// const query = req.query;
const { searchQry, limit } = req.query;
console.log(searchQry)
// const {
// query: { name, keyword },
// method,
// } = req;
// console.log(name, keyword, method);
const DB_NAME = 'data/appUser.db';
const TABLE_NAME = 'user';
// Open a connection to the SQLite database
const db = new sqlite3.Database(DB_NAME);
const query = `SELECT * FROM ${TABLE_NAME}`;
function getAllRows(tableName, searchQry, pageSize) {
const sql = `SELECT * FROM ${tableName} WHERE uname LIKE '%${searchQry}%'`;
return new Promise((resolve, reject) => {
db.all(sql, [], (err, rows) => {
if (err) {
reject(err);
return;
}
resolve(rows);
});
// let tData={data:rows,page:7}
// const data = tData;
// resolve(data);
});
};
async function doSomething() {
try {
const returnData = await getAllRows('user',searchQry,limit);
res.setHeader('Content-Type', 'application/json')
res.status(200).json(returnData)
// console.log(data);
} catch (err) {
console.error(err);
}
}
doSomething();
// const returnData = getAllRows('user');
// console.log(getAllRows('user'));
// const returnData= db.run('SELECT * FROM user');
// fs.createReadStream('data/user.csv')
// .pipe(csv())
// .on('data', (data) => {
// const values = Object.values(data);
// const placeholders = values.map(() => '?').join(',');
// const sql = `INSERT INTO ${TABLE_NAME} (${Object.keys(data).join(',')}) VALUES (${placeholders})`;
// db.run(sql, values, (err) => {
// if (err) {
// console.error(err);
// }
// });
// })
// .on('end', () => {
// console.log(`Data inserted successfully into table ${TABLE_NAME}`);
// // Close the database connection
// db.close();
// });
}

View File

View File

@ -1,131 +0,0 @@
import NavBar from '../components/NavBar'
import { useId, useState, useEffect, useMemo } from 'react';
import 'react-phone-number-input/style.css'
import { useRouter } from 'next/router'
export default function addSchoolForm() {
const router = useRouter();
const [school, setSchool] = useState({});
useEffect(()=>{
// if(router.query.school<1) {
// const { sid } = router.query;
// setSchool(sid)
if(router.query.school && router.query.school>1 ){
fetch(`https://management.beanstalkedu.com/items/school/${router.query.school}`)
.then(res => res.json())
.then(data => {
console.log(router.query.school); setSchool(data.data)
})
}
}, [router.query.school]);
const handleSubmit = async (event) => {
event.preventDefault()
const data = {
"status":"published",
name: event.target.schoolName.value,
country: event.target.country.value,
state: event.target.state.value,
cities: event.target.cities.value,
anual: event.target.anual.value,
toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value,
agreement_expiry_date: event.target.agreement_expiry_date.value,
school_agreement: event.target.school_agreement.value,
school_contact_number: event.target.school_contact_number.value,
school_email_id: event.target.school_email_id.value,
}
const JSONdata = JSON.stringify(data)
console.log(data)
const endpoint = 'https://management.beanstalkedu.com/items/school'
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSONdata,
}
const response = await fetch(endpoint, options)
const result = await response.json()
// alert(`Is this your full name: ${result.data}`)
alert(`School Saved`)
}
return (
<main>
<div>
<NavBar />
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
<div className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<div className='flex flex-col justify-center place-items-center'>
<img src="/img/1.svg" alt="" />
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>School Registration Form</p>
</div>
<form className='w-full px-6 md:px-20'>
<div className='flex flex-col w-full'>
<label htmlFor="school" className='text-xl font-bold'>School Name</label>
<input type="text" value={school.name} onChange={e => setSchool(e.target.value)} name="schoolName" placeholder='School Name' className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="school_email_id" className='text-xl font-bold'> Email ID</label>
<input type="text" value={school.school_email_id} onChange={e => setSchool(e.target.value)} name="school_email_id" id="school_email_id" placeholder='School Email ID' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<input type="text" value={school.country} onChange={e => setSchool(e.target.value)} name="country" />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'>State</label>
<input type="text" value={school.state} onChange={e => setSchool(e.target.value)} name="state" />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="Cities" className='text-xl font-bold'>Cities</label>
<input type="text" value={school.cities} onChange={e => setSchool(e.target.value)} name="cities" />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="school_contact_number" className='text-xl font-bold'> Phone</label>
<input type="text" value={school.school_contact_number} onChange={e => setSchool(e.target.value)} name="school_contact_number" />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label>
<input type="text" value={school.anual} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
<input type="text" name="toddlers" value={school.toddlers} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label>
<input type="text" name="early_start_programme" value={school.early_start_programme} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<input type="text" name="interakto" value={school.interakto} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="agreement_expiry_date" className='text-xl font-bold pt-4'>Agreement Expiry Date</label>
<input type="date" name="agreement_expiry_date" value={school.agreement_expiry_date} onChange={e => setSchool(e.target.value)} id="agreement_expiry_date" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex justify-center pt-8'>
<input type="submit" value="Save" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' />
</div>
</form>
</div>
</section>
</div>
</main>
)
}

View File

@ -1,12 +1,14 @@
import NavBar from '../components/NavBar' import { signIn, signOut, useSession } from 'next-auth/react'
import { useId, useState, useEffect, useMemo } from 'react'; import {useId, useState, useEffect, useMemo} from 'react';
import 'react-phone-number-input/style.css' import 'react-phone-number-input/style.css'
import NavBar from '../components/NavBar';
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import Link from 'next/link'
export default function addSchoolForm() { export default function EditSchool() {
const { data: session } = useSession()
const router = useRouter(); const router = useRouter();
const uploadToServer = async (event) => { const uploadToServer = async (event) => {
const body = new FormData(); const body = new FormData();
body.append("file", agreement.files[0]); body.append("file", agreement.files[0]);
@ -15,45 +17,57 @@ export default function addSchoolForm() {
method: "POST", method: "POST",
body body
}); });
};
};
const uploadCsv = async (event) => {
// alert('p')
const body = new FormData();
body.append("file", csv.files[0]);
// console.log('body')
// body.append("fName", `${router.query.school}.pdf`);
const response = await fetch("/api/addUsersBulk", {
method: "POST",
body
});
};
const [school, setSchool] = useState({}); const [school, setSchool] = useState({});
useEffect(()=>{ useEffect(()=>{
// if(router.query.school<1) { if(router.query.school && router.query.school>0 ){
// const { sid } = router.query; // console.log(router.query);
// setSchool(sid) fetch(`/api/getSchoolDetails?school=${router.query.school}`)
if(router.query.school && router.query.school>1 ){ .then(res => res.json())
fetch(`https://management.beanstalkedu.com/items/school/${router.query.school}`) .then(data => {
.then(res => res.json()) // console.log(data);
.then(data => { setSchool(data[0])
console.log(router.query.school); setSchool(data.data) // console.log(school)
}) })
} }
}, [router.query.school]); }, [router.query.school]);
const handleSubmit = async (event) => { const updateSchoolData = async (event) => {
event.preventDefault() event.preventDefault()
const data = { const data = {
"status":"published", schoolId: router.query.school,
name: event.target.schoolName.value, sname: event.target.sname.value,
status: event.target.status.value,
country: event.target.country.value, country: event.target.country.value,
state: event.target.state.value, state: event.target.state.value,
cities: event.target.cities.value, city: event.target.city.value,
anual: event.target.anual.value, annual: event.target.annual.value,
toddlers: event.target.toddlers.value, toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value, early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value, interakto: event.target.interakto.value,
agreement_expiry_date: event.target.agreement_expiry_date.value, agg_expiry: event.target.agg_expiry.value,
school_agreement: event.target.school_agreement.value, usage_expiry: event.target.usage_expiry.value,
school_contact_number: event.target.school_contact_number.value, phone: event.target.phone.value,
school_email_id: event.target.school_email_id.value, email: event.target.email.value,
} }
const JSONdata = JSON.stringify(data) const JSONdata = JSON.stringify(data)
console.log(data) // console.log(data)
const endpoint = 'https://management.beanstalkedu.com/items/school' const endpoint = '/api/editSchool'
const options = { const options = {
method: 'POST', method: 'POST',
headers: { headers: {
@ -65,101 +79,116 @@ export default function addSchoolForm() {
const result = await response.json() const result = await response.json()
// alert(`Is this your full name: ${result.data}`) // alert(`Is this your full name: ${result.data}`)
alert(`School Saved`) alert(`User data updated`)
} }
if (session) {
return ( return (
<main> <main>
<div> <div>
<NavBar /> <NavBar/>
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'> <section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
<div className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'> <div
<div className='flex flex-col justify-center place-items-center'> className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<img src="/img/1.svg" alt="" /> <div className='inline-flex p-4 '>
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>School Registration Form</p> <Link href="/add-school-form" className="m-2 inline-flex place-items-center justify-center p-2 pl-4 pr-4 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
</div> <img src="/img/4.svg" alt="" /> &nbsp;
<form className='w-full px-6 md:px-20'> List Users Under This School
<div className='flex flex-col w-full'> </Link>
<label htmlFor="school" className='text-xl font-bold'>School Name</label> <div className="place-items-center justify-center m-2 p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<input type="text" value={school.name} onChange={e => setSchool(e.target.value)} name="schoolName" placeholder='School Name' className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' /> <span className="text-small">CSV &nbsp;</span>
</div> <input type="file" id="csv" onChange={uploadCsv} name="csv" />
<div className='flex flex-col w-full pt-4'> </div>
<label htmlFor="school_email_id" className='text-xl font-bold'> Email ID</label> {/* <img src="/img/2.svg" alt=""/> */}
<input type="text" value={school.school_email_id} onChange={e => setSchool(e.target.value)} name="school_email_id" id="school_email_id" placeholder='School Email ID' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<input type="text" value={school.country} onChange={e => setSchool(e.target.value)} name="country" />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'>State</label>
<input type="text" value={school.state} onChange={e => setSchool(e.target.value)} name="state" />
</div> </div>
<p className='text-2xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update School Information </p>
<form onSubmit={updateSchoolData} action="" className='w-full px-6 md:px-20'>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="sname" className='text-xl font-bold'>School Name</label>
<input value={school.sname} onChange={e => setSchool(e.target.value)} type="text" name="sname" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="status" className='text-xl font-bold'>Status</label>
<input value={school.status} onChange={e => setSchool(e.target.value)} type="text" name="status" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="Cities" className='text-xl font-bold'>Cities</label> <label htmlFor="phone" className='text-xl font-bold'>School contact Number</label>
<input type="text" value={school.cities} onChange={e => setSchool(e.target.value)} name="cities" /> <input value={school.phone} onChange={e => setSchool(e.target.value)} type="text" name="phone" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> </div>
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="school_contact_number" className='text-xl font-bold'> Phone</label> <label htmlFor="email" className='text-xl font-bold'> School contact Email ID</label>
<input type="text" value={school.school_contact_number} onChange={e => setSchool(e.target.value)} name="school_contact_number" /> <input value={school.email} onChange={e => setSchool(e.target.value)} type="text" name="email" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label>
<input type="text" value={school.anual} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
<input type="text" name="toddlers" value={school.toddlers} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label>
<input type="text" name="early_start_programme" value={school.early_start_programme} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<input type="text" name="interakto" value={school.interakto} onChange={e => setSchool(e.target.value)} />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="agreement_expiry_date" className='text-xl font-bold pt-4'>Agreement Expiry Date</label>
<input type="date" name="agreement_expiry_date" value={school.agreement_expiry_date} onChange={e => setSchool(e.target.value)} id="agreement_expiry_date" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
{/* <div className='flex flex-col w-full'>
<label htmlFor="agreement_expiry_date" className='text-xl font-bold pt-4'>Upload Agreement</label>
<input type="file" name="agreement_expiry_date" />
</div> */}
{/* <div className='flex justify-center pt-8'>
<input type="submit" value="Save" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' />
</div> */}
</form>
<div class="flex pt-6">
<div class="flex-1 ">
<input id="agreement" type="file" name="myImage" onChange={uploadToServer} />
{/* <button
className="rounded-full bg-[#FE4501] p-2 text-white"
type="submit"
onClick={uploadToServer}
>
Upload Agreement
</button> */}
</div>
<div class="flex-1 ">
<a href={'/uploaded/'+router.query.school+'.pdf'}><button
className="rounded-full bg-[#FE4501] p-2 text-white"
type="submit"
onClick={uploadToServer}
>
Download Agreement
</button></a>
</div>
</div>
</div> </div>
</section> <div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<input value={school.country} onChange={e => setSchool(e.target.value)} type="text" name="country" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'>State</label>
<input value={school.state} onChange={e => setSchool(e.target.value)} type="text" name="state" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="city" className='text-xl font-bold'>Cities</label>
<input value={school.city} onChange={e => setSchool(e.target.value)} type="text" name="city" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="annual" className='text-xl font-bold'>Annual</label>
<input value={school.annual} onChange={e => setSchool(e.target.value)} type="text" name="annual" placeholder='' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
<input value={school.toddlers} onChange={e => setSchool(e.target.value)} type="text" name="toddlers" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label>
<input value={school.early_start_programme} onChange={e => setSchool(e.target.value)} type="text" name="early_start_programme" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<input value={school.interakto} onChange={e => setSchool(e.target.value)} type="text" name="interakto" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="usage_expiry" className='text-xl font-bold'> Usage Expiry Date: (YYYY-MM-DD)</label>
<input value={school.usage_expiry} onChange={e => setSchool(e.target.value)} type="text" name="usage_expiry" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="agg_expiry" className='text-xl font-bold'> Agreement Expiry Date: (YYYY-MM-DD)</label>
<input value={school.agg_expiry} onChange={e => setSchool(e.target.value)} type="text" name="agg_expiry" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex justify-center pt-8'>
<button type="submit"
className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Update
</button>
</div>
</form>
</div> </div>
</main>
<div className='flex flex-col w-full'>
<label htmlFor="agreement_documents" className='text-xl font-bold'>Upload Agreement Document&apos;s</label>
<input id="agreement" onChange={uploadToServer} type="file" name="agreement_documents" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
<div className='flex justify-end pt-2'>
<button className=' bg-[#FE4501] px-4 py-1.5 rounded-lg text-white'>Download Agreement</button>
</div>
</div>
</section>
</div>
</main>
) )
} }
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
}

178
src/pages/edit-user.jsx Normal file
View File

@ -0,0 +1,178 @@
import { signIn, signOut, useSession } from 'next-auth/react'
import {useId, useState, useEffect, useMemo} from 'react';
import 'react-phone-number-input/style.css'
import NavBar from '../components/NavBar';
import { useRouter } from 'next/router'
export default function EditUser() {
const router = useRouter();
const [user, setUser] = useState({});
const { data: session } = useSession()
useEffect(()=>{
if(router.query.user && router.query.user>0 ){
fetch(`/api/getUserDetails?user=${router.query.user}`)
.then(res => res.json())
.then(data => {
// console.log(data);
setUser(data[0])
// console.log(user)
})
}
}, [router.query.user]);
const updateUserData = async (event) => {
event.preventDefault()
const data = {
userId: router.query.user,
type: event.target.type.value,
status: event.target.status.value,
uname: event.target.uname.value,
country: event.target.country.value,
state: event.target.state.value,
city: event.target.city.value,
address: event.target.address.value,
start_date: event.target.start_date.value,
end_date: event.target.end_date.value,
school: event.target.school.value,
annual: event.target.annual.value,
toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value,
email: event.target.email.value,
phone: event.target.phone.value,
klas: event.target.klas.value
}
const JSONdata = JSON.stringify(data)
// console.log(data)
const endpoint = '/api/editUser'
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSONdata,
}
const response = await fetch(endpoint, options)
// .then(res => res.json())
// .then(data => {
// console.log(data);
// // setUser(data[0])
// // console.log(user)
// })
const result = await response.json()
console.log(result)
// alert(`Is this your full name: ${result.data}`)
alert(`User data updated`)
}
if (session) {
return (
<main>
<div>
<NavBar/>
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
<div
className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<div className='flex flex-col justify-center place-items-center'>
<img src="/img/2.svg" alt=""/>
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update User Information </p>
</div>
<form onSubmit={updateUserData} action="" className='w-full px-6 md:px-20'>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="class" className='text-xl font-bold'>Type</label>
<input value={user.type} onChange={e => setUser(e.target.value)} type="text" name="type" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="name" className='text-xl font-bold'> Name</label>
<input value={user.uname} onChange={e => setUser(e.target.value)} type="text" name="uname" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="status" className='text-xl font-bold'> Status</label>
<input value={user.status} onChange={e => setUser(e.target.value)} type="text" name="status" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="start_date" className='text-xl font-bold'> Start Date (YYYY-MM-DD) </label>
<input value={user.start_date} onChange={e => setUser(e.target.value)} type="text" name="start_date" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="end_date" className='text-xl font-bold'> End Date (YYYY-MM-DD)</label>
<input value={user.end_date} onChange={e => setUser(e.target.value)} type="text" name="end_date" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="email" className='text-xl font-bold'>Email</label>
<input value={user.email} onChange={e => setUser(e.target.value)} type="email" name="email" placeholder='ex. xyz@email.com' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="phone" className='text-xl font-bold'> Phone</label>
<input value={user.phone} onChange={e => setUser(e.target.value)} type="text" name="phone" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<input value={user.country} onChange={e => setUser(e.target.value)} type="text" name="country" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'> State</label>
<input value={user.state} onChange={e => setUser(e.target.value)} type="text" name="state" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="city" className='text-xl font-bold'> City</label>
<input value={user.city} onChange={e => setUser(e.target.value)} type="text" name="city" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="address" className='text-xl font-bold'> Address Line-1</label>
<input value={user.address} onChange={e => setUser(e.target.value)} type="text" name="address" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
{/* <div className='flex flex-col w-full'>
<label htmlFor="address" className='text-xl font-bold'> Address Line-2</label>
<input value={user.address} onChange={e => setUser(e.target.value)} type="text" name="address" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> */}
<div className='flex flex-col w-full pt-4'>
<label htmlFor="" className='text-xl font-bold'>School ID</label>
<input value={user.school} onChange={e => setUser(e.target.value)} type="text" name="school" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="klas" className='text-xl font-bold'>Class</label>
<input value={user.klas} onChange={e => setUser(e.target.value)} type="text" name="klas" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="annual" className='text-xl font-bold'>annual</label>
<input value={user.annual} onChange={e => setUser(e.target.value)} type="text" name="annual" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Programme</label>
<input value={user.early_start_programme} onChange={e => setUser(e.target.value)} type="text" name="early_start_programme" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
<input value={user.toddlers} onChange={e => setUser(e.target.value)} type="text" name="toddlers" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<input value={user.interakto} onChange={e => setUser(e.target.value)} type="text" name="interakto" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex justify-center pt-8'>
<button type="submit"
className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Update
</button>
</div>
</form>
</div>
</section>
</div>
</main>
)
}
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
}

View File

@ -6,23 +6,52 @@ import countryList from 'react-select-country-list'
import 'react-phone-number-input/style.css' import 'react-phone-number-input/style.css'
import PhoneInput from 'react-phone-number-input' import PhoneInput from 'react-phone-number-input'
import NavBar from '../components/NavBar'; import NavBar from '../components/NavBar';
import { useRouter } from 'next/router'
// import { Inter } from 'next/font/google' // import { Inter } from 'next/font/google'
const typeParent = "parent" const typeParent = "parent"
export default function addUserForm() { export default function addUserForm() {
const [allLanguage, setLanguage] = useState([
{lang: "Assamese", value: false}, const router = useRouter();
{lang: "Bengali", value: false},
{lang: "English", value: false}, const [userDetails, setUserDetails] = useState({});
{lang: "Hindi", value: false},
{lang: "telegu", value: false}, useEffect(()=>{
{lang: "Punjabi", value: false}, if(router.query.user && router.query.user>1 ){
{lang: "malayalam", value: false}, const body = new FormData();
{lang: "tamil", value: false}, body.append("user", router.query.user);
{lang: "kannada", value: false}, const response = await fetch("/api/getUserDetails", {
{lang: "gujrati", value: false}, method: "POST",
]) body
});
fetch(`/api/getUserDetails?${router.query.user}`)
.then(res => res.json())
.then(data => {
// console.log(router.query.school);
setUserDetails(data.data)
})
}
}, [router.query.school]);
const response = await fetch(endpoint, options)
const result = await response.json()
const [allLanguage, setLanguage] = useState([
{lang: "Assamese", value: false},
{lang: "Bengali", value: false},
{lang: "English", value: false},
{lang: "Hindi", value: false},
{lang: "Telegu", value: false},
{lang: "Punjabi", value: false},
{lang: "Malayalam", value: false},
{lang: "Tamil", value: false},
{lang: "Kannada", value: false},
{lang: "Gujrati", value: false},
])
// console.log(allLanguage)
const [currentType, setCurrentType] = useState(typeParent) const [currentType, setCurrentType] = useState(typeParent)
const [countryValue, setCountryValue] = useState('') const [countryValue, setCountryValue] = useState('')
const options = useMemo(() => countryList().getData(), []) const options = useMemo(() => countryList().getData(), [])
@ -34,9 +63,10 @@ export default function addUserForm() {
const handleSelectAllStates = stateCode => { const handleSelectAllStates = stateCode => {
setAllCities([]) setAllCities([])
fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${countryValue.value}&state=${stateCode.value}`).then(res => res.json()) fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${countryValue.value}&state=${stateCode.value}`)
.then(res => res.json())
.then(data => { .then(data => {
console.log("handleSelectAllStates:", data, options) // console.log("handleSelectAllStates:", data, options)
let newData = data && data.length > 0 && data.map(n => { let newData = data && data.length > 0 && data.map(n => {
return { return {
label: n.name, label: n.name,
@ -81,24 +111,44 @@ export default function addUserForm() {
}) })
}, []) }, [])
// console.log(school);
const [user, setUser] = useState({});
useEffect(()=>{
if(router.query.user && router.query.user>1){
fetch(`/api/listUsers/${router.query.user}`)
.then(res => res.json())
.then(data => {
setUser(data)
}
)
}
},
[router.query.user]);
console.log(user)
const handleFormsubmit = async (event) => { const handleFormsubmit = async (event) => {
event.preventDefault() event.preventDefault()
console.log(event.target.lang.checked)
const data = { const data = {
"status": "published", "status": "published",
type: event.target.type.value, type: event.target.type.value,
name: event.target.name.value, uname: event.target.uname.value,
user: event.target.email.value,
country: event.target.country.value, country: event.target.country.value,
state: event.target.state.value ? event.target.state.value:"",
city: event.target.city.value ? event.target.city.value:"",
phone: event.target.phone.value, phone: event.target.phone.value,
email: event.target.email.value,
school: event.target.schoolID.value, school: event.target.schoolID.value,
class: event.target.class.value, klas: event.target.klas.value,
lang: event.target.lang.value, lang: allLanguage,
start_month: event.target.start_month.value, start_month: event.target.start_month.value,
start_date: event.target.start_date.value, start_date: event.target.start_date.value,
end_date: event.target.end_date.value, end_date: event.target.end_date.value,
anual: event.target.anual.value, anual: event.target.anual.value,
early_start_programme: event.target.early_start_programme.value,
toddlers: event.target.toddlers.value,
interakto: event.target.interakto.value,
} }
const JSONdata = JSON.stringify(data) const JSONdata = JSON.stringify(data)
const endpoint = '/api/addUsers' const endpoint = '/api/addUsers'
@ -111,13 +161,14 @@ export default function addUserForm() {
} }
const response = await fetch(endpoint, options) const response = await fetch(endpoint, options)
const result = await response.json() const result = await response.json()
alert(`Is this your full name: ${result.data}`) // console.log(result)
// alert(`Is this your full name: ${result}`)
} }
const handleOnLanguageChange = (e, v) => { const handleOnLanguageChange = (e, v) => {
let idx = allLanguage.findIndex(o => o.lang === e.target.value); let idx = allLanguage.findIndex(o => o.lang === e.target.value);
let newAllLang = [...allLanguage] let newAllLang = [...allLanguage]
newAllLang[idx].value = true newAllLang[idx].value = true
// console.log(newAllLang)
if ([typeParent, "teacher"].includes(currentType)) { if ([typeParent, "teacher"].includes(currentType)) {
let counter = 0 let counter = 0
@ -140,7 +191,10 @@ export default function addUserForm() {
newAllLang[idx].value = false newAllLang[idx].value = false
newAllLang[idx].disabled = false newAllLang[idx].disabled = false
}) })
setLanguage(newAllLang) const { name, checked } = e.target;
setLanguage({ ...allLanguage, [name]: checked });
// setLanguage(newAllLang)
setCurrentType(e.target.value) setCurrentType(e.target.value)
} }
return ( return (
@ -152,24 +206,18 @@ export default function addUserForm() {
className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'> className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<div className='flex flex-col justify-center place-items-center'> <div className='flex flex-col justify-center place-items-center'>
<img src="/img/2.svg" alt=""/> <img src="/img/2.svg" alt=""/>
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>User <p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update User Information </p>
Registration Form</p>
</div> </div>
<form onSubmit={handleFormsubmit} action="" className='w-full px-6 md:px-20'> <form onSubmit={handleFormsubmit} action="" className='w-full px-6 md:px-20'>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="class" className='text-xl font-bold'>Type</label> <label htmlFor="class" className='text-xl font-bold'>Type</label>
<select name="type" <input type="text" value="wvgfbhvwhvf" name="type" onChange={handleTypeOnChange} className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
onChange={handleTypeOnChange}
className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value={typeParent}>Parent</option>
<option value="teacher">Teacher</option>
<option value="coordinator">Coordinator</option>
<option value="master">Master</option>
</select>
</div> </div>
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="name" className='text-xl font-bold'> Name</label> <label htmlFor="name" className='text-xl font-bold'> Name</label>
<input type="text" name="name" <input type="text" name="uname"
className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
placeholder='Enter your Name'/> placeholder='Enter your Name'/>
</div> </div>
@ -196,10 +244,10 @@ export default function addUserForm() {
{ {
allCities && allCities.length > 0 && allCities && allCities.length > 0 &&
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="Cities" className='text-xl font-bold'>Cities</label> <label htmlFor="city" className='text-xl font-bold'>City</label>
<Select <Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="Cities" options={allCities} value={allCities[0].name} name="city" options={allCities} value={allCities[0].name}
// onChange={() => {}} // onChange={() => {}}
/> />
</div>} </div>}
@ -214,7 +262,7 @@ export default function addUserForm() {
<label htmlFor="" className='text-xl font-bold'>School name</label> <label htmlFor="" className='text-xl font-bold'>School name</label>
<select name="schoolID" onChange={individual} <select name="schoolID" onChange={individual}
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="individual"> individual</option> <option value="0"> individual</option>
{school && school.data.map(data => {school && school.data.map(data =>
<option value={data.id} key={data.id}>{data.name}</option> <option value={data.id} key={data.id}>{data.name}</option>
)} )}
@ -222,7 +270,7 @@ export default function addUserForm() {
</div> </div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="class" className='text-xl font-bold'>Class</label> <label htmlFor="class" className='text-xl font-bold'>Class</label>
<select name="class" <select name="klas"
className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0">-Select-</option> <option value="0">-Select-</option>
<option value="IK1">IK1</option> <option value="IK1">IK1</option>
@ -235,47 +283,90 @@ export default function addUserForm() {
<div> <div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label> <label htmlFor="anual" className='text-xl font-bold'>Anual</label>
<select name="anual" <select name="anual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0">-NA-</option> <option value="0">-NA-</option>
<option value="January">January</option> <option value="Jan">Jan</option>
<option value="February">February</option> <option value="Feb">Feb</option>
<option value="March">March</option> <option value="Mar">Mar</option>
<option value="April">April</option> <option value="Apr">Apr</option>
<option value="May">May</option> <option value="May">May</option>
<option value="June">June</option> <option value="Jun">Jun</option>
<option value="July">July</option> <option value="Jul">Jul</option>
<option value="August">August</option> <option value="Aug">Aug</option>
<option value="September">September</option> <option value="Sept">Sept</option>
<option value="October">October</option> <option value="Oct">Oct</option>
<option value="November">November</option> <option value="Nov">Nov</option>
<option value="December">December</option> <option value="Dec">Dec</option>
</select> </select>
</div> </div>
{/* <div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="plan" className='text-xl font-bold'>Plan</label> <label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Programme</label>
<div className='grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-y-2 pt-2 '> <select name="early_start_programme" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<div className='flex flex-row place-items-center'> <option value="0">-NA-</option>
<label className='cursor-pointer' htmlFor="Anual">Anual</label>&nbsp; <option value="Jan">Jan</option>
<input type="checkbox" name="plan" id="Anual" value='Anual' className='check-box'/> <option value="Feb">Feb</option>
</div> <option value="Mar">Mar</option>
<div className='flex flex-row place-items-center'> <option value="Apr">Apr</option>
<label className='cursor-pointer' htmlFor="Toddler">Toddler</label>&nbsp; <option value="May">May</option>
<input type="checkbox" name="plan" id="Toddler" value='Toddler' className='check-box'/> <option value="Jun">Jun</option>
</div> <option value="Jul">Jul</option>
<div className='flex flex-row place-items-center'> <option value="Aug">Aug</option>
<label className='cursor-pointer' htmlFor="Interakto">Interakto</label>&nbsp; <option value="Sept">Sept</option>
<input type="checkbox" name="plan" id="Interakto" value='Interakto' className='check-box'/> <option value="Oct">Oct</option>
</div> <option value="Nov">Nov</option>
<div className='flex flex-row place-items-center col-span-2'> <option value="Dec">Dec</option>
<label className='cursor-pointer md:whitespace-nowrap' htmlFor="Early_Start_program">Early Start Program</label>&nbsp; </select>
<input type="checkbox" name="plan" id="Early_Start_program" value='Early_Start_program' className='check-box'/> </div>
</div> <div className='flex flex-col w-full pt-4'>
</div> <label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
</div> */} <select name="toddlers" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0">-NA-</option>
<option value="Jan">Jan</option>
<option value="Feb">Feb</option>
<option value="Mar">Mar</option>
<option value="Apr">Apr</option>
<option value="May">May</option>
<option value="Jun">Jun</option>
<option value="Jul">Jul</option>
<option value="Aug">Aug</option>
<option value="Sept">Sept</option>
<option value="Oct">Oct</option>
<option value="Nov">Nov</option>
<option value="Dec">Dec</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<select name="interakto" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0">-NA-</option>
<option value="Jan">Jan</option>
<option value="Feb">Feb</option>
<option value="Mar">Mar</option>
<option value="Apr">Apr</option>
<option value="May">May</option>
<option value="Jun">Jun</option>
<option value="Jul">Jul</option>
<option value="Aug">Aug</option>
<option value="Sept">Sept</option>
<option value="Oct">Oct</option>
<option value="Nov">Nov</option>
<option value="Dec">Dec</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="lang" className='text-xl font-bold'>Language</label> <label htmlFor="lang" className='text-xl font-bold'>Language</label>
<div className='grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-y-2 pt-2'> <div className='grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-y-2 pt-2'>
{/* <label className='cursor-pointer' htmlFor="Assamese"> Assamese </label> &nbsp; <input type="checkbox" name="lang" value="Assamese" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Bengali"> Bengali </label> &nbsp; <input type="checkbox" name="lang" value="Bengali" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="English"> English </label> &nbsp; <input type="checkbox" name="lang" value="English" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Hindi"> Hindi </label> &nbsp; <input type="checkbox" name="lang" value="Hindi" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Telegu"> Telegu </label> &nbsp; <input type="checkbox" name="lang" value="Telegu" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Punjabi"> Punjabi </label> &nbsp; <input type="checkbox" name="lang" value="Punjabi" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Malayalam"> Malayalam </label> &nbsp; <input type="checkbox" name="lang" value="Malayalam" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Tamil"> Tamil </label> &nbsp; <input type="checkbox" name="lang" value="Tamil" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Kannada"> Kannada </label> &nbsp; <input type="checkbox" name="lang" value="Kannada" className='check-box'/> <br />
<label className='cursor-pointer' htmlFor="Gujrati"> Gujrati </label> &nbsp; <input type="checkbox" name="lang" value="Gujrati" className='check-box'/> <br /> */}
{allLanguage && allLanguage.length && allLanguage.map(n => { {allLanguage && allLanguage.length && allLanguage.map(n => {
return ( return (
<div key={n.lang} className=''> <div key={n.lang} className=''>
@ -291,20 +382,19 @@ export default function addUserForm() {
</div> </div>
<div className='flex flex-col w-full pt-4'> <div className='flex flex-col w-full pt-4'>
<label htmlFor="start_month" className='text-xl font-bold'>Start Month</label> <label htmlFor="start_month" className='text-xl font-bold'>Start Month</label>
<select name="start_month" id="start_month" <select name="start_month" id="start_month" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0">-Select-</option> <option value="0">-Select-</option>
<option value="January"> January</option> <option value="Jan"> Jan</option>
<option value="February"> February</option> <option value="Feb"> Feb</option>
<option value="March"> March</option> <option value="Mar"> Mar</option>
<option value="April"> April</option> <option value="Apr"> Apr</option>
<option value="May"> May</option> <option value="May"> May</option>
<option value="June"> June</option> <option value="Jun"> Jun</option>
<option value="July"> July</option> <option value="Jul"> Jul</option>
<option value="August"> August</option> <option value="Aug"> Aug</option>
<option value="September"> September</option> <option value="Sept"> Sept</option>
<option value="November"> November</option> <option value="Nov"> Nov</option>
<option value="December"> December</option> <option value="Dec"> Dec</option>
</select> </select>
</div> </div>
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
@ -323,7 +413,7 @@ export default function addUserForm() {
} }
<div className='flex justify-center pt-8'> <div className='flex justify-center pt-8'>
<button type="submit" <button type="submit"
className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Save className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Update
</button> </button>
{/* <input type="submit" value="Submit Now" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' /> */} {/* <input type="submit" value="Submit Now" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' /> */}
</div> </div>

91
src/pages/file-upload.jsx Normal file
View File

@ -0,0 +1,91 @@
import { signIn, signOut, useSession } from 'next-auth/react'
import {useId, useState, useEffect, useMemo} from 'react';
import { useRouter } from 'next/router'
export default function fileUpload() {
const [school, setSchool] = useState([]);
const { data: session} = useSession()
const fetchData = async () => {
const response = await fetch("/api/listSchlools-test");
const data = await response.json();
return setSchool(data);
}
// console.log(school)
useEffect(() => {
fetchData();
},[])
const uploadToServer = async (event) => {
const body = new FormData();
body.append("file", agreement.files[0]);
body.append("fName", `${+new Date()}.pdf`);
const response = await fetch("/api/fileUpload-test", {
method: "POST",
body
});
};
function fInput() {
let x = document.getElementById('myInput').value
document.getElementById('print').innerHTML = "You Typed :-" + x;
}
var dt = Date();
var unix = Math.floor(+new Date()/1000);
function myFunction() {
document.getElementById('demo').innerHTML = "Time :-"+dt+ " & Unix Time :-"+unix;
document.getElementById('demo').style.color = "red"
}
// console.log(+new Date())
// console.log(Math.floor(Date.now() / 1000))
return (
<main>
<div>
<section className='container mx-auto px-4'>
<button onClick={myFunction}>Click</button>
<p id='demo'></p>
<div className=' pt-24 flex flex-col justify-center place-items-center w-full'>
<input type="file" id='agreement' onChange={uploadToServer} className='border-2 border-[#7c4c23] p-2 rounded-lg' />
<label htmlFor="">School Name</label>
<input type="text" className='border-2 border-[#7c4c23] p-2 rounded-lg' id='myInput' onInput={fInput} />
<p id='print'></p>
<input type="text" name="" id="print" className='border-2' />
</div>
</section>
<section className='container mx-auto px-4'>
<div className='flex 2xl:justify-center overflow-x-scroll '>
<table className='border-2'>
<thead className='border-2'>
<tr className='bg-gray-300'>
<th className='border-2'>ID</th>
<th className='border-2'>School Name</th>
<th className='border-2'>Toddlers</th>
<th className='border-2'>City</th>
<th>Input</th>
</tr>
</thead>
<tbody>
{school.map(data =>
<tr key={data.id} className='text-center'>
<td className='border-2 p-2'>{data.id}</td>
<td className='border-2'>{data.sname}</td>
<td className='border-2'>{data.toddlers}</td>
<td className='border-2'>{data.city}</td>
<td>
<div>
<label htmlFor="">Name</label>&nbsp;
<input type="text" className='border-2 p-2 rounded-lg'/>&nbsp;
<button className='bg-orange-500 px-4 py-1.5 rounded-lg text-white'>Submit</button>
</div>
</td>
</tr>
)}
</tbody>
</table>
</div>
</section>
</div>
</main>
)
}

View File

@ -1,13 +1,15 @@
import Image from 'next/image' import { signIn, signOut } from 'next-auth/react';
import NavBar from '../components/NavBar' import NavBar from '../components/NavBar'
import { Inter } from 'next/font/google' import { useSession } from "next-auth/react";
const inter = Inter({ subsets: ['latin'] }) // const { data: session } = useSession();
// console.log(session)
export default function Home() { export default function Home() {
return ( return (
<main> <main>
<NavBar /> <NavBar />
<br />
</main> </main>
) )
} }

131
src/pages/login.jsx Normal file
View File

@ -0,0 +1,131 @@
import { useState } from 'react';
import { signIn, signOut, getCsrfToken, useSession } from 'next-auth/react';
import { Formik, Field, ErrorMessage } from 'formik';
import * as Yup from 'yup';
import { useRouter } from 'next/router';
import Link from 'next/link'
export default function SignIn({ csrfToken }) {
const router = useRouter();
const [error, setError] = useState(null);
const { data: session } = useSession()
// console.log(session)
if (session) {
return (
<>
<br /><br />
You are already Signed in, click on continue
<br />
<Link href="/">Continue...</Link>
<br /><br />
or : <button onClick={() => signOut()}>Sign out</button>
</>
)
}
return (
<>
<Formik
initialValues={{ email: '', password: '', tenantKey: '' }}
validationSchema={Yup.object({
email: Yup.string()
.max(30, 'Must be 30 characters or less')
.email('Invalid email address')
.required('Please enter your email'),
password: Yup.string().required('Please enter your password'),
})}
onSubmit={async (values, { setSubmitting }) => {
const res = await signIn('credentials', {
redirect: false,
email: values.email,
password: values.password,
callbackUrl: `${window.location.origin}`,
});
if (res?.error) {
setError(res.error);
} else {
setError(null);
}
if (res.url) router.push(res.url);
setSubmitting(false);
}}
>
{(formik) => (
<form onSubmit={formik.handleSubmit}>
<div
className="bg-[#FFF6F2] flex flex-col items-center
justify-center min-h-screen py-2 shadow-lg">
<div className="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
<input
name="csrfToken"
type="hidden"
defaultValue={csrfToken}
/>
<div className="text-red-400 text-md text-center rounded p-2">
{error}
</div>
<div className="mb-4">
<label
htmlFor="email"
className="uppercase text-sm text-gray-600 font-bold"
>
Email
<Field
name="email"
aria-label="enter your email"
aria-required="true"
type="text"
className="w-full focus:bg-gray-300 text-gray-900 mt-2 p-3 border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]"
/>
</label>
<div className="text-red-600 text-sm">
<ErrorMessage name="email" />
</div>
</div>
<div className="mb-6">
<label
htmlFor="password"
className="uppercase text-sm text-gray-600 font-bold "
>
password
<Field
name="password"
aria-label="enter your password"
aria-required="true"
type="password"
className="w-full bg-gray-300 text-gray-900 mt-2 p-3 border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]"
/>
</label>
<div className="text-red-600 text-sm">
<ErrorMessage name="password" />
</div>
</div>
<div className="flex items-center justify-center">
<button
type="submit"
className="bg-[#FE4501] text-white p-3 rounded-lg w-full"
>
{formik.isSubmitting ? 'Please wait...' : 'Sign In'}
</button>
</div>
</div>
</div>
</form>
)}
</Formik>
</>
);
}
// This is the recommended way for Next.js 9.3 or newer
export async function getServerSideProps(context) {
return {
props: {
csrfToken: await getCsrfToken(context),
},
};
}

22
src/pages/profile.jsx Normal file
View File

@ -0,0 +1,22 @@
import { signIn, signOut, useSession } from 'next-auth/react'
export default function Home() {
const { data: session } = useSession()
// console.log(session)
if (session) {
return (
<>
Signed in
<br />
<button onClick={() => signOut()}>Sign out</button>
</>
)
}
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
}

View File

@ -1,241 +1,161 @@
import NavBar from '../../components/NavBar' import {useId, useState, useEffect, useMemo} from 'react';
import {useRouter} from "next/router";
import { useId, useState, useEffect, useMemo } from 'react';
import Select from 'react-select'
import countryList from 'react-select-country-list'
import 'react-phone-number-input/style.css' import 'react-phone-number-input/style.css'
import PhoneInput from 'react-phone-number-input' import NavBar from '../../components/NavBar';
import { useRouter } from 'next/router'
import Link from 'next/link'
export default function addSchoolForm() {
const { query } = useRouter();
const [countryValue, setCountryValue] = useState('')
const options = useMemo(() => countryList().getData(), [])
const [phoneValue, setphoneValue] = useState()
const [allStates, setAllStates] = useState([])
const [allCities, setAllCities] = useState([])
const handleSelectAllStates = stateCode => { export default function SchoolSlug() {
setAllCities([]) const router = useRouter();
fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${countryValue.value}&state=${stateCode.value}`)
.then(res => res.json()) const [school, setSchool] = useState({});
.then(data => {
// console.log("handleSelectAllStates:", data, options) useEffect(()=>{
let newData = data && data.length > 0 && data.map(n => { if(router.query.school && router.query.school>0 ){
return { console.log(router.query);
label: n.name, fetch(`/api/getSchoolDetails?school=${router.query.school}`)
value: n.name .then(res => res.json())
} .then(data => {
console.log(data);
setSchool(data[0])
// console.log(school)
}) })
setAllCities(newData)
})
}
const selectCountry = countryValue => {
setAllStates([])
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=${countryValue.value}`)
.then(res => res.json())
.then(data => {
// console.log("countryValue:", data, options)
let newData = data && data.length > 0 && data.map(n => {
return {
label: n.name,
value: n.iso2
}
})
setAllStates(newData)
setAllCities([])
})
setCountryValue(countryValue)
}
// console.log(phoneValue)
// const selectCountry = countryValue => {
// setCountryValue(countryValue)
// }
const handleSubmit = async (event) => {
event.preventDefault()
const data = {
"status":"published",
name: event.target.schoolName.value,
country: event.target.country.value,
state: event.target.state.value,
cities: event.target.cities.value,
anual: event.target.anual.value,
toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value,
agreement_expiry_date: event.target.agreement_expiry_date.value,
school_agreement: event.target.school_agreement.value,
school_contact_number: event.target.school_contact_number.value,
school_email_id: event.target.school_email_id.value,
} }
const JSONdata = JSON.stringify(data)
// console.log(data)
const endpoint = 'https://management.beanstalkedu.com/items/school'
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSONdata,
}
const response = await fetch(endpoint, options)
const result = await response.json() }, [router.query.school]);
// alert(`Is this your full name: ${result.data}`)
alert(`School Saved`) const updateSchoolData = async (event) => {
event.preventDefault()
const data = {
schoolId: router.query.school,
sname: event.target.sname.value,
status: event.target.status.value,
country: event.target.country.value,
state: event.target.state.value,
city: event.target.city.value,
annual: event.target.annual.value,
toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value,
agg_expiry: event.target.agg_expiry.value,
usage_expiry: event.target.usage_expiry.value,
phone: event.target.phone.value,
email: event.target.email.value,
} }
const [school, setUser] = useState([]); const JSONdata = JSON.stringify(data)
const fetchData = async () => { console.log(data)
const response = await fetch("https://management.beanstalkedu.com/items/school?filter[status][_eq]=published&"); const endpoint = '/api/editSchool'
const data = await response.json(); const options = {
return setUser(data.data[0]); method: 'POST',
} headers: {
// console.log(school.name) 'Content-Type': 'application/json',
},
body: JSONdata,
}
const response = await fetch(endpoint, options)
useEffect(() => { const result = await response.json()
fetchData(); // alert(`Is this your full name: ${result.data}`)
},[]) alert(`User data updated`)
return ( }
<main>
<div> return (
<NavBar /> <main>
<div> <div>
<h1>Items page</h1> <NavBar/>
<p>{query.id}</p> <section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
<p>{query.name}</p> <div
</div> className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'> <div className='inline-flex p-4 '>
<div className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'> <Link href="/add-school-form" className="m-2 inline-flex place-items-center justify-center p-2 pl-4 pr-4 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<div className='flex flex-col justify-center place-items-center'> <img src="/img/4.svg" alt="" /> &nbsp;
<img src="/img/1.svg" alt="" /> List Users Under This School
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update School Information</p> </Link>
</div> <div className="place-items-center justify-center m-2 p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<form onSubmit={handleSubmit} className='w-full px-6 md:px-20'> <span className="text-small">CSV Upload &nbsp;</span>
<div className='flex flex-col w-full'> <input type="file" />
<label htmlFor="school" className='text-xl font-bold'>School Name</label> </div>
<input type="text" name="schoolName"value={school.name} placeholder='School Name' className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' /> {/* <img src="/img/2.svg" alt=""/> */}
</div>
<div className='flex flex-col w-full pt-4'> </div>
<label htmlFor="school_email_id" className='text-xl font-bold'> Email ID</label> <p className='text-2xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update School Information </p>
<input type="text" name="school_email_id" id="school_email_id" placeholder='School Email ID' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' /> <form onSubmit={updateSchoolData} action="" className='w-full px-6 md:px-20'>
</div> <div className='flex flex-col w-full pt-4'>
<div className='flex flex-col w-full'> <label htmlFor="sname" className='text-xl font-bold'>School Name</label>
<label htmlFor="country" className='text-xl font-bold'>Country</label> <input value={school.sname} onChange={e => setSchool(e.target.value)} type="text" name="sname" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
<Select </div>
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' <div className='flex flex-col w-full pt-4'>
name="country" instanceId={useId()} options={options} value={countryValue} <label htmlFor="status" className='text-xl font-bold'>Status</label>
onChange={selectCountry}/> <input value={school.status} onChange={e => setSchool(e.target.value)} type="text" name="status" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="phone" className='text-xl font-bold'>School contact Number</label>
<input value={school.phone} onChange={e => setSchool(e.target.value)} type="text" name="phone" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="email" className='text-xl font-bold'> School contact Email ID</label>
<input value={school.email} onChange={e => setSchool(e.target.value)} type="text" name="email" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<input value={school.country} onChange={e => setSchool(e.target.value)} type="text" name="country" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> </div>
{allStates && allStates.length > 0 &&
<div className='flex flex-col w-full'> <div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'>State</label> <label htmlFor="state" className='text-xl font-bold'>State</label>
<Select <input value={school.state} onChange={e => setSchool(e.target.value)} type="text" name="state" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' </div>
name="state" options={allStates} value={allStates[0].name} <div className='flex flex-col w-full'>
onChange={handleSelectAllStates}/> <label htmlFor="city" className='text-xl font-bold'>Cities</label>
</div>} <input value={school.city} onChange={e => setSchool(e.target.value)} type="text" name="city" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
{ </div>
allCities && allCities.length > 0 && <div className='flex flex-col w-full'>
<div className='flex flex-col w-full'> <label htmlFor="annual" className='text-xl font-bold'>Annual</label>
<label htmlFor="Cities" className='text-xl font-bold'>Cities</label> <input value={school.annual} onChange={e => setSchool(e.target.value)} type="text" name="annual" placeholder='' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
<Select </div>
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' <div className='flex flex-col w-full'>
name="cities" options={allCities} value={allCities[0].name} <label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
// onChange={() => {}} <input value={school.toddlers} onChange={e => setSchool(e.target.value)} type="text" name="toddlers" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
/> </div>
</div>} <div className='flex flex-col w-full'>
<div className='flex flex-col w-full'> <label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label>
<label htmlFor="phone" className='text-xl font-bold'> Phone</label> <input value={school.early_start_programme} onChange={e => setSchool(e.target.value)} type="text" name="early_start_programme" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
<PhoneInput className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' name="phone" placeholder="Enter phone number" value={phoneValue} onChange={setphoneValue}/> </div>
</div> <div className='flex flex-col w-full'>
<div className='flex flex-col w-full pt-4'> <label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label> <input value={school.interakto} onChange={e => setSchool(e.target.value)} type="text" name="interakto" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
<select name="anual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> </div>
<option value="0" >-NA-</option> <div className='flex flex-col w-full'>
<option value="January">January</option> <label htmlFor="usage_expiry" className='text-xl font-bold'> Usage Expiry Date: (YYYY-MM-DD)</label>
<option value="February">February</option> <input value={school.usage_expiry} onChange={e => setSchool(e.target.value)} type="text" name="usage_expiry" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
<option value="March">March</option> </div>
<option value="April">April</option>
<option value="May">May</option> <div className='flex flex-col w-full'>
<option value="June">June</option> <label htmlFor="agg_expiry" className='text-xl font-bold'> Agreement Expiry Date: (YYYY-MM-DD)</label>
<option value="July">July</option> <input value={school.agg_expiry} onChange={e => setSchool(e.target.value)} type="text" name="agg_expiry" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
<option value="August">August</option> </div>
<option value="September">September</option> <div className='flex justify-center pt-8'>
<option value="October">October</option> <button type="submit"
<option value="November">November</option> className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Update
<option value="December">December</option> </button>
</select> </div>
</div> </form>
<div className='flex flex-col w-full pt-4'> </div>
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
<select name="toddlers" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'> <div className='flex flex-col w-full'>
<option value="0" >-NA-</option> <label htmlFor="agreement_documents" className='text-xl font-bold'>Upload Agreement Document&apos;s</label>
<option value="January">January</option> <input onChange={e => setSchool(e.target.value)} type="file" name="agreement_documents" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
<option value="February">February</option> <div className='flex justify-end pt-2'>
<option value="March">March</option> <button className=' bg-[#FE4501] px-4 py-1.5 rounded-lg text-white'>Download Agreement</button>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label>
<select name="early_start_programme" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0" >-NA-</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<select name="interakto" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="na">-NA-</option>
<option value="January"> January</option>
<option value="February"> February</option>
<option value="March"> March</option>
<option value="April"> April</option>
<option value="May"> May</option>
<option value="June"> June</option>
<option value="July"> July</option>
<option value="August"> August</option>
<option value="September"> September</option>
<option value="November"> November</option>
<option value="December"> December</option>
</select>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="agreement_expiry_date" className='text-xl font-bold pt-4'>Agreement Expiry Date</label>
<input type="date" name="agreement_expiry_date" id="agreement_expiry_date" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
{/* <div className='flex flex-col w-full'>
<label htmlFor="school_agreement" className='text-xl font-bold pt-4'>Upload School Agreement</label>
<input type="file" name="school_agreement" id="school_agreement" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> */}
<div className='flex justify-center pt-8'>
{/* <a href="/school-list"><button type='submit' className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Submit Now</button></a> */}
<input type="submit" value="Update" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' />
</div>
</form>
</div>
</section>
</div> </div>
</main>
) </div>
}
</section>
</div>
</main>
)
}

View File

@ -1,67 +1,85 @@
// import SchoolEditForm from '../../components/SchoolEditForm' // import SchoolEditForm from '../../components/SchoolEditForm'
import { signIn, signOut, useSession } from 'next-auth/react'
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import Image from 'next/image' import Image from 'next/image'
import { Inter } from 'next/font/google' import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] }) const inter = Inter({ subsets: ['latin'] })
import NavBar from '../../components/NavBar' import NavBar from '../../components/NavBar'
export default function Modal() { export default function Modal() {
const [school, setUser] = useState([]); const [school, setSchool] = useState([]);
const { data: session} = useSession()
const fetchData = async () => { const fetchData = async () => {
const response = await fetch("https://management.beanstalkedu.com/items/school?filter[status][_eq]=published"); const response = await fetch("/api/listSchlools");
const data = await response.json(); const data = await response.json();
return setUser(data.data); return setSchool(data);
} }
console.log(school) console.log(school)
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
},[]) },[])
if (session) {
return (
<main>
<div>
<NavBar />
<section className='container mx-auto px-4 mt-16'>
<div className="flex flex-row justify-end bg-[#FFF6F2] p-2 gap-x-4 border-x-2 border-t-2 rounded-t-xl">
<div className="flex flex-row justify-center place-items-center">
<input type="text" className="md:w-32 md:focus:w-96 duration-[1s] border-2 border-[#FE4501] w-full rounded-l-full p-2 focus:outline-none focus:border-[#F2B705] bg-[#FFF6F2] focus:bg-white text-center" placeholder="Search School" />
<a href="" className="bg-[#FE4501] rounded-r-full p-2 px-4 border-2 border-[#FE4501] text-white font-bold ">
<svg width="24px" height="24px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill="#ffffff" fill-rule="evenodd" d="M4 9a5 5 0 1110 0A5 5 0 014 9zm5-7a7 7 0 104.2 12.6.999.999 0 00.093.107l3 3a1 1 0 001.414-1.414l-3-3a.999.999 0 00-.107-.093A7 7 0 009 2z"></path> </g></svg>
</a>
</div>
{/* <a href="/add-school-form" className="inline-flex place-items-center justify-center p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<svg width="20px" height="20px" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7.5 4.5L11.5 6.5V14.5H3.5V6.5L7.5 4.5ZM7.5 4.5V0M0 14.5H15M1.5 14.5V8.5H3.5M13.5 14.5V8.5H11.5M6.5 14.5V11.5H8.5V14.5M7.5 0.5H10.5V2.5H7.5M7.5 9.5C6.94772 9.5 6.5 9.05228 6.5 8.5C6.5 7.94772 6.94772 7.5 7.5 7.5C8.05228 7.5 8.5 7.94772 8.5 8.5C8.5 9.05228 8.05228 9.5 7.5 9.5Z" stroke="#ffffff"></path> </g></svg>&nbsp;
Add School
</a> */}
</div>
<div className='flex xl:justify-center overflow-x-scroll pb-4 w-full'>
<table className=" text-center border-x-2 border-b-2 p-2 w-full">
<thead className=''>
<tr className='bg-[#FFF6F2] text-[#1D1D1D] text-xl whitespace-nowrap'>
<th className=" p-2">ID</th>
<th className=" p-2"> Name</th>
<th className=" p-2">City</th>
<th className=" p-2">Status</th>
<th className=" p-2">Expiry</th>
<th className=" p-2 inline-flex"> <img src="/img/3.svg" alt="" />Edit</th>
</tr>
</thead>
<tbody>
{school.map(data=>
<tr key={data.id} className="border-b-2 whitespace-normal">
<td className=" p-2">{data.id}</td>
<td className=" p-2">{data.sname}</td>
<td className="p-2">{data.city}</td>
<td className="p-2">{data.status}</td>
<td className="p-2">{data.usage_expiry}</td>
<td className="p-2">
<a href={'/edit-school?school='+data.id} className="flex justify-center place-items-center">
<svg width="35px" height="35px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#166435"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path opacity="0.15" d="M8 16H12L18 10L14 6L8 12V16Z" fill="#166435"></path> <path d="M14 6L8 12V16H12L18 10M14 6L17 3L21 7L18 10M14 6L18 10M10 4L4 4L4 20L20 20V14" stroke="#166435" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg></a>
</td>
</tr>
)}
</tbody>
{/* <SchoolEditForm /> */}
</table>
</div>
</section>
</div>
</main>
)
}
{/* <LogOutPage /> */}
return ( return (
<main>
<div> <>
<NavBar /> Not signed in <br />
<section className='container mx-auto px-4 mt-16'> <button onClick={() => signIn()}>Sign in</button>
<div className="flex justify-end bg-[#FFF6F2] p-2 border-x-2 border-t-2 rounded-t-xl "> </>
<a href="/add-school-form" className=" inline-flex place-items-center p-2">
<img src="/img/3.svg" alt="" />Add School</a>
</div>
<div className='flex xl:justify-center overflow-x-scroll pb-4 w-full'>
<table className=" text-center border-x-2 border-b-2 p-2 w-full">
<thead className=''>
<tr className='bg-[#FFF6F2] text-[#1D1D1D] text-xl whitespace-nowrap'>
<th className=" p-2">ID</th>
<th className=" p-2">School Name</th>
<th className=" p-2">Country</th>
<th className=" p-2">Anual</th>
<th className=" p-2">Early Start Program</th>
<th className=" p-2">Toddlers</th>
<th className=" p-2">Interakto</th>
<th className=" p-2">Status</th>
<th className=" p-2 inline-flex"> <img src="/img/3.svg" alt="" />Edit</th>
</tr>
</thead>
<tbody>
{school.map(data=>
<tr className="border-b-2 whitespace-normal">
<td className=" p-2">{data.id}</td>
<td className=" p-2">{data.name}</td>
<td className="p-2">{data.country}</td>
<td className="p-2">{data.anual}</td>
<td className="p-2">{data.early_start_programme}</td>
<td className="p-2">{data.toddlers}</td>
<td className="p-2">{data.interakto}</td>
<td className="p-2">{data.status}</td>
<td className="p-2"><a href={'/edit-school?school='+data.id}>Edit</a> </td>
</tr>
)}
</tbody>
{/* <SchoolEditForm /> */}
</table>
</div>
</section>
</div>
</main>
) )
} }

View File

@ -0,0 +1,84 @@
// import SchoolEditForm from '../../components/SchoolEditForm'
import React, { useEffect, useState } from "react";
import Image from 'next/image'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
import NavBar from '../../components/NavBar'
export default function Modal() {
const [school, setUser] = useState([]);
const fetchData = async () => {
const response = await fetch("https://management.beanstalkedu.com/items/school?filter[status][_eq]=published");
const data = await response.json();
return setUser(data.data);
}
console.log(school)
useEffect(() => {
fetchData();
},[])
return (
<main>
<div>
<NavBar />
<section className='container mx-auto px-4 mt-16'>
<div className="flex flex-row justify-end bg-[#FFF6F2] p-2 gap-x-4 border-x-2 border-t-2 rounded-t-xl">
<div className="flex flex-row justify-center place-items-center">
<input type="text" className="md:w-32 md:focus:w-96 duration-[1s] border-2 border-[#FE4501] w-full rounded-l-full p-2 focus:outline-none focus:border-[#F2B705] bg-[#FFF6F2] focus:bg-white text-center" placeholder="Search School" />
<a href="" className="bg-[#FE4501] rounded-r-full p-2 px-4 border-2 border-[#FE4501] text-white font-bold ">
<svg width="24px" height="24px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill="#ffffff" fill-rule="evenodd" d="M4 9a5 5 0 1110 0A5 5 0 014 9zm5-7a7 7 0 104.2 12.6.999.999 0 00.093.107l3 3a1 1 0 001.414-1.414l-3-3a.999.999 0 00-.107-.093A7 7 0 009 2z"></path> </g></svg>
</a>
</div>
{/* <a href="/add-school-form" className="inline-flex place-items-center justify-center p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<svg width="20px" height="20px" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7.5 4.5L11.5 6.5V14.5H3.5V6.5L7.5 4.5ZM7.5 4.5V0M0 14.5H15M1.5 14.5V8.5H3.5M13.5 14.5V8.5H11.5M6.5 14.5V11.5H8.5V14.5M7.5 0.5H10.5V2.5H7.5M7.5 9.5C6.94772 9.5 6.5 9.05228 6.5 8.5C6.5 7.94772 6.94772 7.5 7.5 7.5C8.05228 7.5 8.5 7.94772 8.5 8.5C8.5 9.05228 8.05228 9.5 7.5 9.5Z" stroke="#ffffff"></path> </g></svg>&nbsp;
Add School
</a> */}
<a href="/add-school-form" className="inline-flex place-items-center justify-center p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<svg width="20px" height="20px" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7.5 4.5L11.5 6.5V14.5H3.5V6.5L7.5 4.5ZM7.5 4.5V0M0 14.5H15M1.5 14.5V8.5H3.5M13.5 14.5V8.5H11.5M6.5 14.5V11.5H8.5V14.5M7.5 0.5H10.5V2.5H7.5M7.5 9.5C6.94772 9.5 6.5 9.05228 6.5 8.5C6.5 7.94772 6.94772 7.5 7.5 7.5C8.05228 7.5 8.5 7.94772 8.5 8.5C8.5 9.05228 8.05228 9.5 7.5 9.5Z" stroke="#ffffff"></path> </g></svg>&nbsp;
List Users Under This School
</a>
<div className="inline-flex place-items-center justify-center p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<span className="text-small">CSV Upload</span>
<input type="file" />
</div>
</div>
<div className='flex xl:justify-center overflow-x-scroll pb-4 w-full'>
<table className=" text-center border-x-2 border-b-2 p-2 w-full">
<thead className=''>
<tr className='bg-[#FFF6F2] text-[#1D1D1D] text-xl whitespace-nowrap'>
<th className=" p-2">ID</th>
<th className=" p-2">School Name</th>
<th className=" p-2">City</th>
<th className=" p-2">Annual</th>
<th className=" p-2">Interakto</th>
<th className=" p-2">Status</th>
<th className=" p-2 inline-flex"> <img src="/img/3.svg" alt="" />Edit</th>
</tr>
</thead>
<tbody>
{school.map(data=>
<tr className="border-b-2 whitespace-normal">
<td className=" p-2">{data.id}</td>
<td className=" p-2">{data.name}</td>
<td className="p-2">{data.city}</td>
<td className="p-2">{data.anual}</td>
<td className="p-2">{data.agreement_expiry_date}</td>
<td className="p-2">{data.early_start_programme}</td>
<td className="p-2">{data.toddlers}</td>
<td className="p-2">{data.interakto}</td>
<td className="p-2">{data.status}</td>
<td className="p-2"><a href={'/edit-school?school='+data.id} className="flex justify-center place-items-center">
<svg width="35px" height="35px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#166435"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path opacity="0.15" d="M8 16H12L18 10L14 6L8 12V16Z" fill="#166435"></path> <path d="M14 6L8 12V16H12L18 10M14 6L17 3L21 7L18 10M14 6L18 10M10 4L4 4L4 20L20 20V14" stroke="#166435" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg></a> </td>
</tr>
)}
</tbody>
{/* <SchoolEditForm /> */}
</table>
</div>
</section>
</div>
</main>
)
}

View File

@ -0,0 +1,96 @@
// import SchoolEditForm from '../../components/SchoolEditForm'
import { signIn, signOut, useSession } from 'next-auth/react'
import React, { useEffect, useState } from "react";
import Image from 'next/image'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
import NavBar from '../../components/NavBar'
export default function Modal() {
const [school, setSchool] = useState([]);
const { data: session} = useSession()
const fetchData = async () => {
const response = await fetch("/api/listSchlools-test");
const data = await response.json();
return setSchool(data);
}
console.log(school)
useEffect(() => {
fetchData();
},[])
if (session) {
return (
<main>
<div>
<NavBar />
<section className='container mx-auto px-4 mt-16'>
<div className="flex flex-row justify-end bg-[#FFF6F2] p-2 gap-x-4 border-x-2 border-t-2 rounded-t-xl">
<div className="flex flex-row justify-center place-items-center">
<input type="text" className="md:w-32 md:focus:w-96 duration-[1s] border-2 border-[#FE4501] w-full rounded-l-full p-2 focus:outline-none focus:border-[#F2B705] bg-[#FFF6F2] focus:bg-white text-center" placeholder="Search School" />
<a href="" className="bg-[#FE4501] rounded-r-full p-2 px-4 border-2 border-[#FE4501] text-white font-bold">
<svg width="24px" height="24px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill="#ffffff" fill-rule="evenodd" d="M4 9a5 5 0 1110 0A5 5 0 014 9zm5-7a7 7 0 104.2 12.6.999.999 0 00.093.107l3 3a1 1 0 001.414-1.414l-3-3a.999.999 0 00-.107-.093A7 7 0 009 2z"></path> </g></svg>
</a>
</div>
{/* <a href="/add-school-form" className="inline-flex place-items-center justify-center p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<svg width="20px" height="20px" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7.5 4.5L11.5 6.5V14.5H3.5V6.5L7.5 4.5ZM7.5 4.5V0M0 14.5H15M1.5 14.5V8.5H3.5M13.5 14.5V8.5H11.5M6.5 14.5V11.5H8.5V14.5M7.5 0.5H10.5V2.5H7.5M7.5 9.5C6.94772 9.5 6.5 9.05228 6.5 8.5C6.5 7.94772 6.94772 7.5 7.5 7.5C8.05228 7.5 8.5 7.94772 8.5 8.5C8.5 9.05228 8.05228 9.5 7.5 9.5Z" stroke="#ffffff"></path> </g></svg>&nbsp;
Add School
</a> */}
</div>
<div className='flex xl:justify-center overflow-x-scroll pb-4 w-full'>
<table className=" text-center border-x-2 border-b-2 p-2 w-full">
<thead className=''>
<tr className='bg-[#FFF6F2] text-[#1D1D1D] text-xl whitespace-nowrap'>
<th className="p-2">Name</th>
<th className="p-2">Email</th>
<th className="p-2">Location</th>
<th className="p-2">Status</th>
<th className="p-2">Expiry</th>
<th className="p-2">Toddlers</th>
<th className="p-2">Interakto</th>
<th className="p-2">Address</th>
<th className="p-2">Pin</th>
<th className="p-2">Anual</th>
<th className="p-2 inline-flex">
<img src="/img/3.svg" alt="" />Edit
</th>
</tr>
</thead>
<tbody>
{school.map(data=>
<tr key={data.id} className="border-b-2 whitespace-normal">
<td className=" p-2">{data.sname}</td>
<td className=" p-2">{data.email}</td>
<td className=" p-2">{data.city}</td>
{/* <td className="p-2">{data.city}</td> */}
<td className="p-2">{data.status}</td>
<td className="p-2">{data.usage_expiry}</td>
<td className="p-2">{data.toddlers}</td>
<td className="p-2">{data.interakto}</td>
<td className="p-2">{data.address}</td>
<td className="p-2">{data.pin}</td>
<td className="p-2">{data.annual}</td>
<td className="p-2">
<a href={'/edit-school?school='+data.id} className="flex justify-center place-items-center">
<svg width="35px" height="35px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#166435"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path opacity="0.15" d="M8 16H12L18 10L14 6L8 12V16Z" fill="#166435"></path> <path d="M14 6L8 12V16H12L18 10M14 6L17 3L21 7L18 10M14 6L18 10M10 4L4 4L4 20L20 20V14" stroke="#166435" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
</a>
</td>
</tr>
)}
</tbody>
{/* <SchoolEditForm /> */}
</table>
</div>
</section>
</div>
</main>
)
}
{/* <LogOutPage /> */}
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
}

View File

@ -1,241 +0,0 @@
import NavBar from '../../components/NavBar'
import {useRouter} from "next/router";
import { useId, useState, useEffect, useMemo } from 'react';
import Select from 'react-select'
import countryList from 'react-select-country-list'
import 'react-phone-number-input/style.css'
import PhoneInput from 'react-phone-number-input'
export default function addSchoolForm() {
const { query } = useRouter();
const [countryValue, setCountryValue] = useState('')
const options = useMemo(() => countryList().getData(), [])
const [phoneValue, setphoneValue] = useState()
const [allStates, setAllStates] = useState([])
const [allCities, setAllCities] = useState([])
const handleSelectAllStates = stateCode => {
setAllCities([])
fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${countryValue.value}&state=${stateCode.value}`)
.then(res => res.json())
.then(data => {
// console.log("handleSelectAllStates:", data, options)
let newData = data && data.length > 0 && data.map(n => {
return {
label: n.name,
value: n.name
}
})
setAllCities(newData)
})
}
const selectCountry = countryValue => {
setAllStates([])
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=${countryValue.value}`)
.then(res => res.json())
.then(data => {
// console.log("countryValue:", data, options)
let newData = data && data.length > 0 && data.map(n => {
return {
label: n.name,
value: n.iso2
}
})
setAllStates(newData)
setAllCities([])
})
setCountryValue(countryValue)
}
// console.log(phoneValue)
// const selectCountry = countryValue => {
// setCountryValue(countryValue)
// }
const handleSubmit = async (event) => {
event.preventDefault()
const data = {
"status":"published",
name: event.target.schoolName.value,
country: event.target.country.value,
state: event.target.state.value,
cities: event.target.cities.value,
anual: event.target.anual.value,
toddlers: event.target.toddlers.value,
early_start_programme: event.target.early_start_programme.value,
interakto: event.target.interakto.value,
agreement_expiry_date: event.target.agreement_expiry_date.value,
school_agreement: event.target.school_agreement.value,
school_contact_number: event.target.school_contact_number.value,
school_email_id: event.target.school_email_id.value,
}
const JSONdata = JSON.stringify(data)
// console.log(data)
const endpoint = 'https://management.beanstalkedu.com/items/school'
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSONdata,
}
const response = await fetch(endpoint, options)
const result = await response.json()
// alert(`Is this your full name: ${result.data}`)
alert(`School Saved`)
}
const [school, setUser] = useState([]);
const fetchData = async () => {
const response = await fetch("https://management.beanstalkedu.com/items/school?filter[status][_eq]=published");
const data = await response.json();
return setUser(data.data[0]);
}
// console.log(school.name)
useEffect(() => {
fetchData();
},[])
return (
<main>
<div>
<NavBar />
<div>
<h1>Items page</h1>
<p>{query.id}</p>
<p>{query.name}</p>
</div>
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
<div className='flex flex-col justify-center place-items-center bg-[#FFF6F2] pt-6 pb-20 rounded-tl-[50px] rounded-br-[50px]'>
<div className='flex flex-col justify-center place-items-center'>
<img src="/img/1.svg" alt="" />
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update School Information</p>
</div>
<form onSubmit={handleSubmit} className='w-full px-6 md:px-20'>
<div className='flex flex-col w-full'>
<label htmlFor="school" className='text-xl font-bold'>School Name</label>
<input type="text" name="schoolName"value={school.name} placeholder='School Name' className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="school_email_id" className='text-xl font-bold'> Email ID</label>
<input type="text" name="school_email_id" id="school_email_id" placeholder='School Email ID' className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
<div className='flex flex-col w-full'>
<label htmlFor="country" className='text-xl font-bold'>Country</label>
<Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="country" instanceId={useId()} options={options} value={countryValue}
onChange={selectCountry}/>
</div>
{allStates && allStates.length > 0 &&
<div className='flex flex-col w-full'>
<label htmlFor="state" className='text-xl font-bold'>State</label>
<Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="state" options={allStates} value={allStates[0].name}
onChange={handleSelectAllStates}/>
</div>}
{
allCities && allCities.length > 0 &&
<div className='flex flex-col w-full'>
<label htmlFor="Cities" className='text-xl font-bold'>Cities</label>
<Select
className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'
name="cities" options={allCities} value={allCities[0].name}
// onChange={() => {}}
/>
</div>}
<div className='flex flex-col w-full'>
<label htmlFor="phone" className='text-xl font-bold'> Phone</label>
<PhoneInput className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' name="phone" placeholder="Enter phone number" value={phoneValue} onChange={setphoneValue}/>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="anual" className='text-xl font-bold'>Anual</label>
<select name="anual" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0" >-NA-</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
<select name="toddlers" className=' bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0" >-NA-</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label>
<select name="early_start_programme" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="0" >-NA-</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
<div className='flex flex-col w-full pt-4'>
<label htmlFor="interakto" className='text-xl font-bold'>Interakto</label>
<select name="interakto" className='bg-white border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'>
<option value="na">-NA-</option>
<option value="January"> January</option>
<option value="February"> February</option>
<option value="March"> March</option>
<option value="April"> April</option>
<option value="May"> May</option>
<option value="June"> June</option>
<option value="July"> July</option>
<option value="August"> August</option>
<option value="September"> September</option>
<option value="November"> November</option>
<option value="December"> December</option>
</select>
</div>
<div className='flex flex-col w-full'>
<label htmlFor="agreement_expiry_date" className='text-xl font-bold pt-4'>Agreement Expiry Date</label>
<input type="date" name="agreement_expiry_date" id="agreement_expiry_date" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div>
{/* <div className='flex flex-col w-full'>
<label htmlFor="school_agreement" className='text-xl font-bold pt-4'>Upload School Agreement</label>
<input type="file" name="school_agreement" id="school_agreement" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
</div> */}
<div className='flex justify-center pt-8'>
{/* <a href="/school-list"><button type='submit' className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer'>Submit Now</button></a> */}
<input type="submit" value="Update" className='bg-[#FE4501] hover:shadow-2xl hover:shadow-[#F2B705] p-2.5 rounded-lg px-10 rounded-tl-full rounded-br-full hover:scale-110 active:scale-75 duration-200 text-xl font-bold text-white cursor-pointer' />
</div>
</form>
</div>
</section>
</div>
</main>
)
}

38
src/pages/upload-user.jsx Normal file
View File

@ -0,0 +1,38 @@
import {useId, useState, useEffect, useMemo} from 'react';
import NavBar from '../components/NavBar';
import { useRouter } from 'next/router'
export default function EditSchool() {
const router = useRouter();
const uploadCsv = async (event) => {
// alert('p')
const body = new FormData();
body.append("file", csv.files[0]);
// console.log('body')
// body.append("fName", `${router.query.school}.pdf`);
const response = await fetch("/api/addUsersBulk", {
method: "POST",
body
});
};
return (
<main>
<div>
<NavBar/>
<section className='container mx-auto px-4 my-16 lg:px-28 xl:px-56 2xl:px-96'>
<div className="place-items-center justify-center m-2 p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<span className="text-small">CSV &nbsp;</span>
<input type="file" id="csv" onChange={uploadCsv} name="csv" />
</div>
</section>
</div>
</main>
)
}

View File

@ -0,0 +1,90 @@
import React, { useEffect, useState } from "react";
import Link from 'next/link'
import NavBar from '../components/NavBar'
export default function Modal() {
const [user, setUser] = useState([]);
const fetchData = async () => {
const response = await fetch("/api/listUsers");
const data = await response.json();
// console.log(data)
return setUser(data);
}
// console.log(user)
useEffect(() => {
fetchData();
},[])
return (
<main>
<div>
<NavBar />
<section className='container mx-auto px-4 mt-16'>
<div className="flex flex-row justify-end bg-[#FFF6F2] p-2 gap-x-4 border-x-2 border-t-2 rounded-t-xl">
<div className="flex flex-row justify-center place-items-center">
<input type="text" className="md:w-32 md:focus:w-96 duration-[1s] border-2 border-[#FE4501] w-full rounded-l-full p-2 focus:outline-none focus:border-[#F2B705] bg-[#FFF6F2] focus:bg-white text-center" placeholder="Search User" />
<Link href="" className="bg-[#FE4501] rounded-r-full p-2 px-4 border-2 border-[#FE4501] text-white font-bold ">
<svg className="hover:scale-110 active:scale-75 duration-300" width="24px" height="24px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill="#ffffff" fill-rule="evenodd" d="M4 9a5 5 0 1110 0A5 5 0 014 9zm5-7a7 7 0 104.2 12.6.999.999 0 00.093.107l3 3a1 1 0 001.414-1.414l-3-3a.999.999 0 00-.107-.093A7 7 0 009 2z"></path> </g></svg>
</Link>
</div>
<Link href="/add-user-form" className="inline-flex place-items-center p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
<svg className="font-bold" width="25px" height="25px" viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg" fill="#ffffff" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="2"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g fill="none" fill-rule="evenodd" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" transform="translate(3 2)"> <path d="m7.5.5c1.65685425 0 3 1.34314575 3 3v2c0 1.65685425-1.34314575 3-3 3s-3-1.34314575-3-3v-2c0-1.65685425 1.34314575-3 3-3z"></path> <path d="m14.5 2.5v4"></path> <path d="m16.5 4.5h-4"></path> <path d="m14.5 14.5v-.7281753c0-3.1864098-3.6862915-5.2718247-7-5.2718247s-7 2.0854149-7 5.2718247v.7281753c0 .5522847.44771525 1 1 1h12c.5522847 0 1-.4477153 1-1z"></path> </g> </g></svg>
Add User
</Link>
</div>
<div className='flex overflow-x-scroll xl:justify-center'>
<table className=" text-center border-2 p-2 w-full">
<thead className=''>
<tr className='bg-[#FFF6F2] text-[#1D1D1D] text-xl whitespace-nowrap'>
<th className="border-x-2 p-4">Name</th>
<th className="border-x-2 p-4">Mobile</th>
<th className="border-x-2 p-4">Email</th>
<th className="border-x-2 p-4">School Name</th>
<th className="border-x-2 p-4">User Type</th>
<th className="border-x-2 p-4">Start Date</th>
<th className="border-x-2 p-4">End Date</th>
<th className="border-x-2 p-4">Action</th>
</tr>
</thead>
<tbody>
{user.map
(data=>
<tr key={data.id} className="border-b-2 whitespace-normal text-left">
<td className="border-x-2 p-2 text-center">{data.uname}</td>
<td className="border-x-2 p-2 text-center">{data.phone}</td>
<td className="border-x-2 p-2 text-center">{data.email}</td>
<td className="border-x-2 p-2 text-center">{data.school}</td>
<td className="border-x-2 p-2 text-center">{data.type}</td>
<td className="border-x-2 p-2 text-center">{data.start_date}</td>
<td className="border-x-2 p-2 text-center">{data.end_date}</td>
<td>
<div className="flex flex-row justify-center place-items-center">
<div className="flex justify-center">
<a href={'/edit-user/?user='+data.id} className="px-2 py-1 rounded-md">
<svg width="35px" height="35px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#166435"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path opacity="0.15" d="M8 16H12L18 10L14 6L8 12V16Z" fill="#166435"></path> <path d="M14 6L8 12V16H12L18 10M14 6L17 3L21 7L18 10M14 6L18 10M10 4L4 4L4 20L20 20V14" stroke="#166435" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
{/* <p className="text-[16px] text-green-800">Edit</p> */}
</a>
</div>
<div className="flex justify-center">
<button className=" text-white px-2 py-1 rounded-md">
<svg width="35px" height="35px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#991b1b"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M10 12V17" stroke="#991b1b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M14 12V17" stroke="#991b1b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M4 7H20" stroke="#991b1b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M6 10V18C6 19.6569 7.34315 21 9 21H15C16.6569 21 18 19.6569 18 18V10" stroke="#991b1b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M9 5C9 3.89543 9.89543 3 11 3H13C14.1046 3 15 3.89543 15 5V7H9V5Z" stroke="#991b1b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
{/* <p className="text-[16px] text-red-800">Delete</p> */}
</button>
</div>
</div>
</td>
</tr>
)
}
</tbody>
</table>
</div>
</section>
</div>
</main>
)
}

View File

@ -1,69 +1,118 @@
import { signIn, signOut, useSession } from 'next-auth/react'
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import Image from 'next/image' import { useRouter } from 'next/router'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] }) import Link from 'next/link'
import NavBar from '../components/NavBar' import NavBar from '../components/NavBar'
export default function Modal() { export default function UserList() {
const [user, setUser] = useState([]); const router = useRouter();
const fetchData = async () => { const { data: session } = useSession()
const response = await fetch("/api/listUsers"); const [user, setUser] = useState([]);
const [maxPageNumber, setMaxPageNumber] = useState([]);
const fetchData = async (page) => {
const response = await fetch("/api/listUsers?page="+page+"&limit=10");
const data = await response.json(); const data = await response.json();
console.log(data) setMaxPageNumber(data.maxPageNumber);
return setUser(data); return setUser(data.data);
} };
// console.log(user) // console.log(user)
useEffect(()=>{ if(!router.isReady) return; fetchData(4); }, [router.isReady]);
useEffect(() => { // useEffect(() => {
fetchData(); // fetchData();
},[]) // },[])
if(session) {
return ( return (
<main> <main>
<div> <div>
<NavBar /> <NavBar />
<section className='container mx-auto px-4 mt-16'> <section className='container mx-auto px-4 mt-16'>
<div className="flex justify-end bg-[#FFF6F2] p-2 border-x-2 border-t-2 rounded-t-xl"> <div className="flex flex-row justify-end bg-[#FFF6F2] p-2 gap-x-4 border-x-2 border-t-2 rounded-t-xl">
<a href="/add-user-form" className=" inline-flex place-items-center p-2"> <nav aria-label="Page navigation example">
<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M21.1213 2.70705C19.9497 1.53548 18.0503 1.53547 16.8787 2.70705L15.1989 4.38685L7.29289 12.2928C7.16473 12.421 7.07382 12.5816 7.02986 12.7574L6.02986 16.7574C5.94466 17.0982 6.04451 17.4587 6.29289 17.707C6.54127 17.9554 6.90176 18.0553 7.24254 17.9701L11.2425 16.9701C11.4184 16.9261 11.5789 16.8352 11.7071 16.707L19.5556 8.85857L21.2929 7.12126C22.4645 5.94969 22.4645 4.05019 21.2929 2.87862L21.1213 2.70705ZM18.2929 4.12126C18.6834 3.73074 19.3166 3.73074 19.7071 4.12126L19.8787 4.29283C20.2692 4.68336 20.2692 5.31653 19.8787 5.70705L18.8622 6.72357L17.3068 5.10738L18.2929 4.12126ZM15.8923 6.52185L17.4477 8.13804L10.4888 15.097L8.37437 15.6256L8.90296 13.5112L15.8923 6.52185ZM4 7.99994C4 7.44766 4.44772 6.99994 5 6.99994H10C10.5523 6.99994 11 6.55223 11 5.99994C11 5.44766 10.5523 4.99994 10 4.99994H5C3.34315 4.99994 2 6.34309 2 7.99994V18.9999C2 20.6568 3.34315 21.9999 5 21.9999H16C17.6569 21.9999 19 20.6568 19 18.9999V13.9999C19 13.4477 18.5523 12.9999 18 12.9999C17.4477 12.9999 17 13.4477 17 13.9999V18.9999C17 19.5522 16.5523 19.9999 16 19.9999H5C4.44772 19.9999 4 19.5522 4 18.9999V7.99994Z" fill="#1d1d1d"></path> </g></svg> <ul className="inline-flex items-center -space-x-px">
Add User {/* <li>
</a> <a href="#" className="block px-3 py-2 ml-0 leading-tight text-gray-500 bg-white border border-gray-300 rounded-l-lg hover:bg-gray-100 hover:text-gray-700 ">
</div> <span className="sr-only">Previous</span>
<div className='flex overflow-x-scroll xl:justify-center'> &lt;
</a>
</li> */}
{maxPageNumber.map((number) => (
<button key={number} onClick={() => fetchData(number)} className="px-3 py-2 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 ">{number} </button>
))}
{/* <li>
<a href="?page=6" className="block px-3 py-2 leading-tight text-gray-500 bg-white border border-gray-300 rounded-r-lg hover:bg-gray-100 hover:text-gray-700 ">
<span className="sr-only">Next</span>
&gt;
</a>
</li> */}
</ul>
</nav>
<div className="flex flex-row justify-center place-items-center">
<input type="text" className="md:w-32 md:focus:w-96 duration-[1s] border-2 border-[#FE4501] w-full rounded-l-full p-2 focus:outline-none focus:border-[#F2B705] bg-[#FFF6F2] focus:bg-white text-center" placeholder="Search User" />
<a href="" className="bg-[#FE4501] rounded-r-full p-2 px-4 border-2 border-[#FE4501] text-white font-bold ">
&#128269;
</a>
</div>
<Link href="/add-user-form" className="inline-flex place-items-center p-2 bg-[#FE4501] text-white font-bold rounded-full whitespace-nowrap">
&#9960;
Add User
</Link>
</div>
<div className='flex overflow-x-scroll xl:justify-center'>
<table className=" text-center border-2 p-2 w-full"> <table className=" text-center border-2 p-2 w-full">
<thead className=''> <thead className=''>
<tr className='bg-[#FFF6F2] text-[#1D1D1D] text-xl whitespace-nowrap'> <tr className='bg-[#FFF6F2] text-[#1D1D1D] text-xl whitespace-nowrap'>
<th className="border-x-2 p-4">user Name</th> <th className="border-x-2 p-4">ID</th>
<th className="border-x-2 p-4">School Name</th> <th className="border-x-2 p-4">School Name</th>
<th className="border-x-2 p-4">Mobile</th>
<th className="border-x-2 p-4">Email</th>
<th className="border-x-2 p-4">School ID</th>
<th className="border-x-2 p-4">User Type</th> <th className="border-x-2 p-4">User Type</th>
<th className="border-x-2 p-4">Plan</th>
<th className="border-x-2 p-4">Class</th>
<th className="border-x-2 p-4">Language</th>
{/* <th className="border-x-2 p-4">Year</th> */}
<th className="border-x-2 p-4">Start Date</th>
<th className="border-x-2 p-4">End Date</th> <th className="border-x-2 p-4">End Date</th>
<th className="border-x-2 p-4">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{user.map(data=> {user.map
<tr className="border-b-2 whitespace-normal text-left"> (data=>
<td className="border-x-2 p-2">{data.user}</td> <tr key={data.id} className="border-b-2 whitespace-normal text-left">
<td className="border-x-2 p-2">{data.school}</td> <td className="border-x-2 p-2 text-center">{data.id}</td>
<td className="border-x-2 p-2 text-center">{data.type}</td> <td className="border-x-2 p-2 text-center">{data.uname}</td>
<td className="border-x-2 p-2 text-center">{data.plan}</td> <td className="border-x-2 p-2 text-center">{data.phone}</td>
<td className="border-x-2 p-2 text-center">{data.class}</td> <td className="border-x-2 p-2 text-center">{data.email}</td>
<td className="border-x-2 p-2 text-center">{data.lang}</td> <td className="border-x-2 p-2 text-center">{data.school}</td>
{/* <td className="border-x-2 p-2">{data.year}</td> */} <td className="border-x-2 p-2 text-center">{data.type}</td>
<td className="border-x-2 p-2 text-center">{data.start_date}</td> <td className="border-x-2 p-2 text-center">{data.end_date}</td>
<td className="border-x-2 p-2 text-center">{data.end_date}</td> <td>
</tr> <div className="flex flex-row justify-center place-items-center">
)} <div className="flex justify-center">
</tbody> <a href={'/edit-user/?user='+data.id} className="px-2 py-1 rounded-md">
</table> &#9998;
</div> </a>
</div>
</div>
</td>
</tr>
)
}
</tbody>
</table>
</div>
</section> </section>
</div> </div>
</main> </main>
) )
}
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
} }

220
yarn.lock
View File

@ -40,7 +40,7 @@
chalk "^2.0.0" chalk "^2.0.0"
js-tokens "^4.0.0" js-tokens "^4.0.0"
"@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7": "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.13", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7":
version "7.21.5" version "7.21.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.5.tgz#8492dddda9644ae3bda3b45eabe87382caee7200" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.5.tgz#8492dddda9644ae3bda3b45eabe87382caee7200"
integrity sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q== integrity sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==
@ -365,6 +365,11 @@
mkdirp "^1.0.4" mkdirp "^1.0.4"
rimraf "^3.0.2" rimraf "^3.0.2"
"@panva/hkdf@^1.0.2":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@panva/hkdf/-/hkdf-1.1.1.tgz#ab9cd8755d1976e72fc77a00f7655a64efe6cd5d"
integrity sha512-dhPeilub1NuIG0X5Kvhh9lH4iW3ZsHlnzwgwbOlgwQ2wG1IqFzsgHqmKPk3WzsdWAeaxKJxgM0+W433RmN45GA==
"@phc/format@^1.0.0": "@phc/format@^1.0.0":
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/@phc/format/-/format-1.0.0.tgz#b5627003b3216dc4362125b13f48a4daa76680e4" resolved "https://registry.yarnpkg.com/@phc/format/-/format-1.0.0.tgz#b5627003b3216dc4362125b13f48a4daa76680e4"
@ -684,6 +689,11 @@ ast-types-flow@^0.0.7:
resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad"
integrity sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag== integrity sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
autoprefixer@10.4.14: autoprefixer@10.4.14:
version "10.4.14" version "10.4.14"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.14.tgz#e28d49902f8e759dd25b153264e862df2705f79d" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.14.tgz#e28d49902f8e759dd25b153264e862df2705f79d"
@ -706,6 +716,15 @@ axe-core@^4.6.2:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.0.tgz#34ba5a48a8b564f67e103f0aa5768d76e15bbbbf" resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.0.tgz#34ba5a48a8b564f67e103f0aa5768d76e15bbbbf"
integrity sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ== integrity sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==
axios@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"
axobject-query@^3.1.1: axobject-query@^3.1.1:
version "3.1.1" version "3.1.1"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.1.1.tgz#3b6e5c6d4e43ca7ba51c5babf99d22a9c68485e1" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.1.1.tgz#3b6e5c6d4e43ca7ba51c5babf99d22a9c68485e1"
@ -897,6 +916,13 @@ color-support@^1.1.2, color-support@^1.1.3:
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==
combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"
commander@^4.0.0: commander@^4.0.0:
version "4.1.1" version "4.1.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
@ -917,6 +943,11 @@ convert-source-map@^1.5.0:
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f"
integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==
cookie@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b"
integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==
cosmiconfig@^7.0.0: cosmiconfig@^7.0.0:
version "7.1.0" version "7.1.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6"
@ -1006,6 +1037,11 @@ deep-is@^0.1.3:
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831"
integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
deepmerge@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.2.1.tgz#5d3ff22a01c00f645405a2fbc17d0778a1801170"
integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==
define-lazy-prop@^2.0.0: define-lazy-prop@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f"
@ -1019,6 +1055,11 @@ define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0:
has-property-descriptors "^1.0.0" has-property-descriptors "^1.0.0"
object-keys "^1.1.1" object-keys "^1.1.1"
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
delegates@^1.0.0: delegates@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
@ -1509,6 +1550,11 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
follow-redirects@^1.15.0:
version "1.15.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
for-each@^0.3.3: for-each@^0.3.3:
version "0.3.3" version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
@ -1516,6 +1562,15 @@ for-each@^0.3.3:
dependencies: dependencies:
is-callable "^1.1.3" is-callable "^1.1.3"
form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"
formidable@^2.1.1: formidable@^2.1.1:
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/formidable/-/formidable-2.1.1.tgz#81269cbea1a613240049f5f61a9d97731517414f" resolved "https://registry.yarnpkg.com/formidable/-/formidable-2.1.1.tgz#81269cbea1a613240049f5f61a9d97731517414f"
@ -1526,6 +1581,19 @@ formidable@^2.1.1:
once "^1.4.0" once "^1.4.0"
qs "^6.11.0" qs "^6.11.0"
formik@^2.2.9:
version "2.2.9"
resolved "https://registry.yarnpkg.com/formik/-/formik-2.2.9.tgz#8594ba9c5e2e5cf1f42c5704128e119fc46232d0"
integrity sha512-LQLcISMmf1r5at4/gyJigGn0gOwFbeEAlji+N9InZF6LIMXnFNkO42sCI8Jt84YZggpD4cPWObAZaxpEFtSzNA==
dependencies:
deepmerge "^2.1.1"
hoist-non-react-statics "^3.3.0"
lodash "^4.17.21"
lodash-es "^4.17.21"
react-fast-compare "^2.0.1"
tiny-warning "^1.0.2"
tslib "^1.10.0"
fraction.js@^4.2.0: fraction.js@^4.2.0:
version "4.2.0" version "4.2.0"
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950" resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950"
@ -1789,7 +1857,7 @@ hexoid@^1.0.0:
resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-1.0.0.tgz#ad10c6573fb907de23d9ec63a711267d9dc9bc18" resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-1.0.0.tgz#ad10c6573fb907de23d9ec63a711267d9dc9bc18"
integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g== integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==
hoist-non-react-statics@^3.3.1: hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1:
version "3.3.2" version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
@ -2098,6 +2166,11 @@ jiti@^1.18.2:
resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.18.2.tgz#80c3ef3d486ebf2450d9335122b32d121f2a83cd" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.18.2.tgz#80c3ef3d486ebf2450d9335122b32d121f2a83cd"
integrity sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg== integrity sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg==
jose@^4.11.4, jose@^4.14.1:
version "4.14.4"
resolved "https://registry.yarnpkg.com/jose/-/jose-4.14.4.tgz#59e09204e2670c3164ee24cbfe7115c6f8bff9ca"
integrity sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==
js-sdsl@^4.1.4: js-sdsl@^4.1.4:
version "4.4.0" version "4.4.0"
resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.0.tgz#8b437dbe642daa95760400b602378ed8ffea8430" resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.0.tgz#8b437dbe642daa95760400b602378ed8ffea8430"
@ -2172,6 +2245,11 @@ jws@^3.2.2:
jwa "^1.4.1" jwa "^1.4.1"
safe-buffer "^5.0.1" safe-buffer "^5.0.1"
jwt-decode@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==
language-subtag-registry@~0.3.2: language-subtag-registry@~0.3.2:
version "0.3.22" version "0.3.22"
resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz#2e1500861b2e457eba7e7ae86877cbd08fa1fd1d" resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz#2e1500861b2e457eba7e7ae86877cbd08fa1fd1d"
@ -2214,6 +2292,11 @@ locate-path@^6.0.0:
dependencies: dependencies:
p-locate "^5.0.0" p-locate "^5.0.0"
lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
lodash.merge@^4.6.2: lodash.merge@^4.6.2:
version "4.6.2" version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
@ -2285,6 +2368,18 @@ micromatch@^4.0.4, micromatch@^4.0.5:
braces "^3.0.2" braces "^3.0.2"
picomatch "^2.3.1" picomatch "^2.3.1"
mime-db@1.52.0:
version "1.52.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
mime-types@^2.1.12:
version "2.1.35"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
dependencies:
mime-db "1.52.0"
minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
version "3.1.2" version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
@ -2395,6 +2490,21 @@ negotiator@^0.6.2:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==
next-auth@^4.22.1:
version "4.22.1"
resolved "https://registry.yarnpkg.com/next-auth/-/next-auth-4.22.1.tgz#1ea5084e38867966dc6492a71c6729c8f5cfa96b"
integrity sha512-NTR3f6W7/AWXKw8GSsgSyQcDW6jkslZLH8AiZa5PQ09w1kR8uHtR9rez/E9gAq/o17+p0JYHE8QjF3RoniiObA==
dependencies:
"@babel/runtime" "^7.20.13"
"@panva/hkdf" "^1.0.2"
cookie "^0.5.0"
jose "^4.11.4"
oauth "^0.9.15"
openid-client "^5.4.0"
preact "^10.6.3"
preact-render-to-string "^5.1.19"
uuid "^8.3.2"
next@13.3.1: next@13.3.1:
version "13.3.1" version "13.3.1"
resolved "https://registry.yarnpkg.com/next/-/next-13.3.1.tgz#17625f7423db2e059d71b41bd9031756cf2b33bc" resolved "https://registry.yarnpkg.com/next/-/next-13.3.1.tgz#17625f7423db2e059d71b41bd9031756cf2b33bc"
@ -2492,11 +2602,21 @@ npmlog@^6.0.0:
gauge "^4.0.3" gauge "^4.0.3"
set-blocking "^2.0.0" set-blocking "^2.0.0"
oauth@^0.9.15:
version "0.9.15"
resolved "https://registry.yarnpkg.com/oauth/-/oauth-0.9.15.tgz#bd1fefaf686c96b75475aed5196412ff60cfb9c1"
integrity sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA==
object-assign@^4.0.1, object-assign@^4.1.1: object-assign@^4.0.1, object-assign@^4.1.1:
version "4.1.1" version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
object-hash@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5"
integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==
object-hash@^3.0.0: object-hash@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9"
@ -2565,6 +2685,11 @@ object.values@^1.1.6:
define-properties "^1.1.4" define-properties "^1.1.4"
es-abstract "^1.20.4" es-abstract "^1.20.4"
oidc-token-hash@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz#9a229f0a1ce9d4fc89bcaee5478c97a889e7b7b6"
integrity sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==
once@^1.3.0, once@^1.4.0: once@^1.3.0, once@^1.4.0:
version "1.4.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
@ -2581,6 +2706,16 @@ open@^8.4.0:
is-docker "^2.1.1" is-docker "^2.1.1"
is-wsl "^2.2.0" is-wsl "^2.2.0"
openid-client@^5.4.0:
version "5.4.2"
resolved "https://registry.yarnpkg.com/openid-client/-/openid-client-5.4.2.tgz#8692bcc2a40ef3426c5ba5c11f7493599e93ccc7"
integrity sha512-lIhsdPvJ2RneBm3nGBBhQchpe3Uka//xf7WPHTIglery8gnckvW7Bd9IaQzekzXJvWthCMyi/xVEyGW0RFPytw==
dependencies:
jose "^4.14.1"
lru-cache "^6.0.0"
object-hash "^2.2.0"
oidc-token-hash "^5.0.3"
optionator@^0.9.1: optionator@^0.9.1:
version "0.9.1" version "0.9.1"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
@ -2738,11 +2873,28 @@ postcss@8.4.23, postcss@^8.4.23:
picocolors "^1.0.0" picocolors "^1.0.0"
source-map-js "^1.0.2" source-map-js "^1.0.2"
preact-render-to-string@^5.1.19:
version "5.2.6"
resolved "https://registry.yarnpkg.com/preact-render-to-string/-/preact-render-to-string-5.2.6.tgz#0ff0c86cd118d30affb825193f18e92bd59d0604"
integrity sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==
dependencies:
pretty-format "^3.8.0"
preact@^10.6.3:
version "10.14.1"
resolved "https://registry.yarnpkg.com/preact/-/preact-10.14.1.tgz#1e15ef6a09e241a48d12c872b90557914b03abac"
integrity sha512-4XDSnUisk3YFBb3p9WeKeH1mKoxdFUsaXcvxs9wlpYR1wax/TWJVqhwmIWbByX0h7jMEJH6Zc5J6jqc58FKaNQ==
prelude-ls@^1.2.1: prelude-ls@^1.2.1:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
pretty-format@^3.8.0:
version "3.8.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-3.8.0.tgz#bfbed56d5e9a776645f4b1ff7aa1a3ac4fa3c385"
integrity sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==
promise-inflight@^1.0.1: promise-inflight@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
@ -2765,6 +2917,16 @@ prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.8.1:
object-assign "^4.1.1" object-assign "^4.1.1"
react-is "^16.13.1" react-is "^16.13.1"
property-expr@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-2.0.5.tgz#278bdb15308ae16af3e3b9640024524f4dc02cb4"
integrity sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==
proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
punycode@^2.1.0: punycode@^2.1.0:
version "2.3.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"
@ -2790,6 +2952,11 @@ react-dom@18.2.0:
loose-envify "^1.1.0" loose-envify "^1.1.0"
scheduler "^0.23.0" scheduler "^0.23.0"
react-fast-compare@^2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9"
integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw==
react-is@^16.13.1, react-is@^16.7.0: react-is@^16.13.1, react-is@^16.7.0:
version "16.13.1" version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
@ -2927,6 +3094,13 @@ run-parallel@^1.1.9:
dependencies: dependencies:
queue-microtask "^1.2.2" queue-microtask "^1.2.2"
rxjs@^7.8.1:
version "7.8.1"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543"
integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==
dependencies:
tslib "^2.1.0"
safe-buffer@^5.0.1, safe-buffer@~5.2.0: safe-buffer@^5.0.1, safe-buffer@~5.2.0:
version "5.2.1" version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
@ -3266,6 +3440,11 @@ thenify-all@^1.0.0:
dependencies: dependencies:
any-promise "^1.0.0" any-promise "^1.0.0"
tiny-case@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tiny-case/-/tiny-case-1.0.3.tgz#d980d66bc72b5d5a9ca86fb7c9ffdb9c898ddd03"
integrity sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==
tiny-glob@^0.2.9: tiny-glob@^0.2.9:
version "0.2.9" version "0.2.9"
resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.9.tgz#2212d441ac17928033b110f8b3640683129d31e2" resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.9.tgz#2212d441ac17928033b110f8b3640683129d31e2"
@ -3274,6 +3453,11 @@ tiny-glob@^0.2.9:
globalyzer "0.1.0" globalyzer "0.1.0"
globrex "^0.1.2" globrex "^0.1.2"
tiny-warning@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
to-fast-properties@^2.0.0: to-fast-properties@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
@ -3286,6 +3470,11 @@ to-regex-range@^5.0.1:
dependencies: dependencies:
is-number "^7.0.0" is-number "^7.0.0"
toposort@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330"
integrity sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==
tr46@~0.0.3: tr46@~0.0.3:
version "0.0.3" version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
@ -3306,11 +3495,16 @@ tsconfig-paths@^3.14.1:
minimist "^1.2.6" minimist "^1.2.6"
strip-bom "^3.0.0" strip-bom "^3.0.0"
tslib@^1.8.1: tslib@^1.10.0, tslib@^1.8.1:
version "1.14.1" version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslib@^2.1.0:
version "2.5.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.2.tgz#1b6f07185c881557b0ffa84b111a0106989e8338"
integrity sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==
tslib@^2.4.0, tslib@^2.5.0: tslib@^2.4.0, tslib@^2.5.0:
version "2.5.0" version "2.5.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
@ -3335,6 +3529,11 @@ type-fest@^0.20.2:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
type-fest@^2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b"
integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==
typed-array-length@^1.0.4: typed-array-length@^1.0.4:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb"
@ -3398,6 +3597,11 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
webidl-conversions@^3.0.0: webidl-conversions@^3.0.0:
version "3.0.1" version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
@ -3487,3 +3691,13 @@ yocto-queue@^0.1.0:
version "0.1.0" version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
yup@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/yup/-/yup-1.1.1.tgz#49dbcf5ae7693ed0a36ed08a9e9de0a09ac18e6b"
integrity sha512-KfCGHdAErqFZWA5tZf7upSUnGKuTOnsI3hUsLr7fgVtx+DK04NPV01A68/FslI4t3s/ZWpvXJmgXhd7q6ICnag==
dependencies:
property-expr "^2.0.5"
tiny-case "^1.0.3"
toposort "^2.0.2"
type-fest "^2.19.0"