// material-ui
import {
Grid,
Typography,
Tab,
Box,
Button,
Stack
} from '@mui/material';
import { TabPanel, TabContext, TabList } from '@mui/lab';
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import * as React from "react";
import * as HttpUtils from "utils/HttpUtils";
import {
GET_PUBLIC_NOTICE_LIST_ListByStatus,
GET_PUBLIC_NOTICE_LIST_ListByStatus_submitted,
GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPayment,
GET_PUBLIC_NOTICE_LIST_ListByStatus_pendingPublish
} from "utils/ApiPathConst";
import Loadable from 'components/Loadable';
import { lazy } from 'react';
const BaseGrid = Loadable(lazy(() => import('./BaseGrid')));
const PendingPaymentTab = Loadable(lazy(() => import('./PendingPaymentTab')));
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
const SearchTab = Loadable(lazy(() => import('./SearchPublicNoticeTab')));
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
import { PNSPS_LONG_BUTTON_THEME } from "../../../themes/buttonConst";
import { ThemeProvider } from "@emotion/react";
import { FormattedMessage, useIntl } from "react-intl";
import usePageTitle from 'components/usePageTitle';
// ==============================|| DASHBOARD - DEFAULT ||============================== //
const PublicNotice = () => {
usePageTitle("myPublicNotice");
const [submittedCount, setSubmittedCount] = useState(0);
const [pendingPaymentCount, setPendingPaymentCount] = useState(0);
const [pendingPublishCount, setPendingPublishCount] = useState(0);
const [isLoading, setLoding] = useState(true);
const [selectedTab, setSelectedTab] = useState("1");
const navigate = useNavigate();
const intl = useIntl();
const _sx = {
padding: "4 2 4 2",
boxShadow: 1,
border: 1,
borderColor: '#DDD',
'& .MuiDataGrid-cell': {
borderTop: 1,
borderBottom: 1,
borderColor: "#EEE"
},
'& .MuiDataGrid-footerContainer': {
border: 1,
borderColor: "#EEE"
},
'& .MuiTabPanel-root': {
padding: '0px',
}
}
const BackgroundHead = {
backgroundImage: `url(${titleBackgroundImg})`,
width: '100%',
height: '100%',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
backgroundColor: '#0C489E',
backgroundPosition: 'right'
}
useEffect(() => {
loadData();
}, []);
const loadData = () => {
setLoding(true);
HttpUtils.get({
url: GET_PUBLIC_NOTICE_LIST_ListByStatus,
onSuccess: function (response) {
setSubmittedCount(response.submitted ?? 0);
setPendingPaymentCount(response.pendingPayment ?? 0);
setPendingPublishCount(response.pendingPublish ?? 0);
}
});
};
useEffect(() => {
setLoding(false);
}, [submittedCount]);
const handleChange = (event, newValue) => {
setSelectedTab(newValue);
}
const onBtnClick = () => {
navigate('/publicNotice/apply')
}
return (
isLoading ?
:
{/*col 2*/}
{
JSON.parse(localStorage.getItem('userData')).creditor ? (
) : (
)
}
);
};
export default PublicNotice;