Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DBMS inventory manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shrey Patel
DBMS inventory manager
Commits
ad7ac9b5
Commit
ad7ac9b5
authored
1 year ago
by
Veda Hegde
Browse files
Options
Downloads
Patches
Plain Diff
List All Organizations working
parent
357b6bb9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory-manager/src/components/user/ListAllOrganizations.jsx
+43
-67
43 additions, 67 deletions
...tory-manager/src/components/user/ListAllOrganizations.jsx
with
43 additions
and
67 deletions
inventory-manager/src/components/user/ListAllOrganizations.jsx
+
43
−
67
View file @
ad7ac9b5
import
*
as
Rea
ct
from
'
react
'
;
import
React
,
{
useState
,
useEffe
ct
}
from
'
react
'
;
import
Table
from
'
@mui/material/Table
'
;
import
TableBody
from
'
@mui/material/TableBody
'
;
import
TableCell
from
'
@mui/material/TableCell
'
;
...
...
@@ -10,77 +10,53 @@ import Paper from '@mui/material/Paper';
import
Axios
from
"
axios
"
;
import
{
Button
}
from
'
@mui/material
'
;
// function createData(name, calories, fat, carbs, protein) {
// return { name, calories, fat, carbs, protein };
// }
export
const
ListAllOrganizations
=
(
props
)
=>
{
const
[
rows
,
setRows
]
=
useState
([]);
// State to store the rows
// const rows = [
// createData('Frozen yoghurt', 159, 6.0, 24, 4.0),
// createData('Ice cream sandwich', 237, 9.0, 37, 4.3),
// createData('Eclair', 262, 16.0, 24, 6.0),
// createData('Cupcake', 305, 3.7, 67, 4.3),
// createData('Gingerbread', 356, 16.0, 49, 3.9),
// ];
useEffect
(()
=>
{
const
fetchOrganizations
=
async
()
=>
{
try
{
const
response
=
await
Axios
.
get
(
"
http://localhost:8080/organization/all
"
);
setRows
(
response
.
data
);
// Update state with fetched data
}
catch
(
error
)
{
console
.
error
(
'
Error fetching data:
'
,
error
);
}
};
function
createData
()
{
}
fetchOrganizations
();
},
[]);
// The empty array ensures this effect runs once on mount
const
rows
=
[];
const
handleSubmit
=
(
e
)
=>
{
e
.
preventDefault
();
Axios
.
get
(
"
http://localhost:8080/organization/all
"
)
.
then
((
response
)
=>
{
const
posts
=
response
.
data
;
// json array
console
.
log
(
"
hello
"
);
console
.
log
(
posts
);
//rows.append(posts);
});
};
export
const
ListAllOrganizations
=
(
props
)
=>
{
// {(e) => handleSubmit(e.target.value)};
// handleSubmit(e);
return
(
<
div
>
<
button
onClick
=
{
handleSubmit
}
>
hi
</
button
>
<
TableContainer
component
=
{
Paper
}
>
<
Table
sx
=
{
{
minWidth
:
650
}
}
aria-label
=
"simple table"
>
<
TableHead
>
<
TableRow
>
<
TableCell
>
Dessert (100g serving)
</
TableCell
>
<
TableCell
align
=
"right"
>
Calories
</
TableCell
>
<
TableCell
align
=
"right"
>
Fat
(g)
</
TableCell
>
<
TableCell
align
=
"right"
>
Carbs
(g)
</
TableCell
>
<
TableCell
align
=
"right"
>
Protein
(g)
</
TableCell
>
</
TableRow
>
</
TableHead
>
<
TableBody
>
{
rows
.
map
((
row
)
=>
(
<
TableRow
key
=
{
row
.
name
}
sx
=
{
{
'
&:last-child td, &:last-child th
'
:
{
border
:
0
}
}
}
>
<
TableCell
component
=
"th"
scope
=
"row"
>
{
row
.
name
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
calories
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
fat
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
carbs
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
protein
}
</
TableCell
>
<
TableContainer
component
=
{
Paper
}
>
<
Table
sx
=
{
{
minWidth
:
650
}
}
aria-label
=
"simple table"
>
<
TableHead
>
<
TableRow
>
<
TableCell
>
Name
</
TableCell
>
<
TableCell
align
=
"right"
>
Category
</
TableCell
>
<
TableCell
align
=
"right"
>
Description
</
TableCell
>
<
TableCell
align
=
"right"
>
Owner Email
</
TableCell
>
<
TableCell
align
=
"right"
>
Member Count
</
TableCell
>
</
TableRow
>
))
}
</
TableBody
>
</
Table
>
</
TableContainer
>
</
TableHead
>
<
TableBody
>
{
rows
.
map
((
row
)
=>
(
<
TableRow
key
=
{
row
.
name
}
sx
=
{
{
'
&:last-child td, &:last-child th
'
:
{
border
:
0
}
}
}
>
<
TableCell
component
=
"th"
scope
=
"row"
>
{
row
.
name
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
category
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
description
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
owner
}
</
TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
membercount
}
</
TableCell
>
</
TableRow
>
))
}
</
TableBody
>
</
Table
>
</
TableContainer
>
</
div
>
);
}
// export default ListAllOrganizations;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment