|
@@ -5,50 +5,55 @@ import {useEffect} from "react"; |
|
|
import {useNavigate} from "react-router-dom"; |
|
|
import {useNavigate} from "react-router-dom"; |
|
|
import { useTheme } from '@mui/material/styles'; |
|
|
import { useTheme } from '@mui/material/styles'; |
|
|
import Checkbox from '@mui/material/Checkbox'; |
|
|
import Checkbox from '@mui/material/Checkbox'; |
|
|
import * as UrlUtils from "../../../utils/ApiPathConst"; |
|
|
|
|
|
import * as HttpUtils from '../../../utils/HttpUtils'; |
|
|
import * as HttpUtils from '../../../utils/HttpUtils'; |
|
|
|
|
|
import { GLD_USER_PATH, GET_USER_LOCK, GET_USER_UNLOCK } from "utils/ApiPathConst"; |
|
|
import { notifyLockSuccess, notifyUnlockSuccess , clickableLink} from 'utils/CommonFunction'; |
|
|
import { notifyLockSuccess, notifyUnlockSuccess , clickableLink} from 'utils/CommonFunction'; |
|
|
|
|
|
|
|
|
// ==============================|| EVENT TABLE ||============================== // |
|
|
// ==============================|| EVENT TABLE ||============================== // |
|
|
|
|
|
|
|
|
export default function UserTable({recordList,setChangeLocked}) { |
|
|
|
|
|
const [rows, setRows] = React.useState(recordList); |
|
|
|
|
|
|
|
|
export default function UserTable({searchCriteria}) { |
|
|
|
|
|
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); |
|
|
|
|
|
const [reloadTime, setReloadTime] = React.useState(new Date()); |
|
|
const theme = useTheme(); |
|
|
const theme = useTheme(); |
|
|
|
|
|
|
|
|
const navigate = useNavigate() |
|
|
const navigate = useNavigate() |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
setRows(recordList); |
|
|
|
|
|
}, [recordList]); |
|
|
|
|
|
|
|
|
set_searchCriteria(searchCriteria); |
|
|
|
|
|
}, [searchCriteria]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
searchCriteria.reloadTime = reloadTime; |
|
|
|
|
|
set_searchCriteria(searchCriteria); |
|
|
|
|
|
}, [reloadTime]); |
|
|
|
|
|
|
|
|
const handleLock = (params) => () => { |
|
|
const handleLock = (params) => () => { |
|
|
setChangeLocked(false) |
|
|
|
|
|
|
|
|
// setChangeLocked(false) |
|
|
if (params.row.locked==true){ |
|
|
if (params.row.locked==true){ |
|
|
doUnlock(params.id) |
|
|
doUnlock(params.id) |
|
|
}else{ |
|
|
}else{ |
|
|
doLock(params.id) |
|
|
doLock(params.id) |
|
|
setRows(recordList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const doLock = (id) => { |
|
|
const doLock = (id) => { |
|
|
HttpUtils.get({ |
|
|
HttpUtils.get({ |
|
|
url: UrlUtils.GET_USER_LOCK+"/"+id, |
|
|
|
|
|
|
|
|
url: GET_USER_LOCK+"/"+id, |
|
|
onSuccess: function(){ |
|
|
onSuccess: function(){ |
|
|
setRows(recordList); |
|
|
|
|
|
setChangeLocked(true) |
|
|
|
|
|
|
|
|
//setChangeLocked(true) |
|
|
notifyLockSuccess() |
|
|
notifyLockSuccess() |
|
|
|
|
|
setReloadTime(new Date()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const doUnlock = (id) => { |
|
|
const doUnlock = (id) => { |
|
|
HttpUtils.get({ |
|
|
HttpUtils.get({ |
|
|
url: UrlUtils.GET_USER_UNLOCK+"/"+id, |
|
|
|
|
|
|
|
|
url: GET_USER_UNLOCK+"/"+id, |
|
|
onSuccess: function(){ |
|
|
onSuccess: function(){ |
|
|
setRows(recordList); |
|
|
|
|
|
setChangeLocked(true) |
|
|
|
|
|
|
|
|
//setChangeLocked(true) |
|
|
notifyUnlockSuccess() |
|
|
notifyUnlockSuccess() |
|
|
|
|
|
setReloadTime(new Date()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
@@ -128,11 +133,14 @@ export default function UserTable({recordList,setChangeLocked}) { |
|
|
return ( |
|
|
return ( |
|
|
<div style={{height: "fit-content", width: '100%'}}> |
|
|
<div style={{height: "fit-content", width: '100%'}}> |
|
|
<FiDataGrid |
|
|
<FiDataGrid |
|
|
rows={rows} |
|
|
|
|
|
columns={columns} |
|
|
columns={columns} |
|
|
customPageSize={5} |
|
|
customPageSize={5} |
|
|
onRowDoubleClick={handleRowDoubleClick} |
|
|
onRowDoubleClick={handleRowDoubleClick} |
|
|
getRowHeight={() => 'auto'} |
|
|
getRowHeight={() => 'auto'} |
|
|
|
|
|
doLoad={{ |
|
|
|
|
|
url: GLD_USER_PATH, |
|
|
|
|
|
params: _searchCriteria, |
|
|
|
|
|
}} |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
); |
|
|
); |
|
|