diff --git a/src/pages/usergroups/tables/usergroup-scenarios-table.js b/src/pages/usergroups/tables/usergroup-scenarios-table.js
index 01e4346..b6716e2 100644
--- a/src/pages/usergroups/tables/usergroup-scenarios-table.js
+++ b/src/pages/usergroups/tables/usergroup-scenarios-table.js
@@ -15,8 +15,48 @@
* along with VILLASweb. If not, see .
******************************************************************************/
-const UsergroupScenariosTable = (props) => {
- return
+import { useGetUsergroupByIdQuery } from "../../../store/apiSlice";
+import { Table, DataColumn, LinkColumn, ButtonColumn } from "../../../common/table";
+import { iconStyle, buttonStyle } from "../styles";
+import IconButton from "../../../common/buttons/icon-button";
+
+const UsergroupScenariosTable = ({usergroupID}) => {
+ const {data: {usergroup} = {}, isLoading} = useGetUsergroupByIdQuery(usergroupID);
+
+ const handleAddScenarioMapping = () => {
+
+ }
+
+ const getDuplicateLabel = (duplicate) => {
+ return duplicate ? yes
: no
;
+ }
+
+ if(isLoading) return Loading...
;
+
+ return (
+
+ Scenario Mappings
+
+ handleAddScenarioMapping()}
+ icon="plus"
+ buttonStyle={buttonStyle}
+ iconStyle={iconStyle}
+ />
+
+
+
+
+
+ getDuplicateLabel(duplicate)}/>
+ {/* */}
+
+
);
}
export default UsergroupScenariosTable;
diff --git a/src/pages/usergroups/tables/usergroup-users-table.js b/src/pages/usergroups/tables/usergroup-users-table.js
index 08fae10..30c1633 100644
--- a/src/pages/usergroups/tables/usergroup-users-table.js
+++ b/src/pages/usergroups/tables/usergroup-users-table.js
@@ -15,8 +15,51 @@
* along with VILLASweb. If not, see .
******************************************************************************/
-const UsergroupUsersTable = (props) => {
- return
+import { useGetUsersByUsergroupIdQuery } from "../../../store/apiSlice";
+import { Table, DataColumn, LinkColumn, ButtonColumn } from "../../../common/table";
+import { iconStyle, buttonStyle } from "../styles";
+import IconButton from "../../../common/buttons/icon-button";
+
+const UsergroupUsersTable = ({usergroupID}) => {
+ const {data: {users}=[], isLoading} = useGetUsersByUsergroupIdQuery(usergroupID);
+
+ const handleAddUser = () => {
+
+ }
+
+ if(isLoading) return Loading...
;
+
+ return (
+
+ Users
+
+ handleAddUser()}
+ icon="plus"
+ buttonStyle={buttonStyle}
+ iconStyle={iconStyle}
+ />
+
+
+
+
);
}
export default UsergroupUsersTable;
diff --git a/src/pages/usergroups/usergroup.js b/src/pages/usergroups/usergroup.js
index 1575a31..0bc2c30 100644
--- a/src/pages/usergroups/usergroup.js
+++ b/src/pages/usergroups/usergroup.js
@@ -20,25 +20,23 @@ import { Table, DataColumn, LinkColumn } from "../../common/table";
import { Row, Col } from "react-bootstrap";
import UsergroupScenariosTable from "./tables/usergroup-scenarios-table";
import UsergroupUsersTable from "./tables/usergroup-users-table";
-import { useGetUserGroupByIdQuery } from "../../store/apiSlice";
+import { useGetUsergroupByIdQuery } from "../../store/apiSlice";
const Usergroup = (props) => {
const params = useParams();
const usergroupID = params.usergroup;
- const {data: {usergroup} = {}, isLoading} = useGetUserGroupByIdQuery(usergroupID);
+ const {data: {usergroup} = {}, isLoading} = useGetUsergroupByIdQuery(usergroupID);
if(isLoading) return Loading...
;
return (
{usergroup.name}
-
+
- Users
- Scenario Mappings
diff --git a/src/store/apiSlice.js b/src/store/apiSlice.js
index ebce8d3..57955ee 100644
--- a/src/store/apiSlice.js
+++ b/src/store/apiSlice.js
@@ -109,5 +109,6 @@ export const {
useGetUsergroupsQuery,
useAddUsergroupMutation,
useDeleteUsergroupMutation,
- useGetUserGroupByIdQuery
+ useGetUsergroupByIdQuery,
+ useGetUsersByUsergroupIdQuery
} = apiSlice;
diff --git a/src/store/endpoints/usergroup-endpoints.js b/src/store/endpoints/usergroup-endpoints.js
index 72d3d36..8fbaf9b 100644
--- a/src/store/endpoints/usergroup-endpoints.js
+++ b/src/store/endpoints/usergroup-endpoints.js
@@ -19,7 +19,7 @@ export const usergroupEndpoints = (builder) => ({
getUsergroups: builder.query({
query: () => 'usergroups',
}),
- getUserGroupById: builder.query({
+ getUsergroupById: builder.query({
query: (usergroupID) => `/usergroups/${usergroupID}`,
}),
addUsergroup: builder.mutation({
@@ -31,6 +31,9 @@ export const usergroupEndpoints = (builder) => ({
},
}),
}),
+ getUsersByUsergroupId: builder.query({
+ query: (usergroupID) => `/usergroups/${usergroupID}/users`,
+ }),
deleteUsergroup: builder.mutation({
query: (usergroupID) => ({
url: `usergroups/${usergroupID}`,