diff --git a/src/App.css b/src/App.css index 4b68e7c..c74387c 100644 --- a/src/App.css +++ b/src/App.css @@ -4,6 +4,7 @@ display: flex; align-items: center; justify-content: center; + } .App-logo { diff --git a/src/App.js b/src/App.js index bd39f47..7b825dd 100644 --- a/src/App.js +++ b/src/App.js @@ -3,17 +3,18 @@ import './App.css'; import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; import Navbar from "./component/Navbar"; import Home from './pages/home'; -import About from './pages/about'; +import Event from './pages/event'; import Login from './pages/login'; import Contact from './pages/contact'; const App = () => { + return (
} /> - } /> + } /> } /> } /> diff --git a/src/clubo_.png b/src/clubo_.png new file mode 100644 index 0000000..39dc15d Binary files /dev/null and b/src/clubo_.png differ diff --git a/src/component/Navbar.js b/src/component/Navbar.js index 7834c1e..c2c5e5e 100644 --- a/src/component/Navbar.js +++ b/src/component/Navbar.js @@ -1,4 +1,5 @@ import React from "react"; +// import style from './nav.css'; import { AppBar, Toolbar, @@ -7,52 +8,90 @@ import { makeStyles, } from "@material-ui/core"; import { Link } from "react-router-dom"; - const useStyles = makeStyles((theme) => ({ navlinks: { marginLeft: theme.spacing(10), display: "flex", }, - logo: { + logo: { + position: "relative", + left: "50px", + fontSize: "30px", flexGrow: "1", cursor: "pointer", + color: "#e3e4e4", + }, + toolbar: { + margin: "10px", + padding: "8px", }, link: { textDecoration: "none", - color: "white", - fontSize: "20px", - marginLeft: theme.spacing(15), + display: "flex", + borderRadius: "20px", + color: "White", + alignItems: "center", + justifyContent: "center", + fontSize: "14px", + paddingLeft: "18px", + paddingRight: "18px", + marginLeft: theme.spacing(8), "&:hover": { - color: "yellow", - borderBottom: "1px solid white", + color: "#7b92cd", + background: "#fff", + // margin: "13px", + // border: "1px solid white", + // paddingright: "3px", + transition: "300ms", + // Radius:"5px", }, }, + login: { + textDecoration: "none", + display: "flex", + color: "White", + background: "#7b92cd", + borderRadius: "14px", + fontSize: "14px", + padding: "8px", + marginLeft: theme.spacing(8), + "&:hover": { + color: "#000" + } + } })); function Navbar() { const classes = useStyles(); - + const [isOpen, setIsOpen] = React.useState(false); + const toggling = () => setIsOpen(!isOpen); + const logoStyle = { + height: "40px", + position: "absolute", + top: "12px", + } return ( - + + clubo - Clubo + CMS -
- - Home - - - About - - - Contact - - - Login/SignUp - -
+
+ + Home + + + Events + + + Members + + + Login/SignUp + +
); diff --git a/src/index.css b/src/index.css index 32378fc..2c11c49 100644 --- a/src/index.css +++ b/src/index.css @@ -8,6 +8,7 @@ body { } .highlight { color:red; + border-radius: 0px; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', diff --git a/src/pages/ModalDialog.js b/src/pages/ModalDialog.js index 5b1c5d6..9c0d869 100644 --- a/src/pages/ModalDialog.js +++ b/src/pages/ModalDialog.js @@ -1,4 +1,3 @@ - import React from 'react'; import Dialog from '@material-ui/core/Dialog'; import FormSignIn from './form'; @@ -8,142 +7,152 @@ import { makeStyles } from '@material-ui/core'; import { useNavigate } from 'react-router-dom'; const useStyles = makeStyles(theme => ({ - root: { - - flexDirection: 'columns', - justifyContent: 'center', - alignItems: 'center', - padding: theme.spacing(2), - - '& .MuiTextField-root': { - margin: theme.spacing(1), - width: '500px', - }, - '& .MuiButtonBase-root': { - margin: theme.spacing(2), - }, + root: { + flexDirection: 'columns', + justifyContent: 'center', + alignItems: 'center', + padding: theme.spacing(2), + + '& .MuiTextField-root': { + margin: theme.spacing(1), + width: '500px', + }, + '& .MuiButtonBase-root': { + margin: theme.spacing(2), }, - })); + }, +})); +const ModalDialog = ({ open, handleClose }) => { -const ModalDialog = ({ open, handleClose}) => { - // const [accessId,setAcessId]=React.useState(true); - const [title,setTitle]=React.useState("Login Here") - const [viewMode,setViewMode]=React.useState("member"); - const clickHandle=(ev)=>{ + const [title, setTitle] = React.useState("Login Here") + const [viewMode, setViewMode] = React.useState("member"); + const clickHandle = (ev) => { - if(ev.currentTarget.value==="member") setViewMode("member") - if(ev.currentTarget.value==="admin") setViewMode("admin") - setTitle("Login Here") - } - const createForm=(ev)=>{ - setViewMode("signUp"); - setTitle("Sign Up Here") + if (ev.currentTarget.value === "member") setViewMode("member") + if (ev.currentTarget.value === "admin") setViewMode("admin") + setTitle("Login Here") + } + const createForm = (ev) => { + setViewMode("signUp"); + setTitle("Sign Up Here") + } + const h3b = { + display: "flex", + backgroundColor: "#3a3f6d", + color: "white", + } + const h3t = { + padding: "10px", + margin: "auto", } return ( // props received from App.js
- -

{title}

- - - {viewMode==="signUp"&& } - {viewMode==="member" && } - { viewMode==="admin" && } -
-
+ +
+

{title}

+
+ + + {viewMode === "signUp" && } + {viewMode === "member" && } + {viewMode === "admin" && } +
+
); }; -const LoginAsMember=({handleClose,createForm})=>{ - const classes = useStyles(); - const [email,setEmail]=React.useState(''); - const [password,setPassword]=React.useState(''); - const linkForm=(ev)=>{ - createForm(ev) - } - const navigate = useNavigate(); - const handleSubmit = e => { - e.preventDefault(); - - handleClose(); - navigate("/") - }; -return( - +const LoginAsMember = ({ handleClose, createForm }) => { + const classes = useStyles(); + const [email, setEmail] = React.useState(''); + const [password, setPassword] = React.useState(''); + const linkForm = (ev) => { + createForm(ev) + } + const navigate = useNavigate(); + const handleSubmit = e => { + e.preventDefault(); + + handleClose(); + navigate("/") + }; + return ( +
-

don't have account a create here SignUp

-
+ + + setEmail(e.target.value)} + /> setEmail(e.target.value)} - /> - setPassword(e.target.value)} - /> -
- - -
+ label="Password" + variant="filled" + type="password" + required + value={password} + onChange={e => setPassword(e.target.value)} + /> +
+ + +
+

Don't have an account? Create one here: SignUp

-) + ) } -const LoginAsAdmin=({handleClose})=>{ - const classes = useStyles(); - const navigate = useNavigate(); - const [email,setEmail]=React.useState(''); - const [password,setPassword]=React.useState(''); - const handleSubmit = e => { - e.preventDefault(); - - handleClose(); - navigate("/") - }; - return( -
-
+const LoginAsAdmin = ({ handleClose }) => { + const classes = useStyles(); + const navigate = useNavigate(); + const [email, setEmail] = React.useState(''); + const [password, setPassword] = React.useState(''); + const handleSubmit = e => { + e.preventDefault(); + + handleClose(); + navigate("/") + }; + return ( +
+ + setEmail(e.target.value)} + /> setEmail(e.target.value)} - /> - setPassword(e.target.value)} - /> -
- - -
+ label="Password" + variant="filled" + type="password" + required + value={password} + onChange={e => setPassword(e.target.value)} + /> +
+ + +
- - ) + + ) } export default ModalDialog; \ No newline at end of file diff --git a/src/pages/about.js b/src/pages/about.js index 59714d6..d15933f 100644 --- a/src/pages/about.js +++ b/src/pages/about.js @@ -1,205 +1,260 @@ -import processingImage from './process.gif' -import dateFormat, { masks } from "dateformat"; -import React from 'react'; -import Calendar from 'react-calendar' -import 'react-calendar/dist/Calendar.css' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faEdit, faTrash} from '@fortawesome/free-solid-svg-icons'; -const getEvent=()=>{ - const promise=new Promise((resolve,reject)=>{ - fetch("/getEvent").then((response)=>{ -if(!response.ok) throw Error("Unable to fetch event"); -return response.json(); - }).then((events)=>{resolve(events)}).catch((error)=>{ - reject(error); - }) - }); - return promise; -} - -const About = () => { - const [clickDate, setClickDate] = React.useState(""); - const [clickChangeDate,setClickChangeDate]=React.useState(""); - const [onChangeSelectedEvent,setOnChangeSelectedEvent]=React.useState([]) - const [viewMode,setViewMode]=React.useState("process") - const [events,setEvents]=React.useState([]) - React.useEffect(()=>{ - //set inital time - var t=dateFormat(clickDate, "dd/mm/yyyy") - setClickChangeDate(t); - - //get Event from database - setViewMode("process"); - getEvent().then((events)=>{ - setViewMode("showAllEvent") - events.forEach((event)=>{ - //convert into string and data format - event.eventDate=dateFormat(event.eventDate, "dd/mm/yyyy"); - // alert(event.eventDate) - //Convert Time to am/pm - var timeString=event.eventTime; - const timeString12hr = new Date('1970-01-01T' + timeString + 'Z') - .toLocaleTimeString('en-US', - {timeZone:'UTC',hour12:true,hour:'numeric',minute:'numeric'} - ); - event.eventTime=timeString12hr; - }) - setEvents(events); - clickEvents() - },(error)=>{ - // viewMode("process") - console.log(error); - }) - },[]) - - function onChange(calDate){ -setClickDate(calDate); -var r=calDate; -// var t=format(r, 'yyyy/MM/dd kk:mm:ss') -var t=dateFormat(r, "dd/mm/yyyy") -setClickChangeDate(t) -clickEvents() - } - const clickEvents=()=>{ - // alert(clickChangeDate) - var selectedEvents=[]; - events.forEach((event)=>{ - - if(event.eventDate===clickChangeDate) - { - selectedEvents.push(event); - } - }) - setOnChangeSelectedEvent(selectedEvents); - } - const eventsDates=[]; -const tileContent=({ date, view })=>{ - date=dateFormat(date, "dd/mm/yyyy") - events.forEach((event)=>{ - eventsDates.push({"date":event.eventDate,"eventName":event.eventName}); - }) - - var i=0; - while(i*

-} - i++; - } -} -const calenderStyle = { - color: "white", - width:"35%", - backgroundColor: "DodgerBlue", - padding: "10px", - fontFamily: "Arial" - - -}; -const styleShowOnTime= { - color: "white", - width:"50%", - height:"200px", - position:"absolute", - top:"100px", - right:"10px", - backgroundColor: "DodgerBlue", - padding: "10px", - fontFamily: "Arial", -}; - - return ( -
-
- -
- -
- - -
- {viewMode==="process" && } - {viewMode==="showAllEvent" && } -
- - ); -}; - -const Processing=()=>{ - return( -
- -
- ) -} -const ShowEventOntime=({events,clickDate})=>{ - - // const [eventDate,setEventDate]=React.useState(new Date()); - - if(events.length!=0) return( -
-

Event for this date -{events.eventDate}

-
    - { - events.map((event)=>{ - return
  • {event.eventName}
  • - - }) - } -
-
-) -if(events.length===0) return( -
-
-

Sorry ... not event found on date

-
-
-) -} -class Detials extends React.Component{ - - constructor(props){ - super(props); - this.state={ - value:this.props.ModalDialog.state, - } - - } - -} - -const ShowAllEvent=({events})=>{ - - - const [entryAdmin,setEntryAdmin]=React.useState(true); - return( -
-

All Events

-
    - { -events.map((event)=>{ - return( -
    -
    -
  • {event.eventId}
  • -

    {event.eventName}

    - {event.eventDate} ({event.eventTime}) - {entryAdmin && -   - - } -
    -
    - - ) -}) - } -
-
- ) -} +import processingImage from './process.gif' +import dateFormat from "dateformat"; +import React from 'react'; +import Calendar from 'react-calendar' +import 'react-calendar/dist/Calendar.css' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faEdit, faTrash} from '@fortawesome/free-solid-svg-icons'; +const getEvent=()=>{ + const promise=new Promise((resolve,reject)=>{ + fetch("/getEvent").then((response)=>{ +if(!response.ok) throw Error("Unable to fetch event"); +return response.json(); + }).then((events)=>{resolve(events)}).catch((error)=>{ + reject(error); + }) + }); + return promise; +} +const deleteEventByID=(id)=>{ + + const datastring=`EventId=${encodeURIComponent(id)}`; + const promise=new Promise((resolve,reject)=>{ + fetch("/deleteEvent",{ + "method":"POST", +"headers":{ +"Content-Type":"application/x-www-form-urlencoded" +}, +"body":datastring + }).then((response)=>{ +if(!response.ok) throw Error ("Unable to delete this Event"); + return response.json; + }).then((deleteEvent)=>{ +resolve(deleteEvent) + }).catch((error)=>{ + reject(error.message) + }) + + }); + return promise; + } +const About = () => { + const [clickDate, setClickDate] = React.useState(""); + const [clickChangeDate,setClickChangeDate]=React.useState(""); + const [onChangeSelectedEvent,setOnChangeSelectedEvent]=React.useState([]) + const [viewMode,setViewMode]=React.useState("process") + const [events,setEvents]=React.useState([]) + React.useEffect(()=>{ + //set inital time + var t=dateFormat(clickDate, "dd/mm/yyyy") + setClickChangeDate(t); + + //get Event from database + setViewMode("process"); + getEvent().then((events)=>{ + setViewMode("showAllEvent") + events.forEach((event)=>{ + //convert into string and data format + event.eventDate=dateFormat(event.eventDate, "dd/mm/yyyy"); + // alert(event.eventDate) + //Convert Time to am/pm + var timeString=event.eventTime; + const timeString12hr = new Date('1970-01-01T' + timeString + 'Z') + .toLocaleTimeString('en-US', + {timeZone:'UTC',hour12:true,hour:'numeric',minute:'numeric'} + ); + event.eventTime=timeString12hr; + }) + setEvents(events); + clickEvents() + },(error)=>{ + // viewMode("process") + console.log(error); + }) + } + , []) + + function onChange(calDate){ +setClickDate(calDate); +var r=calDate; +// var t=format(r, 'yyyy/MM/dd kk:mm:ss') +var t=dateFormat(r, "dd/mm/yyyy") +setClickChangeDate(t) +clickEvents() + } + const clickEvents=()=>{ + // alert(clickChangeDate) + var selectedEvents=[]; + events.forEach((event)=>{ + + if(event.eventDate===clickChangeDate) + { + selectedEvents.push(event); + } + }) + setOnChangeSelectedEvent(selectedEvents); + } + const eventsDates=[]; +const tileContent=({ date, view })=>{ + date=dateFormat(date, "dd/mm/yyyy") + events.forEach((event)=>{ + eventsDates.push({"date":event.eventDate,"eventName":event.eventName}); + }) + + var i=0; + while(i*

+} + i++; + } +} +const calenderStyle = { + color: "white", + width:"35%", + backgroundColor: "DodgerBlue", + padding: "10px", + fontFamily: "Arial", +marging:"50px", +}; +const styleShowOnTime= { + color: "white", + width:"50%", + height:"200px", + position:"absolute", + top:"100px", + right:"10px", + backgroundColor: "DodgerBlue", + padding: "10px", + fontFamily: "Arial", +}; + +const deleteingEvent=(id)=>{ + setViewMode("process"); +deleteEventByID(id).then((resolve)=>{ +setViewMode("showAllEvent"); + console.log(resolve.success); +},(reject)=>{ + alert("Event not delete ,due to some Error") +}) + + +getEvent().then((events)=>{ + setViewMode("showAllEvent") + events.forEach((event)=>{ + //convert into string and data format + event.eventDate=dateFormat(event.eventDate, "dd/mm/yyyy"); + // alert(event.eventDate) + //Convert Time to am/pm + var timeString=event.eventTime; + const timeString12hr = new Date('1970-01-01T' + timeString + 'Z') + .toLocaleTimeString('en-US', + {timeZone:'UTC',hour12:true,hour:'numeric',minute:'numeric'} + ); + event.eventTime=timeString12hr; + }) + setEvents(events); + clickEvents() +},(error)=>{ + // viewMode("process") + console.log(error); +}) + + + +setViewMode("showAllEvent"); +} + return ( +
+
+ +
+ +
+ + +
+ {viewMode==="process" && } + {viewMode==="showAllEvent" && } +
+ + ); +}; + +const Processing=()=>{ + return( +
+ +
+ ) +} +const ShowEventOntime=({events,clickDate})=>{ + // const [eventDate,setEventDate]=React.useState(new Date()); + if(events.length!=0) return( +
+

Event for this date -{events.eventDate}

+
    + { + events.map((event)=>{ + return
  • {event.eventName}
  • + + }) + } +
+
+) +if(events.length===0) return( +
+
+

Sorry ... not event found on date

+
+
+) +} + + +const ShowAllEvent=({events,deleteingEvent})=>{ + + const [entryAdmin,setEntryAdmin]=React.useState(true); + const iconStyle={ + position:"absolute", + right:"15px", + cursor:"pointer" + } + const editEvent=()=>{ +alert("d") + } + const deleteEvent=(ev)=>{ + alert(ev.currentTarget.id) +deleteingEvent(ev.currentTarget.id) + } + return( +
+

All Events

+
    + { +events.map((event)=>{ + return( +
    +
    +
  • {event.eventId}
  • +

    {event.eventName}

    + {event.eventDate} ({event.eventTime}) + {entryAdmin && +   + + } +
    +
    + + ) +}) + } +
+
+ ) +} export default About; \ No newline at end of file diff --git a/src/pages/banner.png b/src/pages/banner.png new file mode 100644 index 0000000..09ed8f4 Binary files /dev/null and b/src/pages/banner.png differ diff --git a/src/pages/contact.jpg b/src/pages/contact.jpg new file mode 100644 index 0000000..64a247e Binary files /dev/null and b/src/pages/contact.jpg differ diff --git a/src/pages/contact.js b/src/pages/contact.js index e4c725a..5b54761 100644 --- a/src/pages/contact.js +++ b/src/pages/contact.js @@ -1,10 +1,9 @@ -import React from "react"; +import React, { useState } from "react"; + function Contact() { + return ( +
-const Contact=()=>{ - return( -
-Conatct pages -
-) +
+ ); } export default Contact; \ No newline at end of file diff --git a/src/pages/del.jpg b/src/pages/del.jpg index d7c9b73..ea86876 100644 Binary files a/src/pages/del.jpg and b/src/pages/del.jpg differ diff --git a/src/pages/event.js b/src/pages/event.js new file mode 100644 index 0000000..8a464d4 --- /dev/null +++ b/src/pages/event.js @@ -0,0 +1,736 @@ +import processingImage from './process.gif' +import dateFormat from "dateformat"; +import React from 'react'; +import Calendar from 'react-calendar' +import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; +import 'react-calendar/dist/Calendar.css' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faEdit, faTrash, faAdd, faSearch } from '@fortawesome/free-solid-svg-icons'; +import { red } from '@material-ui/core/colors'; + +const getEvent = () => { + const promise = new Promise((resolve, reject) => { + + fetch("/getEvent").then((response) => { + alert(JSON.stringify(response)); + if (!response.ok) throw Error("Unable to fetch event"); + return response.json(); + }).then((events) => { + resolve(events) + }).catch((error) => { + reject(error); + }) + }); + return promise; +} +const deleteEventByID = (id) => { + + const datastring = `EventId=${encodeURIComponent(id)}`; + const promise = new Promise((resolve, reject) => { + fetch("/deleteEvent", { + "method": "POST", + "headers": { + "Content-Type": "application/x-www-form-urlencoded" + }, + "body": datastring + }).then((response) => { + if (!response.ok) throw Error("Unable to delete this Event"); + return response.json; + }).then((deleteEvent) => { + resolve(deleteEvent) + }).catch((error) => { + reject(error.message) + }) + + }); + return promise; +} +const editEventByServer = (event) => { + var datastring = `eventId=${event.eventId}&eventName=${encodeURIComponent(event.eventName)}&eventDate=${encodeURIComponent(event.eventDate)}&eventTime=${encodeURIComponent(event.eventTime)}&mgrId=${encodeURIComponent(event.eventMgrId)}&description=${encodeURIComponent(event.eventDescription)}` + // alert(datastring) + const promise = new Promise((resolve, reject) => { + fetch("/editEvent", { + "method": "POST", + "headers": { + "Content-Type": "application/x-www-form-urlencoded" + }, + "body": datastring + }).then((response) => { + if (!response.ok) throw Error("Unable to Edit this Event"); + return response.json() + }).then((event) => { resolve(event) }).catch((error) => { + reject(error.message) + }) + }); + return promise; +} +const saveNewEventOnServerSide = (event) => { + var datastring = `eventId=${event.eventId}&eventName=${encodeURIComponent(event.eventName)}&eventDate=${encodeURIComponent(event.eventDate)}&eventTime=${encodeURIComponent(event.eventTime)}&mgrId=${encodeURIComponent(event.eventManagerId)}&description=${encodeURIComponent(event.eventDescription)}` + // alert(datastring) + const promise = new Promise((resolve, reject) => { + fetch("/addNewEvent", { + "method": "POST", + "headers": { + "Content-Type": "application/x-www-form-urlencoded" + }, + "body": datastring + }).then((response) => { + if (!response.ok) throw Error("Unable to add New Event Event"); + return response.json() + }).then((event) => { resolve(event) }).catch((error) => { + reject(error.message) + }) + }); + return promise; +} +function convertTo24HrsFormat(time) { + const slicedTime = time.split(/(PM|AM)/gm)[0]; + + let [hours, minutes] = slicedTime.split(':'); + + if (hours === '12') { + hours = '00'; + } + + let updateHourAndMin; + + function addition(hoursOrMin) { + updateHourAndMin = + hoursOrMin.length < 2 + ? (hoursOrMin = `${0}${hoursOrMin}`) + : hoursOrMin; + + return updateHourAndMin; + } + + if (time.endsWith('PM')) { + hours = parseInt(hours, 10) + 12; + } + + return `${addition(hours)}:${addition(minutes)}`; +} +function convertDate(date) { + const input = date + const [day, month, year] = input.split('/'); + return (`${year}/${month}/${day}`); +} +const searchEventFromServerSide = (value) => { + var datastring = `searchByCharacter=${value}`; + + const promise = new Promise((resolve, reject) => { + fetch("/searchEvent", { + "method": "POST", + "headers": { + "Content-Type": "application/x-www-form-urlencoded" + }, + "body": datastring + }).then((response) => { + if (!response.ok) throw Error("Unable to aConnect Event"); + return response.json() + }).then((events) => { resolve(events) }).catch((error) => { + reject(error.message) + }) + }) + return promise; +} +const getAllEventDetailFromServerSide = (id) => { + var datastring = `getId=${id}`; + + const promise = new Promise((resolve, reject) => { + fetch("/getAllDetail", { + "method": "POST", + "headers": { + "Content-Type": "application/x-www-form-urlencoded" + }, + "body": datastring + }).then((response) => { + if (!response.ok) throw Error("don't get a full detail Event"); + return response.json() + }).then((events) => { resolve(events) }).catch((error) => { + reject(error.message) + }) + }) + return promise; +} + +const Event = () => { + const [clickDate, setClickDate] = React.useState(""); + const [clickChangeDate, setClickChangeDate] = React.useState(""); + const [onChangeSelectedEvent, setOnChangeSelectedEvent] = React.useState([]) + const [viewMode, setViewMode] = React.useState("process") + const [events, setEvents] = React.useState([]) + React.useEffect(() => { + //set inital time + var t = dateFormat(clickDate, "dd/mm/yyyy") + setClickChangeDate(t); + + //get Event from database + setViewMode("process"); + getEvent().then((events) => { + setViewMode("showAllEvent") + events.forEach((event) => { + //convert into string and data format + event.eventDate = dateFormat(event.eventDate, "dd/mm/yyyy"); + // alert(event.eventDate) + //Convert Time to am/pm + var timeString = event.eventTime; + const timeString12hr = new Date('1970-01-01T' + timeString + 'Z') + .toLocaleTimeString('en-US', + { timeZone: 'UTC', hour12: true, hour: 'numeric', minute: 'numeric' } + ); + event.eventTime = timeString12hr; + }) + setEvents(events); + clickEvents() + }, (error) => { + // viewMode("process") + // console.log(error); + }) + } + , []) + + function onChange(calDate) { + setClickDate(calDate); + var r = calDate; + // var t=format(r, 'yyyy/MM/dd kk:mm:ss') + var t = dateFormat(r, "dd/mm/yyyy") + setClickChangeDate(t) + clickEvents() + } + const clickEvents = () => { + // alert(clickChangeDate) + var selectedEvents = []; + events.forEach((event) => { + + if (event.eventDate === clickChangeDate) { + selectedEvents.push(event); + } + }) + setOnChangeSelectedEvent(selectedEvents); + } + const eventsDates = []; + const tileContent = ({ date, view }) => { + date = dateFormat(date, "dd/mm/yyyy") + events.forEach((event) => { + eventsDates.push({ "date": event.eventDate, "eventName": event.eventName }); + }) + + var i = 0; + while (i < eventsDates.length) { + if (date === eventsDates[i].date) { + return

*

+ } + i++; + } + } + const calenderStyle = { + color: "white", + width: "30%", + backgroundColor: "#e3e4e4", + padding: "10px", + fontFamily: "Arial", + marging: "50px", + leftPadding: "100px" + }; + const styleShowOnTime = { + color: "#3a3f6d", + width: "50%", + height: "200px", + position: "absolute", + top: "100px", + right: "10px", + // border: "1px solid", + padding: "10px", + boxShadow: "2px 2px 12px 2px #888888", + backgroundColor: "#e3e4e4", + borderRadius: "10px", + alignItems: "Center", + padding: "10px", + fontFamily: "Arial", + }; + function gettingEventWhenChange() { + getEvent().then((events) => { + setViewMode("showAllEvent") + events.forEach((event) => { + //convert into string and data format + event.eventDate = dateFormat(event.eventDate, "dd/mm/yyyy"); + // alert(event.eventDate) + //Convert Time to am/pm + var timeString = event.eventTime; + const timeString12hr = new Date('1970-01-01T' + timeString + 'Z') + .toLocaleTimeString('en-US', + { timeZone: 'UTC', hour12: true, hour: 'numeric', minute: 'numeric' } + ); + event.eventTime = timeString12hr; + }) + setEvents(events); + clickEvents() + }, (error) => { + // viewMode("process") + console.log(error); + }) + } + const deleteingEvent = (id) => { + setViewMode("process"); + deleteEventByID(id).then((resolve) => { + setViewMode("showAllEvent"); + console.log(resolve.success); + }, (reject) => { + console.log("Event not delete ,due to some Error") + }) + gettingEventWhenChange(); + setViewMode("showAllEvent"); + } + const saveEditEvent = (event) => { + editEventByServer(event).then((suucess) => { + console.log("success"); + }).then((error) => { + console.log("unable to edit,please try again") + }) + gettingEventWhenChange(); + } + const a = { + backgroundColor: "#e3e4e4" + } + const addNewEvent = (ev) => { + setViewMode("addNewEvent"); + } + const cancelAddEvent = (ev) => { + setViewMode("showAllEvent") + } + const saveNewEvent = (newEvent) => { + setViewMode("process"); + saveNewEventOnServerSide(newEvent).then((newEventAdded) => { + events = newEventAdded; + }).then((error) => { + alert("sorry we Can't added,please try again") + }) + gettingEventWhenChange(); + setViewMode("showAllEvent") + } + + async function serachEvent(value) { + const eventsCome = []; + + await searchEventFromServerSide(value).then((eventsComeFromServer) => { + var i = 0; + while (i < eventsComeFromServer.length) { + eventsCome.push(eventsComeFromServer); + i++ + } + }, (error) => { + alert(error); + }) + + return eventsCome; + } + + const getAllEventDetail = (id) => { + getAllEventDetailFromServerSide(id) + } + + return ( +
+
+ +
+ +
+ + +
+ {viewMode === "process" && } + {viewMode === "showAllEvent" && } + {viewMode === "addNewEvent" && } +
+ + ); +}; + +const Processing = () => { + return ( +
+ +
+ ) +} +const ShowEventOntime = ({ events, clickDate }) => { + // const [eventDate,setEventDate]=React.useState(new Date()); + if (events.length != 0) return ( +
+

Events for this date are -{events.eventDate}

+
    + { + events.map((event) => { + return
  • {event.eventName}
  • + + }) + } +
+
+ ) + if (events.length === 0) return ( +
+
+

No events found on this date

+
+
+ ) +} + +const iconStyle = { + position: "absolute", + right: "15px", + cursor: "pointer" +} + +const ShowAllEvent = ({ events, deleteingEvent, savingEditEvent, addNewEvent, serachEvent, getAllEventDetail }) => { + const [changeEvent, setChangeEvent] = React.useState(false); + + const [entryAdmin, setEntryAdmin] = React.useState(true); + const [eventName, setEventname] = React.useState(""); + const [eventDate, setEventDate] = React.useState(""); + const [eventTime, setEventTime] = React.useState(""); + const [eventMgrId, setEventMenagerId] = React.useState(""); + const [editEventById, setEditEventById] = React.useState("") + const [eventDescription, setEventDescription] = React.useState(""); + const [addEvent, setAddEvent] = React.useState(false); + const [knowMore, setKnowMore] = React.useState(false) + var eventSearch = []; + // const [eventSearch,setEventSearch]=React.useState([]) + + const editEvent = (ev) => { + // alert(changeEvent+""+addEvent+""+knowMore) + setEditEventById(ev.currentTarget.id) + setChangeEvent(true); + // giveIninitalValue(); + events.forEach((event) => { + if (event.eventId === ev.currentTarget.id) { + setEventname(event.eventName); + setEventDate(event.eventDate); + setEventMenagerId(event.mgr_id); + setEventTime(event.eventTime); + setEventDescription(event.eventDescription); + } + }) + + } + + const deleteEvent = (ev) => { + // alert(ev.currentTarget.id) + deleteingEvent(ev.currentTarget.id) + } + + const cancelEditEvent = (ev) => { + setChangeEvent(false); + } + const saveEditEvent = (ev) => { + const event = { + "eventId": editEventById, + "eventName": eventName, + "eventDate": convertDate(eventDate), + "eventTime": convertTo24HrsFormat(eventTime), + "eventMgrId": eventMgrId, + "eventDescription": eventDescription + } + + savingEditEvent(event); + setChangeEvent(false); + } + const EditFormStyle = { + margin: "2.5px", + padding: "2.5px", + border: "1px solid #cf8372" + } + const addIconStyle = { + position: "absolute", + right: "10px", + border: "1px solid black", + cursor: "pointer" + } + const addEventClickHandle = (ev) => { + addNewEvent(ev); + } + function clickKnowMore(ev) { + setKnowMore(true) + setEditEventById(ev.currentTarget.id); + getAllEventDetail(ev.currentTarget.id) + } + async function SearchChangeEvent(ev) { + class Event { + constructor(eventId, eventName, eventDate, eventTime, mgr_id, eventDescription) { + this.eventId = eventId; + this.eventName = eventName; + this.eventDate = eventDate; + this.eventTime = eventTime; + this.mgr_id = mgr_id; + this.eventDescription = eventDescription; + } + } + var event; + + serachEvent(ev.currentTarget.value).then((e) => { + alert(JSON.stringify(e)) + var i = 0; + while (i < e.length) { + event = new Event(e[i].eventId, e[i].eventName, e[i].eventDate, e[i].eventTime, e[i].eventManagerId.e[i].eventDescription) + eventSearch.push(event); + i++; + } + }) + alert(eventSearch) + } + + if (!changeEvent && !addEvent && !knowMore) return ( + +
+

All Events{entryAdmin && }

+ + +
    + { + events.map((event) => { + return ( +
    +
    +
  • {event.eventId}
  • + Event Name {event.eventName}

    + Event Date - {event.eventDate}

    + Event Time - {event.eventTime}

    + Event Manage Id -{event.mgr_id}

    + Description - {event.eventDescription} + + {entryAdmin && +   + + + } +
    +
    + ) + + } + ) + } +
+
+ ) + if (changeEvent && !addEvent && !knowMore) { + return ( +
+

All Event

+
    { + events.map((event) => { + return ( +
    +
    +
  • {event.eventId}
  • + {editEventById === event.eventId && +
    + setEventname(e.target.value)} + /> + setEventDate(e.target.value)} + /> + setEventTime(e.target.value)} + /> + setEventMenagerId(e.target.value)} + /> + setEventDescription(e.target.value)} + /> +
    + + +
    +
    + + } + { + editEventById !== event.eventId && +

    {event.eventName}

    + {event.eventDate} ({event.eventTime}) +
    + } +
    +
    + ) + }) + }
+ +
+ ) + } + + + + if (!changeEvent && !addEvent && knowMore) { + // alert() + + + return ( +
+

Event

+
    { + events.map((event) => { + return ( +
    +
    +
  • {event.eventId}
  • + {editEventById === event.eventId && +
    +

    {event.eventName}

    + {event.eventDate}     + {event.eventTime} +
    + + } + { + editEventById !== event.eventId && +

    {event.eventName}

    + {event.eventDate} ({event.eventTime}) +
    + } +
    +
    + ) + }) + }
+ +
+ ) + } + + + + +} +const AddNewEvent = ({ cancelAddEvent, saveNewEvent, events }) => { + const [eventId, setEventId] = React.useState(""); + const [eventName, setEventName] = React.useState("") + const [eventDate, setEventDate] = React.useState(""); + const [eventTime, setEventTime] = React.useState(""); + const [eventManagerId, setEventMenagerId] = React.useState(""); + const [eventDescription, setEventDescription] = React.useState(""); + const [title, setTitle] = React.useState(""); + + const IdSameTitle = { + color: "red", + "justify-content": "center", + padding: "5px", + margin: "5px", + "text-align": "center", + "animation": { "effect": "blind", "duration": "5000" } + } + + const cancelEvent = (ev) => { + cancelAddEvent(ev); + } + const saveEvent = () => { + var i = 0; + while (i < events.length) { + if (events[i].eventId === eventId) { + setTitle("* Id already exits *"); + return; + } + i++; + } + const newEvent = { + "eventId": eventId, + "eventName": eventName, + "eventDate": convertDate(eventDate), + "eventTime": convertTo24HrsFormat(eventTime), + "eventManagerId": eventManagerId, + "eventDescription": eventDescription + } + setTitle("") + saveNewEvent(newEvent); + } + return ( +
+

You can ADD new Event ,right now

+
Your Event ID Must Be Unique
+
+ {title}

+ setEventId(e.target.value)} + />     + setEventName(e.target.value)} + />     + setEventDate(e.target.value)} + />     + setEventTime(e.target.value)} + />     + setEventMenagerId(e.target.value)} + />     + setEventDescription(e.target.value)} + /> +
+ + +
+
+ +
+ ) +} +export default Event; \ No newline at end of file diff --git a/src/pages/home.css b/src/pages/home.css new file mode 100644 index 0000000..c41d199 --- /dev/null +++ b/src/pages/home.css @@ -0,0 +1,3 @@ +.bg { + color: "red"; +} \ No newline at end of file diff --git a/src/pages/home.js b/src/pages/home.js index 28cdf58..6f791bb 100644 --- a/src/pages/home.js +++ b/src/pages/home.js @@ -1,11 +1,19 @@ import React from 'react'; -import image from './del.jpg'; -const Home = () => { - return ( -
-

Welcome to our website!

- -
+import styles from './my-style.module.css'; +const Styles = { + // opacity: "0.3", + color: "green", + backgroundImage: `url('https://i.postimg.cc/kMxrJHq4/banner.png')`, + height: "600px", + backgroundPosition: "center", + backgroundRepeat: "no-repeat", + backgroundSize: "cover", +} + +function Home() { + return ( +
+
); }; diff --git a/src/pages/login.js b/src/pages/login.js index 4c8b2b0..cb0bac3 100644 --- a/src/pages/login.js +++ b/src/pages/login.js @@ -1,8 +1,8 @@ import React from "react"; import ModalDialog from './ModalDialog'; -import Button from '@material-ui/core/Button'; -import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; +import loginImage from './loginImage.jpg' import { useNavigate } from 'react-router-dom' + const Login=()=>{ const navigate=useNavigate(); const [open, setOpen] = React.useState(true); @@ -15,10 +15,11 @@ const navigate=useNavigate(); setOpen(false); navigate('/') }; + return( -
-

LOgin

- +
+ +
diff --git a/src/pages/loginImage.jpg b/src/pages/loginImage.jpg new file mode 100644 index 0000000..04689b1 Binary files /dev/null and b/src/pages/loginImage.jpg differ diff --git a/src/pages/my-style.module.css b/src/pages/my-style.module.css new file mode 100644 index 0000000..b330bc7 --- /dev/null +++ b/src/pages/my-style.module.css @@ -0,0 +1,7 @@ +.bigblue { + color: DodgerBlue; + padding: 40px; + font-family: Sans-Serif; + text-align: center; + background-image: "https://ibb.co/9pRkDCG"; +} \ No newline at end of file diff --git a/src/pages/process.gif b/src/pages/process.gif index 5372a94..fe48668 100644 Binary files a/src/pages/process.gif and b/src/pages/process.gif differ diff --git a/src/sandra-seitamaa-Zcr67MPWsSM-unsplash.jpg b/src/sandra-seitamaa-Zcr67MPWsSM-unsplash.jpg new file mode 100644 index 0000000..074ae0c Binary files /dev/null and b/src/sandra-seitamaa-Zcr67MPWsSM-unsplash.jpg differ diff --git a/src/styling/colorcodes.txt b/src/styling/colorcodes.txt new file mode 100644 index 0000000..5f4115c --- /dev/null +++ b/src/styling/colorcodes.txt @@ -0,0 +1,5 @@ +#3a3f6d +#e3e4e4 +#e1b259 +#7b92cd +#7b92cd \ No newline at end of file