diff --git a/client/src/components/common/UserActions.jsx b/client/src/components/common/UserActions.jsx index e019c128..01e3ab14 100644 --- a/client/src/components/common/UserActions.jsx +++ b/client/src/components/common/UserActions.jsx @@ -36,7 +36,6 @@ export default function UserActions() { تعيين قائد لقطاع + {isLoadingInsertSector && ( +

+ جاري الإنشاء +

+ )} + + + ); +} diff --git a/client/src/components/insert-sector/InsertSector.scss b/client/src/components/insert-sector/InsertSector.scss new file mode 100644 index 00000000..b0a67847 --- /dev/null +++ b/client/src/components/insert-sector/InsertSector.scss @@ -0,0 +1,19 @@ +.insert-sector { + display: flex; + flex-direction: column; + + &__from { + margin-block: 1rem; + } + &__form__container { + display: grid; + gap: 1rem; + margin-block: 1rem; + } + &__btn { + margin-block: 2rem; + width: 50%; + display: block; + margin-inline: auto; + } +} diff --git a/client/src/redux/actions/DELETEME copy.txt b/client/src/redux/actions/DELETEME copy.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/client/src/redux/slices/captainsApiSlice.js b/client/src/redux/slices/captainsApiSlice.js index 055a75a2..44d97987 100644 --- a/client/src/redux/slices/captainsApiSlice.js +++ b/client/src/redux/slices/captainsApiSlice.js @@ -10,7 +10,13 @@ export const captainsApi = apiSlice.injectEndpoints({ method: "GET", }), }), + GetUnitCaptains: builder.query({ + query: () => ({ + url: `${CAPTAINS_URL}/`, + method: "GET", + }), + }), }), }); -export const { useGetCaptainsQuery } = captainsApi; +export const { useGetCaptainsQuery, useGetUnitCaptainsQuery } = captainsApi; diff --git a/client/src/redux/slices/sectorApiSlice.js b/client/src/redux/slices/sectorApiSlice.js new file mode 100644 index 00000000..cbc40dc4 --- /dev/null +++ b/client/src/redux/slices/sectorApiSlice.js @@ -0,0 +1,29 @@ +import { apiSlice } from "./apiSlice"; + +const SECTOR_URL = "/api/sector"; + +export const captainsApi = apiSlice.injectEndpoints({ + endpoints: (builder) => ({ + InsertSector: builder.mutation({ + query: (sector) => ({ + url: `${SECTOR_URL}/`, + method: "POST", + body: sector, + }), + }), + UpdateSectorUnitCaptain: builder.mutation({ + query: (sector) => ({ + url: `${SECTOR_URL}/:baseName/:suffixName`, + method: "PATCH", + body: sector, + params: { + baseName: sector.baseName, + suffixName: sector.suffixName, + }, + }), + }), + }), +}); + +export const { useInsertSectorMutation, useUpdateSectorUnitCaptainMutation } = + captainsApi; diff --git a/client/src/routes.jsx b/client/src/routes.jsx index fee3514c..93d54e1c 100644 --- a/client/src/routes.jsx +++ b/client/src/routes.jsx @@ -21,6 +21,7 @@ import Dashboard from "./components/dashboard/Dashboard"; import CaptainProfile from "./components/captain-profile/CaptainProfile"; import InsertTermPage from "./components/insert-term/InsertTermPage"; import UpdateTermPage from "./components/update-term-page/UpdateTermPage"; +import InsertSector from "./components/insert-sector/InsertSector"; function Routes() { return ( @@ -34,6 +35,7 @@ function Routes() { } /> } /> } /> + } /> {/* Testing Routes */} diff --git a/client/src/services/api.js b/client/src/services/api.js deleted file mode 100644 index e69de29b..00000000