@@ -141,17 +141,20 @@ function Header(props) { | |||
<Link className="userProfileGld" to='/user/profile'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>My Profile</Typography></Link> | |||
</li> | |||
<li> | |||
<Link className="emailTemplate" to='/emailTemplate'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Email Template</Typography></Link> | |||
<Link className="emailTemplate" to='/setting/emailTemplate'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Email Template</Typography></Link> | |||
</li> | |||
<li> | |||
<Link className="systemSetting" to='/setting/sys'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>System Setting</Typography></Link> | |||
</li> | |||
<li> | |||
<Link className="holidaySetting" to='/holiday'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Holiday Setting</Typography></Link> | |||
<Link className="holidaySetting" to='/setting/holiday'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Holiday Setting</Typography></Link> | |||
</li> | |||
<li> | |||
<Link className="announcement" to='/setting/announcement'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Announcement</Typography></Link> | |||
</li> | |||
<li> | |||
<Link className="gazetteissueSetting" to='/setting/gazetteissuepage'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Gazette Issue</Typography></Link> | |||
</li> | |||
</ul> | |||
</li> | |||
<Box sx={{display: {xs: 'none', sm: 'none', md: 'block'}}}> | |||
@@ -56,7 +56,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p | |||
function getIssueLabel(data) { | |||
if (data == {}) return ""; | |||
return data.year | |||
return data.issueYear | |||
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3) | |||
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2) | |||
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); | |||
@@ -75,7 +75,7 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||
function getIssueLabel(data) { | |||
if (data == {}) return ""; | |||
return data.year | |||
return data.issueYear | |||
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3) | |||
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2) | |||
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); | |||
@@ -64,7 +64,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData | |||
function getIssueLabel(data) { | |||
if (data == {}) return ""; | |||
return data.year | |||
return data.issueYear | |||
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3) | |||
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2) | |||
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); | |||
@@ -0,0 +1,167 @@ | |||
// material-ui | |||
import { | |||
Grid, | |||
Typography, | |||
Stack, | |||
Button, | |||
Dialog, DialogTitle, DialogContent, DialogActions, | |||
} from '@mui/material'; | |||
import * as UrlUtils from "utils/ApiPathConst"; | |||
import * as React from "react"; | |||
import * as HttpUtils from "utils/HttpUtils"; | |||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||
const BackgroundHead = { | |||
backgroundImage: `url(${titleBackgroundImg})`, | |||
width: '100%', | |||
height: '100%', | |||
backgroundSize: 'contain', | |||
backgroundRepeat: 'no-repeat', | |||
backgroundColor: '#0C489E', | |||
backgroundPosition: 'right' | |||
} | |||
import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; | |||
import {ThemeProvider} from "@emotion/react"; | |||
import { notifySaveSuccess } from 'utils/CommonFunction'; | |||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
const Index = () => { | |||
const [attachments, setAttachments] = React.useState([]); | |||
const [waitImport, setWaitImport] = React.useState(false); | |||
const [waitDownload, setWaitDownload] = React.useState(false); | |||
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | |||
const [warningText, setWarningText] = React.useState(""); | |||
React.useEffect(() => { | |||
if (attachments.length > 0) { | |||
importHoliday(); | |||
} | |||
}, [attachments]); | |||
const readFile = (event) => { | |||
let file = event.target.files[0]; | |||
if (file) { | |||
if (!file.name.toLowerCase().substr(file.name.length - 5).includes(".xlsx")) { | |||
setWarningText("Please upload a valid file (File format: .xlsx)."); | |||
setIsWarningPopUp(true); | |||
document.getElementById("uploadFileBtn").value = ""; | |||
return; | |||
} | |||
file['id'] = attachments.length; | |||
setAttachments([ | |||
...attachments, | |||
file | |||
]); | |||
document.getElementById("uploadFileBtn").value = ""; | |||
} | |||
} | |||
const doExport=()=>{ | |||
setWaitDownload(true) | |||
HttpUtils.fileDownload({ | |||
url: UrlUtils.GET_ISSUE_LIST, | |||
onResponse: () => { | |||
setTimeout(()=> setWaitDownload(false), 500) | |||
} | |||
}); | |||
} | |||
const importHoliday = () => { | |||
setWaitImport(true); | |||
if (!attachments || attachments.length <= 0) { | |||
setWarningText("Please upload file."); | |||
setSaving(false); | |||
return; | |||
} | |||
HttpUtils.postWithFiles({ | |||
url: UrlUtils.POST_ISSUE_FILE, | |||
files: attachments, | |||
onSuccess: () => { | |||
notifySaveSuccess() | |||
setWaitImport(false); | |||
setAttachments([]); | |||
// loadForm(); | |||
} | |||
}); | |||
} | |||
return ( | |||
<Grid container sx={{minHeight: '87vh', backgroundColor: 'backgroundColor.default'}} direction="column" justifyContent="flex-start" alignItems="center" > | |||
<Grid item xs={12} width="100%"> | |||
<div style={BackgroundHead} width="100%"> | |||
<Stack direction="row" height='70px'> | |||
<Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>Gazette Issue</Typography> | |||
</Stack> | |||
</div> | |||
</Grid> | |||
<Grid item xs={12} md={12} lg={6} width="100%"> | |||
<Stack direction="row" justifyContent="flex-start" alignItems="center" spacing={2} sx={{ml:2,mt:1}} > | |||
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | |||
<label htmlFor="downloadFileBtn"> | |||
<Button | |||
component="span" | |||
variant="contained" | |||
size="large" | |||
disabled={waitDownload} | |||
onClick={doExport} | |||
> | |||
<Typography variant="h5">Export</Typography> | |||
</Button> | |||
</label> | |||
</ThemeProvider> | |||
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | |||
<input | |||
id="uploadFileBtn" | |||
name="file" | |||
type="file" | |||
accept=".xlsx" | |||
style={{ display: 'none' }} | |||
disabled={waitImport} | |||
onChange={(event) => { | |||
readFile(event) | |||
}} | |||
/> | |||
<label htmlFor="uploadFileBtn"> | |||
<Button | |||
component="span" | |||
variant="contained" | |||
size="large" | |||
disabled={waitImport} | |||
> | |||
<Typography variant="h5">Upload Files</Typography> | |||
</Button> | |||
</label> | |||
</ThemeProvider> | |||
</Stack> | |||
</Grid> | |||
<div> | |||
<Dialog | |||
open={isWarningPopUp} | |||
onClose={() => setIsWarningPopUp(false)} | |||
PaperProps={{ | |||
sx: { | |||
minWidth: '40vw', | |||
maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, | |||
maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } | |||
} | |||
}} | |||
> | |||
<DialogTitle><Typography variant="h3">Warning</Typography></DialogTitle> | |||
<DialogContent style={{ display: 'flex', }}> | |||
<Typography variant="h4" style={{ padding: '16px' }}>{warningText}</Typography> | |||
</DialogContent> | |||
<DialogActions> | |||
<Button onClick={() => setIsWarningPopUp(false)}><Typography variant="h5">OK</Typography></Button> | |||
</DialogActions> | |||
</Dialog> | |||
</div> | |||
</Grid > | |||
); | |||
}; | |||
export default Index; |
@@ -47,7 +47,7 @@ export default function EmailTemplateTable({ recordList }) { | |||
<FiDataGrid | |||
rows={rows} | |||
columns={columns} | |||
customPageSize={10} | |||
customPageSize={20} | |||
// onRowDoubleClick={handleRowDoubleClick} | |||
getRowHeight={() => 'auto'} | |||
/> |
@@ -12,7 +12,7 @@ import * as HttpUtils from "utils/HttpUtils"; | |||
import Loadable from 'components/Loadable'; | |||
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||
const HolidayTable = Loadable(React.lazy(() => import('pages/Holiday/Search_GLD/DataGrid'))) | |||
const HolidayTable = Loadable(React.lazy(() => import('pages/Holiday/DataGrid'))) | |||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||
// import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; | |||
import MainCard from 'components/MainCard'; | |||
@@ -40,13 +40,15 @@ const Index = () => { | |||
const [record, setRecord] = React.useState([]); | |||
const [comboData, setComboData] = React.useState([]); | |||
const [onReady, setOnReady] = React.useState(false); | |||
const [onSearchReady, setOnSearchReady] = React.useState(false); | |||
// const navigate = useNavigate() | |||
const [searchCriteria, setSearchCriteria] = React.useState({ | |||
year: dateStr_Year(new Date()), | |||
// dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)), | |||
}); | |||
const [attachments, setAttachments] = React.useState([]); | |||
const [wait, setWait] = React.useState(false); | |||
const [waitImport, setWaitImport] = React.useState(false); | |||
const [waitDownload, setWaitDownload] = React.useState(false); | |||
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | |||
const [warningText, setWarningText] = React.useState(""); | |||
@@ -54,26 +56,29 @@ const Index = () => { | |||
// loadForm(); | |||
// }, []); | |||
React.useLayoutEffect(() => { | |||
if (comboData && comboData.length > 0) { | |||
setOnReady(true); | |||
} | |||
}, [comboData]); | |||
// React.useLayoutEffect(() => { | |||
// if (comboData) { | |||
// setOnReady(true); | |||
// } | |||
// }, [comboData]); | |||
React.useEffect(() => { | |||
// console.log(searchCriteria) | |||
setOnSearchReady(false) | |||
loadForm(); | |||
}, [searchCriteria]); | |||
function loadForm() { | |||
HttpUtils.get({ | |||
url: UrlUtils.GET_HOLIDAY, | |||
params: searchCriteria, | |||
onSuccess: (responseData) => { | |||
console.log(comboData) | |||
// console.log(comboData) | |||
setRecord(responseData); | |||
if (comboData.length == 0) { | |||
loadCombo(); | |||
}else{ | |||
setOnSearchReady(true) | |||
} | |||
} | |||
}); | |||
@@ -85,6 +90,8 @@ const Index = () => { | |||
onSuccess: (responseData) => { | |||
let combo = responseData; | |||
setComboData(combo); | |||
setOnReady(true); | |||
setOnSearchReady(true) | |||
} | |||
}); | |||
} | |||
@@ -117,8 +124,19 @@ const Index = () => { | |||
} | |||
} | |||
const doExport=()=>{ | |||
setWaitDownload(true) | |||
HttpUtils.fileDownload({ | |||
url: UrlUtils.GET_HOLIDAY_TEMPLATE, | |||
onResponse: () => { | |||
setTimeout(()=> setWaitDownload(false), 500) | |||
} | |||
}); | |||
} | |||
const importHoliday = () => { | |||
setWait(true); | |||
setWaitImport(true); | |||
setOnSearchReady(false); | |||
if (!attachments || attachments.length <= 0) { | |||
setWarningText("Please upload file."); | |||
setSaving(false); | |||
@@ -129,7 +147,7 @@ const Index = () => { | |||
files: attachments, | |||
onSuccess: () => { | |||
notifySaveSuccess() | |||
setWait(false); | |||
setWaitImport(false); | |||
setAttachments([]); | |||
loadForm(); | |||
} | |||
@@ -153,8 +171,23 @@ const Index = () => { | |||
</Stack> | |||
</div> | |||
</Grid> | |||
<Grid item xs={12} md={12} lg={12} width="100%"> | |||
<Stack direction="row" justifyContent="flex-start" alignItems="center" sx={{ml:2,mt:1}} > | |||
<Grid item xs={12} md={12} lg={6} width="100%"> | |||
<Stack direction="row" justifyContent="flex-start" alignItems="center" spacing={2} sx={{ml:2,mt:1}} > | |||
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | |||
<label htmlFor="downloadFileBtn"> | |||
<Button | |||
component="span" | |||
variant="contained" | |||
size="large" | |||
disabled={waitDownload} | |||
onClick={doExport} | |||
> | |||
<Typography variant="h5">Export</Typography> | |||
</Button> | |||
</label> | |||
</ThemeProvider> | |||
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | |||
<input | |||
id="uploadFileBtn" | |||
@@ -162,7 +195,7 @@ const Index = () => { | |||
type="file" | |||
accept=".xlsx" | |||
style={{ display: 'none' }} | |||
disabled={wait} | |||
disabled={waitImport} | |||
onChange={(event) => { | |||
readFile(event) | |||
}} | |||
@@ -172,14 +205,16 @@ const Index = () => { | |||
component="span" | |||
variant="contained" | |||
size="large" | |||
disabled={wait} | |||
disabled={waitImport} | |||
> | |||
<Typography variant="h5">Upload Files</Typography> | |||
</Button> | |||
</label> | |||
</ThemeProvider> | |||
</Stack> | |||
</Grid> | |||
{/*row 1*/} | |||
<Grid item xs={12} md={12} lg={12} width="100%"> | |||
<SearchForm | |||
@@ -190,16 +225,19 @@ const Index = () => { | |||
/> | |||
</Grid> | |||
{/*row 2*/} | |||
<Grid item xs={12} md={12} lg={12} width="100%"> | |||
<MainCard elevation={0} | |||
border={false} | |||
content={false} | |||
> | |||
<HolidayTable | |||
recordList={record} | |||
/> | |||
</MainCard> | |||
</Grid> | |||
{!onSearchReady? | |||
<LoadingComponent/>: | |||
<Grid item xs={12} md={12} lg={12} width="100%"> | |||
<MainCard elevation={0} | |||
border={false} | |||
content={false} | |||
> | |||
<HolidayTable | |||
recordList={record} | |||
/> | |||
</MainCard> | |||
</Grid> | |||
} | |||
<div> | |||
<Dialog | |||
open={isWarningPopUp} |
@@ -78,7 +78,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
function getIssueLabel(data) { | |||
if (data == {}) return ""; | |||
return data.year | |||
return data.issueYear | |||
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3) | |||
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2) | |||
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); | |||
@@ -85,7 +85,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData | |||
function getIssueLabel(data) { | |||
if (data == {}) return ""; | |||
return data.year | |||
return data.issueYear | |||
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3) | |||
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2) | |||
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); | |||
@@ -53,7 +53,7 @@ const ApplyForm = () => { | |||
}; | |||
function getIssueLabel(data) { | |||
return data.year | |||
return data.issueYear | |||
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3) | |||
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2) | |||
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); | |||
@@ -77,7 +77,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||
function getIssueLabel(data) { | |||
if (data == {}) return ""; | |||
return data.year | |||
return data.issueYear | |||
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3) | |||
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2) | |||
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); | |||
@@ -22,6 +22,10 @@ const UserMaintainPage = Loadable(lazy(() => import('pages/User/GLDUserProfile') | |||
const SystemSetting = Loadable(lazy(() => import('pages/Setting/SystemSetting'))); | |||
const AnnouncementDetails = Loadable(lazy(() => import('pages/Announcement/Details'))); | |||
const AnnouncementSearch = Loadable(lazy(() => import('pages/Announcement/Search'))); | |||
const EmailTemplatePage = Loadable(lazy(() => import('pages/EmailTemplate/Search_GLD'))); | |||
const EmailTemplateDetailPage = Loadable(lazy(() => import('pages/EmailTemplate/Detail_GLD'))); | |||
const HolidayPage = Loadable(lazy(() => import('pages/Holiday'))); | |||
const GazetteIssuePage = Loadable(lazy(() => import('pages/GazetteIssue/index'))); | |||
// ==============================|| MAIN ROUTING ||============================== // | |||
@@ -100,6 +104,22 @@ const GLDUserRoutes = { | |||
path: '/setting/announcement/details/:id', | |||
element: <AnnouncementDetails /> | |||
}, | |||
{ | |||
path: '/setting/emailTemplate', | |||
element: <EmailTemplatePage/> | |||
}, | |||
{ | |||
path: '/setting/emailTemplate/:id', | |||
element: <EmailTemplateDetailPage/> | |||
}, | |||
{ | |||
path: '/setting/holiday', | |||
element: <HolidayPage/> | |||
}, | |||
{ | |||
path: '/setting/gazetteissuepage', | |||
element: <GazetteIssuePage/> | |||
}, | |||
] | |||
}, | |||
] | |||
@@ -20,9 +20,6 @@ const UserGroupDetailPage = Loadable(lazy(() => import('pages/pnspsUserGroupDeta | |||
const OrganizationSearchPage = Loadable(lazy(() => import('pages/Organization/SearchPage'))); | |||
const OrganizationDetailPage = Loadable(lazy(() => import('pages/Organization/DetailPage'))); | |||
const OrganizationDetailPage_fromUser = Loadable(lazy(() => import('pages/Organization/DetailPage_FromUser'))); | |||
const EmailTemplatePage = Loadable(lazy(() => import('pages/EmailTemplate/Search_GLD'))); | |||
const EmailTemplateDetailPage = Loadable(lazy(() => import('pages/EmailTemplate/Detail_GLD'))); | |||
const HolidayPage = Loadable(lazy(() => import('pages/Holiday/Search_GLD'))); | |||
// ==============================|| AUTH ROUTING ||============================== // | |||
@@ -83,18 +80,7 @@ const SettingRoutes = { | |||
path: 'passwordpolicy', | |||
element: <PasswordPolicyPage /> | |||
}, | |||
{ | |||
path: 'emailTemplate', | |||
element: <EmailTemplatePage/> | |||
}, | |||
{ | |||
path: '/emailTemplate/:id', | |||
element: <EmailTemplateDetailPage/> | |||
}, | |||
{ | |||
path: 'holiday', | |||
element: <HolidayPage/> | |||
}, | |||
] | |||
}; | |||
@@ -111,7 +111,10 @@ export const SET_PUBLIC_NOTICE_STATUS_REVIEWED = apiPath+'/application/applicati | |||
export const SET_PUBLIC_NOTICE_STATUS_PUBLISH = apiPath+'/application/application-detail-status-publish'; | |||
export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save'; | |||
//gazette | |||
export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo'; | |||
export const GET_ISSUE_LIST = apiPath+'/gazette-issue/export'; | |||
export const POST_ISSUE_FILE = apiPath+'/gazette-issue/import'; | |||
export const CHECK_CREATE_PROOF = apiPath+'/proof/check-create';//GET | |||
export const LIST_PROOF = apiPath+'/proof/list';//GET | |||
@@ -172,4 +175,5 @@ export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET | |||
//Holiday | |||
export const GET_HOLIDAY = apiPath+'/holiday/list'; //GET | |||
export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST | |||
export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET | |||
export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET | |||
export const GET_HOLIDAY_TEMPLATE = apiPath+'/holiday/export'; //GET |