diff --git a/src/BackOffice/CreateNewEvent.jsx b/src/BackOffice/CreateNewEvent.jsx index 5f2ece4..e4fed3c 100644 --- a/src/BackOffice/CreateNewEvent.jsx +++ b/src/BackOffice/CreateNewEvent.jsx @@ -64,7 +64,8 @@ const CreateNewEvent = ({ }, ] ); - const [postTime, setPostTime] = useState(existingEvent.post_time ? existingEvent.post_time : 0); + const [postTime, setPostTime] = useState(existingEvent.post_time ? existingEvent.post_time : ""); + const [startTimePosts, setStartTimePosts] = useState(existingEvent.start_time_posts ? existingEvent.start_time_posts : "" ); /** *************************************************************************** */ @@ -159,6 +160,7 @@ const CreateNewEvent = ({ groups: groups.sort(groupComparator), posts: posts, post_time: postTime, + start_time_posts: startTimePosts, }; if (address.length >= 3) { @@ -355,13 +357,15 @@ const CreateNewEvent = ({ {newSubeventPage && ( )} diff --git a/src/BackOffice/EventWithPosts.js b/src/BackOffice/EventWithPosts.js index d27d2d9..bb70b83 100644 --- a/src/BackOffice/EventWithPosts.js +++ b/src/BackOffice/EventWithPosts.js @@ -1,11 +1,12 @@ -import React, { useCallback, useState } from "react"; +import React, { useCallback } from "react"; import AddPost from "./AddPost"; import AddEventButton from "./AddEventButton"; import uuid from "react-uuid"; import { Form, Input } from "semantic-ui-react"; -const EventWithPosts = ({ selectedGroups, posts, setPosts, setPostTime, postTime }) => { + +const EventWithPosts = ({ selectedGroups, posts, setPosts, setPostTime, postTime, setStartTimePosts, startTimePosts }) => { const groupsInUse = posts.map(post => post.startGroup) const newPost = { id: uuid(), @@ -13,7 +14,6 @@ const EventWithPosts = ({ selectedGroups, posts, setPosts, setPostTime, postTime startGroup: "", address: "", googleMaps: "", - timeOnEveryPost: "" } const deletePost = (id) => { @@ -40,7 +40,7 @@ const EventWithPosts = ({ selectedGroups, posts, setPosts, setPostTime, postTime { setPostTime(data.value); }} @@ -48,7 +48,23 @@ const EventWithPosts = ({ selectedGroups, posts, setPosts, setPostTime, postTime autoComplete="off" /> + + + { + setStartTimePosts(data.value) + }} + type="string" + autoComplete="off" + /> + + {/** Vis poster som er lagt til */} {posts.map((post) => ( { } export const mapTimeOnPosts = (event, sortedPosts) => { - let start_time = event.start_time; + let start_time = event.start_time_posts; const post_time = event.post_time; return sortedPosts.map(post => {