edit-school-same-data-in-all-school-is
parent
81cfb6ce00
commit
3e7e6b8943
BIN
data/appUser.db
BIN
data/appUser.db
Binary file not shown.
|
@ -1,60 +1,66 @@
|
||||||
import NavBar from '../components/NavBar'
|
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'
|
||||||
|
|
||||||
|
export default function editSchool() {
|
||||||
export default function addSchoolForm() {
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const uploadToServer = async (event) => {
|
// const updateSchoolData = async (event) => {
|
||||||
const body = new FormData();
|
// const body = new FormData();
|
||||||
body.append("file", agreement.files[0]);
|
// body.append("file", agreement.files[0]);
|
||||||
body.append("fName", `${router.query.school}.pdf`);
|
// body.append("fName", `${router.query.school}.pdf`);
|
||||||
const response = await fetch("/api/fileUpload", {
|
// const response = await fetch("/api/updateUserDetails", {
|
||||||
method: "POST",
|
// method: "POST",
|
||||||
body
|
// body
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
const [school, setSchool] = useState({});
|
const [school, setSchool] = useState({});
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
// console.log(router.query);
|
||||||
// if(router.query.school<1) {
|
// if(router.query.school<1) {
|
||||||
// const { sid } = router.query;
|
// const { sid } = router.query;
|
||||||
// setSchool(sid)
|
// setSchool(sid)
|
||||||
if(router.query.school && router.query.school>1 ){
|
if(router.query.school && router.query.school>1 ){
|
||||||
fetch(`https://management.beanstalkedu.com/items/school/${router.query.school}`)
|
fetch(`https://management.beanstalkedu.com/items/school?school=${router.query.school}`)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
// console.log(router.query.school);
|
// console.log(data);
|
||||||
setSchool(data.data)
|
setSchool(data.data[0])
|
||||||
})
|
// console.log(data.data)
|
||||||
}
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// console.log(data.data)
|
||||||
|
|
||||||
|
|
||||||
}, [router.query.school]);
|
}, [router.query.school]);
|
||||||
// console.log(setSchool)
|
|
||||||
|
const updateSchoolData = async (event) => {
|
||||||
const handleSubmit = async (event) => {
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const data = {
|
const data = {
|
||||||
"status":"published",
|
// schoolId: router.query.school,
|
||||||
name: event.target.schoolName.value,
|
name: event.target.name.value,
|
||||||
country: event.target.country.value,
|
// status: event.target.status.value,
|
||||||
state: event.target.state.value,
|
// uname: event.target.uname.value,
|
||||||
cities: event.target.cities.value,
|
// country: event.target.country.value,
|
||||||
anual: event.target.anual.value,
|
// state: event.target.state.value,
|
||||||
toddlers: event.target.toddlers.value,
|
// city: event.target.city.value,
|
||||||
early_start_programme: event.target.early_start_programme.value,
|
// address: event.target.address.value,
|
||||||
interakto: event.target.interakto.value,
|
// start_date: event.target.start_date.value,
|
||||||
agreement_expiry_date: event.target.agreement_expiry_date.value,
|
// end_date: event.target.end_date.value,
|
||||||
school_agreement: event.target.school_agreement.value,
|
// school: event.target.school.value,
|
||||||
school_contact_number: event.target.school_contact_number.value,
|
// anual: event.target.anual.value,
|
||||||
school_email_id: event.target.school_email_id.value,
|
// toddlers: event.target.toddlers.value,
|
||||||
|
// early_start_programme: event.target.early_start_programme.value,
|
||||||
|
// email: event.target.email.value,
|
||||||
|
// phone: event.target.phone.value,
|
||||||
|
// klas: event.target.klas.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 = 'https://management.beanstalkedu.com/items/school'
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -64,104 +70,87 @@ export default function addSchoolForm() {
|
||||||
body: JSONdata,
|
body: JSONdata,
|
||||||
}
|
}
|
||||||
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}`)
|
// alert(`Is this your full name: ${result.data}`)
|
||||||
alert(`School Saved`)
|
alert(`School data updated`)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
<div 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/1.svg" alt="" />
|
<img src="/img/2.svg" alt=""/>
|
||||||
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update School Information</p>
|
<p className='text-2xl md:text-4xl font-bold underline decoration-4 decoration-[#FE4501] pb-10'>Update School Information </p>
|
||||||
</div>
|
</div>
|
||||||
<form className='w-full px-6 md:px-20'>
|
<form onSubmit={updateSchoolData} action="" className='w-full px-6 md:px-20'>
|
||||||
<div className='flex flex-col w-full'>
|
<div className='flex flex-col w-full pt-4'>
|
||||||
<label htmlFor="school" className='text-xl font-bold'>School Name</label>
|
<label htmlFor="school_name" 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]' />
|
<input value={school.name} onChange={e => setSchool(e.target.value)} type="text" name="school_name" 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="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 className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' type="text" value={school.country} onChange={e => setSchool(e.target.value)} name="country" />
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<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="mobile" className='text-xl font-bold'>Mobile Number</label>
|
||||||
<input type="text" value={school.state} onChange={e => setSchool(e.target.value)} name="state" className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
|
<input onChange={e => setSchool(e.target.value)} type="text" name="mobile" 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="Cities" className='text-xl font-bold'>Cities</label>
|
<label htmlFor="email" className='text-xl font-bold'>Email ID</label>
|
||||||
<input type="text" value={school.cities} onChange={e => setSchool(e.target.value)} name="cities" className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]'/>
|
<input 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 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 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="cities" className='text-xl font-bold'>Cities</label>
|
||||||
|
<input onChange={e => setSchool(e.target.value)} type="text" name="cities" 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 onChange={e => setSchool(e.target.value)} type="email" 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 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_program" className='text-xl font-bold'>Early Start Program</label>
|
||||||
|
<input onChange={e => setSchool(e.target.value)} type="text" name="early_start_program" 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 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="agreement_expiry_date" className='text-xl font-bold'> Agreement Expiry Date: (YYYY/MM/DD)</label>
|
||||||
|
<input onChange={e => setSchool(e.target.value)} type="text" name="agreement_expiry_date" 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="agreement_documents" className='text-xl font-bold'>Upload Agreement Document's</label>
|
||||||
|
<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]' />
|
||||||
|
<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>
|
||||||
<div className='flex flex-col w-full'>
|
|
||||||
<label htmlFor="school_contact_number" className='text-xl font-bold'> Phone</label>
|
</div>
|
||||||
<input type="text" value={school.school_contact_number} onChange={e => setSchool(e.target.value)} name="school_contact_number" 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'>
|
<div className='flex justify-center pt-8'>
|
||||||
<label htmlFor="anual" className='text-xl font-bold'>Anual</label>
|
<button type="submit"
|
||||||
<input type="text" value={school.anual} onChange={e => setSchool(e.target.value)} className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
|
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
|
||||||
</div>
|
</button>
|
||||||
<div className='flex flex-col w-full pt-4'>
|
</div>
|
||||||
<label htmlFor="toddlers" className='text-xl font-bold'>Toddlers</label>
|
</form>
|
||||||
<input type="text" name="toddlers" value={school.toddlers} onChange={e => setSchool(e.target.value)} className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
|
</div>
|
||||||
</div>
|
</section>
|
||||||
<div className='flex flex-col w-full pt-4'>
|
</div>
|
||||||
<label htmlFor="early_start_programme" className='text-xl font-bold'>Early Start Program</label>
|
</main>
|
||||||
<input type="text" name="early_start_programme" value={school.early_start_programme} onChange={e => setSchool(e.target.value)} 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 type="text" name="interakto" value={school.interakto} onChange={e => setSchool(e.target.value)} 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'>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>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
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 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", {
|
||||||
|
method: "POST",
|
||||||
|
body
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
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]);
|
||||||
|
// console.log(setSchool)
|
||||||
|
|
||||||
|
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'>Update School Information</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 className='border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' 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" 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="Cities" className='text-xl font-bold'>Cities</label>
|
||||||
|
<input type="text" value={school.cities} onChange={e => setSchool(e.target.value)} name="cities" 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_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" 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)} 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 type="text" name="toddlers" value={school.toddlers} onChange={e => setSchool(e.target.value)} 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 Program</label>
|
||||||
|
<input type="text" name="early_start_programme" value={school.early_start_programme} onChange={e => setSchool(e.target.value)} 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 type="text" name="interakto" value={school.interakto} onChange={e => setSchool(e.target.value)} 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'>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>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
)
|
||||||
|
}
|
|
@ -27,9 +27,9 @@ export default function editUser() {
|
||||||
fetch(`/api/getUserDetails?user=${router.query.user}`)
|
fetch(`/api/getUserDetails?user=${router.query.user}`)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
// console.log(data);
|
console.log(data);
|
||||||
setUser(data[0])
|
setUser(data[0])
|
||||||
// console.log(user)
|
console.log(user)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +98,11 @@ export default function editUser() {
|
||||||
<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]' />
|
<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>
|
||||||
<div className='flex flex-col w-full'>
|
<div className='flex flex-col w-full'>
|
||||||
<label htmlFor="start_date" className='text-xl font-bold'> start_date (YYYY-MM-DD) </label>
|
<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]' />
|
<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>
|
||||||
<div className='flex flex-col w-full'>
|
<div className='flex flex-col w-full'>
|
||||||
<label htmlFor="end_date" className='text-xl font-bold'> end_date (YYYY-MM-DD)</label>
|
<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]' />
|
<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>
|
||||||
<div className='flex flex-col w-full'>
|
<div className='flex flex-col w-full'>
|
||||||
|
@ -127,9 +127,13 @@ export default function editUser() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex flex-col w-full'>
|
<div className='flex flex-col w-full'>
|
||||||
<label htmlFor="address" className='text-xl font-bold'> address 1st line</label>
|
<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]' />
|
<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>
|
||||||
|
{/* <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'>
|
<div className='flex flex-col w-full pt-4'>
|
||||||
<label htmlFor="" className='text-xl font-bold'>School ID</label>
|
<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]' />
|
<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]' />
|
||||||
|
@ -143,15 +147,15 @@ export default function editUser() {
|
||||||
<input value={user.anual} onChange={e => setUser(e.target.value)} type="text" name="anual" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
|
<input value={user.anual} onChange={e => setUser(e.target.value)} type="text" name="anual" 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="early_start_programme" className='text-xl font-bold'>early_start_programme</label>
|
<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]' />
|
<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>
|
||||||
<div className='flex flex-col w-full pt-4'>
|
<div className='flex flex-col w-full pt-4'>
|
||||||
<label htmlFor="toddlers" className='text-xl font-bold'>toddlers</label>
|
<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]' />
|
<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>
|
||||||
<div className='flex flex-col w-full pt-4'>
|
<div className='flex flex-col w-full pt-4'>
|
||||||
<label htmlFor="interakto" className='text-xl font-bold'>interakto</label>
|
<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]' />
|
<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>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue