This commit is contained in:
emilyliublair 2021-09-11 17:48:17 -04:00
parent 1a51323c03
commit 3c08695e54
6 changed files with 419 additions and 36 deletions

View File

@ -38,9 +38,9 @@ export const EventInfo = ({route}) => {
const itemDate = new Date(item.event_date) const itemDate = new Date(item.event_date)
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
const months = ['January','February','March','April','May','June','July','August','September','October','November','December',] const months = ['January','February','March','April','May','June','July','August','September','October','November','December',]
const dayOfWeek = days[itemDate.getDay()] const dayOfWeek = days[itemDate.getDay()+1]
const month = months[itemDate.getMonth()] const month = months[itemDate.getMonth()]
const date = itemDate.getDate() const date = itemDate.getDate()+1
console.log(itemDate.getDate()) console.log(itemDate.getDate())
@ -83,7 +83,7 @@ const Event = (props) => {
return ( return (
<View> <View>
<TouchableOpacity style={[styles.listItem, {padding: '2%'}]} onPress={()=>props.navigation.navigate('EventInfo', {data:props.data, title: item.item.title,text:item.item.text,location:item.item.location,date:item.item.event_date, name:item.item.name, emails: item.item.emails})} activeOpacity={0.8}> <TouchableOpacity style={[styles.listItem, {padding: '2%'}]} onPress={()=>props.navigation.navigate('EventInfo', {data:props.data, title: item.item.title,text:item.item.text,location:item.item.location,event_date:item.item.event_date, name:item.item.name, emails: item.item.emails})} activeOpacity={0.8}>
<View style = {[styles.container2, {justifyContent: 'space-between'}]}> <View style = {[styles.container2, {justifyContent: 'space-between'}]}>
<View style={{display: 'flex', flexDirection: 'row'}}> <View style={{display: 'flex', flexDirection: 'row'}}>
<Ionicons name='calendar' size={32} color={'#323232'} style={{marginRight: 15}}/> <Ionicons name='calendar' size={32} color={'#323232'} style={{marginRight: 15}}/>
@ -209,10 +209,7 @@ class Calendar extends React.Component {
if (this.state.data.length >0) { if (this.state.data.length >0) {
try { try {
for (var i =0; i < this.state.data.length; i++) { for (var i =0; i < this.state.data.length; i++) {
console.log(String(this.state.data[i].event_date))
const itemDate = new Date(parseInt(String(this.state.data[i].event_date).split('-')[0]), parseInt(String(this.state.data[i].event_date).split('-')[1])-1, parseInt(String(this.state.data[i].event_date).split('-')[2])) const itemDate = new Date(parseInt(String(this.state.data[i].event_date).split('-')[0]), parseInt(String(this.state.data[i].event_date).split('-')[1])-1, parseInt(String(this.state.data[i].event_date).split('-')[2]))
console.log(itemDate)
console.log('he')
if (itemDate.getTime() == todayDate.getTime()) { if (itemDate.getTime() == todayDate.getTime()) {
today.push(this.state.data[i]) today.push(this.state.data[i])
} }
@ -226,8 +223,6 @@ class Calendar extends React.Component {
} }
} }
catch {null} catch {null}
} }
if (today.length === 0) todayBoolean = false if (today.length === 0) todayBoolean = false

View File

@ -21,9 +21,51 @@ CREATE TABLE teachers (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
lang VARCHAR, lang VARCHAR,
name VARCHAR NOT NULL, name VARCHAR NOT NULL,
emails VARCHAR[] emails VARCHAR NOT NULL
); );
CREATE TABLE announcements (
id SERIAL PRIMARY KEY,
lang VARCHAR,
message VARCHAR NOT NULL,
teacher VARCHAR NOT NULL,
date DATE,
time TIME
);
CREATE TABLE clubs (
id SERIAL PRIMARY KEY,
lang VARCHAR,
name VARCHAR NOT NULL,
meeting VARCHAR NOT NULL,
link VARCHAR NOT NULL,
sponsor VARCHAR NOT NULL
);
CREATE TABLE lunch_events (
id SERIAL PRIMARY KEY,
lang VARCHAR,
title VARCHAR NOT NULL,
text VARCHAR NOT NULL,
location VARCHAR NOT NULL,
time TIME
);
CREATE TABLE ssl_opps (
id SERIAL PRIMARY KEY,
lang VARCHAR,
title VARCHAR NOT NULL,
text VARCHAR NOT NULL,
location VARCHAR NOT NULL,
teacher VARCHAR NOT NULL,
time TIME
);
CREATE TABLE polls (
id SERIAL PRIMARY KEY,
lang VARCHAR,
url VARCHAR NOT NULL
);
CREATE TABLE new ( CREATE TABLE new (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
@ -32,3 +74,10 @@ CREATE TABLE new (
name VARCHAR NOT NULL, name VARCHAR NOT NULL,
new_date DATE new_date DATE
); );
CREATE TABLE important (
id SERIAL PRIMARY KEY,
lang VARCHAR,
image VARCHAR,
text VARCHAR NOT NULL
)

View File

@ -157,7 +157,7 @@ api_route! {
api_route! { api_route! {
teachers { teachers {
name: (Text, String, String), name: (Text, String, String),
emails: (Array<Text>, Vec<String>, EmailList), emails: (Text, String, String),
} }
} }
@ -170,6 +170,15 @@ api_route! {
} }
} }
api_route! {
student {
name: (Text, String, String),
meeting: (Text, String, String),
link: (Text, String, String),
sponsor: (Text, String, String),
}
}
api_route! { api_route! {
clubs { clubs {
name: (Text, String, String), name: (Text, String, String),

View File

@ -0,0 +1,174 @@
{{! vim: set ft=html: }}
<html>
<head>
<link rel="stylesheet" href="/static/style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;700&display=swap" rel="stylesheet">
</head>
<body>
<div class="container-md p-3" style="">
<h2 style="font-size: 24px; font-weight: bold">
Admin Panel
</h2>
</div>
<div class="container-md d-flex gap-4" style="">
<!-- announcements list -->
<div class="p-3" style="flex: 1;">
<h1 style="font-size: 28px;">Announcements</h1>
<div class="vstack gap-3 mt-4">
{{#each ctx}}
<div class="bg-light border rounded-3 p-2">
<small>ID: {{id}} | LANG: {{lang}}</small>
<h3 class="my-2" style="font-size: 18px;">{{teacher}}</h3>
<p class="mb-2">{{message}}</p>
<small><b>{{date}}</b> at time <b>{{time}}</b></small>
<form action="announcements/del" method="post">
<div class="d-flex mt-3">
<input type="number" class="form-control form-control-sm" id="id" name="id" value = {{id}} style="display: none">
</div>
<input type="submit" value="Delete">
</form>
</div>
{{/each}}
</div>
</div>
<!-- announcements actions -->
<div class="p-3" style="flex: 1;">
<h1 style="font-size: 28px;">Announcements Actions</h1>
<hr/>
<div class="my-4">
<h2 style="font-size: 20px;">Add Event</h2>
<form action="announcements/add" method="post">
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Lang</p>
<label for="lang" class="form-label"><small>'en' for English, 'es' for Spanish</small></label>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="lang" name="lang">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Teacher</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="teacher" name="teacher">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Message</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="message" name="message">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Date</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="date" name="date">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Time of Submission</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="time" name="time">
</div>
</div>
<input type="submit" value="Submit">
</form>
</div>
<div class="my-4">
<h2 style="font-size: 20px;">Update Event</h2>
<form action="anouncements/upd" method="post">
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">ID of event to update</p>
</div>
<div style="flex: 1; align: center;">
<input type="number" class="form-control form-control-sm" id="id" name="id">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Lang</p>
<label for="lang" class="form-label"><small>'en' for English, 'es' for Spanish</small></label>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="lang" name="lang">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Teacher</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="teacher" name="teacher">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Message</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="message" name="message">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Date</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="date" name="date">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Time of Submission</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="time" name="time">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Teacher/Organizer Email</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="emails" name="emails">
</div>
</div>
<input type="submit", value="Submit">
</form>
</div>
<hr/>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,175 @@
{{! vim: set ft=html: }}
<html>
<head>
<link rel="stylesheet" href="/static/style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;700&display=swap" rel="stylesheet">
</head>
<body>
<div class="container-md p-3" style="">
<h2 style="font-size: 24px; font-weight: bold">
Admin Panel
</h2>
</div>
<div class="container-md d-flex gap-4" style="">
<!-- clubs list -->
<div class="p-3" style="flex: 1;">
<h1 style="font-size: 28px;">Clubs</h1>
<div class="vstack gap-3 mt-4">
{{#each ctx}}
<div class="bg-light border rounded-3 p-2">
<small>ID: {{id}} | LANG: {{lang}}</small>
<h3 class="my-2" style="font-size: 18px;">{{name}}</h3>
<p class="mb-2">{{meeting}}</p>
<small><b>{{link}}</b></small>
<p class="mt-2 mb-0">Sponsor: {{sponsor}}</p>
<form action="clubs/del" method="post">
<div class="d-flex mt-3">
<input type="number" class="form-control form-control-sm" id="id" name="id" value = {{id}} style="display: none">
</div>
<input type="submit" value="Delete">
</form>
</div>
{{/each}}
</div>
</div>
<!-- clubs actions -->
<div class="p-3" style="flex: 1;">
<h1 style="font-size: 28px;">Clubs Actions</h1>
<hr/>
<div class="my-4">
<h2 style="font-size: 20px;">Add Event</h2>
<form action="clubs/add" method="post">
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Lang</p>
<label for="lang" class="form-label"><small>'en' for English, 'es' for Spanish</small></label>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="lang" name="lang">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Teacher</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="teacher" name="teacher">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Message</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="message" name="message">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Date</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="date" name="date">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Time of Submission</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="time" name="time">
</div>
</div>
<input type="submit" value="Submit">
</form>
</div>
<div class="my-4">
<h2 style="font-size: 20px;">Update Event</h2>
<form action="anouncements/upd" method="post">
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">ID of event to update</p>
</div>
<div style="flex: 1; align: center;">
<input type="number" class="form-control form-control-sm" id="id" name="id">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Lang</p>
<label for="lang" class="form-label"><small>'en' for English, 'es' for Spanish</small></label>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="lang" name="lang">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Teacher</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="teacher" name="teacher">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Message</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="message" name="message">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Date</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="date" name="date">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Time of Submission</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="time" name="time">
</div>
</div>
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">Teacher/Organizer Email</p>
</div>
<div style="flex: 1; align: center;">
<input type="text" class="form-control form-control-sm" id="emails" name="emails">
</div>
</div>
<input type="submit", value="Submit">
</form>
</div>
<hr/>
</div>
</div>
</body>
</html>

View File

@ -28,6 +28,12 @@
<p class="mb-2">{{text}}</p> <p class="mb-2">{{text}}</p>
<small><b>{{event_date}}</b> at <b>{{location}}</b></small> <small><b>{{event_date}}</b> at <b>{{location}}</b></small>
<p class="mt-2 mb-0">Organizer: {{name}} | Organizer Email: {{emails}}</p> <p class="mt-2 mb-0">Organizer: {{name}} | Organizer Email: {{emails}}</p>
<form action="events/del" method="post">
<div class="d-flex mt-3">
<input type="number" class="form-control form-control-sm" id="id" name="id" value = {{id}} style="display: none">
</div>
<input type="submit" value="Delete">
</form>
</div> </div>
{{/each}} {{/each}}
</div> </div>
@ -110,25 +116,6 @@
</form> </form>
</div> </div>
<hr/>
<div class="my-4">
<h2 style="font-size: 20px;">Delete Event</h2>
<form action="events/del" method="post">
<div class="d-flex mt-3">
<div style="flex: 1; justify-content: center;">
<p class="my-0">ID of event to delete</p>
</div>
<div style="flex: 1; align: center;">
<input type="number" class="form-control form-control-sm" id="id" name="id">
</div>
</div>
<input type="submit" value="Submit">
</form>
</div>
<hr/>
<div class="my-4"> <div class="my-4">
<h2 style="font-size: 20px;">Update Event</h2> <h2 style="font-size: 20px;">Update Event</h2>
<form action="events/upd" method="post"> <form action="events/upd" method="post">
@ -212,10 +199,4 @@
</div> </div>
</div> </div>
</body> </body>
</html> </html>
<!--<p>Teacher/Organizer </p>
<input type="text", id="name", name="name">
<p>Teacher/Organizer Email</p>
<input type="text", id="emails", name="emails">
<p></p>-_!>