From b30e1196f4a062099a3b6494170ad2172027f296 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Sat, 8 Feb 2025 20:18:44 +0100 Subject: [PATCH 001/143] canvas included in the main page, still shiting with vue --- front/MyINPulse-front/src/App.vue | 21 ++ .../src/components/canvas/Avantage.vue | 21 ++ .../src/components/canvas/Canaux.vue | 21 ++ .../src/components/canvas/Couts.vue | 21 ++ .../src/components/canvas/Header.vue | 37 ++++ .../src/components/canvas/Indicateurs.vue | 21 ++ .../src/components/canvas/Lean-canvas.vue | 42 ++++ .../src/components/canvas/Probleme.vue | 21 ++ .../src/components/canvas/Revenus.vue | 21 ++ .../src/components/canvas/Segments.vue | 21 ++ .../src/components/canvas/Solution.vue | 21 ++ .../src/components/canvas/Valeur.vue | 21 ++ .../src/components/canvas/style-project.css | 184 ++++++++++++++++++ front/MyINPulse-front/src/main.ts | 3 +- front/MyINPulse-front/src/router/index.ts | 7 + .../MyINPulse-front/src/views/CanvasView.vue | 12 ++ 16 files changed, 494 insertions(+), 1 deletion(-) create mode 100644 front/MyINPulse-front/src/components/canvas/Avantage.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Canaux.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Couts.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Header.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Indicateurs.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Lean-canvas.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Probleme.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Revenus.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Segments.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Solution.vue create mode 100644 front/MyINPulse-front/src/components/canvas/Valeur.vue create mode 100644 front/MyINPulse-front/src/components/canvas/style-project.css create mode 100644 front/MyINPulse-front/src/views/CanvasView.vue diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 71701b5..6c3e95f 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -3,6 +3,7 @@ import { RouterLink, RouterView } from 'vue-router' import HelloWorld from './components/HelloWorld.vue' import Header from './components/Header.vue'; import ProjectComp from './components/Project-comp.vue'; +import CanvasView from './components/canvas/Lean-canvas.vue'; + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Canaux.vue b/front/MyINPulse-front/src/components/canvas/Canaux.vue new file mode 100644 index 0000000..6aee546 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Canaux.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Couts.vue b/front/MyINPulse-front/src/components/canvas/Couts.vue new file mode 100644 index 0000000..c232d3f --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Couts.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Header.vue b/front/MyINPulse-front/src/components/canvas/Header.vue new file mode 100644 index 0000000..e860400 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Header.vue @@ -0,0 +1,37 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Indicateurs.vue b/front/MyINPulse-front/src/components/canvas/Indicateurs.vue new file mode 100644 index 0000000..0fd6d1a --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Indicateurs.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue b/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue new file mode 100644 index 0000000..0141a17 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue @@ -0,0 +1,42 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Probleme.vue b/front/MyINPulse-front/src/components/canvas/Probleme.vue new file mode 100644 index 0000000..d36b983 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Probleme.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Revenus.vue b/front/MyINPulse-front/src/components/canvas/Revenus.vue new file mode 100644 index 0000000..0b8b57e --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Revenus.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Segments.vue b/front/MyINPulse-front/src/components/canvas/Segments.vue new file mode 100644 index 0000000..76eaba5 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Segments.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Solution.vue b/front/MyINPulse-front/src/components/canvas/Solution.vue new file mode 100644 index 0000000..b3d5a05 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Solution.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Valeur.vue b/front/MyINPulse-front/src/components/canvas/Valeur.vue new file mode 100644 index 0000000..d577863 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/Valeur.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/style-project.css b/front/MyINPulse-front/src/components/canvas/style-project.css new file mode 100644 index 0000000..7761d40 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/style-project.css @@ -0,0 +1,184 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 10px; + } + + .canvas { + display: flex; + flex-direction: column; + max-width: 1200px; + margin: 20px auto; + border: 2px dashed #d33; + background: #fff; + } + + .row { + display: flex; + } + + .cell { + flex: 1; + border: 1px solid #ddd; + padding: 10px; + text-align: center; + background-color: #f1f1f1; + } + + .produit { + background-color: #f9e4e4; + } + + .marche { + background-color: #e4f1f9; + } + + .valeur { + background-color: #f9f4e4; + } + + h3 { + margin: 0; + font-size: 18px; + color: #333; + } + + p { + margin: 5px 0 0; + font-size: 14px; + } + + + body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #f9f9f9; + } + + h1 img { + height: 80px; + } + + .canvas { + max-width: 1200px; + margin: 20px auto; + padding: 20px; + border: 2px dashed #d33; + background-color: #fff; + } + + .row { + display: flex; + margin-bottom: 10px; + } + + .cell { + flex: 1; + border: 1px solid #ddd; + padding: 20px; + text-align: center; + background-color: #f1f1f1; + } + + #ade { + max-width: 1200px; + margin: 20px auto; + padding: 20px; + text-align: center; + background-color: #e8f5e9; + border: 2px solid #4caf50; + border-radius: 10px; + } + + #ade h3 { + color: #2e7d32; + } + + #ade p { + margin: 10px 0; + font-size: 16px; + color: #333; + } + header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px 20px; + background-color: #fff; + border-bottom: 2px solid #ddd; + } + + header img { + height: 60px; + } + + header .contact-menu { + position: relative; + } + + .expanded { + transform: scale(1.2); /* L'élément reste agrandi */ + transition: transform 0.3s ease; /* Animation fluide */ + } + + .contact-button, .return { + padding: 10px 15px; + border: none; + border-radius: 4px; + background-color: #2196f3; + color: #fff; + cursor: pointer; + } + + .contact-button:hover, .return:hover { + background-color: #1976d2; + } + + /* Dropdown styling */ + .contact-dropdown { + position: absolute; + right: 0; + top: 50px; + display: none; + flex-direction: column; + gap: 10px; + padding: 15px; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + z-index: 10; + } + + .contact-dropdown button { + padding: 8px 12px; + border: none; + border-radius: 4px; + background-color: #4caf50; + color: #fff; + cursor: pointer; + } + + .contact-dropdown button:hover { + background-color: #388e3c; + } + + .return { + background-color: #f44336; + } + + .return:hover { + background-color: #d32f2f; + } + + .header-buttons { + display: flex; + align-items: center; + gap: 15px; + } + + + a{ + color: white; + } \ No newline at end of file diff --git a/front/MyINPulse-front/src/main.ts b/front/MyINPulse-front/src/main.ts index e33d5c1..5bf00b7 100644 --- a/front/MyINPulse-front/src/main.ts +++ b/front/MyINPulse-front/src/main.ts @@ -25,7 +25,8 @@ keycloakService.CallInit(() => { }) -createApp(App).mount('#app'); +// this shit made by me so i can run the canva vue app +createApp(App).use(router).mount('#app'); // TODO: fix the comment /* diff --git a/front/MyINPulse-front/src/router/index.ts b/front/MyINPulse-front/src/router/index.ts index e9697d9..54cde30 100644 --- a/front/MyINPulse-front/src/router/index.ts +++ b/front/MyINPulse-front/src/router/index.ts @@ -19,6 +19,13 @@ const router = createRouter({ // which is lazy-loaded when the route is visited. component: () => import('../views/Home.vue'), }, + + // route pour les canvas (made by adnane), in fact the two vue apps are separated for now + { + path: '/canvas', + name: 'canvas', + component: () => import('../views/CanvasView.vue'), + }, ], }) diff --git a/front/MyINPulse-front/src/views/CanvasView.vue b/front/MyINPulse-front/src/views/CanvasView.vue new file mode 100644 index 0000000..d87bd29 --- /dev/null +++ b/front/MyINPulse-front/src/views/CanvasView.vue @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file From 4fda5513a920e58e50419140abec3965fbe55f3c Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Sat, 8 Feb 2025 20:33:03 +0100 Subject: [PATCH 002/143] error corrected --- front/MyINPulse-front/src/App.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 65e6bf6..f187256 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -43,8 +43,8 @@ button:hover { \ No newline at end of file + + + \ No newline at end of file From 3d4d5b90d18e6c51703780c2a122fa2a6f1229a7 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 13:03:26 +0100 Subject: [PATCH 004/143] Revert "fix: fixed TS errors" This reverts commit b5c9b4067228e267accfd6e1cffcd9c070146c9d. --- front/MyINPulse-front/src/services/api.ts | 4 ++-- front/MyINPulse-front/src/services/popupDisplayer.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/front/MyINPulse-front/src/services/api.ts b/front/MyINPulse-front/src/services/api.ts index cea6a9e..71e3194 100644 --- a/front/MyINPulse-front/src/services/api.ts +++ b/front/MyINPulse-front/src/services/api.ts @@ -34,11 +34,11 @@ axiosInstance.interceptors.response.use( ); // TODO: spawn a error modal -function defaultApiErrorHandler(err: string){ +function defaultApiErrorHandler(err: String){ addNewMessage(err, color.Red); } -function defaultApiSuccessHandler(response: any){ +function defaultApiSuccessHandler(response: () => void){ addNewMessage(response.data, color.green) } function callApi(endpoint: string, onSuccessHandler?: any, onErrorHandler?: any): void { diff --git a/front/MyINPulse-front/src/services/popupDisplayer.ts b/front/MyINPulse-front/src/services/popupDisplayer.ts index 3b222a2..77113f9 100644 --- a/front/MyINPulse-front/src/services/popupDisplayer.ts +++ b/front/MyINPulse-front/src/services/popupDisplayer.ts @@ -1,4 +1,5 @@ import {ref} from "vue"; + enum color {Red, Yellow, Blue, green} function addNewMessage(errorMessage: string, type?: color, timeout?: number){ @@ -14,6 +15,6 @@ function addNewMessage(errorMessage: string, type?: color, timeout?: number){ setTimeout(() => errorList.value.slice(0, 1), timeout) } -const errorList: any= ref([]) +const errorList = ref([]) export {addNewMessage, errorList, color} \ No newline at end of file From ac19d33bdb3c986f96dfe9e1c405d1722752c108 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Sun, 9 Feb 2025 13:05:28 +0100 Subject: [PATCH 005/143] Reapply "fix: fixed TS errors" This reverts commit 3d4d5b90d18e6c51703780c2a122fa2a6f1229a7. --- front/MyINPulse-front/src/services/api.ts | 4 ++-- front/MyINPulse-front/src/services/popupDisplayer.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/front/MyINPulse-front/src/services/api.ts b/front/MyINPulse-front/src/services/api.ts index 71e3194..cea6a9e 100644 --- a/front/MyINPulse-front/src/services/api.ts +++ b/front/MyINPulse-front/src/services/api.ts @@ -34,11 +34,11 @@ axiosInstance.interceptors.response.use( ); // TODO: spawn a error modal -function defaultApiErrorHandler(err: String){ +function defaultApiErrorHandler(err: string){ addNewMessage(err, color.Red); } -function defaultApiSuccessHandler(response: () => void){ +function defaultApiSuccessHandler(response: any){ addNewMessage(response.data, color.green) } function callApi(endpoint: string, onSuccessHandler?: any, onErrorHandler?: any): void { diff --git a/front/MyINPulse-front/src/services/popupDisplayer.ts b/front/MyINPulse-front/src/services/popupDisplayer.ts index 77113f9..3b222a2 100644 --- a/front/MyINPulse-front/src/services/popupDisplayer.ts +++ b/front/MyINPulse-front/src/services/popupDisplayer.ts @@ -1,5 +1,4 @@ import {ref} from "vue"; - enum color {Red, Yellow, Blue, green} function addNewMessage(errorMessage: string, type?: color, timeout?: number){ @@ -15,6 +14,6 @@ function addNewMessage(errorMessage: string, type?: color, timeout?: number){ setTimeout(() => errorList.value.slice(0, 1), timeout) } -const errorList = ref([]) +const errorList: any= ref([]) export {addNewMessage, errorList, color} \ No newline at end of file From 5145b833aea1fcbc031e04ba09f9a9c449fdfafc Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Mon, 10 Feb 2025 15:15:58 +0100 Subject: [PATCH 006/143] feat: rendez-vous agenda for admin and user --- front/MyINPulse-front/src/App.vue | 5 +- .../MyINPulse-front/src/components/Agenda.vue | 0 .../src/components/Project-comp.vue | 77 ++++++++++++++++--- 3 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 front/MyINPulse-front/src/components/Agenda.vue diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 4977758..72b8407 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -16,6 +16,7 @@ import ErrorWrapper from "@/views/errorWrapper.vue"; :key="index" :projectName="project.name" :listName="project.members" + :projectLink="project.link" />
@@ -59,12 +60,12 @@ export default { projects: [ { name: 'Projet Alpha', - //link: './project-alpha.html', + link: '/project-alpha.html',//to test members: ['Alice', 'Bob', 'Charlie'], }, { name: 'Projet Beta', - //link: './project-beta.html', + link: './project-beta.html', //to test members: ['David', 'Eve', 'Frank'], }, ], diff --git a/front/MyINPulse-front/src/components/Agenda.vue b/front/MyINPulse-front/src/components/Agenda.vue new file mode 100644 index 0000000..e69de29 diff --git a/front/MyINPulse-front/src/components/Project-comp.vue b/front/MyINPulse-front/src/components/Project-comp.vue index 258a6d5..a2e054b 100644 --- a/front/MyINPulse-front/src/components/Project-comp.vue +++ b/front/MyINPulse-front/src/components/Project-comp.vue @@ -1,31 +1,38 @@ - + \ No newline at end of file From 7a03146bf8a8761121edf0412cd48badf78d2277 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 10 Feb 2025 15:21:07 +0100 Subject: [PATCH 007/143] fix: commiting minor changes before switching to front_foundation branch --- front/MyINPulse-front/src/App.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 4977758..a0b43a9 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -17,10 +17,14 @@ import ErrorWrapper from "@/views/errorWrapper.vue"; :projectName="project.name" :listName="project.members" /> -
-
-
+ + + + + + + From b1df7421dc2b6b3d3a8f643a998cf4ba391db0a1 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 10 Feb 2025 15:32:28 +0100 Subject: [PATCH 008/143] fix: commiting some minor changes before switching to front_foundation branch --- .../canvas/{Header.vue => HeaderCanvas.vue} | 2 +- .../src/components/canvas/Lean-canvas.vue | 111 +++++++++++------- front/MyINPulse-front/src/router/index.ts | 0 front/MyINPulse-front/src/router/router.ts | 2 +- .../MyINPulse-front/src/views/CanvasView.vue | 22 ++-- 5 files changed, 83 insertions(+), 54 deletions(-) rename front/MyINPulse-front/src/components/canvas/{Header.vue => HeaderCanvas.vue} (93%) create mode 100644 front/MyINPulse-front/src/router/index.ts diff --git a/front/MyINPulse-front/src/components/canvas/Header.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue similarity index 93% rename from front/MyINPulse-front/src/components/canvas/Header.vue rename to front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index e860400..1063412 100644 --- a/front/MyINPulse-front/src/components/canvas/Header.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -1,6 +1,6 @@ + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/router/index.ts b/front/MyINPulse-front/src/router/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/front/MyINPulse-front/src/router/router.ts b/front/MyINPulse-front/src/router/router.ts index 16f4939..d5dd6fd 100644 --- a/front/MyINPulse-front/src/router/router.ts +++ b/front/MyINPulse-front/src/router/router.ts @@ -12,7 +12,7 @@ const router = createRouter({ component: () => import('../views/test.vue'), }, - // route pour les canvas (made by adnane), in fact the two vue apps are separated for now + // route pour les canvas { path: '/canvas', name: 'canvas', diff --git a/front/MyINPulse-front/src/views/CanvasView.vue b/front/MyINPulse-front/src/views/CanvasView.vue index d87bd29..9da9aff 100644 --- a/front/MyINPulse-front/src/views/CanvasView.vue +++ b/front/MyINPulse-front/src/views/CanvasView.vue @@ -1,12 +1,12 @@ - - - - \ No newline at end of file +
+ +

Page Canvas

+ +
+ + + From 9d71c93b5bfebe7a8a325ab11a81d2c5081d9339 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 10 Feb 2025 15:53:10 +0100 Subject: [PATCH 009/143] feat: layout changes --- .../src/components/canvas/Lean-canvas.vue | 111 +++++++++++------- 1 file changed, 70 insertions(+), 41 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue b/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue index 0141a17..40b1b80 100644 --- a/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue +++ b/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue @@ -1,42 +1,71 @@ - - - - - \ No newline at end of file +
+ + + + + + + + + +
+ + + + + \ No newline at end of file From 6a3d4239aba6d1611c2f121313dea0020ea5857a Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 10 Feb 2025 22:46:59 +0100 Subject: [PATCH 010/143] feat: canvas are now generic --- front/MyINPulse-front/src/App.vue | 2 +- .../src/components/canvas/Avantage.vue | 21 ----- .../src/components/canvas/Canaux.vue | 21 ----- .../src/components/canvas/CanvasItem.vue | 56 +++++++++++ .../src/components/canvas/Couts.vue | 21 ----- .../src/components/canvas/Header.vue | 37 -------- .../src/components/canvas/HeaderCanvas.vue | 36 ++++++++ .../src/components/canvas/Indicateurs.vue | 21 ----- .../src/components/canvas/Lean-canvas.vue | 71 -------------- .../src/components/canvas/LeanCanvas.vue | 92 +++++++++++++++++++ .../src/components/canvas/Probleme.vue | 21 ----- .../src/components/canvas/Revenus.vue | 21 ----- .../src/components/canvas/Segments.vue | 21 ----- .../src/components/canvas/Solution.vue | 21 ----- .../src/components/canvas/Valeur.vue | 21 ----- .../src/components/canvas/style-project.css | 15 +-- .../MyINPulse-front/src/views/CanvasView.vue | 8 +- 17 files changed, 194 insertions(+), 312 deletions(-) delete mode 100644 front/MyINPulse-front/src/components/canvas/Avantage.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Canaux.vue create mode 100644 front/MyINPulse-front/src/components/canvas/CanvasItem.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Couts.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Header.vue create mode 100644 front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Indicateurs.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Lean-canvas.vue create mode 100644 front/MyINPulse-front/src/components/canvas/LeanCanvas.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Probleme.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Revenus.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Segments.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Solution.vue delete mode 100644 front/MyINPulse-front/src/components/canvas/Valeur.vue diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 72b8407..a42626d 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -3,7 +3,7 @@ import { RouterLink, RouterView } from 'vue-router' import HelloWorld from './components/HelloWorld.vue' import Header from './components/Header.vue'; import ProjectComp from './components/Project-comp.vue'; -import CanvasView from './components/canvas/Lean-canvas.vue'; +import CanvasView from './components/canvas/LeanCanvas.vue'; import ErrorWrapper from "@/views/errorWrapper.vue"; diff --git a/front/MyINPulse-front/src/components/canvas/Avantage.vue b/front/MyINPulse-front/src/components/canvas/Avantage.vue deleted file mode 100644 index 59532ce..0000000 --- a/front/MyINPulse-front/src/components/canvas/Avantage.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Canaux.vue b/front/MyINPulse-front/src/components/canvas/Canaux.vue deleted file mode 100644 index 6aee546..0000000 --- a/front/MyINPulse-front/src/components/canvas/Canaux.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue new file mode 100644 index 0000000..120f255 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -0,0 +1,56 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Couts.vue b/front/MyINPulse-front/src/components/canvas/Couts.vue deleted file mode 100644 index c232d3f..0000000 --- a/front/MyINPulse-front/src/components/canvas/Couts.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Header.vue b/front/MyINPulse-front/src/components/canvas/Header.vue deleted file mode 100644 index e860400..0000000 --- a/front/MyINPulse-front/src/components/canvas/Header.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue new file mode 100644 index 0000000..565ef2f --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/front/MyINPulse-front/src/components/canvas/Indicateurs.vue b/front/MyINPulse-front/src/components/canvas/Indicateurs.vue deleted file mode 100644 index 0fd6d1a..0000000 --- a/front/MyINPulse-front/src/components/canvas/Indicateurs.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue b/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue deleted file mode 100644 index 40b1b80..0000000 --- a/front/MyINPulse-front/src/components/canvas/Lean-canvas.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue new file mode 100644 index 0000000..355ff27 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/front/MyINPulse-front/src/components/canvas/Probleme.vue b/front/MyINPulse-front/src/components/canvas/Probleme.vue deleted file mode 100644 index d36b983..0000000 --- a/front/MyINPulse-front/src/components/canvas/Probleme.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Revenus.vue b/front/MyINPulse-front/src/components/canvas/Revenus.vue deleted file mode 100644 index 0b8b57e..0000000 --- a/front/MyINPulse-front/src/components/canvas/Revenus.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Segments.vue b/front/MyINPulse-front/src/components/canvas/Segments.vue deleted file mode 100644 index 76eaba5..0000000 --- a/front/MyINPulse-front/src/components/canvas/Segments.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Solution.vue b/front/MyINPulse-front/src/components/canvas/Solution.vue deleted file mode 100644 index b3d5a05..0000000 --- a/front/MyINPulse-front/src/components/canvas/Solution.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/Valeur.vue b/front/MyINPulse-front/src/components/canvas/Valeur.vue deleted file mode 100644 index d577863..0000000 --- a/front/MyINPulse-front/src/components/canvas/Valeur.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/style-project.css b/front/MyINPulse-front/src/components/canvas/style-project.css index 7761d40..4369b49 100644 --- a/front/MyINPulse-front/src/components/canvas/style-project.css +++ b/front/MyINPulse-front/src/components/canvas/style-project.css @@ -58,14 +58,8 @@ body { h1 img { height: 80px; - } - - .canvas { - max-width: 1200px; - margin: 20px auto; - padding: 20px; - border: 2px dashed #d33; - background-color: #fff; + margin: 40px; + text-align: center; } .row { @@ -117,11 +111,6 @@ body { position: relative; } - .expanded { - transform: scale(1.2); /* L'élément reste agrandi */ - transition: transform 0.3s ease; /* Animation fluide */ - } - .contact-button, .return { padding: 10px 15px; border: none; diff --git a/front/MyINPulse-front/src/views/CanvasView.vue b/front/MyINPulse-front/src/views/CanvasView.vue index d87bd29..0c17286 100644 --- a/front/MyINPulse-front/src/views/CanvasView.vue +++ b/front/MyINPulse-front/src/views/CanvasView.vue @@ -1,5 +1,10 @@ \ No newline at end of file From 09e4b3262fc35f79d8cff6c4eccae0fb6a9d8f36 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Tue, 11 Feb 2025 19:55:28 +0100 Subject: [PATCH 011/143] feat: switching to composition API standard --- .../src/components/canvas/CanvasItem.vue | 50 ++++++++++----- .../src/components/canvas/LeanCanvas.vue | 62 ++++++------------- .../MyINPulse-front/src/views/CanvasView.vue | 11 ++-- 3 files changed, 59 insertions(+), 64 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index 120f255..d999eb9 100644 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -1,25 +1,40 @@ @@ -29,14 +44,21 @@ .cell { display: flex; - flex-direction: column; /* Pour empiler le titre et la description */ - align-items: center; /* Centre horizontalement */ - justify-content: center; /* Centre verticalement */ - text-align: center; /* Centre le texte */ + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; transition: all 0.3s ease; cursor: pointer; } + .cell_Expanded { + display: flex; + flex-direction: column; + align-items: center; + transition: all 0.3s ease; + cursor: pointer; + } .expanded { position: fixed; diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue index 355ff27..ee085bb 100644 --- a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -1,5 +1,5 @@ - - \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/Project-comp.vue b/front/MyINPulse-front/src/components/Project-comp.vue index a2e054b..bbdd841 100644 --- a/front/MyINPulse-front/src/components/Project-comp.vue +++ b/front/MyINPulse-front/src/components/Project-comp.vue @@ -110,6 +110,16 @@ const goToLink = () => { } - + button { + padding: 10px 15px; + background-color: #007bff; + color: white; + border: none; + cursor: pointer; + border-radius: 5px; +} + button:hover { + background-color: #0056b3; + } \ No newline at end of file diff --git a/front/MyINPulse-front/src/router/router.ts b/front/MyINPulse-front/src/router/router.ts index 16f4939..f77493e 100644 --- a/front/MyINPulse-front/src/router/router.ts +++ b/front/MyINPulse-front/src/router/router.ts @@ -12,7 +12,13 @@ const router = createRouter({ component: () => import('../views/test.vue'), }, - // route pour les canvas (made by adnane), in fact the two vue apps are separated for now + { + path: '/', + name: 'Admin-main', + component: () => import('../views/AdminMain.vue'), + }, + +// route pour les canvas (made by adnane), in fact the two vue apps are separated for now { path: '/canvas', name: 'canvas', diff --git a/front/MyINPulse-front/src/views/AdminMain.vue b/front/MyINPulse-front/src/views/AdminMain.vue new file mode 100644 index 0000000..2f5c4fc --- /dev/null +++ b/front/MyINPulse-front/src/views/AdminMain.vue @@ -0,0 +1,82 @@ + + + + + + + + \ No newline at end of file From 651fb2b1a1031a18d145c5dd3efc6b3614718fa8 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Tue, 18 Feb 2025 07:20:58 +0100 Subject: [PATCH 015/143] feat: adding first fake api (use this cmd in fake_data reportory: json-server --watch db.json --port 5000) + fetching witch axios for now (npm install axios) --- front/MyINPulse-front/fake_data/db.json | 8 ++ front/MyINPulse-front/src/App.vue | 5 +- .../src/components/canvas/HeaderCanvas.vue | 108 ++++++++++++++++-- front/MyINPulse-front/src/views/test.vue | 2 +- 4 files changed, 108 insertions(+), 15 deletions(-) create mode 100644 front/MyINPulse-front/fake_data/db.json diff --git a/front/MyINPulse-front/fake_data/db.json b/front/MyINPulse-front/fake_data/db.json new file mode 100644 index 0000000..53ffa8a --- /dev/null +++ b/front/MyINPulse-front/fake_data/db.json @@ -0,0 +1,8 @@ +{ + "entrepreneurs": [ + { "id": 1, "name": "Alice", "email": "alice@example.com" }, + { "id": 2, "name": "Bob", "email": "bob@example.com" }, + { "id": 3, "name": "Charlie", "email": "charlie@example.com" } + ] + } + \ No newline at end of file diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 9485baf..7302268 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -6,12 +6,9 @@ import ErrorWrapper from "@/views/errorWrapper.vue"; diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 565ef2f..1b05ff2 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -2,35 +2,123 @@
INPulse Logo
-
+
+ diff --git a/front/MyINPulse-front/src/views/test.vue b/front/MyINPulse-front/src/views/test.vue index 90db6d1..9bff439 100644 --- a/front/MyINPulse-front/src/views/test.vue +++ b/front/MyINPulse-front/src/views/test.vue @@ -3,7 +3,7 @@ import {store} from "../main.ts"; import {callApi} from "@/services/api.ts"; import ErrorModal from "@/components/errorModal.vue"; import {errorList} from "@/services/popupDisplayer.ts"; -import TempModal from "@/components/temp-modal.vue"; +//import TempModal from "@/components/temp-modal.vue"; import ErrorWrapper from "@/App.vue"; function addResToTable(id: any){ return (req: any) => { From 9f3754776f8cad3238281c84f51a2f44b3ca80b8 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Tue, 18 Feb 2025 22:17:57 +0100 Subject: [PATCH 016/143] fix: fixed the code for AdminMain --- front/MyINPulse-front/src/views/AdminMain.vue | 44 +++++++------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/front/MyINPulse-front/src/views/AdminMain.vue b/front/MyINPulse-front/src/views/AdminMain.vue index 2f5c4fc..657425c 100644 --- a/front/MyINPulse-front/src/views/AdminMain.vue +++ b/front/MyINPulse-front/src/views/AdminMain.vue @@ -24,37 +24,27 @@ import ProjectComp from '../components/Project-comp.vue'; - From d75d45e2043234131cecfae36cba2d141e98e6d7 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 19 Feb 2025 11:02:15 +0100 Subject: [PATCH 017/143] fix + feat: api test + error fix --- front/MyINPulse-front/fake_data/db.json | 10 +- front/MyINPulse-front/fake_data/open.sh | 2 + .../src/components/canvas/CanvasItem.vue | 98 ++++++++++-------- .../src/components/canvas/HeaderCanvas.vue | 52 +++++----- .../src/components/icons/logo inpulse.png | Bin 5269 -> 40328 bytes front/MyINPulse-front/src/views/AdminMain.vue | 10 +- 6 files changed, 89 insertions(+), 83 deletions(-) create mode 100755 front/MyINPulse-front/fake_data/open.sh diff --git a/front/MyINPulse-front/fake_data/db.json b/front/MyINPulse-front/fake_data/db.json index 53ffa8a..51a02c3 100644 --- a/front/MyINPulse-front/fake_data/db.json +++ b/front/MyINPulse-front/fake_data/db.json @@ -1,8 +1,10 @@ { - "entrepreneurs": [ + "entrepreneurs": [ { "id": 1, "name": "Alice", "email": "alice@example.com" }, { "id": 2, "name": "Bob", "email": "bob@example.com" }, { "id": 3, "name": "Charlie", "email": "charlie@example.com" } - ] - } - \ No newline at end of file + ], + "data": [ + { "data": "this is a fake data to test api" } + ] +} diff --git a/front/MyINPulse-front/fake_data/open.sh b/front/MyINPulse-front/fake_data/open.sh new file mode 100755 index 0000000..cd3b9b6 --- /dev/null +++ b/front/MyINPulse-front/fake_data/open.sh @@ -0,0 +1,2 @@ +#!/usr/bin/bash +json-server --watch db.json --port 5000 \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index b96a575..29228ce 100644 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -7,51 +7,63 @@

{{ title }}

{{ currentDescription }}

- + - - expanded.value = !expanded.value; - }; - - return { - expanded, - currentDescription, - toggleExpand - }; - } - }; - - - - \ No newline at end of file + } + diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 1b05ff2..6c8f6b0 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -17,39 +17,35 @@ - + diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 6c8f6b0..1fbe025 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -47,6 +47,7 @@ onMounted(fetchEntrepreneurs); diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue index ebfb9bf..175082b 100644 --- a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -37,6 +37,7 @@ export default { From 8071c01c5d002e8577d60f0123a04c466902fa0e Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Tue, 25 Feb 2025 22:53:15 +0100 Subject: [PATCH 019/143] fix: fixing the issues regarding the use of href --- .../src/components/Project-comp.vue | 14 +++++++++++--- front/MyINPulse-front/src/views/AdminMain.vue | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/front/MyINPulse-front/src/components/Project-comp.vue b/front/MyINPulse-front/src/components/Project-comp.vue index bbdd841..5a18b6c 100644 --- a/front/MyINPulse-front/src/components/Project-comp.vue +++ b/front/MyINPulse-front/src/components/Project-comp.vue @@ -1,7 +1,7 @@ - diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 1fbe025..8b08628 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -10,7 +10,9 @@ {{ email }} - + diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue index 175082b..a687982 100644 --- a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -10,30 +10,21 @@ - + \ No newline at end of file From 9ba8e3e84e4d3f72045dd2d2d748b93c59e1e7d5 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 19 Mar 2025 10:52:12 +0100 Subject: [PATCH 022/143] feat: fake-data can be edited, switching to end-points branch --- .../src/components/canvas/CanvasItem.vue | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index 729fef2..3e504e8 100644 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -5,7 +5,9 @@ @@ -64,9 +66,20 @@ const startEditing = () => { isEditing.value = true; }; -const saveEdit = () => { - currentDescription.value = editedDescription.value; - isEditing.value = false; +const saveEdit = async () => { + try { + const id = 1; // Mets l'ID ici (dans ton cas, l'unique entrée) + + await axios.put(`http://localhost:5000/data/${id}`, { + canva_data: editedDescription.value + }); + + // Mettre à jour l'affichage local après la mise à jour réussie + currentDescription.value = editedDescription.value; + isEditing.value = false; + } catch (error) { + console.error("Erreur lors de la mise à jour des données :", error); + } }; const cancelEdit = () => { @@ -135,8 +148,8 @@ const cancelEdit = () => { .button-container { position: absolute; - bottom: 20px; - right: 20px; + bottom: 40px; + right: 40px; display: flex; gap: 10px; } From 279c171ba220687da9b18c3b6822c6d856de448c Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 19 Mar 2025 11:54:34 +0100 Subject: [PATCH 023/143] fix: Doc added (for me) --- Documentation/openapi/main.yaml | 741 ++++++++++++++++++++++++++++++++ 1 file changed, 741 insertions(+) create mode 100644 Documentation/openapi/main.yaml diff --git a/Documentation/openapi/main.yaml b/Documentation/openapi/main.yaml new file mode 100644 index 0000000..263e9ab --- /dev/null +++ b/Documentation/openapi/main.yaml @@ -0,0 +1,741 @@ +openapi: 3.0.3 +info: + title: MyInpulse Backend Api + description: this document servers as a documentation for the backend api. + version: 0.0.0 + +tags: + - name: Entrepreneurs API + description: La partie de l'api dédiée aux entrepreneurs + - name: Admin API + description: La partie de l'api dédiée aux entrepreneurs + - name: Shared API + description: La partie de l'api dédiée aux entrepreneurs et admins + + +components: + schemas: + user: + type: object + properties: + nom: + type: string + prenom: + type: string + email: + type: string + example: "example@exmaple.com" + secondaryEmail: + type: string + example: "example@exmaple.com" + tel: + type: string + example: "0612345678" + user-entrepreneur: + type: object + properties: + user: + $ref: "#/components/schemas/user" + entrepreneur: + type: object + properties: + ecole: + type: string + example: "enseirb" + filiere: + type: string + example: "info" + status: + type: boolean + example: false + user-admin: + type: object + properties: + admin: + $ref: "#/components/schemas/user" + + securitySchemes: + MyINPulse: + type: oauth2 + flows: + implicit: + authorizationUrl: https://petstore3.swagger.io/oauth/authorize + scopes: + MyINPulse-admin: Administrateur + MyINPulse-entrepreneur: Utilisateur + +paths: + +# _ ____ __ __ ___ _ _ _ ____ ___ +# / \ | _ \| \/ |_ _| \ | | / \ | _ \_ _| +# / _ \ | | | | |\/| || || \| | / _ \ | |_) | | +# / ___ \| |_| | | | || || |\ | / ___ \| __/| | +# /_/ \_\____/|_| |_|___|_| \_| /_/ \_\_| |___| +# + + /admin/projects: + get: + summary: Retourne la liste of projets associés à l'admin + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + description: + JSON array of who's elements are objects containing necessary information for the view + (project name, entrepreneur names, etc..) + of the projects an admin is watching over. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + E_names: + type: string + description: entrepreneur names + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + /admin/projects/pending/decision: + post: + summary: valider un projet en attente de validation + tags: + - Admin API + description: + if the request is accepted the status of the + project is changed to ongoing, entrepreneur + account is confirmed and the project is linked + to the admin accepting the request and the + entrepreneur requesting it. Else the pending + project and user info are deleted. + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + pedingProjectId: + type: integer + decision: + type: boolean + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/projects/add: + post: + summary: Ajout manuel d'un projet + description: + Adds a project with the + inputed details + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/appointments/report/{appointmentId}: + put: + summary: enregistrer un rapport du rendez-vous + description: + Generate a PDF file formatted + from input text and links it + to the appointement. + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: appointmentId + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + body: + type: string + conclusion: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + post: + summary: modifier un rapport déja éxistant du rendez-vous + description: + Modifies the report file to input + text and links it to the appointement. + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: appointmentId + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + body: + type: string + conclusion: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + /admin/projects/remove/{projectId}: + delete: + summary: supression d'un project + description: + Removes the project + with the inputed id projectId + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: projectId + required: true + schema: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + /admin/projects/pending: + get: + summary: Retourne la liste des projets en attente de validation + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + description: + JSON array of who's elements are objects containing + necessary information for the view (project name, + entrepreneur names, etc..) of all pending projects. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + +# +# ____ _ _ _ ____ ___ +# / ___|| |__ __ _ _ __ ___ __| | / \ | _ \_ _| +# \___ \| '_ \ / _` | '__/ _ \/ _` | / _ \ | |_) | | +# ___) | | | | (_| | | | __/ (_| | / ___ \| __/| | +# |____/|_| |_|\__,_|_| \___|\__,_| /_/ \_\_| |___| +# + + /shared/appointments/upcoming: + get: + summary: Retourne la list des prochains rendez-vous de l'utilisateur + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of upcoming appointment data (name, date, time etc..) for a user. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + date: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /shared/projects/lcsection/{projectId}/{title}/{date}: + get: + summary: Retourne la liste de sections de LC avec un titre donné + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array containing Lean Canvas + section data with a title for the + current date (or given date if the + date parameter is passed) + parameters: + - in: path + required: true + name: projectId + schema: + type: integer + - in: path + required: true + description: this number can be 1, 2,...,8. It is associated with the title of the lcsection + name: title + schema: + type: integer + enum: [1, 2, 3, 4, 5, 6, 7, 8] + + - in: path + required: true + name: date + description: the date corresponding to the wanted version of lc section. "Nan" for the latest version + example: "NaN" + schema: + type: string + + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + section: + type: string + txt: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /shared/projects/entrepreneurs/{projectId}: + get: + summary: Retourne la liste d'entrepreneurs associée à un projet donné + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of entrepreneur + names associated with a project + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/user-entrepreneur" + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /shared/projects/admin/{projectId}: + get: + summary: Retourne les informations de l'admin qui accompagne le projet + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON object containing information (name, gmail, tel, etc..) + the admin supervising the project with id projectID. + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/user-admin" + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /shared/projects/appointments/{projectId}: + get: + summary: Retourne les rendez-vous du projet + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of upcoming and past appointment + data for the project with id projectID. + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + appointementId: + type: integer + name: + type: string + date: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + /shared/projects/appointments/report/{apointementId}: + get: + summary: Retourne le rapport pdf du rendez-vous + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + PDF file containing the ap- + pointment report + parameters: + - in: path + name: apointementId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/pdf: + schema: + type: string + format: binary + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /shared/appointments/request: + post: + summary: demander un rendez-vous + description: + will add an appointement request request by the applicant + to have an appointment to be confirmed or denied by the + specified participants of the appointement. + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-entrepreneur + - MyINPulse-admin + requestBody: + description: \"participants\" property is an array containing userids of the participants in the appointement + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + start_time: + type: string + end_time: + type: string + place: + type: string + applicantId: + type: integer + participants: + #/* */ + type: array + items: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + +# _____ _ _ _____ ____ _____ ____ ____ _____ _ _ _____ _ _ ____ +# | ____| \ | |_ _| _ \| ____| _ \| _ \| ____| \ | | ____| | | | _ \ +# | _| | \| | | | | |_) | _| | |_) | |_) | _| | \| | _| | | | | |_) | +# | |___| |\ | | | | _ <| |___| __/| _ <| |___| |\ | |___| |_| | _ < +# |_____|_|_\_| |_| |_| \_\_____|_| |_| \_\_____|_| \_|_____|\___/|_| \_\ +# / \ | _ \_ _| +# / _ \ | |_) | | +# / ___ \| __/| | +# /_/ \_\_| |___| +# + + + /entrepreneur/projects/request: + post: + summary: demander la création et validation d'un projet + tags: + - Entrepreneurs API + description: + Adds project to pending projects + to then be accepted or rejected by + an admin + security: + - MyINPulse: + - MyINPulse-entrepreneur + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + /entrepreneur/lcsection/add/{projectId}: + post: + summary: ajouter une sections au LC + description: + Adds input data to the user's LC + with a specified title. + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + txt: + type: string + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + /entrepreneur/lcsection/modify/{sectionId}: + put: + summary: modifier les données d'une section LC + description: + Modifies input Lean Canvas section by changing it to + the information in the request body and changes the + time stamp. + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: sectionId + schema: + type: integer + required: true + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + txt: + type: string + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /entrepreneur/lcsection/remove/{sectionId}: + delete: + summary: supprimer une section LC. + description: + Deletes section from Lean Canvas + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: sectionId + schema: + type: integer + required: true + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + + \ No newline at end of file From 5f51a1008bc3cfa605e16aed6d181c6746edeff3 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Thu, 20 Mar 2025 22:42:49 +0100 Subject: [PATCH 024/143] fix: fixing conflicts --- front/MyINPulse-front/fake_data/db.json | 10 + front/MyINPulse-front/fake_data/open.sh | 2 + .../src/components/canvas/CanvasItem.vue | 181 ++++++++++++++++++ .../src/components/canvas/HeaderCanvas.vue | 120 ++++++++++++ .../src/components/canvas/LeanCanvas.vue | 56 ++++++ .../src/components/canvas/style-project.css | 156 +++++++++++++++ .../MyINPulse-front/src/plugins/authStore.ts | 14 ++ 7 files changed, 539 insertions(+) create mode 100644 front/MyINPulse-front/fake_data/db.json create mode 100755 front/MyINPulse-front/fake_data/open.sh create mode 100644 front/MyINPulse-front/src/components/canvas/CanvasItem.vue create mode 100644 front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue create mode 100644 front/MyINPulse-front/src/components/canvas/LeanCanvas.vue create mode 100644 front/MyINPulse-front/src/components/canvas/style-project.css create mode 100644 front/MyINPulse-front/src/plugins/authStore.ts diff --git a/front/MyINPulse-front/fake_data/db.json b/front/MyINPulse-front/fake_data/db.json new file mode 100644 index 0000000..8a5776e --- /dev/null +++ b/front/MyINPulse-front/fake_data/db.json @@ -0,0 +1,10 @@ +{ + "entrepreneurs": [ + { "id": 1, "name": "Alice", "email": "alice@example.com" }, + { "id": 2, "name": "Bob", "email": "bob@example.com" }, + { "id": 3, "name": "Charlie", "email": "charlie@example.com" } + ], + "data": [ + { "canva_data": "this is a fake data to test api" } + ] +} diff --git a/front/MyINPulse-front/fake_data/open.sh b/front/MyINPulse-front/fake_data/open.sh new file mode 100755 index 0000000..cd3b9b6 --- /dev/null +++ b/front/MyINPulse-front/fake_data/open.sh @@ -0,0 +1,2 @@ +#!/usr/bin/bash +json-server --watch db.json --port 5000 \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue new file mode 100644 index 0000000..729fef2 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -0,0 +1,181 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue new file mode 100644 index 0000000..8b08628 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -0,0 +1,120 @@ + + + + + + + diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue new file mode 100644 index 0000000..a687982 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/front/MyINPulse-front/src/components/canvas/style-project.css b/front/MyINPulse-front/src/components/canvas/style-project.css new file mode 100644 index 0000000..e505a15 --- /dev/null +++ b/front/MyINPulse-front/src/components/canvas/style-project.css @@ -0,0 +1,156 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 10px; + } + + .row { + display: flex; + } + + .cell { + flex: 1; + border: 1px solid #ddd; + padding: 10px; + text-align: center; + background-color: #f1f1f1; + } + + .produit { + background-color: #f9e4e4; + } + + .marche { + background-color: #e4f1f9; + } + + .valeur { + background-color: #f9f4e4; + } + + h3 { + margin: 0; + font-size: 18px; + color: #333; + } + + p { + margin: 5px 0 0; + font-size: 14px; + } + + + body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #f9f9f9; + } + + h1 img { + height: 80px; + margin: 40px; + text-align: center; + } + + .row { + display: flex; + margin-bottom: 10px; + } + + #ade { + max-width: 1200px; + margin: 20px auto; + padding: 20px; + text-align: center; + background-color: #e8f5e9; + border: 2px solid #4caf50; + border-radius: 10px; + } + + #ade h3 { + color: #2e7d32; + } + + #ade p { + margin: 10px 0; + font-size: 16px; + color: #333; + } + header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px 20px; + background-color: #fff; + border-bottom: 2px solid #ddd; + } + + header img { + height: 60px; + } + + header .contact-menu { + position: relative; + } + + .contact-button, .return { + padding: 10px 15px; + border: none; + border-radius: 4px; + background-color: #2196f3; + color: #fff; + cursor: pointer; + } + + .contact-button:hover, .return:hover { + background-color: #1976d2; + } + + /* Dropdown styling */ + .contact-dropdown { + position: absolute; + right: 0; + top: 50px; + display: none; + flex-direction: column; + gap: 10px; + padding: 15px; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + z-index: 10; + } + + .contact-dropdown button { + padding: 8px 12px; + border: none; + border-radius: 4px; + background-color: #4caf50; + color: #fff; + cursor: pointer; + } + + .contact-dropdown button:hover { + background-color: #388e3c; + } + + .return { + background-color: #f44336; + } + + .return:hover { + background-color: #d32f2f; + } + + .header-buttons { + display: flex; + align-items: center; + gap: 15px; + } + + + a{ + color: white; + } \ No newline at end of file diff --git a/front/MyINPulse-front/src/plugins/authStore.ts b/front/MyINPulse-front/src/plugins/authStore.ts new file mode 100644 index 0000000..1a5c06e --- /dev/null +++ b/front/MyINPulse-front/src/plugins/authStore.ts @@ -0,0 +1,14 @@ +// file: src/plugins/authStore.js + +import { useAuthStore } from "@/stores/authStore.ts"; +import keycloakService from '@/services/keycloak'; +// Setup auth store as a plugin so it can be accessed globally in our FE +const authStorePlugin = { + install(app: any, option: any) { + const store = useAuthStore(option.pinia); + app.config.globalProperties.$store = store; + keycloakService.CallInitStore(store); + } +} + +export default authStorePlugin; \ No newline at end of file From 0f8c83c2e2ad758561ed9472037d084bed5fe7bd Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Fri, 21 Mar 2025 01:20:34 +0100 Subject: [PATCH 025/143] feat: adding the endpoints' doc to the branch for an easy access --- Documentation/openapi/main.yaml | 741 ++++++++++++++++++++++++++++++++ 1 file changed, 741 insertions(+) create mode 100644 Documentation/openapi/main.yaml diff --git a/Documentation/openapi/main.yaml b/Documentation/openapi/main.yaml new file mode 100644 index 0000000..263e9ab --- /dev/null +++ b/Documentation/openapi/main.yaml @@ -0,0 +1,741 @@ +openapi: 3.0.3 +info: + title: MyInpulse Backend Api + description: this document servers as a documentation for the backend api. + version: 0.0.0 + +tags: + - name: Entrepreneurs API + description: La partie de l'api dédiée aux entrepreneurs + - name: Admin API + description: La partie de l'api dédiée aux entrepreneurs + - name: Shared API + description: La partie de l'api dédiée aux entrepreneurs et admins + + +components: + schemas: + user: + type: object + properties: + nom: + type: string + prenom: + type: string + email: + type: string + example: "example@exmaple.com" + secondaryEmail: + type: string + example: "example@exmaple.com" + tel: + type: string + example: "0612345678" + user-entrepreneur: + type: object + properties: + user: + $ref: "#/components/schemas/user" + entrepreneur: + type: object + properties: + ecole: + type: string + example: "enseirb" + filiere: + type: string + example: "info" + status: + type: boolean + example: false + user-admin: + type: object + properties: + admin: + $ref: "#/components/schemas/user" + + securitySchemes: + MyINPulse: + type: oauth2 + flows: + implicit: + authorizationUrl: https://petstore3.swagger.io/oauth/authorize + scopes: + MyINPulse-admin: Administrateur + MyINPulse-entrepreneur: Utilisateur + +paths: + +# _ ____ __ __ ___ _ _ _ ____ ___ +# / \ | _ \| \/ |_ _| \ | | / \ | _ \_ _| +# / _ \ | | | | |\/| || || \| | / _ \ | |_) | | +# / ___ \| |_| | | | || || |\ | / ___ \| __/| | +# /_/ \_\____/|_| |_|___|_| \_| /_/ \_\_| |___| +# + + /admin/projects: + get: + summary: Retourne la liste of projets associés à l'admin + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + description: + JSON array of who's elements are objects containing necessary information for the view + (project name, entrepreneur names, etc..) + of the projects an admin is watching over. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + E_names: + type: string + description: entrepreneur names + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + /admin/projects/pending/decision: + post: + summary: valider un projet en attente de validation + tags: + - Admin API + description: + if the request is accepted the status of the + project is changed to ongoing, entrepreneur + account is confirmed and the project is linked + to the admin accepting the request and the + entrepreneur requesting it. Else the pending + project and user info are deleted. + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + pedingProjectId: + type: integer + decision: + type: boolean + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/projects/add: + post: + summary: Ajout manuel d'un projet + description: + Adds a project with the + inputed details + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/appointments/report/{appointmentId}: + put: + summary: enregistrer un rapport du rendez-vous + description: + Generate a PDF file formatted + from input text and links it + to the appointement. + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: appointmentId + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + body: + type: string + conclusion: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + post: + summary: modifier un rapport déja éxistant du rendez-vous + description: + Modifies the report file to input + text and links it to the appointement. + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: appointmentId + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + body: + type: string + conclusion: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + /admin/projects/remove/{projectId}: + delete: + summary: supression d'un project + description: + Removes the project + with the inputed id projectId + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: projectId + required: true + schema: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + /admin/projects/pending: + get: + summary: Retourne la liste des projets en attente de validation + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + description: + JSON array of who's elements are objects containing + necessary information for the view (project name, + entrepreneur names, etc..) of all pending projects. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + +# +# ____ _ _ _ ____ ___ +# / ___|| |__ __ _ _ __ ___ __| | / \ | _ \_ _| +# \___ \| '_ \ / _` | '__/ _ \/ _` | / _ \ | |_) | | +# ___) | | | | (_| | | | __/ (_| | / ___ \| __/| | +# |____/|_| |_|\__,_|_| \___|\__,_| /_/ \_\_| |___| +# + + /shared/appointments/upcoming: + get: + summary: Retourne la list des prochains rendez-vous de l'utilisateur + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of upcoming appointment data (name, date, time etc..) for a user. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + date: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /shared/projects/lcsection/{projectId}/{title}/{date}: + get: + summary: Retourne la liste de sections de LC avec un titre donné + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array containing Lean Canvas + section data with a title for the + current date (or given date if the + date parameter is passed) + parameters: + - in: path + required: true + name: projectId + schema: + type: integer + - in: path + required: true + description: this number can be 1, 2,...,8. It is associated with the title of the lcsection + name: title + schema: + type: integer + enum: [1, 2, 3, 4, 5, 6, 7, 8] + + - in: path + required: true + name: date + description: the date corresponding to the wanted version of lc section. "Nan" for the latest version + example: "NaN" + schema: + type: string + + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + section: + type: string + txt: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /shared/projects/entrepreneurs/{projectId}: + get: + summary: Retourne la liste d'entrepreneurs associée à un projet donné + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of entrepreneur + names associated with a project + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/user-entrepreneur" + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /shared/projects/admin/{projectId}: + get: + summary: Retourne les informations de l'admin qui accompagne le projet + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON object containing information (name, gmail, tel, etc..) + the admin supervising the project with id projectID. + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/user-admin" + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /shared/projects/appointments/{projectId}: + get: + summary: Retourne les rendez-vous du projet + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of upcoming and past appointment + data for the project with id projectID. + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + appointementId: + type: integer + name: + type: string + date: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + /shared/projects/appointments/report/{apointementId}: + get: + summary: Retourne le rapport pdf du rendez-vous + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + PDF file containing the ap- + pointment report + parameters: + - in: path + name: apointementId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/pdf: + schema: + type: string + format: binary + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /shared/appointments/request: + post: + summary: demander un rendez-vous + description: + will add an appointement request request by the applicant + to have an appointment to be confirmed or denied by the + specified participants of the appointement. + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-entrepreneur + - MyINPulse-admin + requestBody: + description: \"participants\" property is an array containing userids of the participants in the appointement + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + start_time: + type: string + end_time: + type: string + place: + type: string + applicantId: + type: integer + participants: + #/* */ + type: array + items: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + +# _____ _ _ _____ ____ _____ ____ ____ _____ _ _ _____ _ _ ____ +# | ____| \ | |_ _| _ \| ____| _ \| _ \| ____| \ | | ____| | | | _ \ +# | _| | \| | | | | |_) | _| | |_) | |_) | _| | \| | _| | | | | |_) | +# | |___| |\ | | | | _ <| |___| __/| _ <| |___| |\ | |___| |_| | _ < +# |_____|_|_\_| |_| |_| \_\_____|_| |_| \_\_____|_| \_|_____|\___/|_| \_\ +# / \ | _ \_ _| +# / _ \ | |_) | | +# / ___ \| __/| | +# /_/ \_\_| |___| +# + + + /entrepreneur/projects/request: + post: + summary: demander la création et validation d'un projet + tags: + - Entrepreneurs API + description: + Adds project to pending projects + to then be accepted or rejected by + an admin + security: + - MyINPulse: + - MyINPulse-entrepreneur + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + /entrepreneur/lcsection/add/{projectId}: + post: + summary: ajouter une sections au LC + description: + Adds input data to the user's LC + with a specified title. + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + txt: + type: string + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + /entrepreneur/lcsection/modify/{sectionId}: + put: + summary: modifier les données d'une section LC + description: + Modifies input Lean Canvas section by changing it to + the information in the request body and changes the + time stamp. + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: sectionId + schema: + type: integer + required: true + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + txt: + type: string + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /entrepreneur/lcsection/remove/{sectionId}: + delete: + summary: supprimer une section LC. + description: + Deletes section from Lean Canvas + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: sectionId + schema: + type: integer + required: true + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + + \ No newline at end of file From 79baddb8f663bd1f8448b51e0f890bfa8bc097a1 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Sun, 23 Mar 2025 21:59:27 +0100 Subject: [PATCH 026/143] fix + feat: fixed some bugs + added a mock parser since the damn backend is not working, not finished tho (bugs) --- front/MyINPulse-front/fake_data/db.json | 61 +++++- .../src/components/canvas/CanvasItem.vue | 188 ++++++++++++++---- .../src/components/canvas/LeanCanvas.vue | 21 +- .../MyINPulse-front/src/views/CanvasView.vue | 3 +- .../src/views/errorWrapper.vue | 2 +- 5 files changed, 216 insertions(+), 59 deletions(-) mode change 100644 => 100755 front/MyINPulse-front/src/components/canvas/CanvasItem.vue diff --git a/front/MyINPulse-front/fake_data/db.json b/front/MyINPulse-front/fake_data/db.json index 8a5776e..c04a261 100644 --- a/front/MyINPulse-front/fake_data/db.json +++ b/front/MyINPulse-front/fake_data/db.json @@ -1,10 +1,63 @@ { "entrepreneurs": [ - { "id": 1, "name": "Alice", "email": "alice@example.com" }, - { "id": 2, "name": "Bob", "email": "bob@example.com" }, - { "id": 3, "name": "Charlie", "email": "charlie@example.com" } + { "id": 1, "name": "Alice", "email": "alice@example.com" }, + { "id": 2, "name": "Bob", "email": "bob@example.com" }, + { "id": 3, "name": "Charlie", "email": "charlie@example.com" } ], "data": [ - { "canva_data": "this is a fake data to test api" } + { + "projectId": 1, + "title": 1, + "title_text": "1. Problème", + "description": "3 problèmes essentiels à résoudre pour le client" + }, + { + "projectId": 1, + "title": 2, + "title_text": "2. Segments", + "description": "Les segments de clientèle visés" + }, + { + "projectId": 1, + "title": 3, + "title_text": "3. Valeur", + "description": "La proposition de valeur" + }, + { + "projectId": 1, + "title": 4, + "title_text": "4. Solution", + "description": "Les solutions proposées" + }, + { + "projectId": 1, + "title": 5, + "title_text": "5. Avantage", + "description": "Les avantages concurrentiels" + }, + { + "projectId": 1, + "title": 6, + "title_text": "6. Canaux", + "description": "Les canaux de distribution" + }, + { + "projectId": 1, + "title": 7, + "title_text": "7. Indicateurs", + "description": "Les indicateurs clés de performance" + }, + { + "projectId": 1, + "title": 8, + "title_text": "8. Coûts", + "description": "Les coûts associés" + }, + { + "projectId": 1, + "title": 9, + "title_text": "9. Revenus", + "description": "Les sources de revenus" + } ] } diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue old mode 100644 new mode 100755 index 3e504e8..b4d43d9 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -1,23 +1,28 @@ @@ -25,16 +30,22 @@ import { ref, defineProps } from "vue"; import axios from "axios"; -const props = defineProps<{ - title: string; +const IS_MOCK_MODE = true; + +const props = defineProps<{ + projectId: number; + title: number; + title_text: string; description: string; }>(); const expanded = ref(false); -const isEditing = ref(false); -const currentDescription = ref(props.description); -const editedDescription = ref(props.description); +const currentDescriptions = ref([]); +const editedDescriptions = ref([]); +const isEditing = ref([]); + +/* const fetchData = async () => { try { const response = await axios.get("http://localhost:5000/data"); // Met à jour l'URL @@ -48,43 +59,121 @@ const fetchData = async () => { console.error("Erreur lors de la récupération des données :", error); } }; +*/ +// Fonction de simulation de l'API +const mockFetch = async (projectId: number, title: number, date: string) => { + console.log(`Mock fetch pour projectId: ${projectId}, title: ${title}, date: ${date}`); + + return new Promise<{ txt: string }[]>((resolve) => { + setTimeout(() => { + resolve([ + { txt: "Ceci est une description 1 pour tester the damn front, Why are u still reading dumbass this is just some nonsense sentence XD" }, + { txt: "Ceci est une description 1 pour tester the damn front, Bruh are u still here?" }, + { txt: "Ceci est une description 1 pour tester the damn front, .-. BRUH" } + ]); + }, 500); // Simule un délai réseau de 500ms + }); +}; + +// Fonction fetchData avec possibilité d'utiliser le mock +const fetchData = async (projectId: number, title: number, date: string, useMock = false) => { + try { + const responseData = useMock + ? await mockFetch(projectId, title, date) + : (await axios.get<{ txt: string }[]>( + `http://localhost:5000/shared/projects/lcsection/${projectId}/${title}/${date}` + )).data; + + if (responseData.length > 0) { + currentDescriptions.value = responseData.map((item) => item.txt); + editedDescriptions.value = [...currentDescriptions.value]; // Copie initiale + isEditing.value = Array(responseData.length).fill(false); + } else { + console.warn("Aucune donnée reçue."); + } + } catch (error) { + console.error("Erreur lors de la récupération des données :", error); + } +}; + +// Utilisation du mock dans handleClick pour tester sans serveur const handleClick = async () => { if (!expanded.value) { - await fetchData(); - } else if (!isEditing.value) { - currentDescription.value = props.description; - editedDescription.value = props.description; + await fetchData(props.projectId, props.title, "NaN", IS_MOCK_MODE); // true pour activer le mock + } else if (!isEditing.value.includes(true)) { + // Réinitialiser les descriptions si aucune édition n'est en cours + currentDescriptions.value = [props.description]; + editedDescriptions.value = [props.description]; } - if (!isEditing.value) { + if (!isEditing.value.includes(true)) { expanded.value = !expanded.value; } }; -const startEditing = () => { - isEditing.value = true; + +const startEditing = (index: number) => { + isEditing.value[index] = true; }; -const saveEdit = async () => { +/* +const saveEdit = async (index: number) => { try { - const id = 1; // Mets l'ID ici (dans ton cas, l'unique entrée) - + const id = index + 1; // À adapter selon l'ID réel des données await axios.put(`http://localhost:5000/data/${id}`, { - canva_data: editedDescription.value + canva_data: editedDescriptions.value[index] }); // Mettre à jour l'affichage local après la mise à jour réussie - currentDescription.value = editedDescription.value; - isEditing.value = false; + currentDescriptions.value[index] = editedDescriptions.value[index]; + isEditing.value[index] = false; } catch (error) { console.error("Erreur lors de la mise à jour des données :", error); } }; +*/ -const cancelEdit = () => { - editedDescription.value = currentDescription.value; - isEditing.value = false; +// Fonction de mock pour l'enregistrement +const mockSaveEdit = async (index: number) => { + try { + const id = index + 1; // À adapter selon l'ID réel des données + console.log(`Mock save pour l'ID ${id} avec la description : ${editedDescriptions.value[index]}`); + + // Simuler un délai d'enregistrement comme une requête réseau + await new Promise((resolve) => setTimeout(resolve, 500)); // Simulation de délai réseau + + // Mettre à jour l'affichage local après la mise à jour réussie + currentDescriptions.value[index] = editedDescriptions.value[index]; + isEditing.value[index] = false; + } catch (error) { + console.error("Erreur lors de la mise à jour des données mockées :", error); + } +}; + +// Utilisation de `mockSaveEdit` au lieu de `saveEdit` dans `handleClick` ou tout autre endroit +const saveEdit = async (index: number) => { + if (IS_MOCK_MODE) { + await mockSaveEdit(index); + } else { + try { + const id = index + 1; + await axios.put(`http://localhost:5000/data/${id}`, { + canva_data: editedDescriptions.value[index] + }); + + // Mettre à jour l'affichage local après la mise à jour réussie + currentDescriptions.value[index] = editedDescriptions.value[index]; + isEditing.value[index] = false; + } catch (error) { + console.error("Erreur lors de la mise à jour des données :", error); + } + } +}; + +const cancelEdit = (index: number) => { + editedDescriptions.value[index] = currentDescriptions.value[index]; + isEditing.value[index] = false; }; @@ -122,6 +211,17 @@ const cancelEdit = () => { color: #666; } +.cell .description { + width: 800px; + height: 100px; + overflow: hidden; + display: flex; + align-items: center; + justify-content: center; + text-align: center; + padding: 10px; +} + .expanded { position: fixed; top: 0; @@ -137,21 +237,21 @@ const cancelEdit = () => { } .edit-input { - width: 80%; + width: 800px; height: 100px; font-size: 16px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; margin-top: 10px; + box-sizing: border-box; } + .button-container { - position: absolute; - bottom: 40px; - right: 40px; display: flex; gap: 10px; + margin-top: 10px; } .edit-button, .save-button, .cancel-button { @@ -160,7 +260,8 @@ const cancelEdit = () => { border-radius: 5px; cursor: pointer; transition: background 0.3s ease; - font-size: 16px; + font-size: 12px; + margin-right: 5px; } .edit-button { @@ -190,5 +291,4 @@ const cancelEdit = () => { background-color: #c82333; } - - \ No newline at end of file + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue index a687982..61da1b2 100644 --- a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -4,7 +4,9 @@ v-for="(item, index) in items" :key="index" :title="item.title" + :title_text="item.title_text" :description="item.description" + :projectId="item.projectId" :class="item.class" /> @@ -15,16 +17,17 @@ import { ref } from "vue"; import CanvasItem from "@/components/canvas/CanvasItem.vue"; const items = ref([ - { title: "1. Problème", description: "3 problèmes essentiels à résoudre pour le client", class: "Probleme" }, - { title: "2. Segments", description: "Les segments de clientèle visés", class: "Segments" }, - { title: "3. Valeur", description: "La proposition de valeur", class: "Valeur" }, - { title: "4. Solution", description: "Les solutions proposées", class: "Solution" }, - { title: "5. Avantage", description: "Les avantages concurrentiels", class: "Avantage" }, - { title: "6. Canaux", description: "Les canaux de distribution", class: "Canaux" }, - { title: "7. Indicateurs", description: "Les indicateurs clés de performance", class: "Indicateurs" }, - { title: "8. Coûts", description: "Les coûts associés", class: "Couts" }, - { title: "9. Revenus", description: "Les sources de revenus", class: "Revenus" } + { projectId: 1, title: 1, title_text: "1. Problème", description: "3 problèmes essentiels à résoudre pour le client", class: "Probleme" }, + { projectId: 1, title: 2, title_text: "2. Segments", description: "Les segments de clientèle visés", class: "Segments" }, + { projectId: 1, title: 3, title_text: "3. Valeur", description: "La proposition de valeur", class: "Valeur" }, + { projectId: 1, title: 4, title_text: "4. Solution", description: "Les solutions proposées", class: "Solution" }, + { projectId: 1, title: 5, title_text: "5. Avantage", description: "Les avantages concurrentiels", class: "Avantage" }, + { projectId: 1, title: 6, title_text: "6. Canaux", description: "Les canaux de distribution", class: "Canaux" }, + { projectId: 1, title: 7, title_text: "7. Indicateurs", description: "Les indicateurs clés de performance", class: "Indicateurs" }, + { projectId: 1, title: 8, title_text: "8. Coûts", description: "Les coûts associés", class: "Couts" }, + { projectId: 1, title: 9, title_text: "9. Revenus", description: "Les sources de revenus", class: "Revenus" } ]); + From 323cb0538880ce0eff3aca3309b89f25ce057948 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 26 Mar 2025 11:07:50 +0100 Subject: [PATCH 028/143] fix: css fixing --- .../src/components/canvas/CanvasItem.vue | 67 +++++++++++++++---- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index b4d43d9..8cf2124 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -2,7 +2,7 @@

{{ title_text }}

-
+
-
+
@@ -87,7 +87,7 @@ const fetchData = async (projectId: number, title: number, date: string, useMock if (responseData.length > 0) { currentDescriptions.value = responseData.map((item) => item.txt); - editedDescriptions.value = [...currentDescriptions.value]; // Copie initiale + editedDescriptions.value = [...currentDescriptions.value]; isEditing.value = Array(responseData.length).fill(false); } else { console.warn("Aucune donnée reçue."); @@ -211,8 +211,8 @@ const cancelEdit = (index: number) => { color: #666; } -.cell .description { - width: 800px; +.cell { + width: 100%; height: 100px; overflow: hidden; display: flex; @@ -236,32 +236,71 @@ const cancelEdit = (index: number) => { box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } +.description { + width: 100%; + height: 100%; + font-size: 16px; + margin-top: 10px; + /*box-sizing: border-box;*/ + align-items: center; + justify-content: center; + text-align: center; + margin-left: 2%; +} + +.description + .p { + align-items: center; + justify-content: center; + text-align: center; +} + .edit-input { - width: 800px; - height: 100px; + width: 100%; + height: 100%; font-size: 16px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; margin-top: 10px; box-sizing: border-box; + margin-left: 2%; } - .button-container { - display: flex; - gap: 10px; - margin-top: 10px; + display: block; + margin-top: 20px; + justify-content: center; + align-items: center; } -.edit-button, .save-button, .cancel-button { - padding: 10px 15px; +.section-bloc ,.editing-section-bloc { + width: 100%; + justify-content: center; + align-items: center; + display: flex; + margin-right: 10%; + margin: 10px; +} + +.edit-button { + width: 100px; + height: 40px; + border: none; + border-radius: 5px; + cursor: pointer; + transition: background 0.3s ease; + font-size: 12px; + margin-right: 20px; +} + +.save-button, .cancel-button { + width: 100px; + height: 40px; border: none; border-radius: 5px; cursor: pointer; transition: background 0.3s ease; font-size: 12px; - margin-right: 5px; } .edit-button { From e769dd6757b9e1f2cf4f1f4a95e2978880b902d4 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 26 Mar 2025 11:30:59 +0100 Subject: [PATCH 029/143] fix: css fixing (again) --- .../src/components/canvas/CanvasItem.vue | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index 8cf2124..2d7f5e9 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -211,17 +211,6 @@ const cancelEdit = (index: number) => { color: #666; } -.cell { - width: 100%; - height: 100px; - overflow: hidden; - display: flex; - align-items: center; - justify-content: center; - text-align: center; - padding: 10px; -} - .expanded { position: fixed; top: 0; @@ -236,15 +225,16 @@ const cancelEdit = (index: number) => { box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } + .description { + display: flex; + align-items: center; /* Centre verticalement */ + justify-content: center; /* Centre horizontalement */ + text-align: center; /* Centre le texte à l'intérieur */ width: 100%; height: 100%; font-size: 16px; margin-top: 10px; - /*box-sizing: border-box;*/ - align-items: center; - justify-content: center; - text-align: center; margin-left: 2%; } @@ -266,11 +256,13 @@ const cancelEdit = (index: number) => { margin-left: 2%; } + .button-container { display: block; margin-top: 20px; justify-content: center; align-items: center; + gap: 10px; } .section-bloc ,.editing-section-bloc { @@ -301,6 +293,7 @@ const cancelEdit = (index: number) => { cursor: pointer; transition: background 0.3s ease; font-size: 12px; + margin-bottom: 5px; } .edit-button { From 4ef92efd0e132e233ff317bae6c33becd5228170 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Wed, 26 Mar 2025 11:31:54 +0100 Subject: [PATCH 030/143] fix: js to ts in header --- front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 8b08628..0fea105 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -19,7 +19,7 @@ - + + \ No newline at end of file From 288f983816d8f5a286b90651fc672a72300288cc Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 26 Mar 2025 11:44:49 +0100 Subject: [PATCH 032/143] merging --- front/MyINPulse-front/eslint.config.js | 29 ++++ .../src/components/HeaderComponent.vue | 26 ++++ .../src/components/ProjectComponent.vue | 130 ++++++++++++++++++ .../src/views/testComponent.vue | 79 +++++++++++ 4 files changed, 264 insertions(+) create mode 100644 front/MyINPulse-front/eslint.config.js create mode 100644 front/MyINPulse-front/src/components/HeaderComponent.vue create mode 100644 front/MyINPulse-front/src/components/ProjectComponent.vue create mode 100644 front/MyINPulse-front/src/views/testComponent.vue diff --git a/front/MyINPulse-front/eslint.config.js b/front/MyINPulse-front/eslint.config.js new file mode 100644 index 0000000..0fe1e5b --- /dev/null +++ b/front/MyINPulse-front/eslint.config.js @@ -0,0 +1,29 @@ +import eslint from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; +import eslintPluginVue from "eslint-plugin-vue"; +import globals from "globals"; +import typescriptEslint from "typescript-eslint"; + +export default typescriptEslint.config( + { ignores: ["*.d.ts", "**/coverage", "**/dist"] }, + { + extends: [ + eslint.configs.recommended, + ...typescriptEslint.configs.recommended, + ...eslintPluginVue.configs["flat/recommended"], + ], + files: ["**/*.{ts,vue}"], + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + globals: globals.browser, + parserOptions: { + parser: typescriptEslint.parser, + }, + }, + rules: { + // your rules + }, + }, + eslintConfigPrettier +); diff --git a/front/MyINPulse-front/src/components/HeaderComponent.vue b/front/MyINPulse-front/src/components/HeaderComponent.vue new file mode 100644 index 0000000..b285ca1 --- /dev/null +++ b/front/MyINPulse-front/src/components/HeaderComponent.vue @@ -0,0 +1,26 @@ + + + + + diff --git a/front/MyINPulse-front/src/components/ProjectComponent.vue b/front/MyINPulse-front/src/components/ProjectComponent.vue new file mode 100644 index 0000000..c3d9f29 --- /dev/null +++ b/front/MyINPulse-front/src/components/ProjectComponent.vue @@ -0,0 +1,130 @@ + + + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/views/testComponent.vue b/front/MyINPulse-front/src/views/testComponent.vue new file mode 100644 index 0000000..9ba1d5a --- /dev/null +++ b/front/MyINPulse-front/src/views/testComponent.vue @@ -0,0 +1,79 @@ + + + + + From 14a953536ab3999042f8f27e8f5c76300aadc99d Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 26 Mar 2025 11:45:40 +0100 Subject: [PATCH 033/143] merging --- front/MyINPulse-front/.prettierrc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 front/MyINPulse-front/.prettierrc diff --git a/front/MyINPulse-front/.prettierrc b/front/MyINPulse-front/.prettierrc new file mode 100644 index 0000000..18a9a8a --- /dev/null +++ b/front/MyINPulse-front/.prettierrc @@ -0,0 +1,7 @@ +{ + "useTabs":false, + "semi":true, + "trailingComma":"es5", + "arrowParens":"always", + "tabWidth":4 +} \ No newline at end of file From 4ec292cca7762997bec7f1161ea314e6f281211a Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 26 Mar 2025 11:50:23 +0100 Subject: [PATCH 034/143] fix: merging --- front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue old mode 100644 new mode 100755 From 15ccb5630aae57ef43a6481ef1148c9bf1905824 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 26 Mar 2025 11:52:04 +0100 Subject: [PATCH 035/143] MERGING --- .gitea/workflows/front.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitea/workflows/front.yaml diff --git a/.gitea/workflows/front.yaml b/.gitea/workflows/front.yaml new file mode 100644 index 0000000..6ad24d2 --- /dev/null +++ b/.gitea/workflows/front.yaml @@ -0,0 +1,24 @@ +name: CI +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install everything + working-directory: ./front/MyINPulse-front + run: npm i + + - name: Run ESLint + working-directory: ./front/MyINPulse-front + run: npx eslint + + - name: Run prettier + working-directory: ./front/MyINPulse-front + run: npx prettier src --check + + - name: Build frontend + working-directory: ./front/MyINPulse-front + run: npm run build \ No newline at end of file From 0ae6e7dfda77a5f3d7af6ed1a638ef649b2b2590 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 26 Mar 2025 11:53:49 +0100 Subject: [PATCH 036/143] merging --- .../src/components/canvas/HeaderCanvas.vue | 120 ------------------ 1 file changed, 120 deletions(-) delete mode 100755 front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue deleted file mode 100755 index 8b08628..0000000 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - From b9f3bbbe15361d3e9af90ec511800e1a1c66afa9 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Wed, 26 Mar 2025 11:59:16 +0100 Subject: [PATCH 037/143] fix: Adnane? --- front/MyINPulse-front/src/trash.vue | 215 ---------------------------- 1 file changed, 215 deletions(-) delete mode 100644 front/MyINPulse-front/src/trash.vue diff --git a/front/MyINPulse-front/src/trash.vue b/front/MyINPulse-front/src/trash.vue deleted file mode 100644 index 2220673..0000000 --- a/front/MyINPulse-front/src/trash.vue +++ /dev/null @@ -1,215 +0,0 @@ - - - - - \ No newline at end of file From 00a733c03bbf507427514919cb26b51b4a4f23e3 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 2 Apr 2025 10:52:41 +0200 Subject: [PATCH 038/143] fix: manine try now --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 6f4e820..beb949c 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,8 @@ dev-front: clean vite keycloak @cp config/frontdev.docker-compose.yaml docker-compose.yaml @docker compose up -d --build @cd ./front/MyINPulse-front/ && npm run dev + @echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)' + @echo "./gradlew bootRun --args='--server.port=8081'" prod: clean keycloak @cp config/prod.env front/MyINPulse-front/.env @@ -40,6 +42,7 @@ prod: clean keycloak @cp config/prod.env .env @cp config/prod.docker-compose.yaml docker-compose.yaml @docker compose up -d --build + From 03897e11395651ad8df60f13261e1226c254e956 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 2 Apr 2025 11:51:39 +0200 Subject: [PATCH 039/143] feat: mode admin added 'first try' --- .../src/components/canvas/CanvasItem.vue | 105 ++++++++++-------- 1 file changed, 61 insertions(+), 44 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index 6c2e6df..9065461 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -3,26 +3,41 @@

{{ title_text }}

- - - From 84d8d4523b59ebc7907c9ef577c3c31b8e1ef2b2 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Wed, 9 Apr 2025 00:09:58 +0200 Subject: [PATCH 044/143] feat: added a function for post and delete that follows callApi that only does get --- front/MyINPulse-front/src/services/api.ts | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/front/MyINPulse-front/src/services/api.ts b/front/MyINPulse-front/src/services/api.ts index 5c4fc7b..64e03a6 100644 --- a/front/MyINPulse-front/src/services/api.ts +++ b/front/MyINPulse-front/src/services/api.ts @@ -65,4 +65,28 @@ function callApi( ); } -export { callApi }; +function postApi( + endpoint: string, + data: any, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(endpoint, data) + .then(onSuccessHandler ?? defaultApiSuccessHandler) + .catch(onErrorHandler ?? defaultApiErrorHandler); +} + +function deleteApi( + endpoint: string, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .delete(endpoint) + .then(onSuccessHandler ?? defaultApiSuccessHandler) + .catch(onErrorHandler ?? defaultApiErrorHandler); +} + + +export { callApi, postApi, deleteApi }; From 8c4b9ceb9de6bee6bdb474f0a2b72fb9ce1a356d Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Wed, 9 Apr 2025 00:19:56 +0200 Subject: [PATCH 045/143] feat: still enhancing the visuals --- .../src/components/canvas/CanvasItem.vue | 12 +++++------- .../src/components/canvas/HeaderCanvas.vue | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index 2ff2219..cbb1e0d 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -199,9 +199,6 @@ const cancelEdit = (index: number) => { From 60290956ecca2e7e8d5f9809240be6f720ddc50e Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Wed, 9 Apr 2025 00:46:44 +0200 Subject: [PATCH 046/143] feat: added form to add project and pending project section for admin, i forgot to push them --- .../src/components/AddProjectForm.vue | 102 ++++++++++++ .../components/PendingProjectComponent.vue | 149 ++++++++++++++++++ front/MyINPulse-front/src/views/AdminMain.vue | 41 +++-- 3 files changed, 282 insertions(+), 10 deletions(-) create mode 100644 front/MyINPulse-front/src/components/AddProjectForm.vue create mode 100644 front/MyINPulse-front/src/components/PendingProjectComponent.vue diff --git a/front/MyINPulse-front/src/components/AddProjectForm.vue b/front/MyINPulse-front/src/components/AddProjectForm.vue new file mode 100644 index 0000000..7b59104 --- /dev/null +++ b/front/MyINPulse-front/src/components/AddProjectForm.vue @@ -0,0 +1,102 @@ + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/PendingProjectComponent.vue b/front/MyINPulse-front/src/components/PendingProjectComponent.vue new file mode 100644 index 0000000..8c8c250 --- /dev/null +++ b/front/MyINPulse-front/src/components/PendingProjectComponent.vue @@ -0,0 +1,149 @@ + + + + + + + + + \ No newline at end of file diff --git a/front/MyINPulse-front/src/views/AdminMain.vue b/front/MyINPulse-front/src/views/AdminMain.vue index 0e37829..eacccd2 100644 --- a/front/MyINPulse-front/src/views/AdminMain.vue +++ b/front/MyINPulse-front/src/views/AdminMain.vue @@ -1,8 +1,9 @@ diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue index c566f16..8f84140 100644 --- a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -1,5 +1,5 @@ diff --git a/front/MyINPulse-front/src/services/api.ts b/front/MyINPulse-front/src/services/api.ts index 64e03a6..6b9513f 100644 --- a/front/MyINPulse-front/src/services/api.ts +++ b/front/MyINPulse-front/src/services/api.ts @@ -89,4 +89,4 @@ function deleteApi( } -export { callApi, postApi, deleteApi }; +export { axiosInstance, callApi, postApi, deleteApi }; diff --git a/front/MyINPulse-front/src/views/CanvasView.vue b/front/MyINPulse-front/src/views/CanvasView.vue index 336acd1..822d6dc 100644 --- a/front/MyINPulse-front/src/views/CanvasView.vue +++ b/front/MyINPulse-front/src/views/CanvasView.vue @@ -1,12 +1,24 @@ @@ -14,5 +26,89 @@ // @ts-ignore import HeaderCanvas from "../components/canvas/HeaderCanvas.vue"; import LeanCanvas from '../components/canvas/LeanCanvas.vue'; +import { ref, onMounted } from "vue"; +import { axiosInstance } from "@/services/api.ts"; + +const IS_MOCK_MODE = true; + +// Variables pour les informations de l'administrateur +const admin = ref({ + idUser: 0, + userSurname: "", + userName: "", + primaryMail: "", + secondaryMail: "", + phoneNumber: "" +}); + +const mockAdminData = { + idUser: 1, + userSurname: "ALAMI", + userName: "Adnane", + primaryMail: "mock.admin@example.com", + secondaryMail: "admin.backup@example.com", + phoneNumber: "0600000000" +}; + +// Fonction pour récupérer les données de l'administrateur +const fetchAdminData = async (projectId: number, useMock = IS_MOCK_MODE) => { + try { + if (useMock) { + console.log("Utilisation des données mockées pour l'administrateur"); + admin.value = mockAdminData; + return; + } + + const response = await axiosInstance.get(`/shared/projects/admin/${projectId}`); + admin.value = response.data; + } catch (error) { + console.error("Erreur lors de la récupération des données de l'administrateur :", error); + } +}; + +// Appeler la fonction fetch au montage du composant +onMounted(() => { + const projectId = 1; + fetchAdminData(projectId); +}); - \ No newline at end of file + + \ No newline at end of file From 2b31753265c9e8d07438bbc71b1a9fad4f2a11fd Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Sat, 12 Apr 2025 03:55:30 +0200 Subject: [PATCH 048/143] feat: added an login page but the auth issue is still persisting, found a way to interprete the token the line is commneted in case it breaks code or needs a change --- .../src/components/LoginComponent.vue | 171 ++++++++++++++++++ .../components/PendingProjectComponent.vue | 2 +- front/MyINPulse-front/src/router/router.ts | 6 +- front/MyINPulse-front/src/stores/authStore.ts | 2 +- 4 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 front/MyINPulse-front/src/components/LoginComponent.vue diff --git a/front/MyINPulse-front/src/components/LoginComponent.vue b/front/MyINPulse-front/src/components/LoginComponent.vue new file mode 100644 index 0000000..ef48942 --- /dev/null +++ b/front/MyINPulse-front/src/components/LoginComponent.vue @@ -0,0 +1,171 @@ + + + + + + diff --git a/front/MyINPulse-front/src/components/PendingProjectComponent.vue b/front/MyINPulse-front/src/components/PendingProjectComponent.vue index 8c8c250..c6c95a6 100644 --- a/front/MyINPulse-front/src/components/PendingProjectComponent.vue +++ b/front/MyINPulse-front/src/components/PendingProjectComponent.vue @@ -3,7 +3,7 @@

{{ projectName }}

-

projet mis le: {{ creationDate }}

+

Projet mis le: {{ creationDate }}

diff --git a/front/MyINPulse-front/src/router/router.ts b/front/MyINPulse-front/src/router/router.ts index 6883c33..365e276 100644 --- a/front/MyINPulse-front/src/router/router.ts +++ b/front/MyINPulse-front/src/router/router.ts @@ -11,7 +11,11 @@ const router = createRouter({ // which is lazy-loaded when the route is visited. component: () => import('../views/testComponent.vue'), }, - + { + path: '/login', + name: 'login', + component: () => import('../components/LoginComponent.vue'), + }, { path: '/', name: 'Admin-main', diff --git a/front/MyINPulse-front/src/stores/authStore.ts b/front/MyINPulse-front/src/stores/authStore.ts index 06187ca..a5874d4 100644 --- a/front/MyINPulse-front/src/stores/authStore.ts +++ b/front/MyINPulse-front/src/stores/authStore.ts @@ -54,7 +54,7 @@ const useAuthStore = defineStore("storeAuth", { async logout() { try { await keycloakService.CallLogout( - import.meta.env.VITE_APP_URL + "/test" + import.meta.env.VITE_APP_URL + "/login" //redirect to login page instead of test... ); await this.clearUserData(); } catch (error) { From 70658e4fb98b1582b55f524068623e8566d5acb6 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Sat, 12 Apr 2025 22:22:22 +0200 Subject: [PATCH 049/143] fix: fixed an issue with the server by adding the dependency of jwt --- front/MyINPulse-front/package.json | 3 ++- front/MyINPulse-front/src/components/LoginComponent.vue | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/front/MyINPulse-front/package.json b/front/MyINPulse-front/package.json index ff46180..57ec628 100644 --- a/front/MyINPulse-front/package.json +++ b/front/MyINPulse-front/package.json @@ -18,7 +18,8 @@ "pinia": "^2.3.1", "pinia-plugin-persistedstate": "^4.2.0", "vue": "^3.5.13", - "vue-router": "^4.5.0" + "vue-router": "^4.5.0", + "jwt-decode": "^4.0.0" }, "devDependencies": { "@playwright/test": "^1.49.1", diff --git a/front/MyINPulse-front/src/components/LoginComponent.vue b/front/MyINPulse-front/src/components/LoginComponent.vue index ef48942..b752fe3 100644 --- a/front/MyINPulse-front/src/components/LoginComponent.vue +++ b/front/MyINPulse-front/src/components/LoginComponent.vue @@ -1,7 +1,7 @@ + + + \ No newline at end of file From 03bbc77e8aaea13a4449ed43104fdf6d877480cd Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Mon, 14 Apr 2025 01:32:29 +0200 Subject: [PATCH 051/143] fix: linting all the files possible error may still occur but i just ignored them cuz it's commented code, probably will fix them later if it persists --- front/MyINPulse-front/package-lock.json | 10 ++++++++++ front/MyINPulse-front/src/App.vue | 2 +- front/MyINPulse-front/src/components/Agenda.vue | 6 +++--- .../src/components/LoginComponent.vue | 2 +- .../src/components/ProjectComponent.vue | 4 ++-- .../src/components/canvas/CanvasItem.vue | 12 ++++++------ .../src/components/canvas/LeanCanvas.vue | 2 +- front/MyINPulse-front/src/views/AdminMain.vue | 12 ++++++------ front/MyINPulse-front/src/views/CanvasView.vue | 4 ++-- 9 files changed, 32 insertions(+), 22 deletions(-) diff --git a/front/MyINPulse-front/package-lock.json b/front/MyINPulse-front/package-lock.json index 8809acc..641b0b6 100644 --- a/front/MyINPulse-front/package-lock.json +++ b/front/MyINPulse-front/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "axios": "^1.7.9", "cors": "^2.8.5", + "jwt-decode": "^4.0.0", "keycloak-js": "^26.1.0", "pinia": "^2.3.1", "pinia-plugin-persistedstate": "^4.2.0", @@ -3588,6 +3589,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jwt-decode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/keycloak-js": { "version": "26.1.0", "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-26.1.0.tgz", diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index c675988..795a6d2 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -1,5 +1,5 @@ diff --git a/front/MyINPulse-front/src/components/Agenda.vue b/front/MyINPulse-front/src/components/Agenda.vue index f771e2a..e1af6d0 100644 --- a/front/MyINPulse-front/src/components/Agenda.vue +++ b/front/MyINPulse-front/src/components/Agenda.vue @@ -15,9 +15,9 @@ import { defineProps } from "vue"; interface rendezVous{ - projectName: String, - date: String, - lieu: String, + projectName: string, + date: string, + lieu: string, } const props = defineProps<{ diff --git a/front/MyINPulse-front/src/components/LoginComponent.vue b/front/MyINPulse-front/src/components/LoginComponent.vue index b752fe3..64a0ea4 100644 --- a/front/MyINPulse-front/src/components/LoginComponent.vue +++ b/front/MyINPulse-front/src/components/LoginComponent.vue @@ -54,7 +54,7 @@ onMounted(() => {
-
+

Access Token:

{{ store.user.token }}
diff --git a/front/MyINPulse-front/src/components/ProjectComponent.vue b/front/MyINPulse-front/src/components/ProjectComponent.vue index c3d9f29..0cff5f3 100644 --- a/front/MyINPulse-front/src/components/ProjectComponent.vue +++ b/front/MyINPulse-front/src/components/ProjectComponent.vue @@ -1,5 +1,5 @@ @@ -55,7 +55,7 @@ const IS_ADMIN = false; const props = defineProps<{ projectId: number; title: number; - title_text: string; + titleText: string; description: string; }>(); diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue index 8f84140..1f3219b 100644 --- a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -6,7 +6,7 @@ :title="item.title" :title_text="item.title_text" :description="item.description" - :projectId="item.projectId" + :project-id="item.projectId" :class="['canvas-item', item.class, 'card', 'shadow', 'p-3']" />
diff --git a/front/MyINPulse-front/src/views/AdminMain.vue b/front/MyINPulse-front/src/views/AdminMain.vue index eacccd2..5675037 100644 --- a/front/MyINPulse-front/src/views/AdminMain.vue +++ b/front/MyINPulse-front/src/views/AdminMain.vue @@ -7,9 +7,9 @@
@@ -18,15 +18,15 @@
- +
diff --git a/front/MyINPulse-front/src/views/CanvasView.vue b/front/MyINPulse-front/src/views/CanvasView.vue index 822d6dc..3f535f9 100644 --- a/front/MyINPulse-front/src/views/CanvasView.vue +++ b/front/MyINPulse-front/src/views/CanvasView.vue @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file From 8b863ee4b128b0464cf9d8fc476011c3f7b93676 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Wed, 16 Apr 2025 11:59:03 +0200 Subject: [PATCH 057/143] fix: adminview --- front/MyINPulse-front/src/components/ProjectComponent.vue | 2 +- front/MyINPulse-front/src/views/AdminMain.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/front/MyINPulse-front/src/components/ProjectComponent.vue b/front/MyINPulse-front/src/components/ProjectComponent.vue index 0cff5f3..983115f 100644 --- a/front/MyINPulse-front/src/components/ProjectComponent.vue +++ b/front/MyINPulse-front/src/components/ProjectComponent.vue @@ -31,7 +31,7 @@ const router = useRouter(); const goToLink = () => { if (props.projectLink) { - router.push(props.projectLink);0 + router.push(props.projectLink); } }; diff --git a/front/MyINPulse-front/src/views/AdminMain.vue b/front/MyINPulse-front/src/views/AdminMain.vue index 5675037..2b2bd4b 100644 --- a/front/MyINPulse-front/src/views/AdminMain.vue +++ b/front/MyINPulse-front/src/views/AdminMain.vue @@ -23,12 +23,12 @@ />
- + - + diff --git a/front/MyINPulse-front/src/components/PendingProjectComponent.vue b/front/MyINPulse-front/src/components/PendingProjectComponent.vue index c6c95a6..d93c94c 100644 --- a/front/MyINPulse-front/src/components/PendingProjectComponent.vue +++ b/front/MyINPulse-front/src/components/PendingProjectComponent.vue @@ -5,7 +5,7 @@

{{ projectName }}

Projet mis le: {{ creationDate }}

-
+
@@ -56,20 +56,26 @@ const refuseProject = () => sendDecision("false"); \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/ProjectComponent.vue b/front/MyINPulse-front/src/components/ProjectComponent.vue index 983115f..d4077f6 100644 --- a/front/MyINPulse-front/src/components/ProjectComponent.vue +++ b/front/MyINPulse-front/src/components/ProjectComponent.vue @@ -40,91 +40,70 @@ const goToLink = () => { \ No newline at end of file diff --git a/front/MyINPulse-front/src/views/AdminMain.vue b/front/MyINPulse-front/src/views/AdminMain.vue index 2b2bd4b..1bf8b5a 100644 --- a/front/MyINPulse-front/src/views/AdminMain.vue +++ b/front/MyINPulse-front/src/views/AdminMain.vue @@ -118,10 +118,28 @@ const rendezVous = ref([ \ No newline at end of file From 6d875d9df19d40833ac8861e857f1c008dcd6d0e Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Mon, 21 Apr 2025 17:10:43 +0200 Subject: [PATCH 059/143] fix: eslint --- .../src/components/{Agenda.vue => AgendaComponent.vue} | 3 ++- .../MyINPulse-front/src/components/LoginComponent.vue | 4 ++-- front/MyINPulse-front/src/views/AdminMain.vue | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) rename front/MyINPulse-front/src/components/{Agenda.vue => AgendaComponent.vue} (99%) diff --git a/front/MyINPulse-front/src/components/Agenda.vue b/front/MyINPulse-front/src/components/AgendaComponent.vue similarity index 99% rename from front/MyINPulse-front/src/components/Agenda.vue rename to front/MyINPulse-front/src/components/AgendaComponent.vue index fabd137..e06c4e1 100644 --- a/front/MyINPulse-front/src/components/Agenda.vue +++ b/front/MyINPulse-front/src/components/AgendaComponent.vue @@ -29,10 +29,11 @@ date: string, lieu: string, } - + const props = defineProps<{ projectRDV: rendezVous[] }>(); + \ No newline at end of file diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index 226c456..3c665b8 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -56,10 +56,10 @@ const props = defineProps<{ title: number; titleText: string; description: string; - is_admin: number; + isAdmin: number; }>(); -const IS_ADMIN = props.is_admin; +const IS_ADMIN = props.isAdmin; const expanded = ref(false); const currentDescriptions = ref([]); diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 3332465..980d251 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -125,7 +125,7 @@ const contactSingle = (email: string) => { }); }; - +/* const copyToClipboard = (email: string) => { navigator.clipboard.writeText(email).then(() => { alert(`Adresse copiée : ${email}`); @@ -133,6 +133,7 @@ const copyToClipboard = (email: string) => { console.error("Erreur lors de la copie :", err); }); }; +*/ onMounted(() => fetchEntrepreneurs(props.projectId, IS_MOCK_MODE)); diff --git a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue index 69f332f..aa763b1 100644 --- a/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/LeanCanvas.vue @@ -4,11 +4,11 @@ v-for="(item, index) in items" :key="index" :title="item.title" - :titleText="item.title_text" + :title-text="item.title_text" :description="item.description" :project-id="item.projectId" :class="['canvas-item', item.class, 'card', 'shadow', 'p-3']" - :is_admin=is_admin + :is-admin= props.isAdmin />
@@ -18,7 +18,7 @@ import { ref, onMounted } from "vue"; import CanvasItem from "@/components/canvas/CanvasItem.vue"; const props = defineProps<{ - is_admin: number; + isAdmin: number; }>(); const items = ref([ diff --git a/front/MyINPulse-front/src/router/router.ts b/front/MyINPulse-front/src/router/router.ts index c2a127a..50bf2b0 100644 --- a/front/MyINPulse-front/src/router/router.ts +++ b/front/MyINPulse-front/src/router/router.ts @@ -34,6 +34,12 @@ const router = createRouter({ name: 'signup', component: () => import('../views/EntrepSignUp.vue'), }, + + { + path: '/JorCproject', + name: 'JorCproject', + component: () => import('../views/JoinOrCreatProjectForEntrep.vue'), + }, ], }) diff --git a/front/MyINPulse-front/src/views/AdminMain.vue b/front/MyINPulse-front/src/views/AdminMain.vue index 2b2bd4b..c3e775b 100644 --- a/front/MyINPulse-front/src/views/AdminMain.vue +++ b/front/MyINPulse-front/src/views/AdminMain.vue @@ -10,6 +10,7 @@ :project-name="project.name" :list-name="project.members" :project-link="project.link" + :project-id="0" />
diff --git a/front/MyINPulse-front/src/views/CanvasView.vue b/front/MyINPulse-front/src/views/CanvasView.vue index 3c9c983..90ebfc4 100644 --- a/front/MyINPulse-front/src/views/CanvasView.vue +++ b/front/MyINPulse-front/src/views/CanvasView.vue @@ -10,7 +10,7 @@

Cliquez sur un champ du tableau pour afficher son contenu en détail ci-dessous.

- +

@@ -26,7 +26,7 @@ import HeaderCanvas from "../components/canvas/HeaderCanvas.vue"; import LeanCanvas from '../components/canvas/LeanCanvas.vue'; -import { ref, onMounted, defineProps} from "vue"; +import { ref, onMounted /*, defineProps*/} from "vue"; import { axiosInstance } from "@/services/api.ts"; const IS_MOCK_MODE = true; @@ -41,7 +41,7 @@ const props = defineProps<{ is_admin = token.includes("MyINPulse-admin") */ -const is_admin = 0 +const isAdmin = 0 // Variables pour les informations de l'administrateur const admin = ref({ From fdae3e4c0421cee26debd2b7666fc0a7092e496c Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Mon, 21 Apr 2025 18:21:21 +0200 Subject: [PATCH 061/143] fix: linter error --- front/MyINPulse-front/src/plugins/authStore.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/front/MyINPulse-front/src/plugins/authStore.ts b/front/MyINPulse-front/src/plugins/authStore.ts index 1a5c06e..eb11635 100644 --- a/front/MyINPulse-front/src/plugins/authStore.ts +++ b/front/MyINPulse-front/src/plugins/authStore.ts @@ -1,14 +1,16 @@ // file: src/plugins/authStore.js import { useAuthStore } from "@/stores/authStore.ts"; -import keycloakService from '@/services/keycloak'; +import keycloakService from "@/services/keycloak"; +import type { Pinia } from "pinia"; +import type { AppConfig } from "vue"; // Setup auth store as a plugin so it can be accessed globally in our FE const authStorePlugin = { - install(app: any, option: any) { + install(app: AppConfig, option: Pinia) { const store = useAuthStore(option.pinia); app.config.globalProperties.$store = store; keycloakService.CallInitStore(store); - } -} + }, +}; -export default authStorePlugin; \ No newline at end of file +export default authStorePlugin; From d9c5f7bacf0447c8ffc72dbc520db26e0f28821b Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Mon, 21 Apr 2025 18:33:51 +0200 Subject: [PATCH 062/143] fix: eslint --- front/MyINPulse-front/src/components/AgendaComponent.vue | 2 +- front/MyINPulse-front/src/services/api.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/front/MyINPulse-front/src/components/AgendaComponent.vue b/front/MyINPulse-front/src/components/AgendaComponent.vue index e06c4e1..1fb354b 100644 --- a/front/MyINPulse-front/src/components/AgendaComponent.vue +++ b/front/MyINPulse-front/src/components/AgendaComponent.vue @@ -30,7 +30,7 @@ lieu: string, } - const props = defineProps<{ + defineProps<{ projectRDV: rendezVous[] }>(); diff --git a/front/MyINPulse-front/src/services/api.ts b/front/MyINPulse-front/src/services/api.ts index 6b9513f..e3ec236 100644 --- a/front/MyINPulse-front/src/services/api.ts +++ b/front/MyINPulse-front/src/services/api.ts @@ -67,7 +67,7 @@ function callApi( function postApi( endpoint: string, - data: any, + data: unknown, //to fix eslint issue, go back here if errors occurs later onSuccessHandler?: (response: AxiosResponse) => void, onErrorHandler?: (error: AxiosError) => void ): void { From c60fb8945b65710ad1527822e8d6e139b2dd0ca5 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Mon, 21 Apr 2025 19:01:15 +0200 Subject: [PATCH 063/143] fix: with prettier --- front/MyINPulse-front/src/App.vue | 8 +- .../src/components/AddProjectForm.vue | 142 +++--- .../src/components/AgendaComponent.vue | 116 ++--- .../src/components/LoginComponent.vue | 232 ++++----- .../components/PendingProjectComponent.vue | 134 +++-- .../src/components/ProjectComponent.vue | 304 +++++------ .../src/components/canvas/CanvasItem.vue | 472 +++++++++--------- .../src/components/canvas/HeaderCanvas.vue | 289 ++++++----- .../src/components/canvas/LeanCanvas.vue | 195 ++++++-- .../src/components/canvas/style-project.css | 122 ++--- front/MyINPulse-front/src/main.ts | 6 +- front/MyINPulse-front/src/router/router.ts | 76 +-- front/MyINPulse-front/src/services/api.ts | 1 - front/MyINPulse-front/src/views/AdminMain.vue | 145 +++--- .../MyINPulse-front/src/views/CanvasView.vue | 149 +++--- .../src/views/EntrepSignUp.vue | 295 ++++++----- .../src/views/errorWrapper.vue | 14 +- 17 files changed, 1414 insertions(+), 1286 deletions(-) diff --git a/front/MyINPulse-front/src/App.vue b/front/MyINPulse-front/src/App.vue index 795a6d2..d359e36 100644 --- a/front/MyINPulse-front/src/App.vue +++ b/front/MyINPulse-front/src/App.vue @@ -1,16 +1,12 @@ - - - diff --git a/front/MyINPulse-front/src/components/AddProjectForm.vue b/front/MyINPulse-front/src/components/AddProjectForm.vue index de3a21a..6a24514 100644 --- a/front/MyINPulse-front/src/components/AddProjectForm.vue +++ b/front/MyINPulse-front/src/components/AddProjectForm.vue @@ -1,110 +1,108 @@ - - - - - \ No newline at end of file +} + diff --git a/front/MyINPulse-front/src/components/AgendaComponent.vue b/front/MyINPulse-front/src/components/AgendaComponent.vue index 1fb354b..6b58c4c 100644 --- a/front/MyINPulse-front/src/components/AgendaComponent.vue +++ b/front/MyINPulse-front/src/components/AgendaComponent.vue @@ -2,98 +2,92 @@

Rendez-vous

- - - - - - - - - - - - - - + + + + + + + + + + + + + +
ProjetDateLieu
{{ p.projectName }}{{ p.date }}{{ p.lieu }}
ProjetDateLieu
{{ p.projectName }}{{ p.date }}{{ p.lieu }}
-
\ No newline at end of file +} + diff --git a/front/MyINPulse-front/src/components/LoginComponent.vue b/front/MyINPulse-front/src/components/LoginComponent.vue index fae57db..3706e60 100644 --- a/front/MyINPulse-front/src/components/LoginComponent.vue +++ b/front/MyINPulse-front/src/components/LoginComponent.vue @@ -1,35 +1,35 @@ - diff --git a/front/MyINPulse-front/src/components/PendingProjectComponent.vue b/front/MyINPulse-front/src/components/PendingProjectComponent.vue index d93c94c..a0d917c 100644 --- a/front/MyINPulse-front/src/components/PendingProjectComponent.vue +++ b/front/MyINPulse-front/src/components/PendingProjectComponent.vue @@ -5,129 +5,125 @@

{{ projectName }}

Projet mis le: {{ creationDate }}

-
- - +
+ + +
- - - - - - \ No newline at end of file + diff --git a/front/MyINPulse-front/src/components/ProjectComponent.vue b/front/MyINPulse-front/src/components/ProjectComponent.vue index 7badab4..3113fff 100644 --- a/front/MyINPulse-front/src/components/ProjectComponent.vue +++ b/front/MyINPulse-front/src/components/ProjectComponent.vue @@ -1,37 +1,41 @@ - - - \ No newline at end of file +} + diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index 3c665b8..73eb952 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -1,47 +1,69 @@ From bca88a7b20cd4b7c8dc31a0ea88f75123f09abb3 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 21 Apr 2025 19:07:31 +0200 Subject: [PATCH 064/143] feat: adding join file --- .../src/views/JoinOrCreatProjectForEntrep.vue | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 front/MyINPulse-front/src/views/JoinOrCreatProjectForEntrep.vue diff --git a/front/MyINPulse-front/src/views/JoinOrCreatProjectForEntrep.vue b/front/MyINPulse-front/src/views/JoinOrCreatProjectForEntrep.vue new file mode 100644 index 0000000..cd8d494 --- /dev/null +++ b/front/MyINPulse-front/src/views/JoinOrCreatProjectForEntrep.vue @@ -0,0 +1,116 @@ + + + + + From 01f062211afa868b2de744782ce82038426817ef Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Mon, 21 Apr 2025 19:16:42 +0200 Subject: [PATCH 065/143] fix: awful fix but works for now ? --- front/MyINPulse-front/src/plugins/authStore.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/front/MyINPulse-front/src/plugins/authStore.ts b/front/MyINPulse-front/src/plugins/authStore.ts index eb11635..40591d8 100644 --- a/front/MyINPulse-front/src/plugins/authStore.ts +++ b/front/MyINPulse-front/src/plugins/authStore.ts @@ -2,11 +2,9 @@ import { useAuthStore } from "@/stores/authStore.ts"; import keycloakService from "@/services/keycloak"; -import type { Pinia } from "pinia"; -import type { AppConfig } from "vue"; // Setup auth store as a plugin so it can be accessed globally in our FE const authStorePlugin = { - install(app: AppConfig, option: Pinia) { + install(app: unknown, option: unknown) { const store = useAuthStore(option.pinia); app.config.globalProperties.$store = store; keycloakService.CallInitStore(store); From 08706af6c2b1dedecf0daa4d92d792511f864861 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Mon, 21 Apr 2025 19:24:38 +0200 Subject: [PATCH 066/143] fix: proper fix --- front/MyINPulse-front/src/plugins/authStore.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/front/MyINPulse-front/src/plugins/authStore.ts b/front/MyINPulse-front/src/plugins/authStore.ts index 40591d8..e844126 100644 --- a/front/MyINPulse-front/src/plugins/authStore.ts +++ b/front/MyINPulse-front/src/plugins/authStore.ts @@ -2,9 +2,11 @@ import { useAuthStore } from "@/stores/authStore.ts"; import keycloakService from "@/services/keycloak"; +import type { Pinia } from "pinia"; +import type { App } from "vue"; // Setup auth store as a plugin so it can be accessed globally in our FE const authStorePlugin = { - install(app: unknown, option: unknown) { + install(app: App, option: { pinia: Pinia }) { const store = useAuthStore(option.pinia); app.config.globalProperties.$store = store; keycloakService.CallInitStore(store); From 4b6d501adcfcb47c7c6f743e224d79beb24839bc Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 21 Apr 2025 19:29:25 +0200 Subject: [PATCH 067/143] feat: contact fixed --- .../src/components/ProjectComponent.vue | 203 ++++++++++-------- .../src/components/canvas/HeaderCanvas.vue | 72 ++++--- .../MyINPulse-front/src/components/contact.ts | 0 3 files changed, 163 insertions(+), 112 deletions(-) create mode 100644 front/MyINPulse-front/src/components/contact.ts diff --git a/front/MyINPulse-front/src/components/ProjectComponent.vue b/front/MyINPulse-front/src/components/ProjectComponent.vue index 3113fff..f43740a 100644 --- a/front/MyINPulse-front/src/components/ProjectComponent.vue +++ b/front/MyINPulse-front/src/components/ProjectComponent.vue @@ -1,43 +1,45 @@ + diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 1e39aff..de22bc5 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -1,36 +1,38 @@ + diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index de22bc5..8c53221 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -1,32 +1,31 @@ - diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index 8c53221..afb0659 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -1,6 +1,14 @@ @@ -175,17 +189,17 @@ const mockFetch = async (projectId: number, title: number, date: string) => { "Les clients ont du mal à trouver des produits écoresponsables abordables.", "Le processus d'achat en ligne est trop complexe.", "Manque de transparence sur l’origine des produits.", - "Peu d’alternatives locales et durables sur le marché." + "Peu d’alternatives locales et durables sur le marché.", ], 2: [ "Jeunes urbains engagés dans la cause écologique.", "Familles à revenu moyen voulant consommer responsable.", - "Entreprises soucieuses de leur empreinte carbone." + "Entreprises soucieuses de leur empreinte carbone.", ], 3: [ "Une plateforme centralisée avec des produits écologiques certifiés.", "Un service client humain et réactif.", - "Livraison éco-responsable avec suivi." + "Livraison éco-responsable avec suivi.", ], 4: [ "Application intuitive avec suggestions personnalisées.", @@ -198,22 +212,22 @@ const mockFetch = async (projectId: number, title: number, date: string) => { 6: [ "Canaux digitaux : réseaux sociaux, SEO.", "Partenariats avec influenceurs écoresponsables.", - "Boutique physique en pop-up stores." + "Boutique physique en pop-up stores.", ], 7: [ "Taux de rétention client mensuel.", - "Taux de satisfaction utilisateur (NPS)." + "Taux de satisfaction utilisateur (NPS).", ], 8: [ "Coût du développement logiciel initial.", "Campagnes publicitaires et communication.", - "Frais logistiques (emballages, transport)." + "Frais logistiques (emballages, transport).", ], 9: [ "Ventes directes sur la plateforme.", "Abonnement mensuel premium pour livraison gratuite.", - "Revenus via partenariats de marque." - ] + "Revenus via partenariats de marque.", + ], }; // On extrait les descriptions pour la section demandée @@ -227,8 +241,6 @@ const mockFetch = async (projectId: number, title: number, date: string) => { }); }; - - // Utilisation du mock dans handleClick pour tester sans serveur const handleClick = async () => { if (!expanded.value) { @@ -309,20 +321,6 @@ const cancelEdit = (index: number) => { editedDescriptions.value[index] = currentDescriptions.value[index]; isEditing.value[index] = false; }; - -const randomStyle = () => { - const offsetX = Math.floor(Math.random() * 20) - 10; // entre -10 et +10px - const offsetY = Math.floor(Math.random() * 20) - 10; - return { - transform: `translate(${offsetX}px, ${offsetY}px)`, - transition: 'transform 0.3s ease', - }; -}; - -const styleClasses = ['float-up', 'float-left', 'float-right', 'wiggle', 'tilt']; -const getRandomClass = () => { - return styleClasses[Math.floor(Math.random() * styleClasses.length)]; -}; diff --git a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue index afb0659..b8966e4 100644 --- a/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue +++ b/front/MyINPulse-front/src/components/canvas/HeaderCanvas.vue @@ -1,15 +1,17 @@ From 3de1ec71fffc041fde7e12700652497c903be78c Mon Sep 17 00:00:00 2001 From: root Date: Sun, 27 Apr 2025 21:52:43 +0200 Subject: [PATCH 077/143] suppression de Appointement --- .../src/components/Appointments.vue | 169 ------------------ 1 file changed, 169 deletions(-) delete mode 100644 front/MyINPulse-front/src/components/Appointments.vue diff --git a/front/MyINPulse-front/src/components/Appointments.vue b/front/MyINPulse-front/src/components/Appointments.vue deleted file mode 100644 index f534ed4..0000000 --- a/front/MyINPulse-front/src/components/Appointments.vue +++ /dev/null @@ -1,169 +0,0 @@ - - - - - From 549028b1d0b54b744a50791dec60a9d2dd66b311 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 27 Apr 2025 21:58:32 +0200 Subject: [PATCH 078/143] apply prettier to appointement --- .../src/components/AdminAppointments.vue | 238 +++++++++--------- 1 file changed, 123 insertions(+), 115 deletions(-) diff --git a/front/MyINPulse-front/src/components/AdminAppointments.vue b/front/MyINPulse-front/src/components/AdminAppointments.vue index 5641e2e..f6ecb3a 100644 --- a/front/MyINPulse-front/src/components/AdminAppointments.vue +++ b/front/MyINPulse-front/src/components/AdminAppointments.vue @@ -1,170 +1,178 @@ From 6d84b3ff93e364e33658c1449f28232e3f77a921 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 28 Apr 2025 20:57:12 +0200 Subject: [PATCH 079/143] feat: api fonctions for each class, will be sperated shortly --- front/MyINPulse-front/src/api_tmp.ts | 738 +++++++++++++++++++++++++++ 1 file changed, 738 insertions(+) create mode 100644 front/MyINPulse-front/src/api_tmp.ts diff --git a/front/MyINPulse-front/src/api_tmp.ts b/front/MyINPulse-front/src/api_tmp.ts new file mode 100644 index 0000000..222915f --- /dev/null +++ b/front/MyINPulse-front/src/api_tmp.ts @@ -0,0 +1,738 @@ +import axios, { type AxiosError, type AxiosResponse } from "axios"; +import { store } from "@/main.ts"; +import { addNewMessage, color } from "@/services/popupDisplayer.ts"; +import Project from "./ApiClasses/Project"; +import SectionCell from "./ApiClasses/SectionCell"; +import Report from "./ApiClasses/Repport"; +import Appointment from "./ApiClasses/Appointment"; + +const axiosInstance = axios.create({ + baseURL: import.meta.env.VITE_BACKEND_URL, + headers: { + "Content-Type": "application/json", + }, +}); + +axiosInstance.interceptors.response.use( + (response) => response, // Directly return successful responses. + async (error) => { + const originalRequest = error.config; + if ( + ((error.response && error.response.status === 401) || + error.code == "ERR_NETWORK") && + !originalRequest._retry && + store.authenticated + ) { + originalRequest._retry = true; // Mark the request as retried to avoid infinite loops. + try { + await store.refreshUserToken(); + // Update the authorization header with the new access token. + axiosInstance.defaults.headers.common["Authorization"] = + `Bearer ${store.user.token}`; + return axiosInstance(originalRequest); // Retry the original request with the new access token. + } catch (refreshError) { + // Handle refresh token errors by clearing stored tokens and redirecting to the login page. + console.error("Token refresh failed:", refreshError); + localStorage.removeItem("accessToken"); + localStorage.removeItem("refreshToken"); + window.location.href = "/login"; + return Promise.reject(refreshError); + } + } + return Promise.reject(error); // For all other errors, return the error as is. + } +); + +// TODO: spawn a error modal +function defaultApiErrorHandler(err: AxiosError) { + addNewMessage(err.message, color.Red); +} + +function defaultApiSuccessHandler(response: AxiosResponse) { + addNewMessage(response.data, color.Green); +} + +// Existing functions (maintained for backward compatibility) +function callApi( + endpoint: string, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(endpoint) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function postApi( + endpoint: string, + data: unknown, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(endpoint, data) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function deleteApi( + endpoint: string, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .delete(endpoint) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// New functions based on Swagger documentation + +// Unauth API +function finalizeAccount( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/unauth/finalize") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// function requestJoinProject( // Not yet implemented [cite: 4] +// projectId: number, +// onSuccessHandler?: (response: AxiosResponse) => void, +// onErrorHandler?: (error: AxiosError) => void +// ): void { +// axiosInstance +// .post(`/unauth/request-join/${projectId}`) +// .then((response) => { +// if (onSuccessHandler) { +// onSuccessHandler(response); +// } else { +// defaultApiSuccessHandler(response); +// } +// }) +// .catch((error: AxiosError) => { +// if (onErrorHandler) { +// onErrorHandler(error); +// } else { +// defaultApiErrorHandler(error); +// } +// }); +// } + +// Admin API +function getPendingAccounts( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/pending-accounts") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function validateUserAccount( + userId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/accounts/validate/${userId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// function getPendingProjectJoinRequests( // Not yet implemented [cite: 3] +// onSuccessHandler?: (response: AxiosResponse) => void, +// onErrorHandler?: (error: AxiosError) => void +// ): void { +// axiosInstance +// .get("/admin/request-join") +// .then((response) => { +// if (onSuccessHandler) { +// onSuccessHandler(response); +// } else { +// defaultApiSuccessHandler(response); +// } +// }) +// .catch((error: AxiosError) => { +// if (onErrorHandler) { +// onErrorHandler(error); +// } else { +// defaultApiErrorHandler(error); +// } +// }); +// } + +// function decideProjectJoinRequest( // Not yet implemented [cite: 3] +// joinRequestId: number, +// decision: { isAccepted: boolean }, +// onSuccessHandler?: (response: AxiosResponse) => void, +// onErrorHandler?: (error: AxiosError) => void +// ): void { +// axiosInstance +// .post(`/admin/request-join/decision/${joinRequestId}`, decision) +// .then((response) => { +// if (onSuccessHandler) { +// onSuccessHandler(response); +// } else { +// defaultApiSuccessHandler(response); +// } +// }) +// .catch((error: AxiosError) => { +// if (onErrorHandler) { +// onErrorHandler(error); +// } else { +// defaultApiErrorHandler(error); +// } +// }); +// } + +function getAdminProjects( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/projects") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function addProjectManually( + projectDetails: Project, // Replace 'any' with a proper type for project details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/admin/projects", projectDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getPendingProjects( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/projects/pending") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function decidePendingProject( + pendingProjectId: number, + decision: { projectId: number; adminId: number; isAccepted: boolean }, // Replace 'any' with a proper type for project decision if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/projects/pending/decision/${pendingProjectId}`, decision) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function createAppointmentReport( + appointmentId: number, + reportContent: Report, // Replace 'any' with a proper type for report content if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/appointments/report/${appointmentId}`, reportContent) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function updateAppointmentReport( + appointmentId: number, + reportContent: Report, // Replace 'any' with a proper type for report content if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .put(`/admin/appointments/report/${appointmentId}`, reportContent) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getUpcomingAppointments( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/appointments/upcoming") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function removeProject( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .delete(`/admin/projects/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function grantAdminRights( + userId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/make-admin/${userId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// Shared API +function getSectionCellsByDate( + projectId: number, + sectionId: number, + date: string, // Use string for date in 'YYYY-MM-DD HH:mm' format + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/sectionCells/${projectId}/${sectionId}/${date}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getProjectEntrepreneurs( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/entrepreneurs/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getProjectAdmin( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/admin/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getProjectAppointments( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/appointments/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getAppointmentReport( + appointmentId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/appointments/report/${appointmentId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function requestAppointment( + appointmentDetails: Appointment, // Replace 'any' with a proper type for appointment details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/shared/appointments/request", appointmentDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// Entrepreneurs API +function requestProjectCreation( + projectDetails: Project, // Replace 'any' with a proper type for project details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/entrepreneur/projects/request", projectDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function addSectionCell( + sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/entrepreneur/sectionCells", sectionCellDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function modifySectionCell( + sectionCellId: number, + sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .put(`/entrepreneur/sectionCells/${sectionCellId}`, sectionCellDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function removeSectionCell( + sectionCellId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .delete(`/entrepreneur/sectionCells/${sectionCellId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +export { + axiosInstance, + callApi, + postApi, + deleteApi, + finalizeAccount, + // requestJoinProject, // Not yet implemented [cite: 4] + getPendingAccounts, + validateUserAccount, + // getPendingProjectJoinRequests, // Not yet implemented [cite: 3] + // decideProjectJoinRequest, // Not yet implemented [cite: 3] + getAdminProjects, + addProjectManually, + getPendingProjects, + decidePendingProject, + createAppointmentReport, + updateAppointmentReport, + getUpcomingAppointments, + removeProject, + grantAdminRights, + getSectionCellsByDate, + getProjectEntrepreneurs, + getProjectAdmin, + getProjectAppointments, + getAppointmentReport, + requestAppointment, + requestProjectCreation, + addSectionCell, + modifySectionCell, + removeSectionCell, +}; From be7381586162089572857c4d643f0bee3c407b8e Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Mon, 28 Apr 2025 22:35:56 +0200 Subject: [PATCH 080/143] fix: separating the apis --- front/MyINPulse-front/src/api_tmp.ts | 738 ------------------ .../src/services/Apis/Admin.ts | 321 ++++++++ .../src/services/Apis/Entrepreneurs.ts | 134 ++++ .../src/services/Apis/Shared.ts | 154 ++++ .../src/services/Apis/Unauth.ts | 56 ++ 5 files changed, 665 insertions(+), 738 deletions(-) delete mode 100644 front/MyINPulse-front/src/api_tmp.ts create mode 100644 front/MyINPulse-front/src/services/Apis/Admin.ts create mode 100644 front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts create mode 100644 front/MyINPulse-front/src/services/Apis/Shared.ts create mode 100644 front/MyINPulse-front/src/services/Apis/Unauth.ts diff --git a/front/MyINPulse-front/src/api_tmp.ts b/front/MyINPulse-front/src/api_tmp.ts deleted file mode 100644 index 222915f..0000000 --- a/front/MyINPulse-front/src/api_tmp.ts +++ /dev/null @@ -1,738 +0,0 @@ -import axios, { type AxiosError, type AxiosResponse } from "axios"; -import { store } from "@/main.ts"; -import { addNewMessage, color } from "@/services/popupDisplayer.ts"; -import Project from "./ApiClasses/Project"; -import SectionCell from "./ApiClasses/SectionCell"; -import Report from "./ApiClasses/Repport"; -import Appointment from "./ApiClasses/Appointment"; - -const axiosInstance = axios.create({ - baseURL: import.meta.env.VITE_BACKEND_URL, - headers: { - "Content-Type": "application/json", - }, -}); - -axiosInstance.interceptors.response.use( - (response) => response, // Directly return successful responses. - async (error) => { - const originalRequest = error.config; - if ( - ((error.response && error.response.status === 401) || - error.code == "ERR_NETWORK") && - !originalRequest._retry && - store.authenticated - ) { - originalRequest._retry = true; // Mark the request as retried to avoid infinite loops. - try { - await store.refreshUserToken(); - // Update the authorization header with the new access token. - axiosInstance.defaults.headers.common["Authorization"] = - `Bearer ${store.user.token}`; - return axiosInstance(originalRequest); // Retry the original request with the new access token. - } catch (refreshError) { - // Handle refresh token errors by clearing stored tokens and redirecting to the login page. - console.error("Token refresh failed:", refreshError); - localStorage.removeItem("accessToken"); - localStorage.removeItem("refreshToken"); - window.location.href = "/login"; - return Promise.reject(refreshError); - } - } - return Promise.reject(error); // For all other errors, return the error as is. - } -); - -// TODO: spawn a error modal -function defaultApiErrorHandler(err: AxiosError) { - addNewMessage(err.message, color.Red); -} - -function defaultApiSuccessHandler(response: AxiosResponse) { - addNewMessage(response.data, color.Green); -} - -// Existing functions (maintained for backward compatibility) -function callApi( - endpoint: string, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get(endpoint) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function postApi( - endpoint: string, - data: unknown, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post(endpoint, data) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function deleteApi( - endpoint: string, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .delete(endpoint) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -// New functions based on Swagger documentation - -// Unauth API -function finalizeAccount( - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post("/unauth/finalize") - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -// function requestJoinProject( // Not yet implemented [cite: 4] -// projectId: number, -// onSuccessHandler?: (response: AxiosResponse) => void, -// onErrorHandler?: (error: AxiosError) => void -// ): void { -// axiosInstance -// .post(`/unauth/request-join/${projectId}`) -// .then((response) => { -// if (onSuccessHandler) { -// onSuccessHandler(response); -// } else { -// defaultApiSuccessHandler(response); -// } -// }) -// .catch((error: AxiosError) => { -// if (onErrorHandler) { -// onErrorHandler(error); -// } else { -// defaultApiErrorHandler(error); -// } -// }); -// } - -// Admin API -function getPendingAccounts( - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get("/admin/pending-accounts") - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function validateUserAccount( - userId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post(`/admin/accounts/validate/${userId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -// function getPendingProjectJoinRequests( // Not yet implemented [cite: 3] -// onSuccessHandler?: (response: AxiosResponse) => void, -// onErrorHandler?: (error: AxiosError) => void -// ): void { -// axiosInstance -// .get("/admin/request-join") -// .then((response) => { -// if (onSuccessHandler) { -// onSuccessHandler(response); -// } else { -// defaultApiSuccessHandler(response); -// } -// }) -// .catch((error: AxiosError) => { -// if (onErrorHandler) { -// onErrorHandler(error); -// } else { -// defaultApiErrorHandler(error); -// } -// }); -// } - -// function decideProjectJoinRequest( // Not yet implemented [cite: 3] -// joinRequestId: number, -// decision: { isAccepted: boolean }, -// onSuccessHandler?: (response: AxiosResponse) => void, -// onErrorHandler?: (error: AxiosError) => void -// ): void { -// axiosInstance -// .post(`/admin/request-join/decision/${joinRequestId}`, decision) -// .then((response) => { -// if (onSuccessHandler) { -// onSuccessHandler(response); -// } else { -// defaultApiSuccessHandler(response); -// } -// }) -// .catch((error: AxiosError) => { -// if (onErrorHandler) { -// onErrorHandler(error); -// } else { -// defaultApiErrorHandler(error); -// } -// }); -// } - -function getAdminProjects( - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get("/admin/projects") - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function addProjectManually( - projectDetails: Project, // Replace 'any' with a proper type for project details if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post("/admin/projects", projectDetails) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function getPendingProjects( - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get("/admin/projects/pending") - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function decidePendingProject( - pendingProjectId: number, - decision: { projectId: number; adminId: number; isAccepted: boolean }, // Replace 'any' with a proper type for project decision if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post(`/admin/projects/pending/decision/${pendingProjectId}`, decision) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function createAppointmentReport( - appointmentId: number, - reportContent: Report, // Replace 'any' with a proper type for report content if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post(`/admin/appointments/report/${appointmentId}`, reportContent) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function updateAppointmentReport( - appointmentId: number, - reportContent: Report, // Replace 'any' with a proper type for report content if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .put(`/admin/appointments/report/${appointmentId}`, reportContent) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function getUpcomingAppointments( - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get("/admin/appointments/upcoming") - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function removeProject( - projectId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .delete(`/admin/projects/${projectId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function grantAdminRights( - userId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post(`/admin/make-admin/${userId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -// Shared API -function getSectionCellsByDate( - projectId: number, - sectionId: number, - date: string, // Use string for date in 'YYYY-MM-DD HH:mm' format - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get(`/shared/projects/sectionCells/${projectId}/${sectionId}/${date}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function getProjectEntrepreneurs( - projectId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get(`/shared/projects/entrepreneurs/${projectId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function getProjectAdmin( - projectId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get(`/shared/projects/admin/${projectId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function getProjectAppointments( - projectId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get(`/shared/projects/appointments/${projectId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function getAppointmentReport( - appointmentId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .get(`/shared/appointments/report/${appointmentId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function requestAppointment( - appointmentDetails: Appointment, // Replace 'any' with a proper type for appointment details if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post("/shared/appointments/request", appointmentDetails) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -// Entrepreneurs API -function requestProjectCreation( - projectDetails: Project, // Replace 'any' with a proper type for project details if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post("/entrepreneur/projects/request", projectDetails) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function addSectionCell( - sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .post("/entrepreneur/sectionCells", sectionCellDetails) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function modifySectionCell( - sectionCellId: number, - sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .put(`/entrepreneur/sectionCells/${sectionCellId}`, sectionCellDetails) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -function removeSectionCell( - sectionCellId: number, - onSuccessHandler?: (response: AxiosResponse) => void, - onErrorHandler?: (error: AxiosError) => void -): void { - axiosInstance - .delete(`/entrepreneur/sectionCells/${sectionCellId}`) - .then((response) => { - if (onSuccessHandler) { - onSuccessHandler(response); - } else { - defaultApiSuccessHandler(response); - } - }) - .catch((error: AxiosError) => { - if (onErrorHandler) { - onErrorHandler(error); - } else { - defaultApiErrorHandler(error); - } - }); -} - -export { - axiosInstance, - callApi, - postApi, - deleteApi, - finalizeAccount, - // requestJoinProject, // Not yet implemented [cite: 4] - getPendingAccounts, - validateUserAccount, - // getPendingProjectJoinRequests, // Not yet implemented [cite: 3] - // decideProjectJoinRequest, // Not yet implemented [cite: 3] - getAdminProjects, - addProjectManually, - getPendingProjects, - decidePendingProject, - createAppointmentReport, - updateAppointmentReport, - getUpcomingAppointments, - removeProject, - grantAdminRights, - getSectionCellsByDate, - getProjectEntrepreneurs, - getProjectAdmin, - getProjectAppointments, - getAppointmentReport, - requestAppointment, - requestProjectCreation, - addSectionCell, - modifySectionCell, - removeSectionCell, -}; diff --git a/front/MyINPulse-front/src/services/Apis/Admin.ts b/front/MyINPulse-front/src/services/Apis/Admin.ts new file mode 100644 index 0000000..d08df72 --- /dev/null +++ b/front/MyINPulse-front/src/services/Apis/Admin.ts @@ -0,0 +1,321 @@ +import { type AxiosError, type AxiosResponse } from "axios"; +import Project from "@/ApiClasses/Project"; +import Report from "@/ApiClasses/Repport"; +import { axiosInstance, defaultApiErrorHandler, defaultApiSuccessHandler } from "@/services/api" + +// Admin API +function getPendingAccounts( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/pending-accounts") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function validateUserAccount( + userId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/accounts/validate/${userId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// function getPendingProjectJoinRequests( // Not yet implemented [cite: 3] +// onSuccessHandler?: (response: AxiosResponse) => void, +// onErrorHandler?: (error: AxiosError) => void +// ): void { +// axiosInstance +// .get("/admin/request-join") +// .then((response) => { +// if (onSuccessHandler) { +// onSuccessHandler(response); +// } else { +// defaultApiSuccessHandler(response); +// } +// }) +// .catch((error: AxiosError) => { +// if (onErrorHandler) { +// onErrorHandler(error); +// } else { +// defaultApiErrorHandler(error); +// } +// }); +// } + +// function decideProjectJoinRequest( // Not yet implemented [cite: 3] +// joinRequestId: number, +// decision: { isAccepted: boolean }, +// onSuccessHandler?: (response: AxiosResponse) => void, +// onErrorHandler?: (error: AxiosError) => void +// ): void { +// axiosInstance +// .post(`/admin/request-join/decision/${joinRequestId}`, decision) +// .then((response) => { +// if (onSuccessHandler) { +// onSuccessHandler(response); +// } else { +// defaultApiSuccessHandler(response); +// } +// }) +// .catch((error: AxiosError) => { +// if (onErrorHandler) { +// onErrorHandler(error); +// } else { +// defaultApiErrorHandler(error); +// } +// }); +// } + +function getAdminProjects( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/projects") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function addProjectManually( + projectDetails: Project, // Replace 'any' with a proper type for project details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/admin/projects", projectDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getPendingProjects( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/projects/pending") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function decidePendingProject( + pendingProjectId: number, + decision: { projectId: number; adminId: number; isAccepted: boolean }, // Replace 'any' with a proper type for project decision if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/projects/pending/decision/${pendingProjectId}`, decision) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function createAppointmentReport( + appointmentId: number, + reportContent: Report, // Replace 'any' with a proper type for report content if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/appointments/report/${appointmentId}`, reportContent) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function updateAppointmentReport( + appointmentId: number, + reportContent: Report, // Replace 'any' with a proper type for report content if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .put(`/admin/appointments/report/${appointmentId}`, reportContent) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getUpcomingAppointments( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/admin/appointments/upcoming") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function removeProject( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .delete(`/admin/projects/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function grantAdminRights( + userId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post(`/admin/make-admin/${userId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +export { + axiosInstance, + // requestJoinProject, // Not yet implemented [cite: 4] + getPendingAccounts, + validateUserAccount, + // getPendingProjectJoinRequests, // Not yet implemented [cite: 3] + // decideProjectJoinRequest, // Not yet implemented [cite: 3] + getAdminProjects, + addProjectManually, + getPendingProjects, + decidePendingProject, + createAppointmentReport, + updateAppointmentReport, + getUpcomingAppointments, + removeProject, + grantAdminRights, +}; diff --git a/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts b/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts new file mode 100644 index 0000000..f3d9fbc --- /dev/null +++ b/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts @@ -0,0 +1,134 @@ +import Project from "@/ApiClasses/Project"; +import SectionCell from "@/ApiClasses/SectionCell"; +import { axiosInstance, defaultApiErrorHandler, defaultApiSuccessHandler } from "@/services/api" + +axiosInstance.interceptors.response.use( + (response) => response, // Directly return successful responses. + async (error) => { + const originalRequest = error.config; + if ( + ((error.response && error.response.status === 401) || + error.code == "ERR_NETWORK") && + !originalRequest._retry && + store.authenticated + ) { + originalRequest._retry = true; // Mark the request as retried to avoid infinite loops. + try { + await store.refreshUserToken(); + // Update the authorization header with the new access token. + axiosInstance.defaults.headers.common["Authorization"] = + `Bearer ${store.user.token}`; + return axiosInstance(originalRequest); // Retry the original request with the new access token. + } catch (refreshError) { + // Handle refresh token errors by clearing stored tokens and redirecting to the login page. + console.error("Token refresh failed:", refreshError); + localStorage.removeItem("accessToken"); + localStorage.removeItem("refreshToken"); + router.push("/login"); + return Promise.reject(refreshError); + } + } + return Promise.reject(error); // For all other errors, return the error as is. + } +); + +// Entrepreneurs API +function requestProjectCreation( + projectDetails: Project, // Replace 'any' with a proper type for project details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/entrepreneur/projects/request", projectDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function addSectionCell( + sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/entrepreneur/sectionCells", sectionCellDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function modifySectionCell( + sectionCellId: number, + sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .put(`/entrepreneur/sectionCells/${sectionCellId}`, sectionCellDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function removeSectionCell( + sectionCellId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .delete(`/entrepreneur/sectionCells/${sectionCellId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +export { + requestProjectCreation, + addSectionCell, + modifySectionCell, + removeSectionCell, +}; diff --git a/front/MyINPulse-front/src/services/Apis/Shared.ts b/front/MyINPulse-front/src/services/Apis/Shared.ts new file mode 100644 index 0000000..6693527 --- /dev/null +++ b/front/MyINPulse-front/src/services/Apis/Shared.ts @@ -0,0 +1,154 @@ +import { type AxiosError, type AxiosResponse } from "axios"; +import Appointment from "@/ApiClasses/Appointment"; +import { axiosInstance, defaultApiErrorHandler, defaultApiSuccessHandler } from "@/services/api" + + +// Shared API +function getSectionCellsByDate( + projectId: number, + sectionId: number, + date: string, // Use string for date in 'YYYY-MM-DD HH:mm' format + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/sectionCells/${projectId}/${sectionId}/${date}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getProjectEntrepreneurs( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/entrepreneurs/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getProjectAdmin( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/admin/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getProjectAppointments( + projectId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/projects/appointments/${projectId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function getAppointmentReport( + appointmentId: number, + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get(`/shared/appointments/report/${appointmentId}`) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +function requestAppointment( + appointmentDetails: Appointment, // Replace 'any' with a proper type for appointment details if available + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/shared/appointments/request", appointmentDetails) + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +export { + getSectionCellsByDate, + getProjectEntrepreneurs, + getProjectAdmin, + getProjectAppointments, + getAppointmentReport, + requestAppointment, +}; diff --git a/front/MyINPulse-front/src/services/Apis/Unauth.ts b/front/MyINPulse-front/src/services/Apis/Unauth.ts new file mode 100644 index 0000000..d4e4f64 --- /dev/null +++ b/front/MyINPulse-front/src/services/Apis/Unauth.ts @@ -0,0 +1,56 @@ +import { type AxiosError, type AxiosResponse } from "axios"; + +import { axiosInstance, defaultApiErrorHandler, defaultApiSuccessHandler } from "@/services/api" + + +// Unauth API +function finalizeAccount( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .post("/unauth/finalize") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// function requestJoinProject( // Not yet implemented [cite: 4] +// projectId: number, +// onSuccessHandler?: (response: AxiosResponse) => void, +// onErrorHandler?: (error: AxiosError) => void +// ): void { +// axiosInstance +// .post(`/unauth/request-join/${projectId}`) +// .then((response) => { +// if (onSuccessHandler) { +// onSuccessHandler(response); +// } else { +// defaultApiSuccessHandler(response); +// } +// }) +// .catch((error: AxiosError) => { +// if (onErrorHandler) { +// onErrorHandler(error); +// } else { +// defaultApiErrorHandler(error); +// } +// }); +// } + + +export { + finalizeAccount, + // requestJoinProject, // Not yet implemented [cite: 4] +}; From 9f4596d0ba9d8a68f9a801c89e9ee577e6db47ac Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Mon, 28 Apr 2025 22:49:07 +0200 Subject: [PATCH 081/143] feat: trying to connect to the bach --- front/MyINPulse-front/index.html | 22 +- .../src/ApiClasses/SectionCell.ts | 9 + front/MyINPulse-front/src/api_tmp.ts | 4 +- .../src/components/canvas/CanvasItem.vue | 281 ++++++++---------- .../src/components/canvas/HeaderCanvas.vue | 10 - 5 files changed, 141 insertions(+), 185 deletions(-) diff --git a/front/MyINPulse-front/index.html b/front/MyINPulse-front/index.html index 9e5fc8f..a678cb5 100644 --- a/front/MyINPulse-front/index.html +++ b/front/MyINPulse-front/index.html @@ -1,13 +1,13 @@ - + - - - - - Vite App - - -
- - + + + + + Vite App + + +
+ + diff --git a/front/MyINPulse-front/src/ApiClasses/SectionCell.ts b/front/MyINPulse-front/src/ApiClasses/SectionCell.ts index 1b346d1..e5fa52e 100644 --- a/front/MyINPulse-front/src/ApiClasses/SectionCell.ts +++ b/front/MyINPulse-front/src/ApiClasses/SectionCell.ts @@ -43,6 +43,15 @@ class SectionCell { set modificationDate(value: string | undefined) { this._modificationDate = value; } + + toPlainObject() { + return { + idSectionCell: this._idSectionCell, + sectionId: this._sectionId, + contentSectionCell: this._contentSectionCell, + modificationDate: this._modificationDate, + }; + } } export default SectionCell; diff --git a/front/MyINPulse-front/src/api_tmp.ts b/front/MyINPulse-front/src/api_tmp.ts index 222915f..3399062 100644 --- a/front/MyINPulse-front/src/api_tmp.ts +++ b/front/MyINPulse-front/src/api_tmp.ts @@ -636,12 +636,12 @@ function requestProjectCreation( } function addSectionCell( - sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available + sectionCellDetails: SectionCell, onSuccessHandler?: (response: AxiosResponse) => void, onErrorHandler?: (error: AxiosError) => void ): void { axiosInstance - .post("/entrepreneur/sectionCells", sectionCellDetails) + .post("/entrepreneur/sectionCells", sectionCellDetails.toPlainObject()) // <-- Ici .then((response) => { if (onSuccessHandler) { onSuccessHandler(response); diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index a106e74..4bcdc33 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -6,37 +6,32 @@
- - -