Skip to content

Commit

Permalink
A couple of new Admin UI changes. (#789)
Browse files Browse the repository at this point in the history
* volunteer data

* better formatting
  • Loading branch information
dgershman authored Apr 1, 2023
1 parent 0af7607 commit 3553eaf
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
rules: {
}
};
18 changes: 18 additions & 0 deletions app/Http/Controllers/Api/V1/Admin/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ public function __construct(ConfigRepository $config)
* tags={"Config"},
* summary="Get Configuration",
* description="Get Configuration",
* @OA\Parameter(
* description="The service body ID",
* in="query",
* name="service_body_id",
* required=true,
* @OA\Schema(type="number"),
* ),
* @OA\Parameter(
* description="The data type",
* in="query",
* name="data_type",
* required=true,
* @OA\Schema(type="string"),
* @OA\Examples(example="config", value="_YAP_CONFIG_V2_", summary="Configuration"),
* @OA\Examples(example="volunteers", value="_YAP_VOLUNTEERS_V2_", summary="Volunteers"),
* @OA\Examples(example="groups", value="_YAP_GROUPS_V2_", summary="Groups"),
* @OA\Examples(example="callhandling", value="_YAP_CALL_HANDLING_V2_", summary="Call Handling"),
* ),
* @OA\Response(
* response=200,
* description="Data Returned",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"axios": "^0.21",
"bootstrap": "^5.2.3",
"cross-env": "^7.0",
"eslint": "^8.37.0",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.2.0",
"gulp-concat": "^2.6.1",
Expand Down
14 changes: 7 additions & 7 deletions resources/js/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import ReactDOM from 'react-dom/client';
import {createTheme, Button, ThemeProvider} from "@mui/material";
import MenuBar from './MenuBar';
import {BrowserRouter, Route, Routes, useLocation} from "react-router-dom";
import ServiceBodies from "./ServiceBodies";
import Schedules from "./Schedules";
import Home from "./Home";
import Reports from "./Reports";
import Volunteers from "./Volunteers";
import Groups from "./Groups";
import Users from "./Users";
import ServiceBodies from "../pages/ServiceBodies";
import Schedules from "../pages/Schedules";
import Home from "../pages/Home";
import Reports from "../pages/Reports";
import Volunteers from "../pages/Volunteers";
import Groups from "../pages/Groups";
import Users from "../pages/Users";

function App() {
const themeOptions = createTheme({
Expand Down
7 changes: 0 additions & 7 deletions resources/js/components/Home.js

This file was deleted.

35 changes: 35 additions & 0 deletions resources/js/components/VolunteerControl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {useEffect, useState} from "react";
import Box from "@mui/material/Box";
import {Card, TextField} from "@mui/material";

function VolunteerControl({serviceBodyId})
{
const [data, setData] = useState(null);
const [loading, setLoading] = useState(false);

const getVolunteers = async() => {
setLoading(true)
let response = await fetch(`${rootUrl}/api/v1/config?service_body_id=${serviceBodyId}&data_type=_YAP_VOLUNTEERS_V2_`)
let responseData = await response.json()
setData(responseData)
setLoading(false)
}

useEffect(() => {
console.log(`volunteercontrol: ${serviceBodyId}`)
getVolunteers()
}, [])

return (
!loading && data != null ? data.data.map(volunteer => (
<Card>
<div>
<TextField label="Volunteer Name" defaultValue={volunteer.volunteer_name}/>
<TextField label="Phone Number" defaultValue={volunteer.volunteer_phone_number}/>
</div>
</Card>
)) : ""
);
}

export default VolunteerControl;
17 changes: 0 additions & 17 deletions resources/js/components/Volunteers.js

This file was deleted.

File renamed without changes.
10 changes: 10 additions & 0 deletions resources/js/pages/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function Home() {
return (
<div>
<h1>Home</h1>
Api Docs: /api/v1/documentation
</div>
)
}

export default Home;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions resources/js/pages/Volunteers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, {useState} from "react";
import ServiceBodiesDropdown from "../components/ServiceBodiesDropdown";
import VolunteerControl from "../components/VolunteerControl";

function Volunteers() {
const [serviceBodyId, setServiceBodyId] = useState(0);

const serviceBodiesHandleChange = (event, index) => {
console.log(event)
setServiceBodyId(event)
}

return (
<div>
<ServiceBodiesDropdown handleChange={serviceBodiesHandleChange}/>
{serviceBodyId > 0 ?
<VolunteerControl serviceBodyId={serviceBodyId} /> : ""}
</div>
)
}

export default Volunteers;
38 changes: 38 additions & 0 deletions storage/api-docs/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,44 @@
"summary": "Get Configuration",
"description": "Get Configuration",
"operationId": "Config",
"parameters": [
{
"name": "service_body_id",
"in": "query",
"description": "The service body ID",
"required": true,
"schema": {
"type": "number"
}
},
{
"name": "data_type",
"in": "query",
"description": "The data type",
"required": true,
"schema": {
"type": "string"
},
"examples": {
"config": {
"summary": "Configuration",
"value": "_YAP_CONFIG_V2_"
},
"volunteers": {
"summary": "Volunteers",
"value": "_YAP_VOLUNTEERS_V2_"
},
"groups": {
"summary": "Groups",
"value": "_YAP_GROUPS_V2_"
},
"callhandling": {
"summary": "Call Handling",
"value": "_YAP_CALL_HANDLING_V2_"
}
}
}
],
"responses": {
"200": {
"description": "Data Returned",
Expand Down

0 comments on commit 3553eaf

Please sign in to comment.