main2
parent
3e7e6b8943
commit
27657679d7
BIN
data/appUser.db
BIN
data/appUser.db
Binary file not shown.
|
@ -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';
|
||||
|
|
|
@ -129,7 +129,7 @@ export default function editSchool() {
|
|||
<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>
|
||||
<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'>
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -29,10 +29,19 @@ const fetchData = async () => {
|
|||
<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">
|
||||
{/* <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>
|
||||
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>
|
||||
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">
|
||||
|
|
|
@ -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 (
|
||||
<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" />
|
||||
<a 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>
|
||||
</a>
|
||||
</div>
|
||||
<a 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
|
||||
</a>
|
||||
</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 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>
|
||||
)
|
||||
|
||||
}
|
|
@ -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 () => {
|
|||
<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">Annual</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">Action</th>
|
||||
|
@ -61,10 +58,6 @@ const fetchData = async () => {
|
|||
<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.anual}</td>
|
||||
<td className="border-x-2 p-2 text-center">{data.klas}</td>
|
||||
{/* <td className="border-x-2 p-2 text-center">{data.lang}</td> */}
|
||||
{/* <td className="border-x-2 p-2">{data.year}</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>
|
||||
|
|
Loading…
Reference in New Issue