diff --git a/data/appUser.db b/data/appUser.db index 88aa376..dee3dcb 100644 Binary files a/data/appUser.db and b/data/appUser.db differ diff --git a/src/pages/api/listUsers.js b/src/pages/api/listUsers.js index d1d3d8c..d78ecaa 100644 --- a/src/pages/api/listUsers.js +++ b/src/pages/api/listUsers.js @@ -4,6 +4,12 @@ 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'; diff --git a/src/pages/edit-school.jsx b/src/pages/edit-school.jsx index 33d79d0..d795573 100644 --- a/src/pages/edit-school.jsx +++ b/src/pages/edit-school.jsx @@ -129,7 +129,7 @@ export default function editSchool() { 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]' />
- + 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]' />
diff --git a/src/pages/edit-user.jsx b/src/pages/edit-user.jsx index 3bd69a6..f763a9c 100644 --- a/src/pages/edit-user.jsx +++ b/src/pages/edit-user.jsx @@ -52,6 +52,7 @@ export default function editUser() { anual: event.target.anual.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 @@ -71,6 +72,7 @@ export default function editUser() { const result = await response.json() // alert(`Is this your full name: ${result.data}`) alert(`User data updated`) + } return ( diff --git a/src/pages/school-list/index.jsx b/src/pages/school-list/index.jsx index 1219b98..64cd67c 100644 --- a/src/pages/school-list/index.jsx +++ b/src/pages/school-list/index.jsx @@ -29,10 +29,19 @@ const fetchData = async () => {
- -   + {/* +   Add School + */} + +   + List Users Under This School +
+ CSV Upload + +
+
diff --git a/src/pages/user-list-by-school.jsx b/src/pages/user-list-by-school.jsx new file mode 100644 index 0000000..a1d8f36 --- /dev/null +++ b/src/pages/user-list-by-school.jsx @@ -0,0 +1,91 @@ +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 [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 ( +
+
+ +
+ +
+
+ + + + + + + + + + + + + + {user.map + (data=> + + + + + + + + + + + ) + } + +
NameMobileEmailSchool NameUser TypeStart DateEnd DateAction
{data.uname}{data.phone}{data.email}{data.school}{data.type}{data.start_date}{data.end_date} +
+ +
+ +
+
+
+
+ + + + + ) + +} diff --git a/src/pages/user-list.jsx b/src/pages/user-list.jsx index ac9565f..a1d8f36 100644 --- a/src/pages/user-list.jsx +++ b/src/pages/user-list.jsx @@ -1,4 +1,5 @@ import React, { useEffect, useState } from "react"; + import Image from 'next/image' import { Inter } from 'next/font/google' const inter = Inter({ subsets: ['latin'] }) @@ -43,10 +44,6 @@ const fetchData = async () => { Email School Name User Type - Annual - Class - {/* Language */} - {/* Year */} Start Date End Date Action @@ -61,10 +58,6 @@ const fetchData = async () => { {data.email} {data.school} {data.type} - {data.anual} - {data.klas} - {/* {data.lang} */} - {/* {data.year} */} {data.start_date} {data.end_date}