main
This commit is contained in:
@@ -37,7 +37,6 @@ import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
|
||||
import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";
|
||||
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
|
||||
import { provinceCarsDashboardService } from "../../services/province-cars-dashboard";
|
||||
import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith";
|
||||
|
||||
export const ProvinceManageCars = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -46,32 +45,18 @@ export const ProvinceManageCars = () => {
|
||||
const { provinceCars } = useSelector((state) => state.provinceSlice);
|
||||
// const userInfo = useSelector((state) => state.userSlice);
|
||||
const userKey = useSelector((state) => state.userSlice.userProfile.key);
|
||||
const selectedSubUser = useSelector(
|
||||
(state) => state.userSlice.selectedSubUser
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(
|
||||
provinceGetCars({
|
||||
role_key: checkPathStartsWith("province")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
);
|
||||
}, [selectedSubUser?.key]);
|
||||
dispatch(provinceGetCars());
|
||||
}, []);
|
||||
|
||||
const [dashboardData, setDashboardData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(
|
||||
provinceCarsDashboardService({
|
||||
role_key: checkPathStartsWith("province")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
).then((r) => {
|
||||
dispatch(provinceCarsDashboardService()).then((r) => {
|
||||
setDashboardData(r.payload.data);
|
||||
});
|
||||
}, [dispatch, provinceCars, selectedSubUser?.key]);
|
||||
}, [dispatch, provinceCars]);
|
||||
|
||||
useEffect(() => {
|
||||
const d = provinceCars?.map((item, i) => {
|
||||
@@ -162,11 +147,7 @@ export const ProvinceManageCars = () => {
|
||||
<a
|
||||
href={`${
|
||||
axios.defaults.baseURL
|
||||
}car_province_excel/?key=${userKey}&role=${getRoleFromUrl()}${
|
||||
checkPathStartsWith("province")
|
||||
? `&role_key=${selectedSubUser?.key}`
|
||||
: ""
|
||||
}`}
|
||||
}car_province_excel/?key=${userKey}&role=${getRoleFromUrl()}`}
|
||||
rel="noreferrer"
|
||||
>
|
||||
<Button color="success">
|
||||
@@ -175,7 +156,7 @@ export const ProvinceManageCars = () => {
|
||||
</a>
|
||||
</Tooltip>
|
||||
<Card sx={{ width: "100%" }}>
|
||||
<Grid container mt={2} mb={4} isDashboard xs={12}>
|
||||
<Grid container mt={2} mb={4} isDashboard>
|
||||
<ResponsiveTable
|
||||
noPagination
|
||||
isDashboard
|
||||
|
||||
Reference in New Issue
Block a user