Closed daisycrego closed 3 years ago
Source
to view other lead sources, including all sources. Action 1
--> Update Status
, when user selects Update Status
, we display a dropdown to update the status in place of the Update Status
button, and a Save
button. We can use state within the EventsTable component to know whether or not we are currently editing a given row, and then either display the Update Status
button or the status dropdown + Save
button.EventsTable
component to have internal state to determine whether or not a row is being edited. If a row is being edited, display a status dropdown and a Save
button. Attach an onclick handler to the Update Status
button which will change the isEditing
status, this should result in the component being re-rendered.\The current EventsTable
receives rows
as props. This should be ok, we can update which rows are actually to be displayed internally within the EventsTable
:
export default function EventsTable({ rows }) {
const classes = useStyles();
const [order, setOrder] = React.useState("desc");
const [orderBy, setOrderBy] = React.useState("created");
const [page, setPage] = React.useState(0);
const [dense, setDense] = React.useState(false);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleRequestSort = (event, property) => {
const isAsc = orderBy === property && order === "asc";
setOrder(isAsc ? "desc" : "asc");
setOrderBy(property);
};
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(parseInt(event.target.value, 10));
setPage(0);
};
const handleChangeDense = (event) => {
setDense(event.target.checked);
};
const emptyRows =
rowsPerPage - Math.min(rowsPerPage, rows.length - page * rowsPerPage);
return (
<div className={classes.root}>
<Paper className={classes.paper}>
<EnhancedTableToolbar />
<TableContainer>
<Table
className={classes.table}
aria-labelledby="tableTitle"
size={dense ? "small" : "medium"}
aria-label="enhanced table"
>
<EnhancedTableHead
classes={classes}
order={order}
orderBy={orderBy}
onRequestSort={handleRequestSort}
rowCount={rows.length}
/>
<TableBody>
{stableSort(rows, getComparator(order, orderBy))
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row, index) => {
const labelId = `enhanced-table-checkbox-${index}`;
return (
<TableRow hover tabIndex={-1} key={row.id}>
<TableCell
component="th"
id={labelId}
scope="row"
align={"default"}
padding={"left"}
>
{row.property ? row.property.street : ""}
</TableCell>
<TableCell align={"default"} padding={"left"}>
{`${new Date(row.created).toDateString()} ${new Date(
row.created
).toLocaleTimeString()}`}
</TableCell>
<TableCell align={"default"} padding={"left"}>
{row.source}
</TableCell>
<TableCell align={"default"} padding={"left"}>
{actions.map((action) => (
<Button>{action.name}</Button>
))}
</TableCell>
<TableCell align={"default"} padding={"left"}>
<Link to={"/event/" + row._id} key={row._id}>
<IconButton>
<ArrowForward />
</IconButton>
</Link>
</TableCell>
</TableRow>
);
})}
{emptyRows > 0 && (
<TableRow style={{ height: (dense ? 33 : 53) * emptyRows }}>
<TableCell colSpan={6} />
</TableRow>
)}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[5, 10, 25, 50, 100]}
component="div"
count={rows.length}
rowsPerPage={rowsPerPage}
page={page}
onChangePage={handleChangePage}
onChangeRowsPerPage={handleChangeRowsPerPage}
/>
</Paper>
<FormControlLabel
control={<Switch checked={dense} onChange={handleChangeDense} />}
label="Dense padding"
/>
</div>
);
}
Events
Allow user to change status from multiple UI locations: (1) individual /events/:id page (2) homepage - events table - each row should have an option to edit directly
Todo
Event
model:No action
Notified Zillow
Zillow Approves Exemption
Zillow Rejected Exemption
How?
enum
,match
,minLength
, andmaxLength
validators.No action
,Notified Zillow
,Zillow Approves Exemption
,Zillow Rejected Exemption
. All incoming events will be categorized asNo action
by default.