front_foundation #9

Closed
mohamed_maoulainine wants to merge 181 commits from front_foundation into main
3 changed files with 282 additions and 10 deletions
Showing only changes of commit 60290956ec - Show all commits

View File

@ -0,0 +1,102 @@
<template>
Review

We must keep the same order for template and script everywhere.

We must keep the same order for template and script everywhere.
<form class="add-project-form" @submit.prevent="submitProject">
<h2>Ajouter un projet</h2>
<div class="form-group">
<label for="projectName">Nom du projet</label>
<input
id="projectName"
v-model="project.projectName"
type="text"
required
/>
</div>
<div class="form-group">
<label for="creationDate">Date de création</label>
<input
id="creationDate"
v-model="project.creationDate"
type="text"
placeholder="JJ-MM-AAAA"
required
/>
</div>
<div class="form-group">
Outdated
Review

For now, it would be better to hide this altogether, I don't think we will have time to implement it.

For now, it would be better to hide this altogether, I don't think we will have time to implement it.
<label for="logo">Logo</label>
<input
id="logo"
v-model="project.logo"
type="text"
placeholder="(à discuter)"
/>
</div>
<button type="submit">Ajouter</button>
</form>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { postApi } from "@/services/api.ts";
const project = ref({
idProject: 0,
projectName: "",
creationDate: "",
logo: "to be discussed not yet fixed",
});
function submitProject() {
postApi("/admin/projects/add", project.value);
}
</script>
<style scoped>
Outdated
Review

The h2 from this file is the same as the h3 from the next (AgendaComponent). It would be better to have a single css file for this part.

The h2 from this file is the same as the h3 from the next (AgendaComponent). It would be better to have a single css file for this part.
.add-project-form {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background: #fff;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h2 {
margin-bottom: 20px;
font-size: 24px;
color: #333;
}
.form-group {
margin-bottom: 15px;
display: flex;
flex-direction: column;
}
label {
font-weight: bold;
margin-bottom: 5px;
}
input {
padding: 8px;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
background-color: #4caf50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 5px;
cursor: pointer;
Review

same, button should look the same in the project, so the css shouldn't be scoped here

same, button should look the same in the project, so the css shouldn't be scoped here
}
button:hover {
background-color: #45a049;
}
</style>

View File

@ -0,0 +1,149 @@
<template>
<div class="project">
<div class="project-header">
<div class="project-title">
<h2>{{ projectName }}</h2>
<p>projet mis le: {{ creationDate }}</p>
</div>
<div class="project-button">
<button id="accept" @click="acceptProject">Accepter</button>
<button id="refus" @click="refuseProject">Refuser</button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { defineProps } from "vue";
import { postApi } from "@/services/api";
import { addNewMessage, color } from "@/services/popupDisplayer";
const props = defineProps<{
projectName: string;
creationDate: string;
}>();
const URI = "/admin/projects/pending/decision";
const sendDecision = (decision: "true" | "false") => {
postApi(
URI,
{
projectName: props.projectName,
decision,
},
() => {
addNewMessage(
`Projet ${props.projectName} ${decision === "true" ? "accepté" : "refusé"}`,
color.Green
);
},
(err) => {
addNewMessage(`Erreur lors de la décision`, color.Red);
console.error(err);
}
);
};
const acceptProject = () => sendDecision("true");
const refuseProject = () => sendDecision("false");
</script>
<style scoped>
.project {
background: linear-gradient(to right, #f4f4f4, #ffffff);
border: 1px solid #ddd;
border-radius: 10px;
padding: 20px;
margin: 20px 0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
font-family: Arial, sans-serif;
}
/* Header Styling */
.project-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.project-title {
display: flex;
flex-direction: column;
}
.project-title h2 {
font-size: 20px;
color: #333;
margin: 0;
}
.project-title p {
font-size: 14px;
color: #777;
margin-top: 4px;
}
/* Button Container */
.project-buttons {
display: flex;
gap: 10px;
}
#accept {
background-color: #45a049;
}
#refus {
background-color: red;
}
button {
padding: 10px 15px;
color: white;
border: none;
cursor: pointer;
border-radius: 5px;
}
button:hover {
transform: scale(1.05);
}
#accept:hover {
background-color: #3e8e41;
}
#refus:hover {
background-color: darkred;
}
/* Project Body (unchanged) */
.project-body {
margin-top: 15px;
}
.project-body p {
font-size: 16px;
color: #555;
margin-bottom: 10px;
}
.project-body ul {
list-style-type: disc;
margin: 0;
padding-left: 20px;
}
.project-body ul li {
font-size: 14px;
color: #666;
line-height: 1.6;
}
</style>

View File

@ -1,8 +1,9 @@
<template> <template>
<Header /> <Header />
<error-wrapper></error-wrapper> <error-wrapper></error-wrapper>
<div id="container"> <div id="container">
Outdated
Review

it's a bit weird to have content here, if this file replaces main.vue, fine bud don"t put content on it

it's a bit weird to have content here, if this file replaces main.vue, fine bud don"t put content on it
<div id="main"> <div id="main">
<h3> Projet en cours </h3>
<ProjectComp <ProjectComp
v-for="(project, index) in projects" v-for="(project, index) in projects"
:key="index" :key="index"
@ -10,11 +11,24 @@
:listName="project.members" :listName="project.members"
:projectLink="project.link" :projectLink="project.link"
/> />
</div>
<div id ="main">
<h3> Projet en attente </h3>
<PendingProjectComponent
v-for="( project, index) in pendingProjects"
:key="index"
:projectName="project.name"
:creationDate="project.creationDate"
/>
</div>
</div>
<Agenda :projectRDV="rendezVous" /> <Agenda :projectRDV="rendezVous" />
</div> </div>
<AddProjectForm/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -24,14 +38,15 @@ import { callApi } from "@/services/api";
import Header from "../components/HeaderComponent.vue"; import Header from "../components/HeaderComponent.vue";
import Agenda from "../components/Agenda.vue"; import Agenda from "../components/Agenda.vue";
import ProjectComp from "../components/ProjectComponent.vue"; import ProjectComp from "../components/ProjectComponent.vue";
import PendingProjectComponent from "@/components/PendingProjectComponent.vue";
import AddProjectForm from "@/components/AddProjectForm.vue";
const PORT = "8081"; const PORT = "8081";
const URI = `http://localhost:${PORT}`; const URI = `http://localhost:${PORT}`;
const projects = ref<{ name: string; link: string; members: string[] }[]>([]); //const projects = ref<{ name: string; link: string; members: string[] }[]>([]);
Outdated
Review

remove this comment

remove this comment
const fetchProjects = () => { /* const fetchProjects = () => {
callApi( callApi(
`${URI}/admin/projects`, `${URI}/admin/projects`,
async (response) => { async (response) => {
@ -71,10 +86,10 @@ const fetchProjects = () => {
}; };
onMounted(fetchProjects); onMounted(fetchProjects);
*/
Outdated
Review

what is that for ?

what is that for ?
const projects = ref([
/*const projects = ref([
{ {
name: "Projet Alpha", name: "Projet Alpha",
link: "/canvas", // to test link: "/canvas", // to test
@ -86,7 +101,13 @@ onMounted(fetchProjects);
members: ["David", "Eve", "Frank"], members: ["David", "Eve", "Frank"],
}, },
]); ]);
*/
const pendingProjects = ref ([
{ name: "l'eau", creationDate: "26-02-2024" },
{ name: "l'air", creationDate: "09-03-2023" },
])
const rendezVous = ref([ const rendezVous = ref([
{ projectName: "Projet Alpha", date: "2025-03-10", lieu: "P106" }, { projectName: "Projet Alpha", date: "2025-03-10", lieu: "P106" },
{ projectName: "Projet Beta", date: "2025-04-15", lieu: "Td10" }, { projectName: "Projet Beta", date: "2025-04-15", lieu: "Td10" },