diff --git a/src/App.js b/src/App.js
index 36f0fc9..ef7a834 100644
--- a/src/App.js
+++ b/src/App.js
@@ -6,8 +6,7 @@ import 'reactjs-windows/dist/index.css'
import {
BrowserRouter as Router,
Switch,
- Route,
- useLocation
+ Route
} from "react-router-dom";
import { HashLink as Link } from 'react-router-hash-link';
@@ -15,6 +14,8 @@ import { HashLink as Link } from 'react-router-hash-link';
const axios = require('axios');
+const BACKEND_URL = 'https://projectdivar.com:4504';
+
function Col(p) {
return
{p.children}
@@ -32,16 +33,27 @@ function Box(p) {
function EditBox(p) {
useEffect(()=>{
- setTimeout(()=>{document.getElementById("editBox").focus()},100)
+ var timer1 = setTimeout(()=>{document.getElementById("editBox").focus()},100)
+ return () => {
+ clearTimeout(timer1);
+ };
})
return
{
if (e.key==="Enter") {p.setEdit(false)}
+ else if (e.key==="Escape") {p.setEdit(false)}
}} maxLength={p.maxlength?p.maxlength:20} onBlur={()=>{p.setEdit(false)}} value={p.value} onChange={(f)=>{f.currentTarget.value.length>0?p.setName(f.currentTarget.value):p.setName(p.originalName)}}>
}
function EditableBox(p) {
const [edit,setEdit] = useState(false)
+
+ useEffect(()=>{
+ if (p.callback) {
+ p.callback()
+ }
+ },[edit])
+
return <>
{setEdit(true)}}>
{edit?
@@ -355,9 +367,78 @@ function PopupWindow(p) {
}
+
+function EditBackendBox(p) {
+ useEffect(()=>{
+ var timer1 = setTimeout(()=>{document.getElementById("editBox").focus()},100)
+ return () => {
+ clearTimeout(timer1);
+ };
+ })
+ return
{
+ if (e.key==="Enter") {p.setEdit(false);p.setUpdate(true)}
+ else if (e.key==="Escape") {p.setEdit(false)}
+ }} maxLength={p.maxlength?p.maxlength:20} onBlur={()=>{p.setEdit(false);p.setUpdate(true)}} value={p.value} onChange={(f)=>{f.currentTarget.value.length>0?p.setName(f.currentTarget.value):p.setName(p.originalName)}}>
+
+}
+
+function EditableBackendBox(p) {
+ const [update,setUpdate] = useState(false)
+ const [edit,setEdit] = useState(false)
+ const [value,setValue] = useState(p.children)
+
+ useEffect(()=>{
+ if (p.callback&&update) {
+ p.callback(value)
+ setUpdate(false)
+ }
+ },[update])
+
+ return <>
+
{setEdit(true)}}>
+ {edit?
+
+ :<>{value}>}
+
+ >
+}
+
+function TableEditor(p) {
+
+ const [fields,setFields] = useState([])
+ const [data,setData] = useState([])
+
+ useEffect(()=>{
+ axios.get(BACKEND_URL+p.path)
+ .then((data)=>{
+ var cols = data.data.fields
+ var rows = data.data.rows
+
+ setFields(cols.filter((col)=>col.dataTypeID!==23).map((col)=>col.name))
+ setData(rows)
+ })
+ },[p.path])
+
+ return <>
+
+
+ List of users
+
+
+ {fields.map((field,i)=>{field} | )}
+
+
+
+ {data.map((dat)=>{fields.map((col,i)=>{console.log(value)}}>{dat[col]} | )}
)}
+
+
+
+ >
+}
+
function AdminPanel(p) {
return
-
+
Class
Class Data
@@ -386,25 +467,16 @@ function AdminPanel(p) {
Roles
- Users
-
+
Users
+
-}
-
-function PageLink(p) {
- return {p.children}
+
+
}
function App() {
- useEffect(()=>{
- axios.get("https://projectdivar.com:4504/ngsplanner")
- .then((data)=>{
- console.log(data.data)
- })
- })
const [author,setAuthor] = useState("Dudley")
const [buildName,setBuildName] = useState("Fatimah")