-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Justin Campbell
committed
Jul 31, 2020
1 parent
88b41a7
commit cfad40e
Showing
4 changed files
with
125 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,47 @@ | ||
import React from 'react'; | ||
import React, { useState, useEffect } from 'react'; | ||
import MaterialTable from "material-table"; | ||
|
||
function ItemTable() { | ||
|
||
const columns = [ | ||
{ title: 'Queue', field: 'queue', filterPlaceholder: "Ex: \"ME\""}, | ||
{ title: 'Item #', field: 'itemNumber', filterPlaceholder: "Ex: \"42\""}, | ||
{ title: 'From', field: 'from', filterPlaceholder: "Ex: \"campb303\""}, | ||
{ title: 'For', field: 'for', filterPlaceholder: "Ex: \"sundeep\""}, | ||
{ title: 'Subject', field: 'subject', filterPlaceholder: "Ex: \"Install Libraries\""}, | ||
{ title: 'Status', field: 'status', filterPlaceholder: "Ex: \"Wating for Reply\""}, | ||
{ title: 'Priority', field: 'priority', filterPlaceholder: "Ex: \"covid\""}, | ||
] | ||
|
||
const data = [ | ||
{"queue": "ME", "itemNumber": 42, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "TECH", "itemNumber": 42, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "CE", "itemNumber": 42, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "LINUX", "itemNumber": 42, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
|
||
{"queue": "ME", "itemNumber": 1, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "TECH", "itemNumber": 2, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "CE", "itemNumber": 3, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "LINUX", "itemNumber": 4, "from": "campb303", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
|
||
{"queue": "ME", "itemNumber": 5, "from": "harley", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "TECH", "itemNumber": 6, "from": "bekuma", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "CE", "itemNumber": 7, "from": "twetzle11", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "LINUX", "itemNumber": 8, "from": "apigman", "for": "sundeep", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
|
||
{"queue": "ME", "itemNumber": 9, "from": "harley", "for": "marthur", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "TECH", "itemNumber": 10, "from": "bekuma", "for": "emuffley", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "CE", "itemNumber": 11, "from": "twetzle11", "for": "seth", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "LINUX", "itemNumber": 12, "from": "apigman", "for": "cs", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
|
||
{"queue": "ME", "itemNumber": 9, "from": "harley", "for": "marthur", "subject": "Installing Libraries", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "TECH", "itemNumber": 10, "from": "bekuma", "for": "emuffley", "subject": "Installing Abaquc", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "CE", "itemNumber": 11, "from": "twetzle11", "for": "seth", "subject": "Restart Printer", "status": "Waitinf for Reply", "priority": "covid"}, | ||
{"queue": "LINUX", "itemNumber": 12, "from": "apigman", "for": "cs", "subject": "Same Problem but a 5th time", "status": "Waitinf for Reply", "priority": "covid"}, | ||
|
||
{"queue": "ME", "itemNumber": 9, "from": "harley", "for": "marthur", "subject": "Installing Libraries", "status": "qc ready", "priority": "covid"}, | ||
{"queue": "TECH", "itemNumber": 10, "from": "bekuma", "for": "emuffley", "subject": "Installing Abaquc", "status": "qc ok", "priority": "covid"}, | ||
{"queue": "CE", "itemNumber": 11, "from": "twetzle11", "for": "seth", "subject": "Restart Printer", "status": "Meet tomorrow at 3p", "priority": "covid"}, | ||
{"queue": "LINUX", "itemNumber": 12, "from": "apigman", "for": "cs", "subject": "Same Problem but a 5th time", "status": "qc ok", "priority": "covid"}, | ||
]; | ||
|
||
const options = { | ||
"filtering": true, | ||
"paging": false, | ||
"search": false, | ||
"draggable": false, | ||
"padding": "dense", | ||
} | ||
|
||
return ( | ||
<MaterialTable | ||
columns={columns} | ||
data={data} | ||
title={"Example Item Table"} | ||
options={options} | ||
/> | ||
); | ||
function ItemTable(props) { | ||
|
||
const columns = [ | ||
{ title: 'Queue', field: 'queue', filterPlaceholder: "Ex: \"ME\"" }, | ||
{ title: 'Item #', field: 'number', filterPlaceholder: "Ex: \"42\"" }, | ||
{ title: 'From', field: 'userAlias', filterPlaceholder: "Ex: \"campb303\"" }, | ||
{ title: 'Assigned To', field: 'assignedTo', filterPlaceholder: "Ex: \"sundeep\"" }, | ||
{ title: 'Subject', field: 'subject', filterPlaceholder: "Ex: \"Install Libraries\"" }, | ||
{ title: 'Status', field: 'status', filterPlaceholder: "Ex: \"Wating for Reply\"" }, | ||
{ title: 'Priority', field: 'priority', filterPlaceholder: "Ex: \"covid\"" }, | ||
{ title: 'Last Updated', field: 'lastUpdated', filterPlaceholder: "Ex: \"07-27-20 12:54 PM\"" }, | ||
// { title: 'Department', field: 'department', filterPlaceholder: "Ex: \"Business Office\"" }, | ||
// { title: 'Building', field: 'building', filterPlaceholder: "Ex: \"KNOY\"" }, | ||
// { title: 'Date Received', field: 'dateReceived', filterPlaceholder: "Ex: \"07-20-20 03:32 AM\"" }, | ||
] | ||
|
||
const [data, setData] = useState([]) | ||
|
||
useEffect(() => { | ||
fetch("/api/ce").then(res => res.json()).then(queue => { | ||
setData(queue.items) | ||
}) | ||
}, []) | ||
|
||
const options = { | ||
"filtering": true, | ||
"paging": false, | ||
"search": false, | ||
"draggable": false, | ||
"padding": "dense", | ||
} | ||
|
||
return ( | ||
<MaterialTable | ||
columns={columns} | ||
data={data} | ||
title={"Demo Table"} | ||
options={options} | ||
onRowClick={(event, rowData) => props.setActiveItem(rowData)} | ||
/> | ||
); | ||
} | ||
|
||
export default ItemTable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,73 @@ | ||
import React, { useState } from 'react'; | ||
import { TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Paper, Typography, makeStyles } from '@material-ui/core'; | ||
|
||
const useStyles = makeStyles({ | ||
"td:first-child": { | ||
"font-weight": "bold", | ||
} | ||
}) | ||
|
||
function ItemView({item}){ | ||
|
||
const classes = useStyles(); | ||
|
||
return( | ||
<> | ||
<Typography variant="h3"> | ||
{item.queue + " " + item.itemNumber} | ||
</Typography> | ||
<TableContainer component={Paper} > | ||
<Table> | ||
<TableBody> | ||
{Object.keys(item).map((key) => { | ||
return ( | ||
<TableRow> | ||
<TableCell | ||
classes={{body: classes["td:first-child"]}} | ||
> | ||
<Typography variant="body1">Some stuff</Typography> | ||
</TableCell> | ||
<TableCell> | ||
<Typography variant="body1"> about the item.</Typography> | ||
</TableCell> | ||
</TableRow> | ||
); | ||
})} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
</> | ||
); | ||
import React, { useState, useEffect } from 'react'; | ||
import { ListItem, ListItemIcon, ListItemText, Paper, Typography, Divider } from '@material-ui/core'; | ||
import FolderIcon from '@material-ui/icons/Folder'; | ||
import PersonIcon from '@material-ui/icons/Person'; | ||
import CalendarIcon from '@material-ui/icons/CalendarToday'; | ||
import AssignmentdIcon from '@material-ui/icons/AssignmentInd'; | ||
import InfoIcon from '@material-ui/icons/Info'; | ||
import ClockIcon from '@material-ui/icons/QueryBuilder'; | ||
|
||
function ItemView(props){ | ||
return( | ||
<Paper> | ||
<ListItem> | ||
<Typography variant="h4"> | ||
{props.activeItem["queue"] + " " + props.activeItem["number"]} | ||
</Typography> | ||
</ListItem> | ||
|
||
<ListItem> | ||
<Typography variant="h5"> | ||
{props.activeItem["subject"]} | ||
</Typography> | ||
</ListItem> | ||
|
||
<ListItem alignItems="flex-start"> | ||
<ListItemIcon> | ||
<PersonIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary={"From: " + props.activeItem["userName"]} secondary={props.activeItem["userEmail"]} /> | ||
</ListItem> | ||
|
||
<ListItem> | ||
<ListItemIcon> | ||
<CalendarIcon /> | ||
</ListItemIcon> | ||
<ListItemText secondary={props.activeItem["dateReceived"]} /> | ||
</ListItem> | ||
|
||
<ListItem alignItems="flex-start"> | ||
<ListItemIcon> | ||
<AssignmentdIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary={"Assigned To:"} secondary={props.activeItem["assignedTo"]} /> | ||
</ListItem> | ||
|
||
<ListItem alignItems="flex-start"> | ||
<ListItemIcon> | ||
<InfoIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary={"Status:"} secondary={props.activeItem["status"]} /> | ||
</ListItem> | ||
|
||
<ListItem alignItems="flex-start"> | ||
<ListItemIcon> | ||
<ClockIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary={"Last Updated:"} secondary={props.activeItem["lastUpdated"]} /> | ||
</ListItem> | ||
|
||
<Divider style={{marginBottom: "1em"}}/> | ||
|
||
{/* <ListItem> */} | ||
{props.activeItem["content"] ? props.activeItem["content"].map(line => ( | ||
<Typography variant="body1" style={{paddingLeft: "1.5em"}} paragraph> | ||
{line} | ||
</Typography> | ||
)): "" } | ||
{/* </ListItem> */} | ||
</Paper> | ||
); | ||
} | ||
|
||
export default ItemView; |