Feature/insurance registration
This commit is contained in:
@@ -4,14 +4,14 @@ import { Switch } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
|
||||
const Activity = ({ rowId, mutate, status }) => {
|
||||
const [disabled, setDisabled] = useState(false)
|
||||
const [disabled, setDisabled] = useState(false);
|
||||
const [checked, setChecked] = useState(status == 1);
|
||||
const requestServer = useRequest();
|
||||
|
||||
const handleSwitch = (event) => {
|
||||
const newChecked = event.target.checked;
|
||||
setChecked(newChecked);
|
||||
setDisabled(true)
|
||||
setDisabled(true);
|
||||
|
||||
requestServer(`${ATIVITY_RECEIPT_DAMAGE_ITEMS}/${rowId}`, "post")
|
||||
.then(() => {
|
||||
@@ -21,8 +21,8 @@ const Activity = ({ rowId, mutate, status }) => {
|
||||
setChecked(!newChecked);
|
||||
})
|
||||
.finally(() => {
|
||||
setDisabled(false)
|
||||
})
|
||||
setDisabled(false);
|
||||
});
|
||||
};
|
||||
|
||||
return <Switch size="small" disabled={disabled} checked={checked} onChange={handleSwitch} />;
|
||||
|
||||
@@ -4,7 +4,7 @@ import Edit from "./Edit";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: 1, alignItems: 'center' }}>
|
||||
<Box sx={{ display: "flex", gap: 1, alignItems: "center" }}>
|
||||
<Edit row={row} mutate={mutate} rowId={row.getValue("id")} />
|
||||
<Activity mutate={mutate} rowId={row.getValue("id")} status={row.original.status} />
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user