Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/s06 fullcalendar back #66

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions client/src/graphQL/mutations/events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { gql } from "@apollo/client";

export const DELETE_EVENT = gql`
mutation DeleteEvent($eventId: Float!) {
deleteEvent(eventId: $eventId)
}
`;

export const UPDATE_EVENT = gql`
mutation UpdateEvent(
$eventId: Float!,
$trainerId: Float,
$serviceId: Float,
$date: DateTime,
$title: String,
$description: String,
$location: LocationInput,
$group_max_size: Float,
$price: Float
) {
updateEvent(
eventId: $eventId,
trainerId: $trainerId,
serviceId: $serviceId,
date: $date,
title: $title,
description: $description,
location: $location,
group_max_size: $group_max_size,
price: $price
) {
id
date
title
description
location {
address
city
postal_code
latitude
longitude
}
group_max_size
price
trainer {
id
user {
id
firstname
lastname
}
}
service {
id
name
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ces jonctions ne sont pas gérées dans le resolver.

}
}
`;
33 changes: 33 additions & 0 deletions client/src/graphQL/queries/event.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il manque le price et peut-être le service id et le user id ?

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { gql } from "@apollo/client";

export const GET_ALL_EVENTS = gql`
query GetAllEvents {
getAllEvents {
id
date
title
description
group_max_size
location {
latitude
longitude
}
}
}
`;

export const GET_EVENT_BY_ID = gql`
query GetEventById($eventId: Float!) {
getEventById(eventId: $eventId) {
id
date
title
description
location {
latitude
longitude
}
group_max_size
}
}
`;
3 changes: 2 additions & 1 deletion client/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Homepage from "@/pages/Homepage/Homepage.tsx";
import Login from "@/pages/Login/Login.tsx";
import NewPassword from "./pages/Login/NewPassword.tsx";
import Planning from "./pages/Planning/Planning.tsx";
import EventDetail from "./pages/Events/EventDetail.tsx";
import Profile from "@/pages/Profile/Profile.tsx";
import Registration from "./pages/Registration/Registration.tsx";
import ResetLink from "./pages/Login/ResetLink.tsx";
Expand Down Expand Up @@ -163,7 +164,7 @@ const router = createBrowserRouter([
},
{
path: ":id",
element: <EventId />,
element: <EventDetail />,
},
],
},
Expand Down
38 changes: 38 additions & 0 deletions client/src/pages/Events/EventDetail.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useParams } from "react-router-dom";
import { useQuery } from "@apollo/client";
import { GET_EVENT_BY_ID } from "@/graphQL/queries/event";

function EventDetail() {
const { id } = useParams();
const { data, loading, error } = useQuery(GET_EVENT_BY_ID, {
variables: { eventId: Number(id) },
});

if (loading) return <div>Chargement de l'événement...</div>;
if (error) return <div>Erreur : {error.message}</div>;

const event = data?.getEventById;

return (
<div className="event-detail">
<h1>{event.title}</h1>
<div className="event-info">
<p>Description : {event.description}</p>
<p>Date : {new Date(event.date).toLocaleString()}</p>
<p>Taille max du groupe : {event.group_max_size}</p>
<div className="event-location">
<p>Latitude : {event.location.latitude}</p>
<p>Longitude : {event.location.longitude}</p>
</div>
</div>
<div>
<a href="">Supprimer</a>
<br />
<br />
<a href="">Modifier l'événement</a>
</div>
</div>
);
}

export default EventDetail;
77 changes: 70 additions & 7 deletions client/src/pages/Planning/Planning.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,72 @@
@import '@style';

/* Container */

.calendar-container {
margin: 20px;
margin-top: 30px;
padding: 20px;

/* Under -> Allow to modify element per view */

/* dayGridMonth */
.event-content-month {
padding: 2px;

.event-title {
font-size: $s;
overflow: hidden;
text-overflow: ellipsis;
font-weight: $semiBold;
color: $primary-dark;

}

.fc-v-event {
background-color: $green-300;
width: 100%;
word-break: normal;
}
}

/* timeGridWeek */
.event-content-week {
padding: 4px;

.event-title {
font-size: 1em;
font-weight: bold;
margin-bottom: 4px;
}

.event-description {
font-size: 0.85em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}

/* listWeek */
.event-content-list {
padding: 8px;

.event-title {
font-size: 1.1em;
font-weight: bold;
margin-bottom: 6px;
}

.event-description {
font-size: 0.9em;
margin-bottom: 6px;
}

.event-details {
font-size: 0.85em;
color: #666;

.event-location {
margin-top: 4px;
}
}
}
}

.fc-theme-standard .fc-scrollgrid {
Expand Down Expand Up @@ -34,7 +96,7 @@
&:first-child {
border-top-left-radius: $atoms-radius !important;
}

&:last-child {
border-top-right-radius: $atoms-radius !important;
}
Expand All @@ -44,7 +106,7 @@
&:first-child {
border-bottom-left-radius: $atoms-radius !important;
}

&:last-child {
border-bottom-right-radius: $atoms-radius !important;
}
Expand Down Expand Up @@ -374,7 +436,8 @@
padding: 0.5rem !important;
}

.fc td, .fc th {
.fc td,
.fc th {
border-style: none;
}
}
Loading