diff --git a/src/components/Card.vue b/src/components/Card.vue index 003c1d4..2c03d59 100644 --- a/src/components/Card.vue +++ b/src/components/Card.vue @@ -9,8 +9,6 @@ + + diff --git a/src/router/index.ts b/src/router/index.ts index f6d0147..e2d3dc9 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -19,25 +19,32 @@ const routes = [ }, }, { - path: "/facility", - name: "Facility", - component: () => import("@/views/controllers/Facility.vue"), + path: "/pilots", + children: [ + { + path: "feedback", + name: "Leave Feedback", + component: () => import("@/views/pilots/LeaveFeedback.vue"), + }, + ], meta: { requiresAuth: true, }, }, { - path: "/leave-feedback", - name: "Leave Feedback", - component: () => import("@/views/pilots/LeaveFeedback.vue"), - meta: { - requiresAuth: true, - }, - }, - { - path: "/feedback", - name: "My Feedback", - component: () => import("@/views/controllers/MyFeedback.vue"), + path: "/controllers", + children: [ + { + path: "facility", + name: "Facility", + component: () => import("@/views/controllers/Facility.vue"), + }, + { + path: "feedback", + name: "My Feedback", + component: () => import("@/views/controllers/MyFeedback.vue"), + }, + ], meta: { requiresAuth: true, }, diff --git a/src/stores/facility.ts b/src/stores/facility.ts index 71a63e9..5333350 100644 --- a/src/stores/facility.ts +++ b/src/stores/facility.ts @@ -1,9 +1,9 @@ import { defineStore } from "pinia"; import { API } from "@/utils/api"; -import { Facility } from "@/types"; +import { Facility, Roster } from "@/types"; interface FacilityState { - facilities: Facility[] | null; + facilities: Facility[]; error: string | null; fetching: boolean; hasFetched: boolean; @@ -14,7 +14,7 @@ const useFacilityStore = defineStore({ id: "facility", state: () => ({ - facilities: null, + facilities: [], error: null, fetching: false, hasFetched: false, @@ -38,6 +38,17 @@ const useFacilityStore = defineStore({ this.hasFetched = true; } }, + async fetchRoster(facility: string): Promise { + this.fetching = true; + try { + const { data } = await API.get(`/v3/facility/${facility}/roster`); + return data; + } catch (e) { + return []; + } finally { + this.fetching = false; + } + }, }, }); diff --git a/src/stores/feedback.ts b/src/stores/feedback.ts index dedd758..396a6e3 100644 --- a/src/stores/feedback.ts +++ b/src/stores/feedback.ts @@ -1,6 +1,6 @@ import { defineStore } from "pinia"; import { API } from "@/utils/api"; -import { Feedback } from "@/types"; +import { Feedback, FeedbackRequest } from "@/types"; interface FeedbackState { myFeedback: Feedback; @@ -33,6 +33,11 @@ const useFeedbackStore = defineStore({ this.hasFetched = true; } }, + async submitFeedback(facility: string, feedback: FeedbackRequest): Promise { + this.loading = API.post(`/v3/facility/${facility}/feedback`, feedback); + await this.loading; + this.loading = null; + }, }, }); diff --git a/src/stores/user.ts b/src/stores/user.ts index 911d8c1..5a99db8 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -1,6 +1,6 @@ import { defineStore } from "pinia"; import { API } from "@/utils/api"; -import { User } from "@/types"; +import { ActionLog, User } from "@/types"; import { getControllerRating, getPilotRating } from "@/utils/rating"; import { notify } from "notiwind"; @@ -103,6 +103,15 @@ const useUserStore = defineStore({ this.hasFetchedRosters = true; } }, + async fetchActionLog(cid: number): Promise { + try { + const { data } = await API.get(`/v3/user/${cid}/action-log`); + return data; + } catch (e) { + console.error(e); + return []; + } + }, async logout(): Promise { this.fetching = true; try { diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 1b51e89..2d9fbf8 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -47,14 +47,27 @@ export interface Feedback { facility: string; position: number; comment: string; - notes: string; + feedback: string; rating: string; status: string; created_at: string; } +export interface FeedbackRequest { + callsign: string; + controller_cid: number; + pilot_cid: number; + position: number; + comment: string; + feedback: string; + rating: string; + status: string; +} + export interface Roster { id: number; + first_name: string; + last_name: string; cid: number; facility: string; operating_initials: string; @@ -78,3 +91,13 @@ export interface Facility { name: string; url: string; } + +export interface ActionLog { + id: number; + cid: number; + entry: string; + created_at: string; + created_by: string; + updated_at: string; + updated_by: string; +} diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 6b2ed69..d46f3ff 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -25,6 +25,9 @@
+
+ +
@@ -42,6 +45,7 @@ import Discord from "@/components/profile/Discord.vue"; import Notifications from "@/components/profile/Notifications.vue"; import Page from "@/components/Page.vue"; import Profile from "@/components/profile/Profile.vue"; +import ActionLog from "@/components/profile/ActionLog.vue"; const userStore = useUserStore(); diff --git a/src/views/controllers/MyFeedback.vue b/src/views/controllers/MyFeedback.vue index 49128ef..c26d765 100644 --- a/src/views/controllers/MyFeedback.vue +++ b/src/views/controllers/MyFeedback.vue @@ -50,7 +50,7 @@ {{ feedback.rating }} - {{ feedback.comment }} + {{ feedback.feedback }} {{ feedback.facility }} / {{ feedback.position }} @@ -65,6 +65,7 @@ diff --git a/src/views/pilots/LeaveFeedback.vue b/src/views/pilots/LeaveFeedback.vue index 20b30ba..1e8c58d 100644 --- a/src/views/pilots/LeaveFeedback.vue +++ b/src/views/pilots/LeaveFeedback.vue @@ -1,61 +1,162 @@